@webex/contact-center 3.11.0 → 3.12.0-llmrefactor.2
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/.sdd/manifest.json +882 -0
- package/AGENTS.md +94 -0
- package/ai-docs/ARCHITECTURE.md +168 -0
- package/ai-docs/CONTRACTS.md +46 -0
- package/ai-docs/GETTING_STARTED.md +168 -0
- package/ai-docs/GLOSSARY.md +43 -0
- package/ai-docs/README.md +138 -0
- package/ai-docs/REVIEW_CHECKLIST.md +41 -0
- package/ai-docs/RULES.md +444 -0
- package/ai-docs/SECURITY.md +52 -0
- package/ai-docs/SERVICE_STATE.md +48 -0
- package/ai-docs/SPEC_INDEX.md +65 -0
- package/ai-docs/adr/0001-spec-source-policy.md +55 -0
- package/ai-docs/adr/README.md +8 -0
- package/ai-docs/adr/_adr-template.md +31 -0
- package/ai-docs/contact-center-spec.md +341 -0
- package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
- package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
- package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
- package/ai-docs/patterns/event-driven-patterns.md +485 -0
- package/ai-docs/patterns/testing-patterns.md +480 -0
- package/ai-docs/patterns/typescript-patterns.md +365 -0
- package/ai-docs/templates/README.md +102 -0
- package/ai-docs/templates/documentation/create-agents-md.md +240 -0
- package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
- package/ai-docs/templates/existing-service/bug-fix.md +254 -0
- package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
- package/ai-docs/templates/new-method/00-master.md +80 -0
- package/ai-docs/templates/new-method/01-requirements.md +232 -0
- package/ai-docs/templates/new-method/02-implementation.md +295 -0
- package/ai-docs/templates/new-method/03-tests.md +201 -0
- package/ai-docs/templates/new-method/04-validation.md +141 -0
- package/ai-docs/templates/new-service/00-master.md +109 -0
- package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
- package/ai-docs/templates/new-service/02-code-generation.md +346 -0
- package/ai-docs/templates/new-service/03-integration.md +178 -0
- package/ai-docs/templates/new-service/04-test-generation.md +205 -0
- package/ai-docs/templates/new-service/05-validation.md +145 -0
- package/dist/cc.js +379 -50
- package/dist/cc.js.map +1 -1
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +22 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.js +27 -5
- package/dist/index.js.map +1 -1
- package/dist/metrics/behavioral-events.js +114 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +32 -3
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/ApiAiAssistant.js +318 -0
- package/dist/services/ApiAiAssistant.js.map +1 -0
- package/dist/services/UserPreference.js +427 -0
- package/dist/services/UserPreference.js.map +1 -0
- package/dist/services/agent/types.js.map +1 -1
- package/dist/services/config/Util.js +8 -4
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +35 -2
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/index.js +41 -2
- package/dist/services/config/index.js.map +1 -1
- package/dist/services/config/types.js +66 -8
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/constants.js +27 -1
- package/dist/services/constants.js.map +1 -1
- package/dist/services/core/Err.js.map +1 -1
- package/dist/services/core/Utils.js +122 -25
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/aqm-reqs.js +92 -17
- package/dist/services/core/aqm-reqs.js.map +1 -1
- package/dist/services/core/websocket/WebSocketManager.js +22 -6
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
- package/dist/services/core/websocket/connection-service.js +3 -1
- package/dist/services/core/websocket/connection-service.js.map +1 -1
- package/dist/services/core/websocket/types.js.map +1 -1
- package/dist/services/index.js +6 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/task/Task.js +688 -0
- package/dist/services/task/Task.js.map +1 -0
- package/dist/services/task/TaskFactory.js +45 -0
- package/dist/services/task/TaskFactory.js.map +1 -0
- package/dist/services/task/TaskManager.js +751 -457
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +220 -23
- package/dist/services/task/TaskUtils.js.map +1 -1
- package/dist/services/task/constants.js +23 -2
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/dialer.js +129 -0
- package/dist/services/task/dialer.js.map +1 -1
- package/dist/services/task/digital/Digital.js +77 -0
- package/dist/services/task/digital/Digital.js.map +1 -0
- package/dist/services/task/state-machine/TaskStateMachine.js +873 -0
- package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
- package/dist/services/task/state-machine/actions.js +567 -0
- package/dist/services/task/state-machine/actions.js.map +1 -0
- package/dist/services/task/state-machine/constants.js +161 -0
- package/dist/services/task/state-machine/constants.js.map +1 -0
- package/dist/services/task/state-machine/guards.js +382 -0
- package/dist/services/task/state-machine/guards.js.map +1 -0
- package/dist/services/task/state-machine/index.js +53 -0
- package/dist/services/task/state-machine/index.js.map +1 -0
- package/dist/services/task/state-machine/types.js +54 -0
- package/dist/services/task/state-machine/types.js.map +1 -0
- package/dist/services/task/state-machine/uiControlsComputer.js +603 -0
- package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
- package/dist/services/task/taskDataNormalizer.js +99 -0
- package/dist/services/task/taskDataNormalizer.js.map +1 -0
- package/dist/services/task/types.js +227 -4
- package/dist/services/task/types.js.map +1 -1
- package/dist/services/task/voice/Voice.js +1044 -0
- package/dist/services/task/voice/Voice.js.map +1 -0
- package/dist/services/task/voice/WebRTC.js +149 -0
- package/dist/services/task/voice/WebRTC.js.map +1 -0
- package/dist/types/cc.d.ts +894 -0
- package/dist/types/config.d.ts +72 -0
- package/dist/types/constants.d.ts +66 -0
- package/dist/types/index.d.ts +199 -0
- package/dist/types/logger-proxy.d.ts +71 -0
- package/dist/types/metrics/MetricsManager.d.ts +223 -0
- package/dist/types/metrics/behavioral-events.d.ts +29 -0
- package/dist/types/metrics/constants.d.ts +181 -0
- package/dist/types/services/AddressBook.d.ts +74 -0
- package/dist/types/services/ApiAiAssistant.d.ts +49 -0
- package/dist/types/services/EntryPoint.d.ts +67 -0
- package/dist/types/services/Queue.d.ts +76 -0
- package/dist/types/services/UserPreference.d.ts +118 -0
- package/dist/types/services/WebCallingService.d.ts +1 -0
- package/dist/types/services/agent/index.d.ts +46 -0
- package/dist/types/services/agent/types.d.ts +413 -0
- package/dist/types/services/config/Util.d.ts +20 -0
- package/dist/types/services/config/constants.d.ts +270 -0
- package/dist/types/services/config/index.d.ts +177 -0
- package/dist/types/services/config/types.d.ts +1368 -0
- package/dist/types/services/constants.d.ts +110 -0
- package/dist/types/services/core/Err.d.ts +125 -0
- package/dist/types/services/core/GlobalTypes.d.ts +58 -0
- package/dist/types/services/core/Utils.d.ts +121 -0
- package/dist/types/services/core/WebexRequest.d.ts +22 -0
- package/dist/types/services/core/aqm-reqs.d.ts +65 -0
- package/dist/types/services/core/constants.d.ts +99 -0
- package/dist/types/services/core/types.d.ts +47 -0
- package/dist/types/services/core/websocket/WebSocketManager.d.ts +36 -0
- package/dist/types/services/core/websocket/connection-service.d.ts +27 -0
- package/dist/types/services/core/websocket/keepalive.worker.d.ts +2 -0
- package/dist/types/services/core/websocket/types.d.ts +37 -0
- package/dist/types/services/index.d.ts +54 -0
- package/dist/types/services/task/AutoWrapup.d.ts +40 -0
- package/dist/types/services/task/Task.d.ts +157 -0
- package/dist/types/services/task/TaskFactory.d.ts +12 -0
- package/dist/types/services/task/TaskManager.d.ts +1 -0
- package/dist/types/services/task/TaskUtils.d.ts +138 -0
- package/dist/types/services/task/constants.d.ts +91 -0
- package/dist/types/services/task/contact.d.ts +69 -0
- package/dist/types/services/task/dialer.d.ts +73 -0
- package/dist/types/services/task/digital/Digital.d.ts +22 -0
- package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1194 -0
- package/dist/types/services/task/state-machine/actions.d.ts +10 -0
- package/dist/types/services/task/state-machine/constants.d.ts +107 -0
- package/dist/types/services/task/state-machine/guards.d.ts +102 -0
- package/dist/types/services/task/state-machine/index.d.ts +13 -0
- package/dist/types/services/task/state-machine/types.d.ts +269 -0
- package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
- package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
- package/dist/types/services/task/types.d.ts +1856 -0
- package/dist/types/services/task/voice/Voice.d.ts +184 -0
- package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
- package/dist/types/types.d.ts +778 -0
- package/dist/types/utils/PageCache.d.ts +173 -0
- package/dist/types/webex-config.d.ts +53 -0
- package/dist/types/webex.d.ts +8 -0
- package/dist/types.js +130 -1
- package/dist/types.js.map +1 -1
- package/dist/webex.js +14 -2
- package/dist/webex.js.map +1 -1
- package/package.json +16 -12
- package/src/cc.ts +477 -51
- package/src/config.ts +6 -0
- package/src/constants.ts +21 -1
- package/src/index.ts +24 -5
- package/src/metrics/ai-docs/AGENTS.md +350 -0
- package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
- package/src/metrics/ai-docs/metrics-spec.md +854 -0
- package/src/metrics/behavioral-events.ts +120 -0
- package/src/metrics/constants.ts +37 -3
- package/src/services/ApiAiAssistant.ts +412 -0
- package/src/services/UserPreference.ts +509 -0
- package/src/services/agent/ai-docs/AGENTS.md +240 -0
- package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
- package/src/services/agent/ai-docs/agent-spec.md +504 -0
- package/src/services/agent/types.ts +1 -1
- package/src/services/ai-docs/AGENTS.md +386 -0
- package/src/services/ai-docs/services-spec.md +492 -0
- package/src/services/config/Util.ts +10 -2
- package/src/services/config/ai-docs/AGENTS.md +255 -0
- package/src/services/config/ai-docs/ARCHITECTURE.md +426 -0
- package/src/services/config/ai-docs/config-spec.md +669 -0
- package/src/services/config/constants.ts +37 -1
- package/src/services/config/index.ts +45 -1
- package/src/services/config/types.ts +241 -11
- package/src/services/constants.ts +29 -0
- package/src/services/core/Err.ts +3 -0
- package/src/services/core/Utils.ts +143 -30
- package/src/services/core/ai-docs/AGENTS.md +381 -0
- package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
- package/src/services/core/ai-docs/core-spec.md +783 -0
- package/src/services/core/aqm-reqs.ts +100 -22
- package/src/services/core/websocket/WebSocketManager.ts +23 -6
- package/src/services/core/websocket/connection-service.ts +5 -1
- package/src/services/core/websocket/types.ts +1 -1
- package/src/services/index.ts +4 -0
- package/src/services/task/Task.ts +837 -0
- package/src/services/task/TaskFactory.ts +55 -0
- package/src/services/task/TaskManager.ts +793 -521
- package/src/services/task/TaskUtils.ts +314 -24
- package/src/services/task/ai-docs/AGENTS.md +457 -0
- package/src/services/task/ai-docs/ARCHITECTURE.md +594 -0
- package/src/services/task/ai-docs/task-spec.md +1319 -0
- package/src/services/task/constants.ts +23 -0
- package/src/services/task/dialer.ts +136 -1
- package/src/services/task/digital/Digital.ts +95 -0
- package/src/services/task/state-machine/TaskStateMachine.ts +1166 -0
- package/src/services/task/state-machine/actions.ts +738 -0
- package/src/services/task/state-machine/ai-docs/AGENTS.md +458 -0
- package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1137 -0
- package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2177 -0
- package/src/services/task/state-machine/constants.ts +172 -0
- package/src/services/task/state-machine/guards.ts +445 -0
- package/src/services/task/state-machine/index.ts +28 -0
- package/src/services/task/state-machine/types.ts +243 -0
- package/src/services/task/state-machine/uiControlsComputer.ts +961 -0
- package/src/services/task/taskDataNormalizer.ts +137 -0
- package/src/services/task/types.ts +734 -71
- package/src/services/task/voice/Voice.ts +1270 -0
- package/src/services/task/voice/WebRTC.ts +187 -0
- package/src/types.ts +205 -2
- package/src/utils/AGENTS.md +278 -0
- package/src/utils/ai-docs/utils-spec.md +381 -0
- package/src/webex.js +2 -0
- package/test/unit/spec/cc.ts +503 -43
- package/test/unit/spec/logger-proxy.ts +70 -0
- package/test/unit/spec/services/ApiAiAssistant.ts +273 -0
- package/test/unit/spec/services/UserPreference.ts +401 -0
- package/test/unit/spec/services/WebCallingService.ts +7 -1
- package/test/unit/spec/services/config/index.ts +85 -29
- package/test/unit/spec/services/core/Utils.ts +481 -2
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +137 -41
- package/test/unit/spec/services/core/websocket/connection-service.ts +3 -1
- package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
- package/test/unit/spec/services/task/Task.ts +477 -0
- package/test/unit/spec/services/task/TaskFactory.ts +62 -0
- package/test/unit/spec/services/task/TaskManager.ts +1001 -1003
- package/test/unit/spec/services/task/TaskUtils.ts +235 -0
- package/test/unit/spec/services/task/dialer.ts +372 -96
- package/test/unit/spec/services/task/digital/Digital.ts +105 -0
- package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +2651 -0
- package/test/unit/spec/services/task/state-machine/guards.ts +637 -0
- package/test/unit/spec/services/task/state-machine/types.ts +18 -0
- package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +2663 -0
- package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
- package/test/unit/spec/services/task/voice/Voice.ts +649 -0
- package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
- package/dist/services/task/index.js +0 -1525
- package/dist/services/task/index.js.map +0 -1
- package/src/services/task/index.ts +0 -1801
- package/test/unit/spec/services/task/index.ts +0 -2184
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isValidDialNumber = exports.getStationLoginErrorData = exports.getErrorDetails = exports.getDestAgentIdForCBT = exports.getConsultedAgentId = exports.generateTaskErrorObject = exports.deriveConsultTransferDestinationType = exports.createErrDetailsObject = exports.calculateDestType = exports.calculateDestAgentId = void 0;
|
|
6
|
+
exports.stripDialPlanChars = exports.isValidDialNumber = exports.getStationLoginErrorData = exports.getErrorDetails = exports.getDestAgentIdForCBT = exports.getConsultedAgentId = exports.generateTaskErrorObject = exports.deriveConsultTransferDestinationType = exports.createErrDetailsObject = exports.calculateDestType = exports.calculateDestAgentId = exports.buildConsultConferenceParamData = void 0;
|
|
7
7
|
var Err = _interopRequireWildcard(require("./Err"));
|
|
8
8
|
var _types = require("../../types");
|
|
9
9
|
var _loggerProxy = _interopRequireDefault(require("../../logger-proxy"));
|
|
@@ -28,30 +28,58 @@ const getCommonErrorDetails = errObj => {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Strips characters defined in the dial plan entry from the input string.
|
|
32
|
+
*
|
|
33
|
+
* @param input - The dial number to sanitize
|
|
34
|
+
* @param strippedChars - String of characters to remove from the input
|
|
35
|
+
* @returns The sanitized input with specified characters removed
|
|
32
36
|
*/
|
|
33
|
-
const
|
|
34
|
-
|
|
37
|
+
const stripDialPlanChars = (input, strippedChars) => {
|
|
38
|
+
if (!strippedChars) {
|
|
39
|
+
return input;
|
|
40
|
+
}
|
|
41
|
+
const charsToStrip = new Set(strippedChars.split(''));
|
|
42
|
+
return input.split('').filter(c => !charsToStrip.has(c)).join('');
|
|
35
43
|
};
|
|
36
44
|
|
|
37
45
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
46
|
+
* Validates a dial number against the provided dial plan regex patterns.
|
|
47
|
+
* A number is valid if it matches at least one regex pattern in the dial plans.
|
|
48
|
+
* Skips validation when no dial plan entries are configured, deferring to the server.
|
|
49
|
+
*
|
|
50
|
+
* @param input - The dial number to validate
|
|
51
|
+
* @param dialPlanEntries - Array of dial plan entries containing regex patterns
|
|
52
|
+
* @returns true if the input matches at least one dial plan regex pattern or no entries are configured, false otherwise
|
|
40
53
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
exports.stripDialPlanChars = stripDialPlanChars;
|
|
55
|
+
const isValidDialNumber = (input, dialPlanEntries) => {
|
|
56
|
+
if (!input) {
|
|
57
|
+
_loggerProxy.default.warn('Dial number is empty or undefined.', {
|
|
58
|
+
module: 'Utils',
|
|
59
|
+
method: 'isValidDialNumber'
|
|
60
|
+
});
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
if (!dialPlanEntries || dialPlanEntries.length === 0) {
|
|
64
|
+
_loggerProxy.default.log('No dial plan entries found. Skipping client-side validation, deferring to server.', {
|
|
65
|
+
module: 'Utils',
|
|
66
|
+
method: 'isValidDialNumber'
|
|
67
|
+
});
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
return dialPlanEntries.some(entry => {
|
|
71
|
+
try {
|
|
72
|
+
const sanitizedInput = stripDialPlanChars(input, entry.strippedChars);
|
|
73
|
+
const regex = new RegExp(entry.regex);
|
|
74
|
+
return regex.test(sanitizedInput);
|
|
75
|
+
} catch (e) {
|
|
76
|
+
_loggerProxy.default.warn(`Failed to validate dial number against entry "${entry.name}": ${e}`, {
|
|
77
|
+
module: 'Utils',
|
|
78
|
+
method: 'isValidDialNumber'
|
|
79
|
+
});
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
55
83
|
};
|
|
56
84
|
exports.isValidDialNumber = isValidDialNumber;
|
|
57
85
|
const getStationLoginErrorData = (failure, loginOption) => {
|
|
@@ -68,7 +96,7 @@ const getStationLoginErrorData = (failure, loginOption) => {
|
|
|
68
96
|
fieldName: loginOption
|
|
69
97
|
},
|
|
70
98
|
INVALID_DIAL_NUMBER: {
|
|
71
|
-
message: 'Enter a valid
|
|
99
|
+
message: 'Enter a valid dial number. For help, reach out to your administrator or support team.',
|
|
72
100
|
fieldName: loginOption
|
|
73
101
|
}
|
|
74
102
|
};
|
|
@@ -191,6 +219,7 @@ const createErrDetailsObject = errObj => {
|
|
|
191
219
|
return new Err.Details('Service.reqs.generic.failure', details);
|
|
192
220
|
};
|
|
193
221
|
|
|
222
|
+
/*
|
|
194
223
|
/**
|
|
195
224
|
* Gets the consulted agent ID from the media object by finding the agent
|
|
196
225
|
* in the consult media participants (excluding the current agent).
|
|
@@ -260,7 +289,14 @@ const calculateDestAgentId = (interaction, agentId) => {
|
|
|
260
289
|
if (destAgentIdCBT) {
|
|
261
290
|
return destAgentIdCBT;
|
|
262
291
|
}
|
|
263
|
-
|
|
292
|
+
const participant = interaction.participants[consultingAgent];
|
|
293
|
+
if (!participant) {
|
|
294
|
+
return '';
|
|
295
|
+
}
|
|
296
|
+
if (participant.type === _constants.PARTICIPANT_TYPES.EP_DN) {
|
|
297
|
+
return participant.epId ?? '';
|
|
298
|
+
}
|
|
299
|
+
return participant.id ?? '';
|
|
264
300
|
};
|
|
265
301
|
|
|
266
302
|
/**
|
|
@@ -292,12 +328,73 @@ const calculateDestType = (interaction, agentId) => {
|
|
|
292
328
|
}
|
|
293
329
|
return _types2.CONSULT_TRANSFER_DESTINATION_TYPE.AGENT;
|
|
294
330
|
};
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Gets the destination agent ID from participants.
|
|
334
|
+
* Finds a participant who is not the current agent and is an agent type.
|
|
335
|
+
*
|
|
336
|
+
* @param participants - The participants object from interaction
|
|
337
|
+
* @param agentId - The current agent's ID
|
|
338
|
+
* @returns The destination agent ID, or undefined if none found
|
|
339
|
+
*/
|
|
295
340
|
exports.calculateDestType = calculateDestType;
|
|
341
|
+
const buildConsultConferenceParamData = (dataPassed, interactionIdPassed) => {
|
|
342
|
+
const data = {
|
|
343
|
+
...('agentId' in dataPassed && {
|
|
344
|
+
agentId: dataPassed.agentId
|
|
345
|
+
}),
|
|
346
|
+
to: dataPassed.destAgentId,
|
|
347
|
+
destinationType: ''
|
|
348
|
+
};
|
|
349
|
+
if ('destinationType' in dataPassed) {
|
|
350
|
+
const destinationType = String(dataPassed.destinationType || '').trim();
|
|
351
|
+
const normalizedDestinationType = destinationType.toUpperCase().replace(/[-_\s]/g, '');
|
|
352
|
+
if (normalizedDestinationType === 'DN' || normalizedDestinationType === 'DIALNUMBER') {
|
|
353
|
+
data.destinationType = _types2.DESTINATION_TYPE.DIALNUMBER;
|
|
354
|
+
} else if (normalizedDestinationType === 'EPDN' || normalizedDestinationType === 'ENTRYPOINT') {
|
|
355
|
+
data.destinationType = _types2.DESTINATION_TYPE.ENTRYPOINT;
|
|
356
|
+
} else if (normalizedDestinationType === 'QUEUE') {
|
|
357
|
+
data.destinationType = _types2.DESTINATION_TYPE.QUEUE;
|
|
358
|
+
} else if (normalizedDestinationType === 'AGENT') {
|
|
359
|
+
data.destinationType = _types2.DESTINATION_TYPE.AGENT;
|
|
360
|
+
} else {
|
|
361
|
+
data.destinationType = destinationType;
|
|
362
|
+
}
|
|
363
|
+
} else {
|
|
364
|
+
data.destinationType = _types2.DESTINATION_TYPE.AGENT;
|
|
365
|
+
}
|
|
366
|
+
return {
|
|
367
|
+
interactionId: interactionIdPassed,
|
|
368
|
+
data
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Derives the consult transfer destination type based on task data.
|
|
374
|
+
* This function determines the appropriate destination type for a consult transfer
|
|
375
|
+
* by examining the destination type stored in the task data.
|
|
376
|
+
*
|
|
377
|
+
* @param taskData - The task data containing destination information
|
|
378
|
+
* @returns The derived consult transfer destination type
|
|
379
|
+
* @public
|
|
380
|
+
*/
|
|
381
|
+
exports.buildConsultConferenceParamData = buildConsultConferenceParamData;
|
|
296
382
|
const deriveConsultTransferDestinationType = taskData => {
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
383
|
+
const destType = taskData?.destinationType;
|
|
384
|
+
const normalizedDestType = String(destType || '').toUpperCase().replace(/[-_\s]/g, '');
|
|
385
|
+
|
|
386
|
+
// Map destination types to consult transfer destination types
|
|
387
|
+
if (normalizedDestType === 'DN' || normalizedDestType === 'DIALNUMBER') {
|
|
388
|
+
return _types2.CONSULT_TRANSFER_DESTINATION_TYPE.DIALNUMBER;
|
|
389
|
+
}
|
|
390
|
+
if (normalizedDestType === 'EPDN' || normalizedDestType === 'ENTRYPOINT') {
|
|
391
|
+
return _types2.CONSULT_TRANSFER_DESTINATION_TYPE.ENTRYPOINT;
|
|
300
392
|
}
|
|
393
|
+
if (normalizedDestType === 'QUEUE') {
|
|
394
|
+
return _types2.CONSULT_TRANSFER_DESTINATION_TYPE.QUEUE;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// Default to agent if no specific type matches
|
|
301
398
|
return _types2.CONSULT_TRANSFER_DESTINATION_TYPE.AGENT;
|
|
302
399
|
};
|
|
303
400
|
exports.deriveConsultTransferDestinationType = deriveConsultTransferDestinationType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Err","_interopRequireWildcard","require","_types","_loggerProxy","_interopRequireDefault","_WebexRequest","_types2","_constants","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","getCommonErrorDetails","errObj","trackingId","headers","trackingid","TrackingID","msg","body","isEntryPointOrEpdn","destAgentType","getAgentActionTypeFromTask","taskData","destinationType","isDialNumber","isEntryPointVariant","isValidDialNumber","input","regexForDn","test","exports","getStationLoginErrorData","failure","loginOption","duplicateLocationMessage","LoginOption","EXTENSION","AGENT_DN","errorCodeMessageMap","DUPLICATE_LOCATION","message","fieldName","INVALID_DIAL_NUMBER","defaultMessage","defaultFieldName","reason","data","getErrorDetails","error","methodName","moduleName","errData","details","LoggerProxy","module","method","WebexRequest","getInstance","uploadLogs","correlationId","err","Error","generateTaskErrorObject","errorMsg","fallbackMessage","errorMessage","errorType","name","errorData","reasonCode","createErrDetailsObject","Details","getConsultedAgentId","media","agentId","consultParticipants","consultedParticipantId","keys","forEach","key","mType","STATE_CONSULT","participants","includes","id","find","participant","getDestAgentIdForCBT","interaction","consultingAgent","destAgentIdForCBT","foundEntry","entries","pType","toLowerCase","PARTICIPANT_TYPES","DN","type","AGENT","dn","calculateDestAgentId","destAgentIdCBT","EP_DN","epId","calculateDestType","destinationaegntId","undefined","CONSULT_TRANSFER_DESTINATION_TYPE","DIALNUMBER","ENTRYPOINT","deriveConsultTransferDestinationType","agentActionType"],"sources":["Utils.ts"],"sourcesContent":["import * as Err from './Err';\nimport {LoginOption, WebexRequestPayload} from '../../types';\nimport {Failure, AugmentedError} from './GlobalTypes';\nimport LoggerProxy from '../../logger-proxy';\nimport WebexRequest from './WebexRequest';\nimport {\n TaskData,\n ConsultTransferPayLoad,\n CONSULT_TRANSFER_DESTINATION_TYPE,\n Interaction,\n} from '../task/types';\nimport {PARTICIPANT_TYPES, STATE_CONSULT} from './constants';\n\n/**\n * Extracts common error details from a Webex request payload.\n *\n * @param errObj - The Webex request payload object.\n * @returns An object containing the tracking ID and message body.\n * @private\n * @ignore\n */\nconst getCommonErrorDetails = (errObj: WebexRequestPayload) => {\n return {\n trackingId: errObj?.headers?.trackingid || errObj?.headers?.TrackingID,\n msg: errObj?.body,\n };\n};\n\n/**\n * Checks if the destination type represents an entry point variant (EPDN or ENTRYPOINT).\n */\nconst isEntryPointOrEpdn = (destAgentType?: string): boolean => {\n return destAgentType === 'EPDN' || destAgentType === 'ENTRYPOINT';\n};\n\n/**\n * Determines if the task involves dialing a number based on the destination type.\n * Returns 'DIAL_NUMBER' for dial-related destinations, empty string otherwise.\n */\nconst getAgentActionTypeFromTask = (taskData?: TaskData): 'DIAL_NUMBER' | '' => {\n const destAgentType = taskData?.destinationType;\n\n // Check if destination requires dialing: direct dial number or entry point variants\n const isDialNumber = destAgentType === 'DN';\n const isEntryPointVariant = isEntryPointOrEpdn(destAgentType);\n\n // If the destination type is a dial number or an entry point variant, return 'DIAL_NUMBER'\n return isDialNumber || isEntryPointVariant ? 'DIAL_NUMBER' : '';\n};\n\nexport const isValidDialNumber = (input: string): boolean => {\n // This regex checks for a valid dial number format for only few countries such as US, Canada.\n const regexForDn = /1[0-9]{3}[2-9][0-9]{6}([,]{1,10}[0-9]+){0,1}/;\n\n return regexForDn.test(input);\n};\n\nexport const getStationLoginErrorData = (failure: Failure, loginOption: LoginOption) => {\n let duplicateLocationMessage = 'This value is already in use';\n\n if (loginOption === LoginOption.EXTENSION) {\n duplicateLocationMessage = 'This extension is already in use';\n }\n\n if (loginOption === LoginOption.AGENT_DN) {\n duplicateLocationMessage =\n 'Dial number is in use. Try a different one. For help, reach out to your administrator or support team.';\n }\n\n const errorCodeMessageMap = {\n DUPLICATE_LOCATION: {\n message: duplicateLocationMessage,\n fieldName: loginOption,\n },\n INVALID_DIAL_NUMBER: {\n message:\n 'Enter a valid US dial number. For help, reach out to your administrator or support team.',\n fieldName: loginOption,\n },\n };\n\n const defaultMessage = 'An error occurred while logging in to the station';\n const defaultFieldName = 'generic';\n\n const reason = failure?.data?.reason || '';\n\n return {\n message: errorCodeMessageMap[reason]?.message || defaultMessage,\n fieldName: errorCodeMessageMap[reason]?.fieldName || defaultFieldName,\n };\n};\n\n/**\n * Extracts error details and logs the error. Also uploads logs for the error unless it is a silent relogin agent not found error.\n *\n * @param error - The error object, expected to have a `details` property of type Failure.\n * @param methodName - The name of the method where the error occurred.\n * @param moduleName - The name of the module where the error occurred.\n * @returns An object containing the error instance and the reason string.\n * @public\n * @example\n * const details = getErrorDetails(error, 'fetchData', 'DataModule');\n * if (details.error) { handleError(details.error); }\n * @ignore\n */\nexport const getErrorDetails = (error: any, methodName: string, moduleName: string) => {\n let errData = {message: '', fieldName: ''};\n\n const failure = error.details as Failure;\n const reason = failure?.data?.reason ?? `Error while performing ${methodName}`;\n\n if (!(reason === 'AGENT_NOT_FOUND' && methodName === 'silentRelogin')) {\n LoggerProxy.error(`${methodName} failed with reason: ${reason}`, {\n module: moduleName,\n method: methodName,\n trackingId: failure?.trackingId,\n });\n // we can add more conditions here if not needed for specific cases eg: silentReLogin\n WebexRequest.getInstance().uploadLogs({\n correlationId: failure?.trackingId,\n });\n }\n\n if (methodName === 'stationLogin') {\n errData = getStationLoginErrorData(failure, error.loginOption);\n\n LoggerProxy.error(\n `${methodName} failed with reason: ${reason}, message: ${errData.message}, fieldName: ${errData.fieldName}`,\n {\n module: moduleName,\n method: methodName,\n trackingId: failure?.trackingId,\n }\n );\n }\n\n const err = new Error(reason ?? `Error while performing ${methodName}`);\n // @ts-ignore - add custom property to the error object for backward compatibility\n err.data = errData;\n\n return {\n error: err,\n reason,\n };\n};\n\n/**\n * Extracts error details from task API errors and logs them. Also uploads logs for the error.\n * This handles the specific error format returned by task API calls.\n *\n * @param error - The error object from task API calls with structure: {id: string, details: {trackingId: string, msg: {...}}}\n * @param methodName - The name of the method where the error occurred.\n * @param moduleName - The name of the module where the error occurred.\n * @returns AugmentedError containing structured error details on err.data for metrics and logging\n * @public\n * @example\n * const taskError = generateTaskErrorObject(error, 'transfer', 'TaskModule');\n * throw taskError.error;\n * @ignore\n */\nexport const generateTaskErrorObject = (\n error: any,\n methodName: string,\n moduleName: string\n): AugmentedError => {\n const trackingId = error?.details?.trackingId || error?.trackingId || '';\n const errorMsg = error?.details?.msg;\n\n const fallbackMessage =\n (error && typeof error.message === 'string' && error.message) ||\n `Error while performing ${methodName}`;\n const errorMessage = errorMsg?.errorMessage || fallbackMessage;\n const errorType =\n errorMsg?.errorType ||\n (error && typeof error.name === 'string' && error.name) ||\n 'Unknown Error';\n const errorData = errorMsg?.errorData || '';\n const reasonCode = errorMsg?.reasonCode || 0;\n\n // Log and upload for Task API formatted errors\n LoggerProxy.error(`${methodName} failed: ${errorMessage} (${errorType})`, {\n module: moduleName,\n method: methodName,\n trackingId,\n });\n WebexRequest.getInstance().uploadLogs({\n correlationId: trackingId,\n });\n\n const reason = `${errorType}: ${errorMessage}${errorData ? ` (${errorData})` : ''}`;\n const err: AugmentedError = new Error(reason);\n err.data = {\n message: errorMessage,\n errorType,\n errorData,\n reasonCode,\n trackingId,\n };\n\n return err;\n};\n\n/**\n * Creates an error details object suitable for use with the Err.Details class.\n *\n * @param errObj - The Webex request payload object.\n * @returns An instance of Err.Details with the generic failure message and extracted details.\n * @public\n * @example\n * const errDetails = createErrDetailsObject(webexRequestPayload);\n * @ignore\n */\nexport const createErrDetailsObject = (errObj: WebexRequestPayload) => {\n const details = getCommonErrorDetails(errObj);\n\n return new Err.Details('Service.reqs.generic.failure', details);\n};\n\n/**\n * Gets the consulted agent ID from the media object by finding the agent\n * in the consult media participants (excluding the current agent).\n *\n * @param media - The media object from the interaction\n * @param agentId - The current agent's ID to exclude from the search\n * @returns The consulted agent ID, or empty string if none found\n */\nexport const getConsultedAgentId = (media: Interaction['media'], agentId: string): string => {\n let consultParticipants: string[] = [];\n let consultedParticipantId = '';\n\n Object.keys(media).forEach((key) => {\n if (media[key].mType === STATE_CONSULT) {\n consultParticipants = media[key].participants;\n }\n });\n\n if (consultParticipants.includes(agentId)) {\n const id = consultParticipants.find((participant) => participant !== agentId);\n consultedParticipantId = id || consultedParticipantId;\n }\n\n return consultedParticipantId;\n};\n\n/**\n * Gets the destination agent ID for CBT (Capacity Based Team) scenarios.\n * CBT refers to teams created in Control Hub with capacity-based routing\n * (as opposed to agent-based routing). This handles cases where the consulted\n * participant is not directly in participants but can be found by matching\n * the dial number (dn).\n *\n * @param interaction - The interaction object\n * @param consultingAgent - The consulting agent identifier\n * @returns The destination agent ID for CBT scenarios, or empty string if none found\n */\nexport const getDestAgentIdForCBT = (interaction: Interaction, consultingAgent: string): string => {\n const participants = interaction.participants;\n let destAgentIdForCBT = '';\n\n // Check if this is a CBT scenario (consultingAgent exists but not directly in participants)\n if (consultingAgent && !participants[consultingAgent]) {\n const foundEntry = Object.entries(participants).find(\n ([, participant]: [string, Interaction['participants'][string]]) => {\n return (\n participant.pType.toLowerCase() === PARTICIPANT_TYPES.DN &&\n participant.type === PARTICIPANT_TYPES.AGENT &&\n participant.dn === consultingAgent\n );\n }\n );\n\n if (foundEntry) {\n destAgentIdForCBT = foundEntry[0];\n }\n }\n\n return destAgentIdForCBT;\n};\n\n/**\n * Calculates the destination agent ID for consult operations.\n *\n * @param interaction - The interaction object\n * @param agentId - The current agent's ID\n * @returns The destination agent ID\n */\nexport const calculateDestAgentId = (interaction: Interaction, agentId: string): string => {\n const consultingAgent = getConsultedAgentId(interaction.media, agentId);\n\n // Check if this is a CBT (Capacity Based Team) scenario\n // If not CBT, the function will return empty string and we'll use the normal flow\n const destAgentIdCBT = getDestAgentIdForCBT(interaction, consultingAgent);\n if (destAgentIdCBT) {\n return destAgentIdCBT;\n }\n\n return interaction.participants[consultingAgent]?.type === PARTICIPANT_TYPES.EP_DN\n ? interaction.participants[consultingAgent]?.epId\n : interaction.participants[consultingAgent]?.id;\n};\n\n/**\n * Calculates the destination agent ID for fetching destination type.\n *\n * @param interaction - The interaction object\n * @param agentId - The current agent's ID\n * @returns The destination agent ID for determining destination type\n */\nexport const calculateDestType = (interaction: Interaction, agentId: string): string => {\n const consultingAgent = getConsultedAgentId(interaction.media, agentId);\n\n // Check if this is a CBT (Capacity Based Team) scenario, otherwise use consultingAgent\n const destAgentIdCBT = getDestAgentIdForCBT(interaction, consultingAgent);\n const destinationaegntId = destAgentIdCBT || consultingAgent;\n const destAgentType = destinationaegntId\n ? interaction.participants[destinationaegntId]?.pType\n : undefined;\n if (destAgentType) {\n if (destAgentType === 'DN') {\n return CONSULT_TRANSFER_DESTINATION_TYPE.DIALNUMBER;\n }\n if (destAgentType === 'EP-DN') {\n return CONSULT_TRANSFER_DESTINATION_TYPE.ENTRYPOINT;\n }\n // Keep the existing destinationType if it's something else (like \"agent\" or \"Agent\")\n // Convert \"Agent\" to lowercase for consistency\n\n return destAgentType.toLowerCase();\n }\n\n return CONSULT_TRANSFER_DESTINATION_TYPE.AGENT;\n};\n\nexport const deriveConsultTransferDestinationType = (\n taskData?: TaskData\n): ConsultTransferPayLoad['destinationType'] => {\n const agentActionType = getAgentActionTypeFromTask(taskData);\n\n if (agentActionType === 'DIAL_NUMBER') {\n return isEntryPointOrEp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AAE;MAC1B,OAAOuF,yCAAiC,CAACC,UAAU;IACrD;IACA,IAAIxF,aAAa,KAAK,OAAO,EAAE;MAC7B,OAAOuF,yCAAiC,CAACE,UAAU;IACrD;IACA;IACA;;IAEA,OAAOzF,aAAa,CAAC0E,WAAW,CAAC,CAAC;EACpC;EAEA,OAAOa,yCAAiC,CAACT,KAAK;AAChD,CAAC;AAACpE,OAAA,CAAA0E,iBAAA,GAAAA,iBAAA;AAEK,MAAMM,oCAAoC,GAC/CxF,QAAmB,IAC2B;EAC9C,MAAMyF,eAAe,GAAG1F,0BAA0B,CAACC,QAAQ,CAAC;EAE5D,IAAIyF,eAAe,KAAK,aAAa,EAAE;IACrC,OAAO5F,kBAAkB,CAACG,QAAQ,EAAEC,eAAe,CAAC,GAChDoF,yCAAiC,CAACE,UAAU,GAC5CF,yCAAiC,CAACC,UAAU;EAClD;EAEA,OAAOD,yCAAiC,CAACT,KAAK;AAChD,CAAC;AAACpE,OAAA,CAAAgF,oCAAA,GAAAA,oCAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Err","_interopRequireWildcard","require","_types","_loggerProxy","_interopRequireDefault","_WebexRequest","_types2","_constants","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","getCommonErrorDetails","errObj","trackingId","headers","trackingid","TrackingID","msg","body","stripDialPlanChars","input","strippedChars","charsToStrip","Set","split","filter","c","join","exports","isValidDialNumber","dialPlanEntries","LoggerProxy","warn","module","method","length","log","some","entry","sanitizedInput","regex","RegExp","test","name","getStationLoginErrorData","failure","loginOption","duplicateLocationMessage","LoginOption","EXTENSION","AGENT_DN","errorCodeMessageMap","DUPLICATE_LOCATION","message","fieldName","INVALID_DIAL_NUMBER","defaultMessage","defaultFieldName","reason","data","getErrorDetails","error","methodName","moduleName","errData","details","WebexRequest","getInstance","uploadLogs","correlationId","err","Error","generateTaskErrorObject","errorMsg","fallbackMessage","errorMessage","errorType","errorData","reasonCode","createErrDetailsObject","Details","getConsultedAgentId","media","agentId","consultParticipants","consultedParticipantId","keys","forEach","key","mType","STATE_CONSULT","participants","includes","id","find","participant","getDestAgentIdForCBT","interaction","consultingAgent","destAgentIdForCBT","foundEntry","entries","pType","toLowerCase","PARTICIPANT_TYPES","DN","type","AGENT","dn","calculateDestAgentId","destAgentIdCBT","EP_DN","epId","calculateDestType","destinationaegntId","destAgentType","undefined","CONSULT_TRANSFER_DESTINATION_TYPE","DIALNUMBER","ENTRYPOINT","buildConsultConferenceParamData","dataPassed","interactionIdPassed","to","destAgentId","destinationType","String","trim","normalizedDestinationType","toUpperCase","replace","DESTINATION_TYPE","QUEUE","interactionId","deriveConsultTransferDestinationType","taskData","destType","normalizedDestType"],"sources":["Utils.ts"],"sourcesContent":["import * as Err from './Err';\nimport {LoginOption, WebexRequestPayload} from '../../types';\nimport {Failure, AugmentedError} from './GlobalTypes';\nimport LoggerProxy from '../../logger-proxy';\nimport WebexRequest from './WebexRequest';\nimport {\n ConsultConferenceData,\n consultConferencePayloadData,\n ConsultTransferDestinationType,\n TaskData,\n CONSULT_TRANSFER_DESTINATION_TYPE,\n DESTINATION_TYPE,\n Interaction,\n InteractionParticipant,\n} from '../task/types';\nimport {PARTICIPANT_TYPES, STATE_CONSULT} from './constants';\nimport {DialPlan} from '../config/types';\n\n/**\n * Extracts common error details from a Webex request payload.\n *\n * @param errObj - The Webex request payload object.\n * @returns An object containing the tracking ID and message body.\n * @private\n * @ignore\n */\nconst getCommonErrorDetails = (errObj: WebexRequestPayload) => {\n return {\n trackingId: errObj?.headers?.trackingid || errObj?.headers?.TrackingID,\n msg: errObj?.body,\n };\n};\n\n/**\n * Strips characters defined in the dial plan entry from the input string.\n *\n * @param input - The dial number to sanitize\n * @param strippedChars - String of characters to remove from the input\n * @returns The sanitized input with specified characters removed\n */\nexport const stripDialPlanChars = (input: string, strippedChars: string): string => {\n if (!strippedChars) {\n return input;\n }\n\n const charsToStrip = new Set(strippedChars.split(''));\n\n return input\n .split('')\n .filter((c) => !charsToStrip.has(c))\n .join('');\n};\n\n/**\n * Validates a dial number against the provided dial plan regex patterns.\n * A number is valid if it matches at least one regex pattern in the dial plans.\n * Skips validation when no dial plan entries are configured, deferring to the server.\n *\n * @param input - The dial number to validate\n * @param dialPlanEntries - Array of dial plan entries containing regex patterns\n * @returns true if the input matches at least one dial plan regex pattern or no entries are configured, false otherwise\n */\nexport const isValidDialNumber = (\n input: string,\n dialPlanEntries: DialPlan['dialPlanEntity']\n): boolean => {\n if (!input) {\n LoggerProxy.warn('Dial number is empty or undefined.', {\n module: 'Utils',\n method: 'isValidDialNumber',\n });\n\n return false;\n }\n\n if (!dialPlanEntries || dialPlanEntries.length === 0) {\n LoggerProxy.log(\n 'No dial plan entries found. Skipping client-side validation, deferring to server.',\n {module: 'Utils', method: 'isValidDialNumber'}\n );\n\n return true;\n }\n\n return dialPlanEntries.some((entry) => {\n try {\n const sanitizedInput = stripDialPlanChars(input, entry.strippedChars);\n const regex = new RegExp(entry.regex);\n\n return regex.test(sanitizedInput);\n } catch (e) {\n LoggerProxy.warn(`Failed to validate dial number against entry \"${entry.name}\": ${e}`, {\n module: 'Utils',\n method: 'isValidDialNumber',\n });\n\n return false;\n }\n });\n};\n\nexport const getStationLoginErrorData = (failure: Failure, loginOption: LoginOption) => {\n let duplicateLocationMessage = 'This value is already in use';\n\n if (loginOption === LoginOption.EXTENSION) {\n duplicateLocationMessage = 'This extension is already in use';\n }\n\n if (loginOption === LoginOption.AGENT_DN) {\n duplicateLocationMessage =\n 'Dial number is in use. Try a different one. For help, reach out to your administrator or support team.';\n }\n\n const errorCodeMessageMap = {\n DUPLICATE_LOCATION: {\n message: duplicateLocationMessage,\n fieldName: loginOption,\n },\n INVALID_DIAL_NUMBER: {\n message:\n 'Enter a valid dial number. For help, reach out to your administrator or support team.',\n fieldName: loginOption,\n },\n };\n\n const defaultMessage = 'An error occurred while logging in to the station';\n const defaultFieldName = 'generic';\n\n const reason = failure?.data?.reason || '';\n\n return {\n message: errorCodeMessageMap[reason]?.message || defaultMessage,\n fieldName: errorCodeMessageMap[reason]?.fieldName || defaultFieldName,\n };\n};\n\n/**\n * Extracts error details and logs the error. Also uploads logs for the error unless it is a silent relogin agent not found error.\n *\n * @param error - The error object, expected to have a `details` property of type Failure.\n * @param methodName - The name of the method where the error occurred.\n * @param moduleName - The name of the module where the error occurred.\n * @returns An object containing the error instance and the reason string.\n * @public\n * @example\n * const details = getErrorDetails(error, 'fetchData', 'DataModule');\n * if (details.error) { handleError(details.error); }\n * @ignore\n */\nexport const getErrorDetails = (error: any, methodName: string, moduleName: string) => {\n let errData = {message: '', fieldName: ''};\n\n const failure = error.details as Failure;\n const reason = failure?.data?.reason ?? `Error while performing ${methodName}`;\n\n if (!(reason === 'AGENT_NOT_FOUND' && methodName === 'silentRelogin')) {\n LoggerProxy.error(`${methodName} failed with reason: ${reason}`, {\n module: moduleName,\n method: methodName,\n trackingId: failure?.trackingId,\n });\n // we can add more conditions here if not needed for specific cases eg: silentReLogin\n WebexRequest.getInstance().uploadLogs({\n correlationId: failure?.trackingId,\n });\n }\n\n if (methodName === 'stationLogin') {\n errData = getStationLoginErrorData(failure, error.loginOption);\n\n LoggerProxy.error(\n `${methodName} failed with reason: ${reason}, message: ${errData.message}, fieldName: ${errData.fieldName}`,\n {\n module: moduleName,\n method: methodName,\n trackingId: failure?.trackingId,\n }\n );\n }\n\n const err = new Error(reason ?? `Error while performing ${methodName}`);\n // @ts-ignore - add custom property to the error object for backward compatibility\n err.data = errData;\n\n return {\n error: err,\n reason,\n };\n};\n\n/**\n * Extracts error details from task API errors and logs them. Also uploads logs for the error.\n * This handles the specific error format returned by task API calls.\n *\n * @param error - The error object from task API calls with structure: {id: string, details: {trackingId: string, msg: {...}}}\n * @param methodName - The name of the method where the error occurred.\n * @param moduleName - The name of the module where the error occurred.\n * @returns AugmentedError containing structured error details on err.data for metrics and logging\n * @public\n * @example\n * const taskError = generateTaskErrorObject(error, 'transfer', 'TaskModule');\n * throw taskError.error;\n * @ignore\n */\nexport const generateTaskErrorObject = (\n error: any,\n methodName: string,\n moduleName: string\n): AugmentedError => {\n const trackingId = error?.details?.trackingId || error?.trackingId || '';\n const errorMsg = error?.details?.msg;\n\n const fallbackMessage =\n (error && typeof error.message === 'string' && error.message) ||\n `Error while performing ${methodName}`;\n const errorMessage = errorMsg?.errorMessage || fallbackMessage;\n const errorType =\n errorMsg?.errorType ||\n (error && typeof error.name === 'string' && error.name) ||\n 'Unknown Error';\n const errorData = errorMsg?.errorData || '';\n const reasonCode = errorMsg?.reasonCode || 0;\n\n // Log and upload for Task API formatted errors\n LoggerProxy.error(`${methodName} failed: ${errorMessage} (${errorType})`, {\n module: moduleName,\n method: methodName,\n trackingId,\n });\n WebexRequest.getInstance().uploadLogs({\n correlationId: trackingId,\n });\n\n const reason = `${errorType}: ${errorMessage}${errorData ? ` (${errorData})` : ''}`;\n const err: AugmentedError = new Error(reason);\n err.data = {\n message: errorMessage,\n errorType,\n errorData,\n reasonCode,\n trackingId,\n };\n\n return err;\n};\n\n/**\n * Creates an error details object suitable for use with the Err.Details class.\n *\n * @param errObj - The Webex request payload object.\n * @returns An instance of Err.Details with the generic failure message and extracted details.\n * @public\n * @example\n * const errDetails = createErrDetailsObject(webexRequestPayload);\n * @ignore\n */\nexport const createErrDetailsObject = (errObj: WebexRequestPayload) => {\n const details = getCommonErrorDetails(errObj);\n\n return new Err.Details('Service.reqs.generic.failure', details);\n};\n\n/*\n/**\n * Gets the consulted agent ID from the media object by finding the agent\n * in the consult media participants (excluding the current agent).\n *\n * @param media - The media object from the interaction\n * @param agentId - The current agent's ID to exclude from the search\n * @returns The consulted agent ID, or empty string if none found\n */\nexport const getConsultedAgentId = (media: Interaction['media'], agentId: string): string => {\n let consultParticipants: string[] = [];\n let consultedParticipantId = '';\n\n Object.keys(media).forEach((key) => {\n if (media[key].mType === STATE_CONSULT) {\n consultParticipants = media[key].participants;\n }\n });\n\n if (consultParticipants.includes(agentId)) {\n const id = consultParticipants.find((participant) => participant !== agentId);\n consultedParticipantId = id || consultedParticipantId;\n }\n\n return consultedParticipantId;\n};\n\n/**\n * Gets the destination agent ID for CBT (Capacity Based Team) scenarios.\n * CBT refers to teams created in Control Hub with capacity-based routing\n * (as opposed to agent-based routing). This handles cases where the consulted\n * participant is not directly in participants but can be found by matching\n * the dial number (dn).\n *\n * @param interaction - The interaction object\n * @param consultingAgent - The consulting agent identifier\n * @returns The destination agent ID for CBT scenarios, or empty string if none found\n */\nexport const getDestAgentIdForCBT = (interaction: Interaction, consultingAgent: string): string => {\n const participants = interaction.participants;\n let destAgentIdForCBT = '';\n\n // Check if this is a CBT scenario (consultingAgent exists but not directly in participants)\n if (consultingAgent && !participants[consultingAgent]) {\n const foundEntry = Object.entries(participants).find(\n ([, participant]: [string, Interaction['participants'][string]]) => {\n return (\n participant.pType.toLowerCase() === PARTICIPANT_TYPES.DN &&\n participant.type === PARTICIPANT_TYPES.AGENT &&\n participant.dn === consultingAgent\n );\n }\n );\n\n if (foundEntry) {\n destAgentIdForCBT = foundEntry[0];\n }\n }\n\n return destAgentIdForCBT;\n};\n\n/**\n * Calculates the destination agent ID for consult operations.\n *\n * @param interaction - The interaction object\n * @param agentId - The current agent's ID\n * @returns The destination agent ID\n */\nexport const calculateDestAgentId = (interaction: Interaction, agentId: string): string => {\n const consultingAgent = getConsultedAgentId(interaction.media, agentId);\n\n // Check if this is a CBT (Capacity Based Team) scenario\n // If not CBT, the function will return empty string and we'll use the normal flow\n const destAgentIdCBT = getDestAgentIdForCBT(interaction, consultingAgent);\n if (destAgentIdCBT) {\n return destAgentIdCBT;\n }\n\n const participant = interaction.participants[consultingAgent];\n if (!participant) {\n return '';\n }\n\n if (participant.type === PARTICIPANT_TYPES.EP_DN) {\n return (participant as InteractionParticipant & {epId?: string}).epId ?? '';\n }\n\n return participant.id ?? '';\n};\n\n/**\n * Calculates the destination agent ID for fetching destination type.\n *\n * @param interaction - The interaction object\n * @param agentId - The current agent's ID\n * @returns The destination agent ID for determining destination type\n */\nexport const calculateDestType = (interaction: Interaction, agentId: string): string => {\n const consultingAgent = getConsultedAgentId(interaction.media, agentId);\n\n // Check if this is a CBT (Capacity Based Team) scenario, otherwise use consultingAgent\n const destAgentIdCBT = getDestAgentIdForCBT(interaction, consultingAgent);\n const destinationaegntId = destAgentIdCBT || consultingAgent;\n const destAgentType = destinationaegntId\n ? interaction.participants[destinationaegntId]?.pType\n : undefined;\n if (destAgentType) {\n if (destAgentType === 'DN') {\n return CONSULT_TRANSFER_DESTINATION_TYPE.DIALNUMBER;\n }\n if (destAgentType === 'EP-DN') {\n return CONSULT_TRANSFER_DESTINATION_TYPE.ENTRYPOINT;\n }\n // Keep the existing destinationType if it's something else (like \"agent\" or \"Agent\")\n // Convert \"Agent\" to lowercase for consistency\n\n return destAgentType.toLowerCase();\n }\n\n return CONSULT_TRANSFER_DESTINATION_TYPE.AGENT;\n};\n\n/**\n * Gets the destination agent ID from participants.\n * Finds a participant who is not the current agent and is an agent type.\n *\n * @param participants - The participants object from interaction\n * @param agentId - The current agent's ID\n * @returns The destination agent ID, or undefined if none found\n */\nexport const buildConsultConferenceParamData = (\n dataPassed: consultConferencePayloadData,\n interactionIdPassed: string\n): {interactionId: string; data: ConsultConferenceData} => {\n const data: ConsultConferenceData = {\n ...('agentId' in dataPassed && {agentId: dataPassed.agentId}),\n to: dataPassed.destAgentId,\n destinationType: '',\n };\n\n if ('destinationType' in dataPassed) {\n const destinationType = String(dataPassed.destinationType || '').trim();\n const normalizedDestinationType = destinationType.toUpperCase().replace(/[-_\\s]/g, '');\n\n if (normalizedDestinationType === 'DN' || normalizedDestinationType === 'DIALNUMBER') {\n data.destinationType = DESTINATION_TYPE.DIALNUMBER;\n } else if (normalizedDestinationType === 'EPDN' || normalizedDestinationType === 'ENTRYPOINT') {\n data.destinationType = DESTINATION_TYPE.ENTRYPOINT;\n } else if (normalizedDestinationType === 'QUEUE') {\n data.destinationType = DESTINATION_TYPE.QUEUE;\n } else if (normalizedDestinationType === 'AGENT') {\n data.destinationType = DESTINATION_TYPE.AGENT;\n } else {\n data.destinationType = destinationType as ConsultConferenceData['destinationType'];\n }\n } else {\n data.destinationType = DESTINATION_TYPE.AGENT;\n }\n\n return {\n interactionId: interactionIdPassed,\n data,\n };\n};\n\n/**\n * Derives the consult transfer destination type based on task data.\n * This function determines the appropriate destination type for a consult transfer\n * by examining the destination type stored in the task data.\n *\n * @param taskData - The task data containing destination information\n * @returns The derived consult transfer destination type\n * @public\n */\nexport const deriveConsultTransferDestinationType = (\n taskData: TaskData\n): ConsultTransferDestinationType => {\n const destType = taskData?.destinationType;\n const normalizedDestType = String(destType || '')\n .toUpperCase()\n .replace(/[-_\\s]/g, '');\n\n // Map destination types to consult transfer destination types\n if (normalizedDestType === 'DN' || normalizedDestType === 'DIALNUMBER') {\n return CONSULT_TRANSFER_DESTINATION_TYPE.DIALNUMBER;\n }\n if (normalizedDestType === 'EPDN' || normalizedDestType === 'ENTRYPOINT') {\n return CONSULT_TRANSFER_DESTINATION_TYPE.ENTRYPOINT;\n }\n if (normalizedDestType === 'QUEUE') {\n return CONSULT_TRANSFER_DESTINATION_TYPE.QUEUE;\n }\n\n // Default to agent if no specific type matches\n return CONSULT_TRANSFER_DESTINATION_TYPE.AGENT;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,GAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAUA,IAAAM,UAAA,GAAAN,OAAA;AAA6D,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,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KAAK;EAChD;;EAEA;EACA,OAAOf,yCAAiC,CAACV,KAAK;AAChD,CAAC;AAAC/E,OAAA,CAAA0G,oCAAA,GAAAA,oCAAA","ignoreList":[]}
|
|
@@ -20,15 +20,41 @@ class AqmReqs {
|
|
|
20
20
|
this.webSocketManager = webSocketManager;
|
|
21
21
|
this.webSocketManager.on('message', this.onMessage.bind(this));
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Creates a request function for an API call with parameters
|
|
26
|
+
* @param c - The configuration for the request
|
|
27
|
+
* @returns A function that makes the API request
|
|
28
|
+
*/
|
|
23
29
|
req(c) {
|
|
24
30
|
return (p, cbRes) => this.makeAPIRequest(c(p), cbRes);
|
|
25
31
|
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates a request function for an API call with no parameters
|
|
35
|
+
* @param c - The configuration for the request
|
|
36
|
+
* @returns A function that makes the API request
|
|
37
|
+
*/
|
|
26
38
|
reqEmpty(c) {
|
|
27
39
|
return cbRes => this.makeAPIRequest(c(), cbRes);
|
|
28
40
|
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Makes an API request
|
|
44
|
+
* @param c - The request configuration
|
|
45
|
+
* @param cbRes - The callback for the response
|
|
46
|
+
* @returns A promise that resolves with the response or rejects with an error
|
|
47
|
+
*/
|
|
29
48
|
async makeAPIRequest(c, cbRes) {
|
|
30
49
|
return this.createPromise(c, cbRes);
|
|
31
50
|
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Creates a promise for an API request
|
|
54
|
+
* @param c - The request configuration
|
|
55
|
+
* @param cbRes - The callback for the response
|
|
56
|
+
* @returns A promise that resolves with the response or rejects with an error
|
|
57
|
+
*/
|
|
32
58
|
createPromise(c, cbRes) {
|
|
33
59
|
return new Promise((resolve, reject) => {
|
|
34
60
|
const keySuccess = this.bindPrint(c.notifSuccess.bind);
|
|
@@ -139,7 +165,7 @@ class AqmReqs {
|
|
|
139
165
|
if (response?.headers) {
|
|
140
166
|
response.headers.Authorization = '*';
|
|
141
167
|
}
|
|
142
|
-
_loggerProxy.default.error(`Routing request timeout${keySuccess}${response}${c.url}`, {
|
|
168
|
+
_loggerProxy.default.error(`Routing request timeout${keySuccess}${JSON.stringify(response)}${c.url}`, {
|
|
143
169
|
module: _constants2.AQM_REQS_FILE,
|
|
144
170
|
method: _constants.METHODS.CREATE_PROMISE
|
|
145
171
|
});
|
|
@@ -151,44 +177,93 @@ class AqmReqs {
|
|
|
151
177
|
}
|
|
152
178
|
});
|
|
153
179
|
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Converts a bind object to a string representation
|
|
183
|
+
* @param bind - The bind object to convert
|
|
184
|
+
* @returns A string representation of the bind object
|
|
185
|
+
*/
|
|
154
186
|
bindPrint(bind) {
|
|
155
187
|
let result = '';
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (Array.isArray(
|
|
159
|
-
result += `${
|
|
160
|
-
} else if (typeof
|
|
161
|
-
result += `${
|
|
188
|
+
for (const key of Object.keys(bind).filter(prop => prop !== '__typeMap')) {
|
|
189
|
+
const value = bind[key];
|
|
190
|
+
if (Array.isArray(value)) {
|
|
191
|
+
result += `${key}=[${value.join(',')}],`;
|
|
192
|
+
} else if (typeof value === 'object' && value !== null) {
|
|
193
|
+
result += `${key}=(${this.bindPrint(value)}),`;
|
|
162
194
|
} else {
|
|
163
|
-
result += `${
|
|
195
|
+
result += `${key}=${value},`;
|
|
164
196
|
}
|
|
165
197
|
}
|
|
166
198
|
return result ? result.slice(0, -1) : result;
|
|
167
199
|
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Checks if a message matches a bind object
|
|
203
|
+
* @param bind - The bind object to check against
|
|
204
|
+
* @param msg - The message to check
|
|
205
|
+
* @returns True if the message matches the bind object, false otherwise
|
|
206
|
+
*/
|
|
168
207
|
bindCheck(bind, msg) {
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
if (
|
|
208
|
+
// Handle type-dependent field matching if __typeMap is present
|
|
209
|
+
if (bind.__typeMap && typeof bind.__typeMap === 'object') {
|
|
210
|
+
if (!AqmReqs.typeMapCheck(bind.__typeMap, msg)) {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
for (const key of Object.keys(bind).filter(prop => prop !== '__typeMap')) {
|
|
215
|
+
const bindValue = bind[key];
|
|
216
|
+
const msgValue = msg[key];
|
|
217
|
+
if (Array.isArray(bindValue)) {
|
|
172
218
|
// Check if the message value matches any of the values in the array
|
|
173
|
-
if (!
|
|
219
|
+
if (!bindValue.includes(msgValue)) {
|
|
174
220
|
return false;
|
|
175
221
|
}
|
|
176
|
-
} else if (typeof
|
|
177
|
-
if (typeof
|
|
178
|
-
if (!this.bindCheck(
|
|
222
|
+
} else if (typeof bindValue === 'object' && bindValue !== null) {
|
|
223
|
+
if (typeof msgValue === 'object' && msgValue !== null) {
|
|
224
|
+
if (!this.bindCheck(bindValue, msgValue)) {
|
|
179
225
|
return false;
|
|
180
226
|
}
|
|
181
227
|
} else {
|
|
182
228
|
return false;
|
|
183
229
|
}
|
|
184
|
-
} else if (!
|
|
230
|
+
} else if (!msgValue || msgValue !== bindValue) {
|
|
185
231
|
return false;
|
|
186
232
|
}
|
|
187
233
|
}
|
|
188
234
|
return true;
|
|
189
235
|
}
|
|
190
236
|
|
|
191
|
-
|
|
237
|
+
/**
|
|
238
|
+
* Checks type-dependent field conditions defined in __typeMap.
|
|
239
|
+
* @param typeMap - The type map to check against
|
|
240
|
+
* @param msg - The message to check
|
|
241
|
+
* @returns True if the message matches the type map, false otherwise
|
|
242
|
+
* The typeMap has the shape:
|
|
243
|
+
* { typeField: "type", conditions: { EventA: { field: value }, EventB: { field: value } } }
|
|
244
|
+
* It reads msg[typeField] to determine which condition set to apply,
|
|
245
|
+
* then verifies all fields in that condition match the message.
|
|
246
|
+
*/
|
|
247
|
+
static typeMapCheck(typeMap, msg) {
|
|
248
|
+
const typeField = typeMap.typeField || 'type';
|
|
249
|
+
const msgType = msg[typeField];
|
|
250
|
+
if (typeMap.conditions && typeMap.conditions[msgType]) {
|
|
251
|
+
const condition = typeMap.conditions[msgType];
|
|
252
|
+
for (const field of Object.keys(condition)) {
|
|
253
|
+
if (!msg[field] || msg[field] !== condition[field]) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Handles incoming messages from the WebSocket (must be a lambda fn)
|
|
264
|
+
* @param msg - The message to handle
|
|
265
|
+
* @returns
|
|
266
|
+
*/
|
|
192
267
|
onMessage = msg => {
|
|
193
268
|
const event = JSON.parse(msg);
|
|
194
269
|
if (event.type === 'Welcome') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Err","_interopRequireWildcard","require","_types","_loggerProxy","_interopRequireDefault","_constants","_constants2","_WebexRequest","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","AqmReqs","pendingRequests","pendingNotifCancelrequest","constructor","webSocketManager","webexRequest","WebexRequest","getInstance","on","onMessage","bind","req","c","p","cbRes","makeAPIRequest","reqEmpty","createPromise","Promise","resolve","reject","keySuccess","bindPrint","notifSuccess","keyFail","notifFail","keyCancel","notifCancel","k","timeout","Details","key","msg","isClear","clear","check","bindCheck","handle","alternateBind","alternateBindKey","LoggerProxy","log","JSON","stringify","module","AQM_REQS_FILE","method","METHODS","CREATE_PROMISE","eerr","errId","err","response","request","service","host","resource","url","data","HTTP_METHODS","POST","GET","body","then","res","catch","error","headers","Authorization","Message","window","setTimeout","TIMEOUT_REQ","result","Array","isArray","join","slice","includes","event","parse","type","info","ON_MESSAGE","keepalive","isHandled","kReq","keys","thisReq","kReqAlt","exports"],"sources":["aqm-reqs.ts"],"sourcesContent":["import {Msg} from './GlobalTypes';\nimport * as Err from './Err';\nimport {HTTP_METHODS, WebexRequestPayload} from '../../types';\nimport LoggerProxy from '../../logger-proxy';\nimport {CbRes, Conf, ConfEmpty, Pending, Req, Res, ResEmpty} from './types';\nimport {TIMEOUT_REQ, METHODS} from './constants';\nimport {AQM_REQS_FILE} from '../../constants';\nimport WebexRequest from './WebexRequest';\nimport {WebSocketManager} from './websocket/WebSocketManager';\n\nexport default class AqmReqs {\n private pendingRequests: Record<string, Pending> = {};\n private pendingNotifCancelrequest: Record<string, Pending> = {};\n private webexRequest: WebexRequest;\n private webSocketManager: WebSocketManager;\n\n constructor(webSocketManager: WebSocketManager) {\n this.webexRequest = WebexRequest.getInstance();\n this.webSocketManager = webSocketManager;\n this.webSocketManager.on('message', this.onMessage.bind(this));\n }\n\n req<TRes, TErr, TReq>(c: Conf<TRes, TErr, TReq>): Res<TRes, TReq> {\n return (p: TReq, cbRes?: CbRes<TRes>) => this.makeAPIRequest(c(p), cbRes);\n }\n\n reqEmpty<TRes, TErr>(c: ConfEmpty<TRes, TErr>): ResEmpty<TRes> {\n return (cbRes?: CbRes<TRes>) => this.makeAPIRequest(c(), cbRes);\n }\n\n private async makeAPIRequest<TRes, TErr>(c: Req<TRes, TErr>, cbRes?: CbRes<TRes>): Promise<TRes> {\n return this.createPromise(c, cbRes);\n }\n\n private createPromise<TRes, TErr>(c: Req<TRes, TErr>, cbRes?: CbRes<TRes>) {\n return new Promise<TRes>((resolve, reject) => {\n const keySuccess = this.bindPrint(c.notifSuccess.bind);\n const keyFail = c.notifFail ? this.bindPrint(c.notifFail.bind) : null;\n const keyCancel = c.notifCancel?.bind ? this.bindPrint(c.notifCancel.bind) : null;\n let k = '';\n if (this.pendingRequests[keySuccess]) {\n k = keySuccess;\n }\n if (keyFail && this.pendingRequests[keyFail]) {\n k += keyFail;\n }\n if (k && c.timeout !== 'disabled') {\n reject(\n new Err.Details('Service.aqm.reqs.Pending', {\n key: k,\n msg: 'The request has been already created, multiple requests are not allowed.',\n })\n );\n\n return;\n }\n\n let isClear = false;\n const clear = () => {\n delete this.pendingRequests[keySuccess];\n if (keyFail) {\n delete this.pendingRequests[keyFail];\n }\n if (keyCancel) {\n delete this.pendingNotifCancelrequest[keyCancel];\n }\n isClear = true;\n };\n\n this.pendingRequests[keySuccess] = {\n check: (msg: Msg) => this.bindCheck(c.notifSuccess.bind, msg),\n handle: (msg: Msg) => {\n clear();\n resolve(msg as any);\n },\n };\n if (keyCancel) {\n this.pendingRequests[keySuccess].alternateBind = keyCancel;\n this.pendingNotifCancelrequest[keyCancel] = {\n check: (msg: Msg) => this.bindCheck(c.notifCancel?.bind, msg),\n handle: (msg: Msg) => {\n const alternateBindKey = this.pendingNotifCancelrequest[keyCancel].alternateBind;\n if (alternateBindKey) {\n this.pendingRequests[alternateBindKey].handle(msg);\n }\n },\n alternateBind: keySuccess,\n };\n }\n\n if (keyFail) {\n this.pendingRequests[keyFail] = {\n check: (msg: Msg) => this.bindCheck(c.notifFail!.bind, msg),\n handle: (msg: Msg) => {\n clear();\n const notifFail = c.notifFail!;\n if ('errId' in notifFail) {\n LoggerProxy.log(`Routing request failed: ${JSON.stringify(msg)}`, {\n module: AQM_REQS_FILE,\n method: METHODS.CREATE_PROMISE,\n });\n const eerr = new Err.Details(notifFail.errId, msg as any);\n LoggerProxy.log(`Routing request failed: ${eerr}`, {\n module: AQM_REQS_FILE,\n method: METHODS.CREATE_PROMISE,\n });\n reject(eerr);\n } else {\n reject(notifFail.err(msg as any));\n }\n },\n };\n }\n let response: WebexRequestPayload | null = null;\n this.webexRequest\n .request({\n service: c.host ?? '',\n resource: c.url,\n // eslint-disable-next-line no-nested-ternary\n method: c.method ? c.method : c.data ? HTTP_METHODS.POST : HTTP_METHODS.GET,\n\n body: c.data,\n })\n .then((res: any) => {\n response = res;\n if (cbRes) {\n cbRes(res);\n }\n })\n .catch((error: WebexRequestPayload) => {\n clear();\n if (error?.headers) {\n error.headers.Authorization = '*';\n }\n if (error?.headers) {\n error.headers.Authorization = '*';\n }\n if (typeof c.err === 'function') {\n reject(c.err(error));\n } else if (typeof c.err === 'string') {\n reject(new Err.Message(c.err));\n } else {\n reject(new Err.Message('Service.aqm.reqs.GenericRequestError'));\n }\n });\n\n if (c.timeout !== 'disabled') {\n window.setTimeout(\n () => {\n if (isClear) {\n return;\n }\n clear();\n if (response?.headers) {\n response.headers.Authorization = '*';\n }\n LoggerProxy.error(`Routing request timeout${keySuccess}${response!}${c.url}`, {\n module: AQM_REQS_FILE,\n method: METHODS.CREATE_PROMISE,\n });\n reject(\n new Err.Details('Service.aqm.reqs.Timeout', {\n key: keySuccess,\n response: response!,\n })\n );\n },\n c.timeout && c.timeout > 0 ? c.timeout : TIMEOUT_REQ\n );\n }\n });\n }\n\n private bindPrint(bind: any) {\n let result = '';\n // eslint-disable-next-line no-restricted-syntax\n for (const k in bind) {\n if (Array.isArray(bind[k])) {\n result += `${k}=[${bind[k].join(',')}],`;\n } else if (typeof bind[k] === 'object' && bind[k] !== null) {\n result += `${k}=(${this.bindPrint(bind[k])}),`;\n } else {\n result += `${k}=${bind[k]},`;\n }\n }\n\n return result ? result.slice(0, -1) : result;\n }\n\n private bindCheck(bind: any, msg: any) {\n // eslint-disable-next-line no-restricted-syntax\n for (const k in bind) {\n if (Array.isArray(bind[k])) {\n // Check if the message value matches any of the values in the array\n if (!bind[k].includes(msg[k])) {\n return false;\n }\n } else if (typeof bind[k] === 'object' && bind[k] !== null) {\n if (typeof msg[k] === 'object' && msg[k] !== null) {\n if (!this.bindCheck(bind[k], msg[k])) {\n return false;\n }\n } else {\n return false;\n }\n } else if (!msg[k] || msg[k] !== bind[k]) {\n return false;\n }\n }\n\n return true;\n }\n\n // must be lambda\n private readonly onMessage = (msg: any) => {\n const event = JSON.parse(msg);\n if (event.type === 'Welcome') {\n LoggerProxy.info(`Welcome message from Notifs Websocket`, {\n module: AQM_REQS_FILE,\n method: METHODS.ON_MESSAGE,\n });\n\n return;\n }\n\n if (event.keepalive === 'true') {\n return;\n }\n\n if (event.type === 'AgentReloginFailed') {\n LoggerProxy.info('Silently handling the agent relogin fail', {\n module: AQM_REQS_FILE,\n method: METHODS.ON_MESSAGE,\n });\n }\n\n let isHandled = false;\n\n const kReq = Object.keys(this.pendingRequests);\n for (const thisReq of kReq) {\n const req = this.pendingRequests[thisReq];\n if (req.check(event)) {\n req.handle(event);\n isHandled = true;\n break;\n }\n }\n // pendingNotifCancelrequest stores the secondary bind key, checks for the secondary bind key and handles the event\n const kReqAlt = Object.keys(this.pendingNotifCancelrequest);\n for (const thisReq of kReqAlt) {\n const req = this.pendingNotifCancelrequest[thisReq];\n if (req.check(event)) {\n req.handle(event);\n isHandled = true;\n }\n }\n\n // TODO: add event emitter for unhandled events to replicate event.listen or .on\n\n if (!isHandled) {\n LoggerProxy.info(`event=missingEventHandler | [AqmReqs] missing routing message handler`, {\n module: AQM_REQS_FILE,\n method: METHODS.ON_MESSAGE,\n });\n }\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,GAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAH,sBAAA,CAAAH,OAAA;AAA0C,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAAA,CAAAQ,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,Q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,eAAe,CAACuF,OAAO,CAAC;MACzC,IAAI7E,GAAG,CAACwB,KAAK,CAAC4C,KAAK,CAAC,EAAE;QACpBpE,GAAG,CAAC0B,MAAM,CAAC0C,KAAK,CAAC;QACjBM,SAAS,GAAG,IAAI;QAChB;MACF;IACF;IACA;IACA,MAAMI,OAAO,GAAG5F,MAAM,CAAC0F,IAAI,CAAC,IAAI,CAACrF,yBAAyB,CAAC;IAC3D,KAAK,MAAMsF,OAAO,IAAIC,OAAO,EAAE;MAC7B,MAAM9E,GAAG,GAAG,IAAI,CAACT,yBAAyB,CAACsF,OAAO,CAAC;MACnD,IAAI7E,GAAG,CAACwB,KAAK,CAAC4C,KAAK,CAAC,EAAE;QACpBpE,GAAG,CAAC0B,MAAM,CAAC0C,KAAK,CAAC;QACjBM,SAAS,GAAG,IAAI;MAClB;IACF;;IAEA;;IAEA,IAAI,CAACA,SAAS,EAAE;MACd7C,oBAAW,CAAC0C,IAAI,CAAC,uEAAuE,EAAE;QACxFtC,MAAM,EAAEC,yBAAa;QACrBC,MAAM,EAAEC,kBAAO,CAACoC;MAClB,CAAC,CAAC;IACJ;EACF,CAAC;AACH;AAACO,OAAA,CAAA3G,OAAA,GAAAiB,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Err","_interopRequireWildcard","require","_types","_loggerProxy","_interopRequireDefault","_constants","_constants2","_WebexRequest","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","AqmReqs","pendingRequests","pendingNotifCancelrequest","constructor","webSocketManager","webexRequest","WebexRequest","getInstance","on","onMessage","bind","req","c","p","cbRes","makeAPIRequest","reqEmpty","createPromise","Promise","resolve","reject","keySuccess","bindPrint","notifSuccess","keyFail","notifFail","keyCancel","notifCancel","k","timeout","Details","key","msg","isClear","clear","check","bindCheck","handle","alternateBind","alternateBindKey","LoggerProxy","log","JSON","stringify","module","AQM_REQS_FILE","method","METHODS","CREATE_PROMISE","eerr","errId","err","response","request","service","host","resource","url","data","HTTP_METHODS","POST","GET","body","then","res","catch","error","headers","Authorization","Message","window","setTimeout","TIMEOUT_REQ","result","keys","filter","prop","value","Array","isArray","join","slice","__typeMap","typeMapCheck","bindValue","msgValue","includes","typeMap","typeField","msgType","conditions","condition","field","event","parse","type","info","ON_MESSAGE","keepalive","isHandled","kReq","thisReq","kReqAlt","exports"],"sources":["aqm-reqs.ts"],"sourcesContent":["import {Msg} from './GlobalTypes';\nimport * as Err from './Err';\nimport {HTTP_METHODS, WebexRequestPayload} from '../../types';\nimport LoggerProxy from '../../logger-proxy';\nimport {CbRes, Conf, ConfEmpty, Pending, Req, Res, ResEmpty} from './types';\nimport {TIMEOUT_REQ, METHODS} from './constants';\nimport {AQM_REQS_FILE} from '../../constants';\nimport WebexRequest from './WebexRequest';\nimport {WebSocketManager} from './websocket/WebSocketManager';\n\nexport default class AqmReqs {\n private pendingRequests: Record<string, Pending> = {};\n private pendingNotifCancelrequest: Record<string, Pending> = {};\n private webexRequest: WebexRequest;\n private webSocketManager: WebSocketManager;\n\n constructor(webSocketManager: WebSocketManager) {\n this.webexRequest = WebexRequest.getInstance();\n this.webSocketManager = webSocketManager;\n this.webSocketManager.on('message', this.onMessage.bind(this));\n }\n\n /**\n * Creates a request function for an API call with parameters\n * @param c - The configuration for the request\n * @returns A function that makes the API request\n */\n req<TRes, TErr, TReq>(c: Conf<TRes, TErr, TReq>): Res<TRes, TReq> {\n return (p: TReq, cbRes?: CbRes<TRes>) => this.makeAPIRequest(c(p), cbRes);\n }\n\n /**\n * Creates a request function for an API call with no parameters\n * @param c - The configuration for the request\n * @returns A function that makes the API request\n */\n reqEmpty<TRes, TErr>(c: ConfEmpty<TRes, TErr>): ResEmpty<TRes> {\n return (cbRes?: CbRes<TRes>) => this.makeAPIRequest(c(), cbRes);\n }\n\n /**\n * Makes an API request\n * @param c - The request configuration\n * @param cbRes - The callback for the response\n * @returns A promise that resolves with the response or rejects with an error\n */\n private async makeAPIRequest<TRes, TErr>(c: Req<TRes, TErr>, cbRes?: CbRes<TRes>): Promise<TRes> {\n return this.createPromise(c, cbRes);\n }\n\n /**\n * Creates a promise for an API request\n * @param c - The request configuration\n * @param cbRes - The callback for the response\n * @returns A promise that resolves with the response or rejects with an error\n */\n private createPromise<TRes, TErr>(c: Req<TRes, TErr>, cbRes?: CbRes<TRes>) {\n return new Promise<TRes>((resolve, reject) => {\n const keySuccess = this.bindPrint(c.notifSuccess.bind);\n const keyFail = c.notifFail ? this.bindPrint(c.notifFail.bind) : null;\n const keyCancel = c.notifCancel?.bind ? this.bindPrint(c.notifCancel.bind) : null;\n let k = '';\n if (this.pendingRequests[keySuccess]) {\n k = keySuccess;\n }\n if (keyFail && this.pendingRequests[keyFail]) {\n k += keyFail;\n }\n if (k && c.timeout !== 'disabled') {\n reject(\n new Err.Details('Service.aqm.reqs.Pending', {\n key: k,\n msg: 'The request has been already created, multiple requests are not allowed.',\n })\n );\n\n return;\n }\n\n let isClear = false;\n const clear = () => {\n delete this.pendingRequests[keySuccess];\n if (keyFail) {\n delete this.pendingRequests[keyFail];\n }\n if (keyCancel) {\n delete this.pendingNotifCancelrequest[keyCancel];\n }\n isClear = true;\n };\n\n this.pendingRequests[keySuccess] = {\n check: (msg: Msg) => this.bindCheck(c.notifSuccess.bind, msg),\n handle: (msg: Msg) => {\n clear();\n resolve(msg as any);\n },\n };\n if (keyCancel) {\n this.pendingRequests[keySuccess].alternateBind = keyCancel;\n this.pendingNotifCancelrequest[keyCancel] = {\n check: (msg: Msg) => this.bindCheck(c.notifCancel?.bind, msg),\n handle: (msg: Msg) => {\n const alternateBindKey = this.pendingNotifCancelrequest[keyCancel].alternateBind;\n if (alternateBindKey) {\n this.pendingRequests[alternateBindKey].handle(msg);\n }\n },\n alternateBind: keySuccess,\n };\n }\n\n if (keyFail) {\n this.pendingRequests[keyFail] = {\n check: (msg: Msg) => this.bindCheck(c.notifFail!.bind, msg),\n handle: (msg: Msg) => {\n clear();\n const notifFail = c.notifFail!;\n if ('errId' in notifFail) {\n LoggerProxy.log(`Routing request failed: ${JSON.stringify(msg)}`, {\n module: AQM_REQS_FILE,\n method: METHODS.CREATE_PROMISE,\n });\n const eerr = new Err.Details(notifFail.errId, msg as any);\n LoggerProxy.log(`Routing request failed: ${eerr}`, {\n module: AQM_REQS_FILE,\n method: METHODS.CREATE_PROMISE,\n });\n reject(eerr);\n } else {\n reject(notifFail.err(msg as any));\n }\n },\n };\n }\n let response: WebexRequestPayload | null = null;\n this.webexRequest\n .request({\n service: c.host ?? '',\n resource: c.url,\n // eslint-disable-next-line no-nested-ternary\n method: c.method ? c.method : c.data ? HTTP_METHODS.POST : HTTP_METHODS.GET,\n\n body: c.data,\n })\n .then((res: any) => {\n response = res;\n if (cbRes) {\n cbRes(res);\n }\n })\n .catch((error: WebexRequestPayload) => {\n clear();\n if (error?.headers) {\n error.headers.Authorization = '*';\n }\n if (error?.headers) {\n error.headers.Authorization = '*';\n }\n if (typeof c.err === 'function') {\n reject(c.err(error));\n } else if (typeof c.err === 'string') {\n reject(new Err.Message(c.err));\n } else {\n reject(new Err.Message('Service.aqm.reqs.GenericRequestError'));\n }\n });\n\n if (c.timeout !== 'disabled') {\n window.setTimeout(\n () => {\n if (isClear) {\n return;\n }\n clear();\n if (response?.headers) {\n response.headers.Authorization = '*';\n }\n LoggerProxy.error(\n `Routing request timeout${keySuccess}${JSON.stringify(response)}${c.url}`,\n {\n module: AQM_REQS_FILE,\n method: METHODS.CREATE_PROMISE,\n }\n );\n reject(\n new Err.Details('Service.aqm.reqs.Timeout', {\n key: keySuccess,\n response: response!,\n })\n );\n },\n c.timeout && c.timeout > 0 ? c.timeout : TIMEOUT_REQ\n );\n }\n });\n }\n\n /**\n * Converts a bind object to a string representation\n * @param bind - The bind object to convert\n * @returns A string representation of the bind object\n */\n private bindPrint(bind: any): string {\n let result = '';\n for (const key of Object.keys(bind).filter((prop) => prop !== '__typeMap')) {\n const value = bind[key];\n\n if (Array.isArray(value)) {\n result += `${key}=[${value.join(',')}],`;\n } else if (typeof value === 'object' && value !== null) {\n result += `${key}=(${this.bindPrint(value)}),`;\n } else {\n result += `${key}=${value},`;\n }\n }\n\n return result ? result.slice(0, -1) : result;\n }\n\n /**\n * Checks if a message matches a bind object\n * @param bind - The bind object to check against\n * @param msg - The message to check\n * @returns True if the message matches the bind object, false otherwise\n */\n private bindCheck(bind: any, msg: any): boolean {\n // Handle type-dependent field matching if __typeMap is present\n if (bind.__typeMap && typeof bind.__typeMap === 'object') {\n if (!AqmReqs.typeMapCheck(bind.__typeMap, msg)) {\n return false;\n }\n }\n\n for (const key of Object.keys(bind).filter((prop) => prop !== '__typeMap')) {\n const bindValue = bind[key];\n const msgValue = msg[key];\n\n if (Array.isArray(bindValue)) {\n // Check if the message value matches any of the values in the array\n if (!bindValue.includes(msgValue)) {\n return false;\n }\n } else if (typeof bindValue === 'object' && bindValue !== null) {\n if (typeof msgValue === 'object' && msgValue !== null) {\n if (!this.bindCheck(bindValue, msgValue)) {\n return false;\n }\n } else {\n return false;\n }\n } else if (!msgValue || msgValue !== bindValue) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Checks type-dependent field conditions defined in __typeMap.\n * @param typeMap - The type map to check against\n * @param msg - The message to check\n * @returns True if the message matches the type map, false otherwise\n * The typeMap has the shape:\n * { typeField: \"type\", conditions: { EventA: { field: value }, EventB: { field: value } } }\n * It reads msg[typeField] to determine which condition set to apply,\n * then verifies all fields in that condition match the message.\n */\n private static typeMapCheck(typeMap: any, msg: any): boolean {\n const typeField = typeMap.typeField || 'type';\n const msgType = msg[typeField];\n\n if (typeMap.conditions && typeMap.conditions[msgType]) {\n const condition = typeMap.conditions[msgType];\n for (const field of Object.keys(condition)) {\n if (!msg[field] || msg[field] !== condition[field]) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Handles incoming messages from the WebSocket (must be a lambda fn)\n * @param msg - The message to handle\n * @returns\n */\n private readonly onMessage = (msg: any) => {\n const event = JSON.parse(msg);\n if (event.type === 'Welcome') {\n LoggerProxy.info(`Welcome message from Notifs Websocket`, {\n module: AQM_REQS_FILE,\n method: METHODS.ON_MESSAGE,\n });\n\n return;\n }\n\n if (event.keepalive === 'true') {\n return;\n }\n\n if (event.type === 'AgentReloginFailed') {\n LoggerProxy.info('Silently handling the agent relogin fail', {\n module: AQM_REQS_FILE,\n method: METHODS.ON_MESSAGE,\n });\n }\n\n let isHandled = false;\n\n const kReq = Object.keys(this.pendingRequests);\n for (const thisReq of kReq) {\n const req = this.pendingRequests[thisReq];\n if (req.check(event)) {\n req.handle(event);\n isHandled = true;\n break;\n }\n }\n // pendingNotifCancelrequest stores the secondary bind key, checks for the secondary bind key and handles the event\n const kReqAlt = Object.keys(this.pendingNotifCancelrequest);\n for (const thisReq of kReqAlt) {\n const req = this.pendingNotifCancelrequest[thisReq];\n if (req.check(event)) {\n req.handle(event);\n isHandled = true;\n }\n }\n\n // TODO: add event emitter for unhandled events to replicate event.listen or .on\n\n if (!isHandled) {\n LoggerProxy.info(`event=missingEventHandler | [AqmReqs] missing routing message handler`, {\n module: AQM_REQS_FILE,\n method: METHODS.ON_MESSAGE,\n });\n }\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,GAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAH,sBAAA,CAAAH,OAAA;AAA0C,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAAA,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