@webex/contact-center 0.0.0-next.1
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 +81 -0
- package/__mocks__/workerMock.js +15 -0
- package/babel.config.js +15 -0
- package/dist/cc.js +1416 -0
- package/dist/cc.js.map +1 -0
- package/dist/config.js +72 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.js +58 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.js +142 -0
- package/dist/index.js.map +1 -0
- package/dist/logger-proxy.js +115 -0
- package/dist/logger-proxy.js.map +1 -0
- package/dist/metrics/MetricsManager.js +474 -0
- package/dist/metrics/MetricsManager.js.map +1 -0
- package/dist/metrics/behavioral-events.js +322 -0
- package/dist/metrics/behavioral-events.js.map +1 -0
- package/dist/metrics/constants.js +134 -0
- package/dist/metrics/constants.js.map +1 -0
- package/dist/services/WebCallingService.js +323 -0
- package/dist/services/WebCallingService.js.map +1 -0
- package/dist/services/agent/index.js +177 -0
- package/dist/services/agent/index.js.map +1 -0
- package/dist/services/agent/types.js +137 -0
- package/dist/services/agent/types.js.map +1 -0
- package/dist/services/config/Util.js +203 -0
- package/dist/services/config/Util.js.map +1 -0
- package/dist/services/config/constants.js +221 -0
- package/dist/services/config/constants.js.map +1 -0
- package/dist/services/config/index.js +607 -0
- package/dist/services/config/index.js.map +1 -0
- package/dist/services/config/types.js +334 -0
- package/dist/services/config/types.js.map +1 -0
- package/dist/services/constants.js +117 -0
- package/dist/services/constants.js.map +1 -0
- package/dist/services/core/Err.js +43 -0
- package/dist/services/core/Err.js.map +1 -0
- package/dist/services/core/GlobalTypes.js +6 -0
- package/dist/services/core/GlobalTypes.js.map +1 -0
- package/dist/services/core/Utils.js +126 -0
- package/dist/services/core/Utils.js.map +1 -0
- package/dist/services/core/WebexRequest.js +96 -0
- package/dist/services/core/WebexRequest.js.map +1 -0
- package/dist/services/core/aqm-reqs.js +246 -0
- package/dist/services/core/aqm-reqs.js.map +1 -0
- package/dist/services/core/constants.js +109 -0
- package/dist/services/core/constants.js.map +1 -0
- package/dist/services/core/types.js +6 -0
- package/dist/services/core/types.js.map +1 -0
- package/dist/services/core/websocket/WebSocketManager.js +187 -0
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -0
- package/dist/services/core/websocket/connection-service.js +111 -0
- package/dist/services/core/websocket/connection-service.js.map +1 -0
- package/dist/services/core/websocket/keepalive.worker.js +94 -0
- package/dist/services/core/websocket/keepalive.worker.js.map +1 -0
- package/dist/services/core/websocket/types.js +6 -0
- package/dist/services/core/websocket/types.js.map +1 -0
- package/dist/services/index.js +78 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/task/AutoWrapup.js +88 -0
- package/dist/services/task/AutoWrapup.js.map +1 -0
- package/dist/services/task/TaskManager.js +369 -0
- package/dist/services/task/TaskManager.js.map +1 -0
- package/dist/services/task/constants.js +58 -0
- package/dist/services/task/constants.js.map +1 -0
- package/dist/services/task/contact.js +464 -0
- package/dist/services/task/contact.js.map +1 -0
- package/dist/services/task/dialer.js +60 -0
- package/dist/services/task/dialer.js.map +1 -0
- package/dist/services/task/index.js +1188 -0
- package/dist/services/task/index.js.map +1 -0
- package/dist/services/task/types.js +214 -0
- package/dist/services/task/types.js.map +1 -0
- package/dist/types/cc.d.ts +676 -0
- package/dist/types/config.d.ts +66 -0
- package/dist/types/constants.d.ts +45 -0
- package/dist/types/index.d.ts +178 -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 +127 -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 +19 -0
- package/dist/types/services/config/constants.d.ts +203 -0
- package/dist/types/services/config/index.d.ts +171 -0
- package/dist/types/services/config/types.d.ts +1113 -0
- package/dist/types/services/constants.d.ts +97 -0
- package/dist/types/services/core/Err.d.ts +119 -0
- package/dist/types/services/core/GlobalTypes.d.ts +33 -0
- package/dist/types/services/core/Utils.d.ts +36 -0
- package/dist/types/services/core/WebexRequest.d.ts +22 -0
- package/dist/types/services/core/aqm-reqs.d.ts +16 -0
- package/dist/types/services/core/constants.d.ts +85 -0
- package/dist/types/services/core/types.d.ts +47 -0
- package/dist/types/services/core/websocket/WebSocketManager.d.ts +34 -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 +52 -0
- package/dist/types/services/task/AutoWrapup.d.ts +40 -0
- package/dist/types/services/task/TaskManager.d.ts +1 -0
- package/dist/types/services/task/constants.d.ts +46 -0
- package/dist/types/services/task/contact.d.ts +59 -0
- package/dist/types/services/task/dialer.d.ts +28 -0
- package/dist/types/services/task/index.d.ts +569 -0
- package/dist/types/services/task/types.d.ts +1041 -0
- package/dist/types/types.d.ts +452 -0
- package/dist/types/webex-config.d.ts +53 -0
- package/dist/types/webex.d.ts +7 -0
- package/dist/types.js +292 -0
- package/dist/types.js.map +1 -0
- package/dist/webex-config.js +60 -0
- package/dist/webex-config.js.map +1 -0
- package/dist/webex.js +99 -0
- package/dist/webex.js.map +1 -0
- package/jest.config.js +45 -0
- package/package.json +83 -0
- package/src/cc.ts +1618 -0
- package/src/config.ts +65 -0
- package/src/constants.ts +51 -0
- package/src/index.ts +220 -0
- package/src/logger-proxy.ts +110 -0
- package/src/metrics/MetricsManager.ts +512 -0
- package/src/metrics/behavioral-events.ts +332 -0
- package/src/metrics/constants.ts +135 -0
- package/src/services/WebCallingService.ts +351 -0
- package/src/services/agent/index.ts +149 -0
- package/src/services/agent/types.ts +440 -0
- package/src/services/config/Util.ts +261 -0
- package/src/services/config/constants.ts +249 -0
- package/src/services/config/index.ts +743 -0
- package/src/services/config/types.ts +1117 -0
- package/src/services/constants.ts +111 -0
- package/src/services/core/Err.ts +126 -0
- package/src/services/core/GlobalTypes.ts +34 -0
- package/src/services/core/Utils.ts +132 -0
- package/src/services/core/WebexRequest.ts +103 -0
- package/src/services/core/aqm-reqs.ts +272 -0
- package/src/services/core/constants.ts +106 -0
- package/src/services/core/types.ts +48 -0
- package/src/services/core/websocket/WebSocketManager.ts +196 -0
- package/src/services/core/websocket/connection-service.ts +142 -0
- package/src/services/core/websocket/keepalive.worker.js +88 -0
- package/src/services/core/websocket/types.ts +40 -0
- package/src/services/index.ts +71 -0
- package/src/services/task/AutoWrapup.ts +86 -0
- package/src/services/task/TaskManager.ts +420 -0
- package/src/services/task/constants.ts +52 -0
- package/src/services/task/contact.ts +429 -0
- package/src/services/task/dialer.ts +52 -0
- package/src/services/task/index.ts +1375 -0
- package/src/services/task/types.ts +1113 -0
- package/src/types.ts +639 -0
- package/src/webex-config.ts +54 -0
- package/src/webex.js +96 -0
- package/test/unit/spec/cc.ts +1985 -0
- package/test/unit/spec/metrics/MetricsManager.ts +491 -0
- package/test/unit/spec/metrics/behavioral-events.ts +102 -0
- package/test/unit/spec/services/WebCallingService.ts +416 -0
- package/test/unit/spec/services/agent/index.ts +65 -0
- package/test/unit/spec/services/config/index.ts +1035 -0
- package/test/unit/spec/services/core/Utils.ts +279 -0
- package/test/unit/spec/services/core/WebexRequest.ts +144 -0
- package/test/unit/spec/services/core/aqm-reqs.ts +570 -0
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +378 -0
- package/test/unit/spec/services/core/websocket/connection-service.ts +178 -0
- package/test/unit/spec/services/task/TaskManager.ts +1351 -0
- package/test/unit/spec/services/task/contact.ts +204 -0
- package/test/unit/spec/services/task/dialer.ts +157 -0
- package/test/unit/spec/services/task/index.ts +1474 -0
- package/tsconfig.json +6 -0
- package/typedoc.json +37 -0
- package/typedoc.md +240 -0
- package/umd/contact-center.min.js +3 -0
- package/umd/contact-center.min.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEFAULT_PAGE","exports","DEFAULT_PAGE_SIZE","AGENT_STATE_AVAILABLE_ID","AGENT_STATE_AVAILABLE","AGENT_STATE_AVAILABLE_DESCRIPTION","DEFAULT_AUXCODE_ATTRIBUTES","METHODS","GET_AGENT_CONFIG","GET_USER_USING_CI","GET_DESKTOP_PROFILE_BY_ID","GET_MULTIMEDIA_PROFILE_BY_ID","GET_LIST_OF_TEAMS","GET_ALL_TEAMS","GET_LIST_OF_AUX_CODES","GET_ALL_AUX_CODES","GET_SITE_INFO","GET_ORG_INFO","GET_ORGANIZATION_SETTING","GET_TENANT_DATA","GET_URL_MAPPING","GET_DIAL_PLAN_DATA","GET_QUEUES","PARSE_AGENT_CONFIGS","GET_URL_MAPPING_UTIL","GET_MSFT_CONFIG","GET_WEBEX_CONFIG","GET_DEFAULT_AGENT_DN","GET_FILTERED_DIALPLAN_ENTRIES","GET_FILTER_AUX_CODES","GET_DEFAULT_WRAP_UP_CODE","endPointMap","userByCI","orgId","agentId","desktopProfile","desktopProfileId","multimediaProfile","multimediaProfileId","listTeams","page","pageSize","filter","length","listAuxCodes","attributes","orgInfo","orgSettings","siteInfo","siteId","tenantData","urlMapping","dialPlan","queueList","queryParams"],"sources":["constants.ts"],"sourcesContent":["// making query params configurable for List Teams and List Aux Codes API\nexport const DEFAULT_PAGE = 0;\n\n/**\n * Default page size for paginated API requests.\n * @type {number}\n * @public\n * @example\n * const pageSize = DEFAULT_PAGE_SIZE; // 100\n * @ignore\n */\nexport const DEFAULT_PAGE_SIZE = 100;\n\n/**\n * Agent state ID for 'Available'.\n * @type {string}\n * @public\n * @ignore\n */\nexport const AGENT_STATE_AVAILABLE_ID = '0';\n\n/**\n * Agent state label for 'Available'.\n * @type {string}\n * @public\n * @ignore\n */\nexport const AGENT_STATE_AVAILABLE = 'Available';\n\n/**\n * Description for the 'Available' agent state.\n * @type {string}\n * @public\n * @ignore\n */\nexport const AGENT_STATE_AVAILABLE_DESCRIPTION = 'Agent is available to receive calls';\n\n/**\n * Default attributes for auxiliary code API requests.\n * @type {string[]}\n * @public\n * @ignore\n */\nexport const DEFAULT_AUXCODE_ATTRIBUTES = [\n 'id',\n 'isSystemCode',\n 'name',\n 'defaultCode',\n 'workTypeCode',\n 'active',\n];\n\n// Method names for config services\nexport const METHODS = {\n // AgentConfigService methods\n GET_AGENT_CONFIG: 'getAgentConfig',\n GET_USER_USING_CI: 'getUserUsingCI',\n GET_DESKTOP_PROFILE_BY_ID: 'getDesktopProfileById',\n GET_MULTIMEDIA_PROFILE_BY_ID: 'getMultimediaProfileById',\n GET_LIST_OF_TEAMS: 'getListOfTeams',\n GET_ALL_TEAMS: 'getAllTeams',\n GET_LIST_OF_AUX_CODES: 'getListOfAuxCodes',\n GET_ALL_AUX_CODES: 'getAllAuxCodes',\n GET_SITE_INFO: 'getSiteInfo',\n GET_ORG_INFO: 'getOrgInfo',\n GET_ORGANIZATION_SETTING: 'getOrganizationSetting',\n GET_TENANT_DATA: 'getTenantData',\n GET_URL_MAPPING: 'getURLMapping',\n GET_DIAL_PLAN_DATA: 'getDialPlanData',\n GET_QUEUES: 'getQueues',\n\n // Util methods\n PARSE_AGENT_CONFIGS: 'parseAgentConfigs',\n GET_URL_MAPPING_UTIL: 'getUrlMapping',\n GET_MSFT_CONFIG: 'getMsftConfig',\n GET_WEBEX_CONFIG: 'getWebexConfig',\n GET_DEFAULT_AGENT_DN: 'getDefaultAgentDN',\n GET_FILTERED_DIALPLAN_ENTRIES: 'getFilteredDialplanEntries',\n GET_FILTER_AUX_CODES: 'getFilterAuxCodes',\n GET_DEFAULT_WRAP_UP_CODE: 'getDefaultWrapUpCode',\n};\n\n/**\n * Maps API endpoint names to functions that generate endpoint URLs for various organization resources.\n * @public\n * @example\n * const url = endPointMap.userByCI('org123', 'agent456');\n */\nexport const endPointMap = {\n /**\n * Gets the endpoint for a user by CI user ID.\n * @param orgId - Organization ID.\n * @param agentId - Agent ID.\n * @returns The endpoint URL string.\n * @public\n * @example\n * const url = endPointMap.userByCI('org123', 'agent456');\n * @ignore\n */\n userByCI: (orgId: string, agentId: string) =>\n `organization/${orgId}/user/by-ci-user-id/${agentId}`,\n\n /**\n * Gets the endpoint for a desktop profile.\n * @param orgId - Organization ID.\n * @param desktopProfileId - Desktop profile ID.\n * @returns The endpoint URL string.\n * @public\n * @example\n * const url = endPointMap.desktopProfile('org123', 'profile789');\n * @ignore\n */\n desktopProfile: (orgId: string, desktopProfileId: string) =>\n `organization/${orgId}/agent-profile/${desktopProfileId}`,\n\n /**\n * Gets the endpoint for a multimedia profile.\n * @param orgId - Organization ID.\n * @param multimediaProfileId - Multimedia profile ID.\n * @returns The endpoint URL string.\n * @public\n * @example\n * const url = endPointMap.multimediaProfile('org123', 'multi456');\n * @ignore\n */\n multimediaProfile: (orgId: string, multimediaProfileId: string) =>\n `organization/${orgId}/multimedia-profile/${multimediaProfileId}`,\n\n /**\n * Gets the endpoint for listing teams with optional filters.\n * @param orgId - Organization ID.\n * @param page - Page number.\n * @param pageSize - Page size.\n * @param filter - Array of team IDs to filter.\n * @returns The endpoint URL string.\n * @public\n * @example\n * const url = endPointMap.listTeams('org123', 0, 100, ['team1', 'team2']);\n * @ignore\n */\n listTeams: (orgId: string, page: number, pageSize: number, filter: string[]) =>\n `organization/${orgId}/v2/team?page=${page}&pageSize=${pageSize}${\n filter && filter.length > 0 ? `&filter=id=in=(${filter})` : ''\n }`,\n\n /**\n * Gets the endpoint for listing auxiliary codes with optional filters and attributes.\n * @param orgId - Organization ID.\n * @param page - Page number.\n * @param pageSize - Page size.\n * @param filter - Array of auxiliary code IDs to filter.\n * @param attributes - Array of attribute names to include.\n * @returns The endpoint URL string.\n * @public\n * @example\n * const url = endPointMap.listAuxCodes('org123', 0, 100, ['aux1'], ['id', 'name']);\n * @ignore\n */\n listAuxCodes: (\n orgId: string,\n page: number,\n pageSize: number,\n filter: string[],\n attributes: string[]\n ) =>\n `organization/${orgId}/v2/auxiliary-code?page=${page}&pageSize=${pageSize}${\n filter && filter.length > 0 ? `&filter=id=in=(${filter})` : ''\n }&attributes=${attributes}`,\n\n /**\n * Gets the endpoint for organization info.\n * @param orgId - Organization ID.\n * @returns The endpoint URL string.\n * @public\n * @example\n * const url = endPointMap.orgInfo('org123');\n * @ignore\n */\n orgInfo: (orgId: string) => `organization/${orgId}`,\n\n /**\n * Gets the endpoint for organization settings.\n * @param orgId - Organization ID.\n * @returns The endpoint URL string.\n * @public\n * @example\n * const url = endPointMap.orgSettings('org123');\n * @ignore\n */\n orgSettings: (orgId: string) => `organization/${orgId}/v2/organization-setting?agentView=true`,\n\n /**\n * Gets the endpoint for site info.\n * @param orgId - Organization ID.\n * @param siteId - Site ID.\n * @returns The endpoint URL string.\n * @public\n * @example\n * const url = endPointMap.siteInfo('org123', 'site456');\n * @ignore\n */\n siteInfo: (orgId: string, siteId: string) => `organization/${orgId}/site/${siteId}`,\n\n /**\n * Gets the endpoint for tenant configuration data.\n * @param orgId - Organization ID.\n * @returns The endpoint URL string.\n * @public\n * @example\n * const url = endPointMap.tenantData('org123');\n * @ignore\n */\n tenantData: (orgId: string) => `organization/${orgId}/v2/tenant-configuration?agentView=true`,\n\n /**\n * Gets the endpoint for organization URL mapping.\n * @param orgId - Organization ID.\n * @returns The endpoint URL string.\n * @public\n * @example\n * const url = endPointMap.urlMapping('org123');\n * @ignore\n */\n urlMapping: (orgId: string) => `organization/${orgId}/v2/org-url-mapping?sort=name,ASC`,\n\n /**\n * Gets the endpoint for dial plan.\n * @param orgId - Organization ID.\n * @returns The endpoint URL string.\n * @public\n * @example\n * const url = endPointMap.dialPlan('org123');\n * @ignore\n */\n dialPlan: (orgId: string) => `organization/${orgId}/dial-plan?agentView=true`,\n\n /**\n * Gets the endpoint for the queue list with custom query parameters.\n * @param orgId - Organization ID.\n * @param queryParams - Query parameters string.\n * @returns The endpoint URL string.\n * @public\n * @example\n * const url = endPointMap.queueList('org123', 'page=0&pageSize=10');\n * @ignore\n */\n queueList: (orgId: string, queryParams: string) =>\n `organization/${orgId}/v2/contact-service-queue?${queryParams}`,\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _types = require("../../types");
|
|
8
|
+
var _loggerProxy = _interopRequireDefault(require("../../logger-proxy"));
|
|
9
|
+
var _WebexRequest = _interopRequireDefault(require("../core/WebexRequest"));
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
var _constants2 = require("../../constants");
|
|
12
|
+
var _Util = require("./Util");
|
|
13
|
+
var _constants3 = require("./constants");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
/**
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
* @module AgentConfigService
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The AgentConfigService class provides methods to fetch agent configuration data.
|
|
22
|
+
* @private
|
|
23
|
+
* @ignore
|
|
24
|
+
*/
|
|
25
|
+
class AgentConfigService {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.webexReq = _WebexRequest.default.getInstance();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Fetches the agent configuration data for the given orgId and agentId.
|
|
32
|
+
* @param {string} orgId - organization ID for which the agent configuration is to be fetched.
|
|
33
|
+
* @param {string} agentId - agent ID for which the configuration is to be fetched.
|
|
34
|
+
* @returns {Promise<Profile>} - A promise that resolves to the agent configuration profile.
|
|
35
|
+
* @throws {Error} - Throws an error if any API call fails or if the response status is not 200.
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
async getAgentConfig(orgId, agentId) {
|
|
39
|
+
try {
|
|
40
|
+
const userConfigPromise = this.getUserUsingCI(orgId, agentId);
|
|
41
|
+
const orgInfoPromise = this.getOrgInfo(orgId);
|
|
42
|
+
const orgSettingsPromise = this.getOrganizationSetting(orgId);
|
|
43
|
+
const tenantDataPromise = this.getTenantData(orgId);
|
|
44
|
+
const urlMappingPromise = this.getURLMapping(orgId);
|
|
45
|
+
const auxCodesPromise = this.getAllAuxCodes(orgId, _constants3.DEFAULT_PAGE_SIZE, [], _constants3.DEFAULT_AUXCODE_ATTRIBUTES);
|
|
46
|
+
const userConfigData = await userConfigPromise;
|
|
47
|
+
_loggerProxy.default.info(`Fetched user data, userId: ${userConfigData.ciUserId}`, {
|
|
48
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
49
|
+
method: _constants3.METHODS.GET_AGENT_CONFIG
|
|
50
|
+
});
|
|
51
|
+
const agentProfilePromise = this.getDesktopProfileById(orgId, userConfigData.agentProfileId);
|
|
52
|
+
const siteInfoPromise = this.getSiteInfo(orgId, userConfigData.siteId);
|
|
53
|
+
const userDialPlanPromise = agentProfilePromise.then(agentProfileConfigData => agentProfileConfigData.dialPlanEnabled ? this.getDialPlanData(orgId) : []);
|
|
54
|
+
const userTeamPromise = userConfigData.teamIds ? this.getAllTeams(orgId, _constants3.DEFAULT_PAGE_SIZE, userConfigData.teamIds) : Promise.resolve([]);
|
|
55
|
+
const [agentProfileConfigData, siteInfo, userDialPlanData, userTeamData, orgInfo, orgSettingsData, tenantData, urlMappingData, auxCodesData] = await Promise.all([agentProfilePromise, siteInfoPromise, userDialPlanPromise, userTeamPromise, orgInfoPromise, orgSettingsPromise, tenantDataPromise, urlMappingPromise, auxCodesPromise]);
|
|
56
|
+
const multimediaProfileId = userConfigData.multimediaProfileId || userTeamData[0]?.multiMediaProfileId || siteInfo.multimediaProfileId;
|
|
57
|
+
_loggerProxy.default.info('Fetched all required data', {
|
|
58
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
59
|
+
method: _constants3.METHODS.GET_AGENT_CONFIG
|
|
60
|
+
});
|
|
61
|
+
const response = (0, _Util.parseAgentConfigs)({
|
|
62
|
+
userData: userConfigData,
|
|
63
|
+
teamData: userTeamData,
|
|
64
|
+
tenantData,
|
|
65
|
+
orgInfoData: orgInfo,
|
|
66
|
+
auxCodes: auxCodesData,
|
|
67
|
+
orgSettingsData,
|
|
68
|
+
agentProfileData: agentProfileConfigData,
|
|
69
|
+
dialPlanData: userDialPlanData,
|
|
70
|
+
urlMapping: urlMappingData,
|
|
71
|
+
multimediaProfileId
|
|
72
|
+
});
|
|
73
|
+
_loggerProxy.default.info('Parsing completed for agent-config', {
|
|
74
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
75
|
+
method: _constants3.METHODS.GET_AGENT_CONFIG
|
|
76
|
+
});
|
|
77
|
+
_loggerProxy.default.info('Fetched configuration data successfully', {
|
|
78
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
79
|
+
method: _constants3.METHODS.GET_AGENT_CONFIG
|
|
80
|
+
});
|
|
81
|
+
return response;
|
|
82
|
+
} catch (error) {
|
|
83
|
+
_loggerProxy.default.error(`getAgentConfig call failed with ${error}`, {
|
|
84
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
85
|
+
method: _constants3.METHODS.GET_AGENT_CONFIG
|
|
86
|
+
});
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Fetches the agent configuration data for the given orgId and agentId.
|
|
93
|
+
* @ignore
|
|
94
|
+
* @param {string} orgId - organization ID for which the agent configuration is to be fetched.
|
|
95
|
+
* @param {string} agentId - agent ID for which the configuration is to be fetched.
|
|
96
|
+
* @returns {Promise<AgentResponse>} - A promise that resolves to the agent configuration response.
|
|
97
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
async getUserUsingCI(orgId, agentId) {
|
|
101
|
+
_loggerProxy.default.info('Fetching user data using CI', {
|
|
102
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
103
|
+
method: _constants3.METHODS.GET_USER_USING_CI
|
|
104
|
+
});
|
|
105
|
+
try {
|
|
106
|
+
const resource = _constants3.endPointMap.userByCI(orgId, agentId);
|
|
107
|
+
const response = await this.webexReq.request({
|
|
108
|
+
service: _constants.WCC_API_GATEWAY,
|
|
109
|
+
resource,
|
|
110
|
+
method: _types.HTTP_METHODS.GET
|
|
111
|
+
});
|
|
112
|
+
if (response.statusCode !== 200) {
|
|
113
|
+
throw new Error(`API call failed with ${response.statusCode}`);
|
|
114
|
+
}
|
|
115
|
+
_loggerProxy.default.log('getUserUsingCI api success.', {
|
|
116
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
117
|
+
method: _constants3.METHODS.GET_USER_USING_CI
|
|
118
|
+
});
|
|
119
|
+
return Promise.resolve(response.body);
|
|
120
|
+
} catch (error) {
|
|
121
|
+
_loggerProxy.default.error(`getUserUsingCI API call failed with ${error}`, {
|
|
122
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
123
|
+
method: _constants3.METHODS.GET_USER_USING_CI
|
|
124
|
+
});
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Fetches the desktop profile data for the given orgId and desktopProfileId.
|
|
131
|
+
* @ignore
|
|
132
|
+
* @param {string} orgId - organization ID for which the desktop profile is to be fetched.
|
|
133
|
+
* @param {string} desktopProfileId - desktop profile ID for which the data is to be fetched.
|
|
134
|
+
* @returns {Promise<DesktopProfileResponse>} - A promise that resolves to the desktop profile response.
|
|
135
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
136
|
+
* @private
|
|
137
|
+
*/
|
|
138
|
+
async getDesktopProfileById(orgId, desktopProfileId) {
|
|
139
|
+
_loggerProxy.default.info('Fetching desktop profile', {
|
|
140
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
141
|
+
method: _constants3.METHODS.GET_DESKTOP_PROFILE_BY_ID
|
|
142
|
+
});
|
|
143
|
+
try {
|
|
144
|
+
const resource = _constants3.endPointMap.desktopProfile(orgId, desktopProfileId);
|
|
145
|
+
const response = await this.webexReq.request({
|
|
146
|
+
service: _constants.WCC_API_GATEWAY,
|
|
147
|
+
resource,
|
|
148
|
+
method: _types.HTTP_METHODS.GET
|
|
149
|
+
});
|
|
150
|
+
if (response.statusCode !== 200) {
|
|
151
|
+
throw new Error(`API call failed with ${response.statusCode}`);
|
|
152
|
+
}
|
|
153
|
+
_loggerProxy.default.log('getDesktopProfileById api success.', {
|
|
154
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
155
|
+
method: _constants3.METHODS.GET_DESKTOP_PROFILE_BY_ID
|
|
156
|
+
});
|
|
157
|
+
return Promise.resolve(response.body);
|
|
158
|
+
} catch (error) {
|
|
159
|
+
_loggerProxy.default.error(`getDesktopProfileById API call failed with ${error}`, {
|
|
160
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
161
|
+
method: _constants3.METHODS.GET_DESKTOP_PROFILE_BY_ID
|
|
162
|
+
});
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Fetches the multimedia profile data for the given orgId and multimediaProfileId.
|
|
169
|
+
* @ignore
|
|
170
|
+
* @param {string} orgId - organization ID for which the multimedia profile is to be fetched.
|
|
171
|
+
* @param {string} multimediaProfileId - multimedia profile ID for which the data is to be fetched.
|
|
172
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
173
|
+
* @returns {Promise<MultimediaProfileResponse>} - A promise that resolves to the multimedia profile response.
|
|
174
|
+
* @private
|
|
175
|
+
*/
|
|
176
|
+
async getMultimediaProfileById(orgId, multimediaProfileId) {
|
|
177
|
+
_loggerProxy.default.info('Fetching multimedia profile', {
|
|
178
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
179
|
+
method: _constants3.METHODS.GET_MULTIMEDIA_PROFILE_BY_ID
|
|
180
|
+
});
|
|
181
|
+
try {
|
|
182
|
+
const resource = _constants3.endPointMap.multimediaProfile(orgId, multimediaProfileId);
|
|
183
|
+
const response = await this.webexReq.request({
|
|
184
|
+
service: _constants.WCC_API_GATEWAY,
|
|
185
|
+
resource,
|
|
186
|
+
method: _types.HTTP_METHODS.GET
|
|
187
|
+
});
|
|
188
|
+
if (response.statusCode !== 200) {
|
|
189
|
+
throw new Error(`API call failed with ${response.statusCode}`);
|
|
190
|
+
}
|
|
191
|
+
_loggerProxy.default.log('getMultimediaProfileById API success.', {
|
|
192
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
193
|
+
method: _constants3.METHODS.GET_MULTIMEDIA_PROFILE_BY_ID
|
|
194
|
+
});
|
|
195
|
+
return Promise.resolve(response.body);
|
|
196
|
+
} catch (error) {
|
|
197
|
+
_loggerProxy.default.error(`getMultimediaProfileById API call failed with ${error}`, {
|
|
198
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
199
|
+
method: _constants3.METHODS.GET_MULTIMEDIA_PROFILE_BY_ID
|
|
200
|
+
});
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* fetches the list of teams for the given orgId.
|
|
207
|
+
* @ignore
|
|
208
|
+
* @param {string} orgId - organization ID for which the teams are to be fetched.
|
|
209
|
+
* @param {number} page - the page number to fetch.
|
|
210
|
+
* @param {number} pageSize - the number of teams to fetch per page.
|
|
211
|
+
* @param {string[]} filter - optional filter criteria for the teams.
|
|
212
|
+
* @param {string[]} attributes - optional attributes to include in the response.
|
|
213
|
+
* @returns {Promise<ListTeamsResponse>} - A promise that resolves to the list of teams response.
|
|
214
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
215
|
+
* @private
|
|
216
|
+
*/
|
|
217
|
+
async getListOfTeams(orgId, page, pageSize, filter) {
|
|
218
|
+
_loggerProxy.default.info('Fetching list of teams', {
|
|
219
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
220
|
+
method: _constants3.METHODS.GET_LIST_OF_TEAMS
|
|
221
|
+
});
|
|
222
|
+
try {
|
|
223
|
+
const resource = _constants3.endPointMap.listTeams(orgId, page, pageSize, filter);
|
|
224
|
+
const response = await this.webexReq.request({
|
|
225
|
+
service: _constants.WCC_API_GATEWAY,
|
|
226
|
+
resource,
|
|
227
|
+
method: _types.HTTP_METHODS.GET
|
|
228
|
+
});
|
|
229
|
+
if (response.statusCode !== 200) {
|
|
230
|
+
throw new Error(`API call failed with ${response.statusCode}`);
|
|
231
|
+
}
|
|
232
|
+
_loggerProxy.default.log('getListOfTeams api success.', {
|
|
233
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
234
|
+
method: _constants3.METHODS.GET_LIST_OF_TEAMS
|
|
235
|
+
});
|
|
236
|
+
return Promise.resolve(response.body);
|
|
237
|
+
} catch (error) {
|
|
238
|
+
_loggerProxy.default.error(`getListOfTeams API call failed with ${error}`, {
|
|
239
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
240
|
+
method: _constants3.METHODS.GET_LIST_OF_TEAMS
|
|
241
|
+
});
|
|
242
|
+
throw error;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Fetches all teams from all pages for the given orgId
|
|
248
|
+
* @ignore
|
|
249
|
+
* @param {string} orgId - organization ID for which the teams are to be fetched.
|
|
250
|
+
* @param {number} pageSize - the number of teams to fetch per page.
|
|
251
|
+
* @param {string[]} filter - optional filter criteria for the teams.
|
|
252
|
+
* @param {string[]} attributes - optional attributes to include in the response.
|
|
253
|
+
* @returns {Promise<TeamList[]>} - A promise that resolves to the list of teams.
|
|
254
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
255
|
+
* @private
|
|
256
|
+
*/
|
|
257
|
+
async getAllTeams(orgId, pageSize, filter) {
|
|
258
|
+
try {
|
|
259
|
+
let allTeams = [];
|
|
260
|
+
let page = _constants3.DEFAULT_PAGE;
|
|
261
|
+
const firstResponse = await this.getListOfTeams(orgId, page, pageSize, filter);
|
|
262
|
+
const totalPages = firstResponse.meta.totalPages;
|
|
263
|
+
allTeams = allTeams.concat(firstResponse.data);
|
|
264
|
+
const requests = [];
|
|
265
|
+
for (page = _constants3.DEFAULT_PAGE + 1; page < totalPages; page += 1) {
|
|
266
|
+
requests.push(this.getListOfTeams(orgId, page, pageSize, filter));
|
|
267
|
+
}
|
|
268
|
+
const responses = await Promise.all(requests);
|
|
269
|
+
for (const response of responses) {
|
|
270
|
+
allTeams = allTeams.concat(response.data);
|
|
271
|
+
}
|
|
272
|
+
return allTeams;
|
|
273
|
+
} catch (error) {
|
|
274
|
+
_loggerProxy.default.error(`getAllTeams API call failed with ${error}`, {
|
|
275
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
276
|
+
method: _constants3.METHODS.GET_ALL_TEAMS
|
|
277
|
+
});
|
|
278
|
+
throw error;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* fetches the list of aux codes for the given orgId.
|
|
284
|
+
* @ignore
|
|
285
|
+
* @param {string} orgId - organization ID for which the aux codes are to be fetched.
|
|
286
|
+
* @param {number} page - the page number to fetch.
|
|
287
|
+
* @param {number} pageSize - the number of aux codes to fetch per page.
|
|
288
|
+
* @param {string[]} filter - optional filter criteria for the aux codes.
|
|
289
|
+
* @param {string[]} attributes - optional attributes to include in the response.
|
|
290
|
+
* @returns {Promise<ListAuxCodesResponse>} - A promise that resolves to the list of aux codes response.
|
|
291
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
292
|
+
* @private
|
|
293
|
+
*/
|
|
294
|
+
async getListOfAuxCodes(orgId, page, pageSize, filter, attributes) {
|
|
295
|
+
_loggerProxy.default.info('Fetching list of aux codes', {
|
|
296
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
297
|
+
method: _constants3.METHODS.GET_LIST_OF_AUX_CODES
|
|
298
|
+
});
|
|
299
|
+
try {
|
|
300
|
+
const resource = _constants3.endPointMap.listAuxCodes(orgId, page, pageSize, filter, attributes);
|
|
301
|
+
const response = await this.webexReq.request({
|
|
302
|
+
service: _constants.WCC_API_GATEWAY,
|
|
303
|
+
resource,
|
|
304
|
+
method: _types.HTTP_METHODS.GET
|
|
305
|
+
});
|
|
306
|
+
if (response.statusCode !== 200) {
|
|
307
|
+
throw new Error(`API call failed with ${response.statusCode}`);
|
|
308
|
+
}
|
|
309
|
+
_loggerProxy.default.log('getListOfAuxCodes api success.', {
|
|
310
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
311
|
+
method: _constants3.METHODS.GET_LIST_OF_AUX_CODES
|
|
312
|
+
});
|
|
313
|
+
return Promise.resolve(response.body);
|
|
314
|
+
} catch (error) {
|
|
315
|
+
_loggerProxy.default.error(`getListOfAuxCodes API call failed with ${error}`, {
|
|
316
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
317
|
+
method: _constants3.METHODS.GET_LIST_OF_AUX_CODES
|
|
318
|
+
});
|
|
319
|
+
throw error;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Fetches all aux codes from all pages for the given orgId
|
|
325
|
+
* @ignore
|
|
326
|
+
* @param {string} orgId - organization ID for which the aux codes are to be fetched.
|
|
327
|
+
* @param {number} pageSize - the number of aux codes to fetch per page.
|
|
328
|
+
* @param {string[]} filter - optional filter criteria for the aux codes.
|
|
329
|
+
* @param {string[]} attributes - optional attributes to include in the response.
|
|
330
|
+
* @returns {Promise<AuxCode[]>} - A promise that resolves to the list of aux codes.
|
|
331
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
332
|
+
* @private
|
|
333
|
+
*/
|
|
334
|
+
async getAllAuxCodes(orgId, pageSize, filter, attributes) {
|
|
335
|
+
try {
|
|
336
|
+
let allAuxCodes = [];
|
|
337
|
+
let page = _constants3.DEFAULT_PAGE;
|
|
338
|
+
const firstResponse = await this.getListOfAuxCodes(orgId, page, pageSize, filter, attributes);
|
|
339
|
+
allAuxCodes = allAuxCodes.concat(firstResponse.data);
|
|
340
|
+
const totalPages = firstResponse.meta.totalPages;
|
|
341
|
+
const promises = [];
|
|
342
|
+
for (page = _constants3.DEFAULT_PAGE + 1; page < totalPages; page += 1) {
|
|
343
|
+
promises.push(this.getListOfAuxCodes(orgId, page, pageSize, filter, attributes));
|
|
344
|
+
}
|
|
345
|
+
const responses = await Promise.all(promises);
|
|
346
|
+
responses.forEach(response => {
|
|
347
|
+
allAuxCodes = allAuxCodes.concat(response.data);
|
|
348
|
+
});
|
|
349
|
+
return allAuxCodes;
|
|
350
|
+
} catch (error) {
|
|
351
|
+
_loggerProxy.default.error(`getAllAuxCodes API call failed with ${error}`, {
|
|
352
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
353
|
+
method: _constants3.METHODS.GET_ALL_AUX_CODES
|
|
354
|
+
});
|
|
355
|
+
throw error;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Fetches the site data for the given orgId and siteId.
|
|
361
|
+
* @ignore
|
|
362
|
+
* @param {string} orgId - organization ID for which the site info is to be fetched.
|
|
363
|
+
* @param {string} siteId - site ID for which the data is to be fetched.
|
|
364
|
+
* @returns {Promise<SiteInfo>} - A promise that resolves to the site info response.
|
|
365
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
366
|
+
* @private
|
|
367
|
+
*/
|
|
368
|
+
async getSiteInfo(orgId, siteId) {
|
|
369
|
+
_loggerProxy.default.info('Fetching site information', {
|
|
370
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
371
|
+
method: _constants3.METHODS.GET_SITE_INFO
|
|
372
|
+
});
|
|
373
|
+
try {
|
|
374
|
+
const resource = _constants3.endPointMap.siteInfo(orgId, siteId);
|
|
375
|
+
const response = await this.webexReq.request({
|
|
376
|
+
service: _constants.WCC_API_GATEWAY,
|
|
377
|
+
resource,
|
|
378
|
+
method: _types.HTTP_METHODS.GET
|
|
379
|
+
});
|
|
380
|
+
if (response.statusCode !== 200) {
|
|
381
|
+
throw new Error(`API call failed with ${response.statusCode}`);
|
|
382
|
+
}
|
|
383
|
+
_loggerProxy.default.log('getSiteInfo api success.', {
|
|
384
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
385
|
+
method: _constants3.METHODS.GET_SITE_INFO
|
|
386
|
+
});
|
|
387
|
+
return Promise.resolve(response.body);
|
|
388
|
+
} catch (error) {
|
|
389
|
+
_loggerProxy.default.error(`getSiteInfo API call failed with ${error}`, {
|
|
390
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
391
|
+
method: _constants3.METHODS.GET_SITE_INFO
|
|
392
|
+
});
|
|
393
|
+
throw error;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Fetches the organization info for the given orgId.
|
|
399
|
+
* @ignore
|
|
400
|
+
* @param {string} orgId - organization ID for which the organization info is to be fetched.
|
|
401
|
+
* @returns {Promise<OrgInfo>} - A promise that resolves to the organization info response.
|
|
402
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
403
|
+
* @private
|
|
404
|
+
*/
|
|
405
|
+
async getOrgInfo(orgId) {
|
|
406
|
+
try {
|
|
407
|
+
const resource = _constants3.endPointMap.orgInfo(orgId);
|
|
408
|
+
const response = await this.webexReq.request({
|
|
409
|
+
service: _constants.WCC_API_GATEWAY,
|
|
410
|
+
resource,
|
|
411
|
+
method: _types.HTTP_METHODS.GET
|
|
412
|
+
});
|
|
413
|
+
if (response.statusCode !== 200) {
|
|
414
|
+
throw new Error(`API call failed with ${response.statusCode}`);
|
|
415
|
+
}
|
|
416
|
+
_loggerProxy.default.log('getOrgInfo api success.', {
|
|
417
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
418
|
+
method: _constants3.METHODS.GET_ORG_INFO
|
|
419
|
+
});
|
|
420
|
+
return Promise.resolve(response.body);
|
|
421
|
+
} catch (error) {
|
|
422
|
+
_loggerProxy.default.error(`getOrgInfo API call failed with ${error}`, {
|
|
423
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
424
|
+
method: _constants3.METHODS.GET_ORG_INFO
|
|
425
|
+
});
|
|
426
|
+
throw error;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Fetches the organization settings for the given orgId.
|
|
432
|
+
* @ignore
|
|
433
|
+
* @param {string} orgId - organization ID for which the organization settings are to be fetched.
|
|
434
|
+
* @returns {Promise<OrgSettings>} - A promise that resolves to the organization settings response.
|
|
435
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
436
|
+
* @private
|
|
437
|
+
*/
|
|
438
|
+
async getOrganizationSetting(orgId) {
|
|
439
|
+
try {
|
|
440
|
+
const resource = _constants3.endPointMap.orgSettings(orgId);
|
|
441
|
+
const response = await this.webexReq.request({
|
|
442
|
+
service: _constants.WCC_API_GATEWAY,
|
|
443
|
+
resource,
|
|
444
|
+
method: _types.HTTP_METHODS.GET
|
|
445
|
+
});
|
|
446
|
+
if (response.statusCode !== 200) {
|
|
447
|
+
throw new Error(`API call failed with ${response.statusCode}`);
|
|
448
|
+
}
|
|
449
|
+
_loggerProxy.default.log('getOrganizationSetting api success.', {
|
|
450
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
451
|
+
method: _constants3.METHODS.GET_ORGANIZATION_SETTING
|
|
452
|
+
});
|
|
453
|
+
return Promise.resolve(response.body.data[0]);
|
|
454
|
+
} catch (error) {
|
|
455
|
+
_loggerProxy.default.error(`getOrganizationSetting API call failed with ${error}`, {
|
|
456
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
457
|
+
method: _constants3.METHODS.GET_ORGANIZATION_SETTING
|
|
458
|
+
});
|
|
459
|
+
throw error;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Fetches the tenant data for the given orgId.
|
|
465
|
+
* @ignore
|
|
466
|
+
* @param {string} orgId - organization ID for which the tenant data is to be fetched.
|
|
467
|
+
* @returns {Promise<TenantData>} - A promise that resolves to the tenant data response.
|
|
468
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
469
|
+
* @private
|
|
470
|
+
*/
|
|
471
|
+
async getTenantData(orgId) {
|
|
472
|
+
try {
|
|
473
|
+
const resource = _constants3.endPointMap.tenantData(orgId);
|
|
474
|
+
const response = await this.webexReq.request({
|
|
475
|
+
service: _constants.WCC_API_GATEWAY,
|
|
476
|
+
resource,
|
|
477
|
+
method: _types.HTTP_METHODS.GET
|
|
478
|
+
});
|
|
479
|
+
if (response.statusCode !== 200) {
|
|
480
|
+
throw new Error(`API call failed with ${response.statusCode}`);
|
|
481
|
+
}
|
|
482
|
+
_loggerProxy.default.log('getTenantData api success.', {
|
|
483
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
484
|
+
method: _constants3.METHODS.GET_TENANT_DATA
|
|
485
|
+
});
|
|
486
|
+
return Promise.resolve(response.body.data[0]);
|
|
487
|
+
} catch (error) {
|
|
488
|
+
_loggerProxy.default.error(`getTenantData API call failed with ${error}`, {
|
|
489
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
490
|
+
method: _constants3.METHODS.GET_TENANT_DATA
|
|
491
|
+
});
|
|
492
|
+
throw error;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Fetches the URL mapping data for the given orgId.
|
|
498
|
+
* @ignore
|
|
499
|
+
* @param {string} orgId - organization ID for which the URL mapping is to be fetched.
|
|
500
|
+
* @returns {Promise<URLMapping[]>} - A promise that resolves to the URL mapping response.
|
|
501
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
502
|
+
* @private
|
|
503
|
+
*/
|
|
504
|
+
async getURLMapping(orgId) {
|
|
505
|
+
try {
|
|
506
|
+
const resource = _constants3.endPointMap.urlMapping(orgId);
|
|
507
|
+
const response = await this.webexReq.request({
|
|
508
|
+
service: _constants.WCC_API_GATEWAY,
|
|
509
|
+
resource,
|
|
510
|
+
method: _types.HTTP_METHODS.GET
|
|
511
|
+
});
|
|
512
|
+
if (response.statusCode !== 200) {
|
|
513
|
+
throw new Error(`API call failed with ${response.statusCode}`);
|
|
514
|
+
}
|
|
515
|
+
_loggerProxy.default.log('getURLMapping api success.', {
|
|
516
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
517
|
+
method: _constants3.METHODS.GET_URL_MAPPING
|
|
518
|
+
});
|
|
519
|
+
return Promise.resolve(response.body.data);
|
|
520
|
+
} catch (error) {
|
|
521
|
+
_loggerProxy.default.error(`getURLMapping API call failed with ${error}`, {
|
|
522
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
523
|
+
method: _constants3.METHODS.GET_URL_MAPPING
|
|
524
|
+
});
|
|
525
|
+
throw error;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Fetches the dial plan data for the given orgId.
|
|
531
|
+
* @ignore
|
|
532
|
+
* @param {string} orgId - organization ID for which the dial plan data is to be fetched.
|
|
533
|
+
* @returns {Promise<DialPlanEntity[]>} - A promise that resolves to the dial plan data response.
|
|
534
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
535
|
+
* @private
|
|
536
|
+
*/
|
|
537
|
+
async getDialPlanData(orgId) {
|
|
538
|
+
try {
|
|
539
|
+
const resource = _constants3.endPointMap.dialPlan(orgId);
|
|
540
|
+
const response = await this.webexReq.request({
|
|
541
|
+
service: _constants.WCC_API_GATEWAY,
|
|
542
|
+
resource,
|
|
543
|
+
method: _types.HTTP_METHODS.GET
|
|
544
|
+
});
|
|
545
|
+
if (response.statusCode !== 200) {
|
|
546
|
+
throw new Error(`API call failed with ${response.statusCode}`);
|
|
547
|
+
}
|
|
548
|
+
_loggerProxy.default.log('getDialPlanData api success.', {
|
|
549
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
550
|
+
method: _constants3.METHODS.GET_DIAL_PLAN_DATA
|
|
551
|
+
});
|
|
552
|
+
return Promise.resolve(response.body);
|
|
553
|
+
} catch (error) {
|
|
554
|
+
_loggerProxy.default.error(`getDialPlanData API call failed with ${error}`, {
|
|
555
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
556
|
+
method: _constants3.METHODS.GET_DIAL_PLAN_DATA
|
|
557
|
+
});
|
|
558
|
+
throw error;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Fetches the list of queues for the given orgId.
|
|
564
|
+
* @ignore
|
|
565
|
+
* @param {string} orgId - organization ID for which the queues are to be fetched.
|
|
566
|
+
* @param {number} page - the page number to fetch.
|
|
567
|
+
* @param {number} pageSize - the number of queues to fetch per page.
|
|
568
|
+
* @param {string} search - optional search string
|
|
569
|
+
* @param {string} filter - optional filter string
|
|
570
|
+
* @returns Promise<ContactServiceQueue[]> - A promise that resolves to the list of contact service queues.
|
|
571
|
+
* @throws {Error} - Throws an error if the API call fails or if the response status is not 200.
|
|
572
|
+
* @private
|
|
573
|
+
*/
|
|
574
|
+
async getQueues(orgId, page, pageSize, search, filter) {
|
|
575
|
+
_loggerProxy.default.info('Fetching queue list', {
|
|
576
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
577
|
+
method: _constants3.METHODS.GET_QUEUES
|
|
578
|
+
});
|
|
579
|
+
try {
|
|
580
|
+
let queryParams = `page=${page}&pageSize=${pageSize}&desktopProfileFilter=true`;
|
|
581
|
+
if (search) queryParams += `&search=${search}`;
|
|
582
|
+
if (filter) queryParams += `&filter=${filter}`;
|
|
583
|
+
const resource = _constants3.endPointMap.queueList(orgId, queryParams);
|
|
584
|
+
const response = await this.webexReq.request({
|
|
585
|
+
service: _constants.WCC_API_GATEWAY,
|
|
586
|
+
resource,
|
|
587
|
+
method: _types.HTTP_METHODS.GET
|
|
588
|
+
});
|
|
589
|
+
if (response.statusCode !== 200) {
|
|
590
|
+
throw new Error(`API call failed with ${response.statusCode}`);
|
|
591
|
+
}
|
|
592
|
+
_loggerProxy.default.log('getQueues API success.', {
|
|
593
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
594
|
+
method: _constants3.METHODS.GET_QUEUES
|
|
595
|
+
});
|
|
596
|
+
return response.body?.data;
|
|
597
|
+
} catch (error) {
|
|
598
|
+
_loggerProxy.default.error(`getQueues API call failed with ${error}`, {
|
|
599
|
+
module: _constants2.CONFIG_FILE_NAME,
|
|
600
|
+
method: _constants3.METHODS.GET_QUEUES
|
|
601
|
+
});
|
|
602
|
+
throw error;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
exports.default = AgentConfigService;
|
|
607
|
+
//# sourceMappingURL=index.js.map
|