@webex/calling 3.10.0 → 3.11.0-webex-services-ready.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/dist/CallHistory/CallHistory.js +128 -133
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +289 -186
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +17 -18
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js +14 -14
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +72 -25
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +138 -48
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +138 -145
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +149 -150
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +298 -347
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +267 -405
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +7 -8
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +24 -24
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +657 -616
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +864 -551
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +22 -18
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +114 -114
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/constants.js +5 -1
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +57 -74
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +22 -22
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +659 -527
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +657 -309
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +24 -24
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +20 -20
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +259 -268
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +64 -63
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +7 -10
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +6 -9
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +6 -8
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +6 -9
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Events/impl/index.js +12 -14
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Logger/index.js +3 -3
- package/dist/Logger/index.js.map +1 -1
- package/dist/Logger/index.test.js +1 -1
- package/dist/Logger/index.test.js.map +1 -1
- package/dist/Metrics/index.js +1 -2
- package/dist/Metrics/index.js.map +1 -1
- package/dist/SDKConnector/index.js +1 -2
- package/dist/SDKConnector/index.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +131 -139
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +106 -98
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +88 -92
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +103 -131
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +20 -20
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +117 -131
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +180 -154
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/common/Utils.js +198 -166
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +436 -191
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +3 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/testUtil.js +5 -4
- package/dist/common/testUtil.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +20 -11
- package/dist/module/CallSettings/UcmBackendConnector.js +21 -8
- package/dist/module/CallSettings/WxCallBackendConnector.js +10 -15
- package/dist/module/CallingClient/CallingClient.js +83 -123
- package/dist/module/CallingClient/calling/call.js +73 -58
- package/dist/module/CallingClient/calling/callManager.js +7 -0
- package/dist/module/CallingClient/constants.js +3 -0
- package/dist/module/CallingClient/registration/register.js +85 -5
- package/dist/module/CallingClient/registration/webWorker.js +2 -2
- package/dist/module/CallingClient/registration/webWorkerStr.js +2 -2
- package/dist/module/Contacts/ContactsClient.js +19 -25
- package/dist/module/Events/impl/index.js +1 -1
- package/dist/module/Logger/index.js +2 -2
- package/dist/module/Voicemail/BroadworksBackendConnector.js +10 -18
- package/dist/module/Voicemail/UcmBackendConnector.js +7 -11
- package/dist/module/Voicemail/Voicemail.js +42 -68
- package/dist/module/Voicemail/WxCallBackendConnector.js +14 -28
- package/dist/module/common/Utils.js +31 -5
- package/dist/module/common/constants.js +2 -0
- package/dist/module/common/testUtil.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +4 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +3 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +4 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +6 -0
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Logger/index.d.ts +1 -2
- package/dist/types/Logger/index.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +16 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +1 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -16,6 +16,7 @@ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/pr
|
|
|
16
16
|
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
17
17
|
var _entries = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/entries"));
|
|
18
18
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
19
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
19
20
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
|
|
20
21
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
|
|
21
22
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
@@ -46,6 +47,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
46
47
|
* @ignore
|
|
47
48
|
*/
|
|
48
49
|
function ContactsClient(webex, logger) {
|
|
50
|
+
var _this$webex$internal$;
|
|
49
51
|
(0, _classCallCheck2.default)(this, ContactsClient);
|
|
50
52
|
(0, _defineProperty2.default)(this, "sdkConnector", void 0);
|
|
51
53
|
(0, _defineProperty2.default)(this, "encryptionKeyUrl", void 0);
|
|
@@ -53,6 +55,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
53
55
|
(0, _defineProperty2.default)(this, "groups", void 0);
|
|
54
56
|
(0, _defineProperty2.default)(this, "contacts", void 0);
|
|
55
57
|
(0, _defineProperty2.default)(this, "defaultGroupId", void 0);
|
|
58
|
+
(0, _defineProperty2.default)(this, "contactsServiceUrl", void 0);
|
|
56
59
|
this.sdkConnector = _SDKConnector.default;
|
|
57
60
|
if (!this.sdkConnector.getWebex()) {
|
|
58
61
|
_SDKConnector.default.setWebex(webex);
|
|
@@ -62,33 +65,34 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
62
65
|
this.groups = undefined;
|
|
63
66
|
this.contacts = undefined;
|
|
64
67
|
this.defaultGroupId = '';
|
|
68
|
+
this.contactsServiceUrl = ((_this$webex$internal$ = this.webex.internal.services._serviceUrls) === null || _this$webex$internal$ === void 0 ? void 0 : _this$webex$internal$.contactsService) || this.webex.internal.services.get(this.webex.internal.services._activeServices.contactsService);
|
|
65
69
|
_Logger.default.setLogger(logger.level, _constants2.CONTACTS_CLIENT);
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
/**
|
|
69
73
|
* Decrypt emails, phoneNumbers, sipAddresses.
|
|
70
74
|
*/
|
|
71
|
-
(0, _createClass2.default)(ContactsClient, [{
|
|
75
|
+
return (0, _createClass2.default)(ContactsClient, [{
|
|
72
76
|
key: "decryptContactDetail",
|
|
73
77
|
value: (function () {
|
|
74
78
|
var _decryptContactDetail = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(encryptionKeyUrl, contactDetails) {
|
|
75
79
|
var _this = this;
|
|
76
80
|
var decryptedContactDetail, decryptedValues;
|
|
77
|
-
return _regenerator.default.wrap(function
|
|
81
|
+
return _regenerator.default.wrap(function (_context) {
|
|
78
82
|
while (1) switch (_context.prev = _context.next) {
|
|
79
83
|
case 0:
|
|
80
84
|
decryptedContactDetail = (0, _toConsumableArray2.default)(contactDetails);
|
|
81
|
-
_context.next =
|
|
85
|
+
_context.next = 1;
|
|
82
86
|
return _promise.default.all(decryptedContactDetail.map(function (detail) {
|
|
83
87
|
return _this.webex.internal.encryption.decryptText(encryptionKeyUrl, detail.value);
|
|
84
88
|
}));
|
|
85
|
-
case
|
|
89
|
+
case 1:
|
|
86
90
|
decryptedValues = _context.sent;
|
|
87
91
|
decryptedValues.forEach(function (decryptedValue, index) {
|
|
88
92
|
decryptedContactDetail[index].value = decryptedValue;
|
|
89
93
|
});
|
|
90
94
|
return _context.abrupt("return", decryptedContactDetail);
|
|
91
|
-
case
|
|
95
|
+
case 2:
|
|
92
96
|
case "end":
|
|
93
97
|
return _context.stop();
|
|
94
98
|
}
|
|
@@ -110,21 +114,21 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
110
114
|
var _encryptContactDetail = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(encryptionKeyUrl, contactDetails) {
|
|
111
115
|
var _this2 = this;
|
|
112
116
|
var encryptedContactDetail, encryptedValues;
|
|
113
|
-
return _regenerator.default.wrap(function
|
|
117
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
114
118
|
while (1) switch (_context2.prev = _context2.next) {
|
|
115
119
|
case 0:
|
|
116
120
|
encryptedContactDetail = (0, _toConsumableArray2.default)(contactDetails);
|
|
117
|
-
_context2.next =
|
|
121
|
+
_context2.next = 1;
|
|
118
122
|
return _promise.default.all(encryptedContactDetail.map(function (detail) {
|
|
119
123
|
return _this2.webex.internal.encryption.encryptText(encryptionKeyUrl, detail.value);
|
|
120
124
|
}));
|
|
121
|
-
case
|
|
125
|
+
case 1:
|
|
122
126
|
encryptedValues = _context2.sent;
|
|
123
127
|
encryptedValues.forEach(function (encryptedValue, index) {
|
|
124
128
|
encryptedContactDetail[index].value = encryptedValue;
|
|
125
129
|
});
|
|
126
130
|
return _context2.abrupt("return", encryptedContactDetail);
|
|
127
|
-
case
|
|
131
|
+
case 2:
|
|
128
132
|
case "end":
|
|
129
133
|
return _context2.stop();
|
|
130
134
|
}
|
|
@@ -145,40 +149,40 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
145
149
|
var _encryptContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(contact) {
|
|
146
150
|
var _this3 = this;
|
|
147
151
|
var encryptionKeyUrl, encryptedContact, encryptionPromises, encryptedFieldsList;
|
|
148
|
-
return _regenerator.default.wrap(function
|
|
152
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
149
153
|
while (1) switch (_context5.prev = _context5.next) {
|
|
150
154
|
case 0:
|
|
151
155
|
encryptionKeyUrl = contact.encryptionKeyUrl;
|
|
152
156
|
encryptedContact = _objectSpread({}, contact);
|
|
153
157
|
encryptionPromises = (0, _values.default)(_constants2.encryptedFields).map(/*#__PURE__*/function () {
|
|
154
158
|
var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(field) {
|
|
155
|
-
var plaintextAddressInfo, encryptedAddressInfo, encryptedAddressInfoPromises, plainTextDetails, encryptedDetails, encryptedValue;
|
|
156
|
-
return _regenerator.default.wrap(function
|
|
159
|
+
var plaintextAddressInfo, encryptedAddressInfo, encryptedAddressInfoPromises, plainTextDetails, encryptedDetails, encryptedValue, _t3, _t4;
|
|
160
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
157
161
|
while (1) switch (_context4.prev = _context4.next) {
|
|
158
162
|
case 0:
|
|
159
|
-
|
|
160
|
-
_context4.next =
|
|
163
|
+
_t3 = field;
|
|
164
|
+
_context4.next = _t3 === _constants2.encryptedFields.ADDRESS_INFO ? 1 : _t3 === _constants2.encryptedFields.EMAILS ? 4 : _t3 === _constants2.encryptedFields.PHONE_NUMBERS ? 4 : _t3 === _constants2.encryptedFields.SIP_ADDRESSES ? 4 : 7;
|
|
161
165
|
break;
|
|
162
|
-
case
|
|
166
|
+
case 1:
|
|
163
167
|
plaintextAddressInfo = encryptedContact.addressInfo;
|
|
164
168
|
if (!plaintextAddressInfo) {
|
|
165
|
-
_context4.next =
|
|
169
|
+
_context4.next = 3;
|
|
166
170
|
break;
|
|
167
171
|
}
|
|
168
172
|
encryptedAddressInfoPromises = (0, _entries.default)(plaintextAddressInfo).map(/*#__PURE__*/function () {
|
|
169
173
|
var _ref3 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(_ref2) {
|
|
170
|
-
var _ref4, key, value;
|
|
171
|
-
return _regenerator.default.wrap(function
|
|
174
|
+
var _ref4, key, value, _t, _t2;
|
|
175
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
172
176
|
while (1) switch (_context3.prev = _context3.next) {
|
|
173
177
|
case 0:
|
|
174
178
|
_ref4 = (0, _slicedToArray2.default)(_ref2, 2), key = _ref4[0], value = _ref4[1];
|
|
175
|
-
|
|
176
|
-
_context3.next =
|
|
179
|
+
_t = key;
|
|
180
|
+
_context3.next = 1;
|
|
177
181
|
return _this3.webex.internal.encryption.encryptText(encryptionKeyUrl, value);
|
|
178
|
-
case
|
|
179
|
-
|
|
180
|
-
return _context3.abrupt("return", [
|
|
181
|
-
case
|
|
182
|
+
case 1:
|
|
183
|
+
_t2 = _context3.sent;
|
|
184
|
+
return _context3.abrupt("return", [_t, _t2]);
|
|
185
|
+
case 2:
|
|
182
186
|
case "end":
|
|
183
187
|
return _context3.stop();
|
|
184
188
|
}
|
|
@@ -188,38 +192,37 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
188
192
|
return _ref3.apply(this, arguments);
|
|
189
193
|
};
|
|
190
194
|
}());
|
|
191
|
-
|
|
192
|
-
_context4.next =
|
|
195
|
+
_t4 = Object;
|
|
196
|
+
_context4.next = 2;
|
|
193
197
|
return _promise.default.all(encryptedAddressInfoPromises);
|
|
194
|
-
case
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
case 11:
|
|
198
|
+
case 2:
|
|
199
|
+
encryptedAddressInfo = _t4.fromEntries.call(_t4, _context4.sent);
|
|
200
|
+
case 3:
|
|
198
201
|
return _context4.abrupt("return", [field, encryptedAddressInfo]);
|
|
199
|
-
case
|
|
202
|
+
case 4:
|
|
200
203
|
plainTextDetails = encryptedContact[field];
|
|
201
204
|
if (!plainTextDetails) {
|
|
202
|
-
_context4.next =
|
|
205
|
+
_context4.next = 6;
|
|
203
206
|
break;
|
|
204
207
|
}
|
|
205
|
-
_context4.next =
|
|
208
|
+
_context4.next = 5;
|
|
206
209
|
return _this3.encryptContactDetail(encryptionKeyUrl, plainTextDetails);
|
|
207
|
-
case
|
|
210
|
+
case 5:
|
|
208
211
|
encryptedDetails = _context4.sent;
|
|
209
|
-
case
|
|
212
|
+
case 6:
|
|
210
213
|
return _context4.abrupt("return", [field, encryptedDetails]);
|
|
211
|
-
case
|
|
214
|
+
case 7:
|
|
212
215
|
if (!((0, _values.default)(_constants2.encryptedFields).includes(field) && encryptedContact[field])) {
|
|
213
|
-
_context4.next =
|
|
216
|
+
_context4.next = 9;
|
|
214
217
|
break;
|
|
215
218
|
}
|
|
216
|
-
_context4.next =
|
|
219
|
+
_context4.next = 8;
|
|
217
220
|
return _this3.webex.internal.encryption.encryptText(encryptionKeyUrl, encryptedContact[field]);
|
|
218
|
-
case
|
|
221
|
+
case 8:
|
|
219
222
|
encryptedValue = _context4.sent;
|
|
220
|
-
case
|
|
223
|
+
case 9:
|
|
221
224
|
return _context4.abrupt("return", [field, encryptedValue]);
|
|
222
|
-
case
|
|
225
|
+
case 10:
|
|
223
226
|
case "end":
|
|
224
227
|
return _context4.stop();
|
|
225
228
|
}
|
|
@@ -229,9 +232,9 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
229
232
|
return _ref.apply(this, arguments);
|
|
230
233
|
};
|
|
231
234
|
}());
|
|
232
|
-
_context5.next =
|
|
235
|
+
_context5.next = 1;
|
|
233
236
|
return _promise.default.all(encryptionPromises);
|
|
234
|
-
case
|
|
237
|
+
case 1:
|
|
235
238
|
encryptedFieldsList = _context5.sent;
|
|
236
239
|
encryptedFieldsList.forEach(function (_ref5) {
|
|
237
240
|
var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
|
|
@@ -242,7 +245,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
242
245
|
}
|
|
243
246
|
});
|
|
244
247
|
return _context5.abrupt("return", encryptedContact);
|
|
245
|
-
case
|
|
248
|
+
case 2:
|
|
246
249
|
case "end":
|
|
247
250
|
return _context5.stop();
|
|
248
251
|
}
|
|
@@ -263,40 +266,40 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
263
266
|
var _decryptContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(contact) {
|
|
264
267
|
var _this4 = this;
|
|
265
268
|
var encryptionKeyUrl, decryptedContact, decryptionPromises, decryptedFieldsList;
|
|
266
|
-
return _regenerator.default.wrap(function
|
|
269
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
267
270
|
while (1) switch (_context8.prev = _context8.next) {
|
|
268
271
|
case 0:
|
|
269
272
|
encryptionKeyUrl = contact.encryptionKeyUrl;
|
|
270
273
|
decryptedContact = _objectSpread({}, contact);
|
|
271
274
|
decryptionPromises = (0, _values.default)(_constants2.encryptedFields).map(/*#__PURE__*/function () {
|
|
272
275
|
var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7(field) {
|
|
273
|
-
var plaintextAddressInfo, decryptedAddressInfo, decryptedAddressInfoPromises, plainTextDetails, decryptedDetails, decryptedValue;
|
|
274
|
-
return _regenerator.default.wrap(function
|
|
276
|
+
var plaintextAddressInfo, decryptedAddressInfo, decryptedAddressInfoPromises, plainTextDetails, decryptedDetails, decryptedValue, _t7, _t8;
|
|
277
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
275
278
|
while (1) switch (_context7.prev = _context7.next) {
|
|
276
279
|
case 0:
|
|
277
|
-
|
|
278
|
-
_context7.next =
|
|
280
|
+
_t7 = field;
|
|
281
|
+
_context7.next = _t7 === _constants2.encryptedFields.ADDRESS_INFO ? 1 : _t7 === _constants2.encryptedFields.EMAILS ? 4 : _t7 === _constants2.encryptedFields.PHONE_NUMBERS ? 4 : _t7 === _constants2.encryptedFields.SIP_ADDRESSES ? 4 : 7;
|
|
279
282
|
break;
|
|
280
|
-
case
|
|
283
|
+
case 1:
|
|
281
284
|
plaintextAddressInfo = decryptedContact.addressInfo;
|
|
282
285
|
if (!plaintextAddressInfo) {
|
|
283
|
-
_context7.next =
|
|
286
|
+
_context7.next = 3;
|
|
284
287
|
break;
|
|
285
288
|
}
|
|
286
289
|
decryptedAddressInfoPromises = (0, _entries.default)(plaintextAddressInfo).map(/*#__PURE__*/function () {
|
|
287
290
|
var _ref9 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(_ref8) {
|
|
288
|
-
var _ref0, key, value;
|
|
289
|
-
return _regenerator.default.wrap(function
|
|
291
|
+
var _ref0, key, value, _t5, _t6;
|
|
292
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
290
293
|
while (1) switch (_context6.prev = _context6.next) {
|
|
291
294
|
case 0:
|
|
292
295
|
_ref0 = (0, _slicedToArray2.default)(_ref8, 2), key = _ref0[0], value = _ref0[1];
|
|
293
|
-
|
|
294
|
-
_context6.next =
|
|
296
|
+
_t5 = key;
|
|
297
|
+
_context6.next = 1;
|
|
295
298
|
return _this4.webex.internal.encryption.decryptText(encryptionKeyUrl, value);
|
|
296
|
-
case
|
|
297
|
-
|
|
298
|
-
return _context6.abrupt("return", [
|
|
299
|
-
case
|
|
299
|
+
case 1:
|
|
300
|
+
_t6 = _context6.sent;
|
|
301
|
+
return _context6.abrupt("return", [_t5, _t6]);
|
|
302
|
+
case 2:
|
|
300
303
|
case "end":
|
|
301
304
|
return _context6.stop();
|
|
302
305
|
}
|
|
@@ -306,38 +309,37 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
306
309
|
return _ref9.apply(this, arguments);
|
|
307
310
|
};
|
|
308
311
|
}());
|
|
309
|
-
|
|
310
|
-
_context7.next =
|
|
312
|
+
_t8 = Object;
|
|
313
|
+
_context7.next = 2;
|
|
311
314
|
return _promise.default.all(decryptedAddressInfoPromises);
|
|
312
|
-
case
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
case 11:
|
|
315
|
+
case 2:
|
|
316
|
+
decryptedAddressInfo = _t8.fromEntries.call(_t8, _context7.sent);
|
|
317
|
+
case 3:
|
|
316
318
|
return _context7.abrupt("return", [field, decryptedAddressInfo]);
|
|
317
|
-
case
|
|
319
|
+
case 4:
|
|
318
320
|
plainTextDetails = decryptedContact[field];
|
|
319
321
|
if (!plainTextDetails) {
|
|
320
|
-
_context7.next =
|
|
322
|
+
_context7.next = 6;
|
|
321
323
|
break;
|
|
322
324
|
}
|
|
323
|
-
_context7.next =
|
|
325
|
+
_context7.next = 5;
|
|
324
326
|
return _this4.decryptContactDetail(encryptionKeyUrl, plainTextDetails);
|
|
325
|
-
case
|
|
327
|
+
case 5:
|
|
326
328
|
decryptedDetails = _context7.sent;
|
|
327
|
-
case
|
|
329
|
+
case 6:
|
|
328
330
|
return _context7.abrupt("return", [field, decryptedDetails]);
|
|
329
|
-
case
|
|
331
|
+
case 7:
|
|
330
332
|
if (!((0, _values.default)(_constants2.encryptedFields).includes(field) && decryptedContact[field])) {
|
|
331
|
-
_context7.next =
|
|
333
|
+
_context7.next = 9;
|
|
332
334
|
break;
|
|
333
335
|
}
|
|
334
|
-
_context7.next =
|
|
336
|
+
_context7.next = 8;
|
|
335
337
|
return _this4.webex.internal.encryption.decryptText(encryptionKeyUrl, decryptedContact[field]);
|
|
336
|
-
case
|
|
338
|
+
case 8:
|
|
337
339
|
decryptedValue = _context7.sent;
|
|
338
|
-
case
|
|
340
|
+
case 9:
|
|
339
341
|
return _context7.abrupt("return", [field, decryptedValue]);
|
|
340
|
-
case
|
|
342
|
+
case 10:
|
|
341
343
|
case "end":
|
|
342
344
|
return _context7.stop();
|
|
343
345
|
}
|
|
@@ -347,9 +349,9 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
347
349
|
return _ref7.apply(this, arguments);
|
|
348
350
|
};
|
|
349
351
|
}());
|
|
350
|
-
_context8.next =
|
|
352
|
+
_context8.next = 1;
|
|
351
353
|
return _promise.default.all(decryptionPromises);
|
|
352
|
-
case
|
|
354
|
+
case 1:
|
|
353
355
|
decryptedFieldsList = _context8.sent;
|
|
354
356
|
decryptedFieldsList.forEach(function (_ref1) {
|
|
355
357
|
var _ref10 = (0, _slicedToArray2.default)(_ref1, 2),
|
|
@@ -360,7 +362,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
360
362
|
}
|
|
361
363
|
});
|
|
362
364
|
return _context8.abrupt("return", decryptedContact);
|
|
363
|
-
case
|
|
365
|
+
case 2:
|
|
364
366
|
case "end":
|
|
365
367
|
return _context8.stop();
|
|
366
368
|
}
|
|
@@ -451,8 +453,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
451
453
|
value: (function () {
|
|
452
454
|
var _getContacts = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
453
455
|
var _this5 = this;
|
|
454
|
-
var loggerContext, contactList, cloudContactsMap, _response$headers, response, responseBody, contacts, groups, contactIdList, totalContacts, MAX_CONTACTS_PER_QUERY, i, contactIdListChunk, query, result, slicedCloudContactsMap, resolvedContacts, contactResponse,
|
|
455
|
-
return _regenerator.default.wrap(function
|
|
456
|
+
var loggerContext, contactList, cloudContactsMap, _response$headers, response, responseBody, contacts, groups, contactIdList, totalContacts, MAX_CONTACTS_PER_QUERY, i, contactIdListChunk, query, result, slicedCloudContactsMap, resolvedContacts, contactResponse, errorStatus, _t9, _t0;
|
|
457
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
456
458
|
while (1) switch (_context1.prev = _context1.next) {
|
|
457
459
|
case 0:
|
|
458
460
|
loggerContext = {
|
|
@@ -462,47 +464,47 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
462
464
|
_Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
|
|
463
465
|
contactList = [];
|
|
464
466
|
cloudContactsMap = {};
|
|
465
|
-
_context1.prev =
|
|
466
|
-
_context1.next =
|
|
467
|
+
_context1.prev = 1;
|
|
468
|
+
_context1.next = 2;
|
|
467
469
|
return this.webex.request({
|
|
468
470
|
// eslint-disable-next-line no-underscore-dangle
|
|
469
|
-
uri: "".concat(this.
|
|
471
|
+
uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER),
|
|
470
472
|
method: _types.HTTP_METHODS.GET
|
|
471
473
|
});
|
|
472
|
-
case
|
|
474
|
+
case 2:
|
|
473
475
|
response = _context1.sent;
|
|
474
476
|
_Logger.default.log("Response code: ".concat(response.statusCode, " and Response trackingId: ").concat(response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.trackingid), loggerContext);
|
|
475
477
|
responseBody = response.body;
|
|
476
478
|
if (responseBody) {
|
|
477
|
-
_context1.next =
|
|
479
|
+
_context1.next = 3;
|
|
478
480
|
break;
|
|
479
481
|
}
|
|
480
482
|
throw new Error("".concat(response));
|
|
481
|
-
case
|
|
483
|
+
case 3:
|
|
482
484
|
contacts = responseBody.contacts, groups = responseBody.groups;
|
|
483
|
-
_context1.next =
|
|
485
|
+
_context1.next = 4;
|
|
484
486
|
return _promise.default.all(contacts.map(/*#__PURE__*/function () {
|
|
485
487
|
var _ref11 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9(contact) {
|
|
486
488
|
var decryptedContact;
|
|
487
|
-
return _regenerator.default.wrap(function
|
|
489
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
488
490
|
while (1) switch (_context9.prev = _context9.next) {
|
|
489
491
|
case 0:
|
|
490
492
|
if (!(contact.contactType === _types2.ContactType.CUSTOM)) {
|
|
491
|
-
_context9.next =
|
|
493
|
+
_context9.next = 2;
|
|
492
494
|
break;
|
|
493
495
|
}
|
|
494
|
-
_context9.next =
|
|
496
|
+
_context9.next = 1;
|
|
495
497
|
return _this5.decryptContact(contact);
|
|
496
|
-
case
|
|
498
|
+
case 1:
|
|
497
499
|
decryptedContact = _context9.sent;
|
|
498
500
|
contactList.push(decryptedContact);
|
|
499
|
-
_context9.next =
|
|
501
|
+
_context9.next = 3;
|
|
500
502
|
break;
|
|
501
|
-
case
|
|
503
|
+
case 2:
|
|
502
504
|
if (contact.contactType === _types2.ContactType.CLOUD && contact.contactId) {
|
|
503
505
|
cloudContactsMap[contact.contactId] = contact;
|
|
504
506
|
}
|
|
505
|
-
case
|
|
507
|
+
case 3:
|
|
506
508
|
case "end":
|
|
507
509
|
return _context9.stop();
|
|
508
510
|
}
|
|
@@ -512,28 +514,28 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
512
514
|
return _ref11.apply(this, arguments);
|
|
513
515
|
};
|
|
514
516
|
}()));
|
|
515
|
-
case
|
|
517
|
+
case 4:
|
|
516
518
|
if (!(0, _keys.default)(cloudContactsMap).length) {
|
|
517
|
-
_context1.next =
|
|
519
|
+
_context1.next = 10;
|
|
518
520
|
break;
|
|
519
521
|
}
|
|
520
522
|
contactIdList = (0, _keys.default)(cloudContactsMap);
|
|
521
523
|
totalContacts = contactIdList.length;
|
|
522
524
|
MAX_CONTACTS_PER_QUERY = 50;
|
|
523
525
|
i = 0;
|
|
524
|
-
case
|
|
526
|
+
case 5:
|
|
525
527
|
if (!(i < totalContacts)) {
|
|
526
|
-
_context1.next =
|
|
528
|
+
_context1.next = 10;
|
|
527
529
|
break;
|
|
528
530
|
}
|
|
529
|
-
_context1.prev =
|
|
531
|
+
_context1.prev = 6;
|
|
530
532
|
contactIdListChunk = contactIdList.slice(i, i + MAX_CONTACTS_PER_QUERY);
|
|
531
533
|
query = contactIdListChunk.map(function (item) {
|
|
532
534
|
return "".concat(_constants2.SCIM_ID_FILTER, " \"").concat(item, "\"");
|
|
533
535
|
}).join(_constants2.OR);
|
|
534
|
-
_context1.next =
|
|
536
|
+
_context1.next = 7;
|
|
535
537
|
return (0, _Utils.scimQuery)(query);
|
|
536
|
-
case
|
|
538
|
+
case 7:
|
|
537
539
|
result = _context1.sent;
|
|
538
540
|
slicedCloudContactsMap = Object.fromEntries((0, _entries.default)(cloudContactsMap).slice(i, i + MAX_CONTACTS_PER_QUERY));
|
|
539
541
|
resolvedContacts = this.resolveCloudContacts(slicedCloudContactsMap, result.body);
|
|
@@ -542,28 +544,28 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
542
544
|
return contactList.push(item);
|
|
543
545
|
});
|
|
544
546
|
}
|
|
545
|
-
_context1.next =
|
|
547
|
+
_context1.next = 9;
|
|
546
548
|
break;
|
|
547
|
-
case
|
|
548
|
-
_context1.prev =
|
|
549
|
-
|
|
549
|
+
case 8:
|
|
550
|
+
_context1.prev = 8;
|
|
551
|
+
_t9 = _context1["catch"](6);
|
|
550
552
|
_Logger.default.warn("Error processing contact chunk ".concat(i, "-").concat(i + MAX_CONTACTS_PER_QUERY), loggerContext);
|
|
551
|
-
case
|
|
553
|
+
case 9:
|
|
552
554
|
i += MAX_CONTACTS_PER_QUERY;
|
|
553
|
-
_context1.next =
|
|
555
|
+
_context1.next = 5;
|
|
554
556
|
break;
|
|
555
|
-
case
|
|
556
|
-
_context1.next =
|
|
557
|
+
case 10:
|
|
558
|
+
_context1.next = 11;
|
|
557
559
|
return _promise.default.all(groups.map(/*#__PURE__*/function () {
|
|
558
560
|
var _ref12 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0(group, idx) {
|
|
559
|
-
return _regenerator.default.wrap(function
|
|
561
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
560
562
|
while (1) switch (_context0.prev = _context0.next) {
|
|
561
563
|
case 0:
|
|
562
|
-
_context0.next =
|
|
564
|
+
_context0.next = 1;
|
|
563
565
|
return _this5.webex.internal.encryption.decryptText(group.encryptionKeyUrl, group.displayName);
|
|
564
|
-
case
|
|
566
|
+
case 1:
|
|
565
567
|
groups[idx].displayName = _context0.sent;
|
|
566
|
-
case
|
|
568
|
+
case 2:
|
|
567
569
|
case "end":
|
|
568
570
|
return _context0.stop();
|
|
569
571
|
}
|
|
@@ -573,7 +575,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
573
575
|
return _ref12.apply(this, arguments);
|
|
574
576
|
};
|
|
575
577
|
}()));
|
|
576
|
-
case
|
|
578
|
+
case 11:
|
|
577
579
|
this.groups = groups;
|
|
578
580
|
this.contacts = contactList;
|
|
579
581
|
contactResponse = {
|
|
@@ -586,22 +588,20 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
586
588
|
};
|
|
587
589
|
_Logger.default.log('Successfully fetched contacts and groups', loggerContext);
|
|
588
590
|
return _context1.abrupt("return", contactResponse);
|
|
589
|
-
case
|
|
590
|
-
_context1.prev =
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
|
|
596
|
-
_context1.next = 55;
|
|
591
|
+
case 12:
|
|
592
|
+
_context1.prev = 12;
|
|
593
|
+
_t0 = _context1["catch"](1);
|
|
594
|
+
_Logger.default.error("Error fetching contacts: ".concat((0, _stringify.default)(_t0)), loggerContext);
|
|
595
|
+
errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t0, loggerContext);
|
|
596
|
+
_context1.next = 13;
|
|
597
597
|
return (0, _Utils.uploadLogs)();
|
|
598
|
-
case
|
|
598
|
+
case 13:
|
|
599
599
|
return _context1.abrupt("return", errorStatus);
|
|
600
|
-
case
|
|
600
|
+
case 14:
|
|
601
601
|
case "end":
|
|
602
602
|
return _context1.stop();
|
|
603
603
|
}
|
|
604
|
-
}, _callee1, this, [[
|
|
604
|
+
}, _callee1, this, [[1, 12], [6, 8]]);
|
|
605
605
|
}));
|
|
606
606
|
function getContacts() {
|
|
607
607
|
return _getContacts.apply(this, arguments);
|
|
@@ -619,7 +619,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
619
619
|
value: (function () {
|
|
620
620
|
var _createNewEncryptionKeyUrl = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
621
621
|
var loggerContext, unboundedKeyUri, unboundedKeys;
|
|
622
|
-
return _regenerator.default.wrap(function
|
|
622
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
623
623
|
while (1) switch (_context10.prev = _context10.next) {
|
|
624
624
|
case 0:
|
|
625
625
|
loggerContext = {
|
|
@@ -629,18 +629,18 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
629
629
|
_Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
|
|
630
630
|
unboundedKeyUri = '';
|
|
631
631
|
_Logger.default.info('Requesting kms for a new KRO and key', loggerContext);
|
|
632
|
-
_context10.next =
|
|
632
|
+
_context10.next = 1;
|
|
633
633
|
return this.webex.internal.encryption.kms.createUnboundKeys({
|
|
634
634
|
count: 1
|
|
635
635
|
});
|
|
636
|
-
case
|
|
636
|
+
case 1:
|
|
637
637
|
unboundedKeys = _context10.sent;
|
|
638
638
|
unboundedKeyUri = unboundedKeys[0].uri;
|
|
639
639
|
this.webex.internal.encryption.kms.createResource({
|
|
640
640
|
keyUris: [unboundedKeyUri]
|
|
641
641
|
});
|
|
642
642
|
return _context10.abrupt("return", unboundedKeyUri);
|
|
643
|
-
case
|
|
643
|
+
case 2:
|
|
644
644
|
case "end":
|
|
645
645
|
return _context10.stop();
|
|
646
646
|
}
|
|
@@ -663,7 +663,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
663
663
|
var _fetchEncryptionKeyUrl = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
664
664
|
var _response$data$group;
|
|
665
665
|
var loggerContext, response, _response$data$group2;
|
|
666
|
-
return _regenerator.default.wrap(function
|
|
666
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
667
667
|
while (1) switch (_context11.prev = _context11.next) {
|
|
668
668
|
case 0:
|
|
669
669
|
loggerContext = {
|
|
@@ -672,33 +672,33 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
672
672
|
};
|
|
673
673
|
_Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
|
|
674
674
|
if (!this.encryptionKeyUrl) {
|
|
675
|
-
_context11.next =
|
|
675
|
+
_context11.next = 1;
|
|
676
676
|
break;
|
|
677
677
|
}
|
|
678
678
|
return _context11.abrupt("return", this.encryptionKeyUrl);
|
|
679
|
-
case
|
|
679
|
+
case 1:
|
|
680
680
|
// istanbul ignore else
|
|
681
681
|
if (this.groups === undefined) {
|
|
682
682
|
this.getContacts();
|
|
683
683
|
}
|
|
684
684
|
// istanbul ignore else
|
|
685
685
|
if (!(this.groups && this.groups.length)) {
|
|
686
|
-
_context11.next =
|
|
686
|
+
_context11.next = 2;
|
|
687
687
|
break;
|
|
688
688
|
}
|
|
689
689
|
return _context11.abrupt("return", this.groups[0].encryptionKeyUrl);
|
|
690
|
-
case
|
|
691
|
-
_context11.next =
|
|
690
|
+
case 2:
|
|
691
|
+
_context11.next = 3;
|
|
692
692
|
return this.createNewEncryptionKeyUrl();
|
|
693
|
-
case
|
|
693
|
+
case 3:
|
|
694
694
|
this.encryptionKeyUrl = _context11.sent;
|
|
695
695
|
_Logger.default.log("Creating a default group: ".concat(_constants2.DEFAULT_GROUP_NAME), {
|
|
696
696
|
file: _constants2.CONTACTS_CLIENT,
|
|
697
697
|
method: this.fetchEncryptionKeyUrl.name
|
|
698
698
|
});
|
|
699
|
-
_context11.next =
|
|
699
|
+
_context11.next = 4;
|
|
700
700
|
return this.createContactGroup(_constants2.DEFAULT_GROUP_NAME, this.encryptionKeyUrl);
|
|
701
|
-
case
|
|
701
|
+
case 4:
|
|
702
702
|
response = _context11.sent;
|
|
703
703
|
if ((_response$data$group = response.data.group) !== null && _response$data$group !== void 0 && _response$data$group.groupId) {
|
|
704
704
|
this.defaultGroupId = (_response$data$group2 = response.data.group) === null || _response$data$group2 === void 0 ? void 0 : _response$data$group2.groupId;
|
|
@@ -708,7 +708,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
708
708
|
});
|
|
709
709
|
}
|
|
710
710
|
return _context11.abrupt("return", this.encryptionKeyUrl);
|
|
711
|
-
case
|
|
711
|
+
case 5:
|
|
712
712
|
case "end":
|
|
713
713
|
return _context11.stop();
|
|
714
714
|
}
|
|
@@ -730,7 +730,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
730
730
|
value: (function () {
|
|
731
731
|
var _fetchDefaultGroup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
732
732
|
var loggerContext, i, response, group, groupId;
|
|
733
|
-
return _regenerator.default.wrap(function
|
|
733
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
734
734
|
while (1) switch (_context12.prev = _context12.next) {
|
|
735
735
|
case 0:
|
|
736
736
|
loggerContext = {
|
|
@@ -739,7 +739,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
739
739
|
};
|
|
740
740
|
_Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
|
|
741
741
|
if (!this.defaultGroupId) {
|
|
742
|
-
_context12.next =
|
|
742
|
+
_context12.next = 1;
|
|
743
743
|
break;
|
|
744
744
|
}
|
|
745
745
|
_Logger.default.log("Using existing default group with ID: ".concat(this.defaultGroupId), {
|
|
@@ -747,19 +747,19 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
747
747
|
method: this.fetchDefaultGroup.name
|
|
748
748
|
});
|
|
749
749
|
return _context12.abrupt("return", this.defaultGroupId);
|
|
750
|
-
case
|
|
750
|
+
case 1:
|
|
751
751
|
if (!(this.groups && this.groups.length)) {
|
|
752
|
-
_context12.next =
|
|
752
|
+
_context12.next = 4;
|
|
753
753
|
break;
|
|
754
754
|
}
|
|
755
755
|
i = 0;
|
|
756
|
-
case
|
|
756
|
+
case 2:
|
|
757
757
|
if (!(i < this.groups.length)) {
|
|
758
|
-
_context12.next =
|
|
758
|
+
_context12.next = 4;
|
|
759
759
|
break;
|
|
760
760
|
}
|
|
761
761
|
if (!(this.groups[i].displayName === _constants2.DEFAULT_GROUP_NAME)) {
|
|
762
|
-
_context12.next =
|
|
762
|
+
_context12.next = 3;
|
|
763
763
|
break;
|
|
764
764
|
}
|
|
765
765
|
this.defaultGroupId = this.groups[i].groupId;
|
|
@@ -768,22 +768,22 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
768
768
|
method: this.fetchDefaultGroup.name
|
|
769
769
|
});
|
|
770
770
|
return _context12.abrupt("return", this.defaultGroupId);
|
|
771
|
-
case
|
|
771
|
+
case 3:
|
|
772
772
|
i += 1;
|
|
773
|
-
_context12.next =
|
|
773
|
+
_context12.next = 2;
|
|
774
774
|
break;
|
|
775
|
-
case
|
|
775
|
+
case 4:
|
|
776
776
|
_Logger.default.log('No default group found.', {
|
|
777
777
|
file: _constants2.CONTACTS_CLIENT,
|
|
778
778
|
method: this.fetchDefaultGroup.name
|
|
779
779
|
});
|
|
780
|
-
_context12.next =
|
|
780
|
+
_context12.next = 5;
|
|
781
781
|
return this.createContactGroup(_constants2.DEFAULT_GROUP_NAME);
|
|
782
|
-
case
|
|
782
|
+
case 5:
|
|
783
783
|
response = _context12.sent;
|
|
784
784
|
group = response.data.group;
|
|
785
785
|
if (!group) {
|
|
786
|
-
_context12.next =
|
|
786
|
+
_context12.next = 6;
|
|
787
787
|
break;
|
|
788
788
|
}
|
|
789
789
|
groupId = group.groupId;
|
|
@@ -792,9 +792,9 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
792
792
|
method: this.fetchDefaultGroup.name
|
|
793
793
|
});
|
|
794
794
|
return _context12.abrupt("return", groupId);
|
|
795
|
-
case
|
|
795
|
+
case 6:
|
|
796
796
|
return _context12.abrupt("return", '');
|
|
797
|
-
case
|
|
797
|
+
case 7:
|
|
798
798
|
case "end":
|
|
799
799
|
return _context12.stop();
|
|
800
800
|
}
|
|
@@ -817,8 +817,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
817
817
|
key: "createContactGroup",
|
|
818
818
|
value: (function () {
|
|
819
819
|
var _createContactGroup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13(displayName, encryptionKeyUrl, groupType) {
|
|
820
|
-
var loggerContext, encryptionKeyUrlFinal, isExistingGroup, encryptedDisplayName, groupInfo, _response$headers2, _this$groups, response, group, contactResponse,
|
|
821
|
-
return _regenerator.default.wrap(function
|
|
820
|
+
var loggerContext, encryptionKeyUrlFinal, isExistingGroup, encryptedDisplayName, groupInfo, _response$headers2, _this$groups, response, group, contactResponse, errorStatus, _t1, _t10;
|
|
821
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
822
822
|
while (1) switch (_context13.prev = _context13.next) {
|
|
823
823
|
case 0:
|
|
824
824
|
loggerContext = {
|
|
@@ -826,33 +826,33 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
826
826
|
method: _constants2.METHODS.CREATE_CONTACT_GROUP
|
|
827
827
|
};
|
|
828
828
|
_Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with displayName: ").concat(displayName), loggerContext);
|
|
829
|
-
|
|
830
|
-
if (
|
|
831
|
-
_context13.next =
|
|
829
|
+
_t1 = encryptionKeyUrl;
|
|
830
|
+
if (_t1) {
|
|
831
|
+
_context13.next = 2;
|
|
832
832
|
break;
|
|
833
833
|
}
|
|
834
|
-
_context13.next =
|
|
834
|
+
_context13.next = 1;
|
|
835
835
|
return this.fetchEncryptionKeyUrl();
|
|
836
|
-
case
|
|
837
|
-
|
|
838
|
-
case
|
|
839
|
-
encryptionKeyUrlFinal =
|
|
836
|
+
case 1:
|
|
837
|
+
_t1 = _context13.sent;
|
|
838
|
+
case 2:
|
|
839
|
+
encryptionKeyUrlFinal = _t1;
|
|
840
840
|
if (!(this.groups === undefined)) {
|
|
841
|
-
_context13.next =
|
|
841
|
+
_context13.next = 3;
|
|
842
842
|
break;
|
|
843
843
|
}
|
|
844
|
-
_context13.next =
|
|
844
|
+
_context13.next = 3;
|
|
845
845
|
return this.getContacts();
|
|
846
|
-
case
|
|
846
|
+
case 3:
|
|
847
847
|
if (!(this.groups && this.groups.length)) {
|
|
848
|
-
_context13.next =
|
|
848
|
+
_context13.next = 4;
|
|
849
849
|
break;
|
|
850
850
|
}
|
|
851
851
|
isExistingGroup = this.groups.find(function (group) {
|
|
852
852
|
return group.displayName === displayName;
|
|
853
853
|
});
|
|
854
854
|
if (!isExistingGroup) {
|
|
855
|
-
_context13.next =
|
|
855
|
+
_context13.next = 4;
|
|
856
856
|
break;
|
|
857
857
|
}
|
|
858
858
|
_Logger.default.warn("Group name ".concat(displayName, " already exists."), loggerContext);
|
|
@@ -863,10 +863,10 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
863
863
|
},
|
|
864
864
|
message: _constants.FAILURE_MESSAGE
|
|
865
865
|
});
|
|
866
|
-
case
|
|
867
|
-
_context13.next =
|
|
866
|
+
case 4:
|
|
867
|
+
_context13.next = 5;
|
|
868
868
|
return this.webex.internal.encryption.encryptText(encryptionKeyUrlFinal, displayName);
|
|
869
|
-
case
|
|
869
|
+
case 5:
|
|
870
870
|
encryptedDisplayName = _context13.sent;
|
|
871
871
|
groupInfo = {
|
|
872
872
|
schemas: _constants2.CONTACTS_SCHEMA,
|
|
@@ -874,15 +874,15 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
874
874
|
groupType: groupType || _types2.GroupType.NORMAL,
|
|
875
875
|
encryptionKeyUrl: encryptionKeyUrlFinal
|
|
876
876
|
};
|
|
877
|
-
_context13.prev =
|
|
878
|
-
_context13.next =
|
|
877
|
+
_context13.prev = 6;
|
|
878
|
+
_context13.next = 7;
|
|
879
879
|
return this.webex.request({
|
|
880
880
|
// eslint-disable-next-line no-underscore-dangle
|
|
881
|
-
uri: "".concat(this.
|
|
881
|
+
uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.GROUP_FILTER),
|
|
882
882
|
method: _types.HTTP_METHODS.POST,
|
|
883
883
|
body: groupInfo
|
|
884
884
|
});
|
|
885
|
-
case
|
|
885
|
+
case 7:
|
|
886
886
|
response = _context13.sent;
|
|
887
887
|
_Logger.default.log("Response code: ".concat(response.statusCode), loggerContext);
|
|
888
888
|
_Logger.default.log("Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers2 = response.headers) === null || _response$headers2 === void 0 ? void 0 : _response$headers2.trackingid), loggerContext);
|
|
@@ -898,22 +898,20 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
898
898
|
(_this$groups = this.groups) === null || _this$groups === void 0 ? void 0 : _this$groups.push(group);
|
|
899
899
|
_Logger.default.log("Contact group ".concat(displayName, " successfully created"), loggerContext);
|
|
900
900
|
return _context13.abrupt("return", contactResponse);
|
|
901
|
-
case
|
|
902
|
-
_context13.prev =
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
|
|
908
|
-
_context13.next = 42;
|
|
901
|
+
case 8:
|
|
902
|
+
_context13.prev = 8;
|
|
903
|
+
_t10 = _context13["catch"](6);
|
|
904
|
+
_Logger.default.error("Unable to create contact group: ".concat((0, _stringify.default)(_t10)), loggerContext);
|
|
905
|
+
errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t10, loggerContext);
|
|
906
|
+
_context13.next = 9;
|
|
909
907
|
return (0, _Utils.uploadLogs)();
|
|
910
|
-
case
|
|
908
|
+
case 9:
|
|
911
909
|
return _context13.abrupt("return", errorStatus);
|
|
912
|
-
case
|
|
910
|
+
case 10:
|
|
913
911
|
case "end":
|
|
914
912
|
return _context13.stop();
|
|
915
913
|
}
|
|
916
|
-
}, _callee13, this, [[
|
|
914
|
+
}, _callee13, this, [[6, 8]]);
|
|
917
915
|
}));
|
|
918
916
|
function createContactGroup(_x12, _x13, _x14) {
|
|
919
917
|
return _createContactGroup.apply(this, arguments);
|
|
@@ -929,8 +927,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
929
927
|
key: "deleteContactGroup",
|
|
930
928
|
value: (function () {
|
|
931
929
|
var _deleteContactGroup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14(groupId) {
|
|
932
|
-
var loggerContext, _response$headers3, _this$groups2, _this$groups4, response, contactResponse, groupToDelete, _this$groups3,
|
|
933
|
-
return _regenerator.default.wrap(function
|
|
930
|
+
var loggerContext, _response$headers3, _this$groups2, _this$groups4, response, contactResponse, groupToDelete, _this$groups3, errorStatus, _t11;
|
|
931
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
934
932
|
while (1) switch (_context14.prev = _context14.next) {
|
|
935
933
|
case 0:
|
|
936
934
|
loggerContext = {
|
|
@@ -938,15 +936,15 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
938
936
|
method: _constants2.METHODS.DELETE_CONTACT_GROUP
|
|
939
937
|
};
|
|
940
938
|
_Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with groupId: ").concat(groupId), loggerContext);
|
|
941
|
-
_context14.prev =
|
|
939
|
+
_context14.prev = 1;
|
|
942
940
|
_Logger.default.info("Deleting contact group: ".concat(groupId), loggerContext);
|
|
943
|
-
_context14.next =
|
|
941
|
+
_context14.next = 2;
|
|
944
942
|
return this.webex.request({
|
|
945
943
|
// eslint-disable-next-line no-underscore-dangle
|
|
946
|
-
uri: "".concat(this.
|
|
944
|
+
uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.GROUP_FILTER, "/").concat(groupId),
|
|
947
945
|
method: _types.HTTP_METHODS.DELETE
|
|
948
946
|
});
|
|
949
|
-
case
|
|
947
|
+
case 2:
|
|
950
948
|
response = _context14.sent;
|
|
951
949
|
_Logger.default.log("Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers3 = response.headers) === null || _response$headers3 === void 0 ? void 0 : _response$headers3.trackingid), loggerContext);
|
|
952
950
|
contactResponse = {
|
|
@@ -965,22 +963,20 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
965
963
|
}
|
|
966
964
|
_Logger.default.log("Contact group ".concat(groupId, " successfully deleted"), loggerContext);
|
|
967
965
|
return _context14.abrupt("return", contactResponse);
|
|
968
|
-
case
|
|
969
|
-
_context14.prev =
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
|
|
975
|
-
_context14.next = 24;
|
|
966
|
+
case 3:
|
|
967
|
+
_context14.prev = 3;
|
|
968
|
+
_t11 = _context14["catch"](1);
|
|
969
|
+
_Logger.default.error("Unable to delete contact group ".concat(groupId, ": ").concat((0, _stringify.default)(_t11)), loggerContext);
|
|
970
|
+
errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t11, loggerContext);
|
|
971
|
+
_context14.next = 4;
|
|
976
972
|
return (0, _Utils.uploadLogs)();
|
|
977
|
-
case
|
|
973
|
+
case 4:
|
|
978
974
|
return _context14.abrupt("return", errorStatus);
|
|
979
|
-
case
|
|
975
|
+
case 5:
|
|
980
976
|
case "end":
|
|
981
977
|
return _context14.stop();
|
|
982
978
|
}
|
|
983
|
-
}, _callee14, this, [[
|
|
979
|
+
}, _callee14, this, [[1, 3]]);
|
|
984
980
|
}));
|
|
985
981
|
function deleteContactGroup(_x15) {
|
|
986
982
|
return _deleteContactGroup.apply(this, arguments);
|
|
@@ -996,8 +992,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
996
992
|
key: "createContact",
|
|
997
993
|
value: (function () {
|
|
998
994
|
var _createContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15(contactInfo) {
|
|
999
|
-
var loggerContext, _response$headers4, contact, defaultGroupId, requestBody, encryptedContact, _encryptedContact, response, newContact, contactResponse, query, res, resolvedContact, _this$contacts, _this$contacts2,
|
|
1000
|
-
return _regenerator.default.wrap(function
|
|
995
|
+
var loggerContext, _response$headers4, contact, defaultGroupId, requestBody, encryptedContact, _encryptedContact, response, newContact, contactResponse, query, res, resolvedContact, _this$contacts, _this$contacts2, errorStatus, _t12, _t13;
|
|
996
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
1001
997
|
while (1) switch (_context15.prev = _context15.next) {
|
|
1002
998
|
case 0:
|
|
1003
999
|
loggerContext = {
|
|
@@ -1005,42 +1001,42 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
1005
1001
|
method: _constants2.METHODS.CREATE_CONTACT
|
|
1006
1002
|
};
|
|
1007
1003
|
_Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with contactType: ").concat(contactInfo.contactType), loggerContext);
|
|
1008
|
-
_context15.prev =
|
|
1004
|
+
_context15.prev = 1;
|
|
1009
1005
|
contact = _objectSpread({}, contactInfo);
|
|
1010
1006
|
if (contact.encryptionKeyUrl) {
|
|
1011
|
-
_context15.next =
|
|
1007
|
+
_context15.next = 3;
|
|
1012
1008
|
break;
|
|
1013
1009
|
}
|
|
1014
|
-
_context15.next =
|
|
1010
|
+
_context15.next = 2;
|
|
1015
1011
|
return this.fetchEncryptionKeyUrl();
|
|
1016
|
-
case
|
|
1012
|
+
case 2:
|
|
1017
1013
|
contact.encryptionKeyUrl = _context15.sent;
|
|
1018
|
-
case
|
|
1014
|
+
case 3:
|
|
1019
1015
|
if (!(!contact.groups || contact.groups.length === 0)) {
|
|
1020
|
-
_context15.next =
|
|
1016
|
+
_context15.next = 5;
|
|
1021
1017
|
break;
|
|
1022
1018
|
}
|
|
1023
|
-
_context15.next =
|
|
1019
|
+
_context15.next = 4;
|
|
1024
1020
|
return this.fetchDefaultGroup();
|
|
1025
|
-
case
|
|
1021
|
+
case 4:
|
|
1026
1022
|
defaultGroupId = _context15.sent;
|
|
1027
1023
|
contact.groups = [defaultGroupId];
|
|
1028
|
-
case
|
|
1024
|
+
case 5:
|
|
1029
1025
|
contact.schemas = _constants2.CONTACTS_SCHEMA;
|
|
1030
1026
|
requestBody = {};
|
|
1031
|
-
|
|
1032
|
-
_context15.next =
|
|
1027
|
+
_t12 = contact.contactType;
|
|
1028
|
+
_context15.next = _t12 === _types2.ContactType.CUSTOM ? 6 : _t12 === _types2.ContactType.CLOUD ? 8 : 11;
|
|
1033
1029
|
break;
|
|
1034
|
-
case
|
|
1035
|
-
_context15.next =
|
|
1030
|
+
case 6:
|
|
1031
|
+
_context15.next = 7;
|
|
1036
1032
|
return this.encryptContact(contact);
|
|
1037
|
-
case
|
|
1033
|
+
case 7:
|
|
1038
1034
|
encryptedContact = _context15.sent;
|
|
1039
1035
|
requestBody = encryptedContact;
|
|
1040
|
-
return _context15.abrupt("
|
|
1041
|
-
case
|
|
1036
|
+
return _context15.abrupt("continue", 12);
|
|
1037
|
+
case 8:
|
|
1042
1038
|
if (contact.contactId) {
|
|
1043
|
-
_context15.next =
|
|
1039
|
+
_context15.next = 9;
|
|
1044
1040
|
break;
|
|
1045
1041
|
}
|
|
1046
1042
|
return _context15.abrupt("return", {
|
|
@@ -1050,14 +1046,14 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
1050
1046
|
},
|
|
1051
1047
|
message: _constants.FAILURE_MESSAGE
|
|
1052
1048
|
});
|
|
1053
|
-
case
|
|
1054
|
-
_context15.next =
|
|
1049
|
+
case 9:
|
|
1050
|
+
_context15.next = 10;
|
|
1055
1051
|
return this.encryptContact(contact);
|
|
1056
|
-
case
|
|
1052
|
+
case 10:
|
|
1057
1053
|
_encryptedContact = _context15.sent;
|
|
1058
1054
|
requestBody = _encryptedContact;
|
|
1059
|
-
return _context15.abrupt("
|
|
1060
|
-
case
|
|
1055
|
+
return _context15.abrupt("continue", 12);
|
|
1056
|
+
case 11:
|
|
1061
1057
|
return _context15.abrupt("return", {
|
|
1062
1058
|
statusCode: 400,
|
|
1063
1059
|
data: {
|
|
@@ -1065,15 +1061,15 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
1065
1061
|
},
|
|
1066
1062
|
message: _constants.FAILURE_MESSAGE
|
|
1067
1063
|
});
|
|
1068
|
-
case
|
|
1069
|
-
_context15.next =
|
|
1064
|
+
case 12:
|
|
1065
|
+
_context15.next = 13;
|
|
1070
1066
|
return this.webex.request({
|
|
1071
1067
|
// eslint-disable-next-line no-underscore-dangle
|
|
1072
|
-
uri: "".concat(this.
|
|
1068
|
+
uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER),
|
|
1073
1069
|
method: _types.HTTP_METHODS.POST,
|
|
1074
1070
|
body: requestBody
|
|
1075
1071
|
});
|
|
1076
|
-
case
|
|
1072
|
+
case 13:
|
|
1077
1073
|
response = _context15.sent;
|
|
1078
1074
|
_Logger.default.log("Response code: ".concat(response.statusCode), loggerContext);
|
|
1079
1075
|
_Logger.default.log("Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers4 = response.headers) === null || _response$headers4 === void 0 ? void 0 : _response$headers4.trackingid), loggerContext);
|
|
@@ -1087,41 +1083,39 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
1087
1083
|
message: _constants.SUCCESS_MESSAGE
|
|
1088
1084
|
};
|
|
1089
1085
|
if (!(contact.contactType === _types2.ContactType.CLOUD && newContact.contactId)) {
|
|
1090
|
-
_context15.next =
|
|
1086
|
+
_context15.next = 15;
|
|
1091
1087
|
break;
|
|
1092
1088
|
}
|
|
1093
1089
|
query = "".concat(_constants2.SCIM_ID_FILTER, " \"").concat(newContact.contactId, "\"");
|
|
1094
|
-
_context15.next =
|
|
1090
|
+
_context15.next = 14;
|
|
1095
1091
|
return (0, _Utils.scimQuery)(query);
|
|
1096
|
-
case
|
|
1092
|
+
case 14:
|
|
1097
1093
|
res = _context15.sent;
|
|
1098
1094
|
resolvedContact = this.resolveCloudContacts(Object.fromEntries([[newContact.contactId, newContact]]), res.body);
|
|
1099
1095
|
if (resolvedContact) {
|
|
1100
1096
|
(_this$contacts = this.contacts) === null || _this$contacts === void 0 ? void 0 : _this$contacts.push(resolvedContact[0]);
|
|
1101
1097
|
}
|
|
1102
|
-
_context15.next =
|
|
1098
|
+
_context15.next = 16;
|
|
1103
1099
|
break;
|
|
1104
|
-
case
|
|
1100
|
+
case 15:
|
|
1105
1101
|
(_this$contacts2 = this.contacts) === null || _this$contacts2 === void 0 ? void 0 : _this$contacts2.push(contact);
|
|
1106
|
-
case
|
|
1102
|
+
case 16:
|
|
1107
1103
|
_Logger.default.log("Contact successfully created", loggerContext);
|
|
1108
1104
|
return _context15.abrupt("return", contactResponse);
|
|
1109
|
-
case
|
|
1110
|
-
_context15.prev =
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
|
|
1116
|
-
_context15.next = 61;
|
|
1105
|
+
case 17:
|
|
1106
|
+
_context15.prev = 17;
|
|
1107
|
+
_t13 = _context15["catch"](1);
|
|
1108
|
+
_Logger.default.error("Failed to create contact: ".concat((0, _stringify.default)(_t13)), loggerContext);
|
|
1109
|
+
errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t13, loggerContext);
|
|
1110
|
+
_context15.next = 18;
|
|
1117
1111
|
return (0, _Utils.uploadLogs)();
|
|
1118
|
-
case
|
|
1112
|
+
case 18:
|
|
1119
1113
|
return _context15.abrupt("return", errorStatus);
|
|
1120
|
-
case
|
|
1114
|
+
case 19:
|
|
1121
1115
|
case "end":
|
|
1122
1116
|
return _context15.stop();
|
|
1123
1117
|
}
|
|
1124
|
-
}, _callee15, this, [[
|
|
1118
|
+
}, _callee15, this, [[1, 17]]);
|
|
1125
1119
|
}));
|
|
1126
1120
|
function createContact(_x16) {
|
|
1127
1121
|
return _createContact.apply(this, arguments);
|
|
@@ -1137,8 +1131,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
1137
1131
|
key: "deleteContact",
|
|
1138
1132
|
value: (function () {
|
|
1139
1133
|
var _deleteContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16(contactId) {
|
|
1140
|
-
var loggerContext, _this$contacts3, response, contactResponse, contactToDelete, _this$contacts4,
|
|
1141
|
-
return _regenerator.default.wrap(function
|
|
1134
|
+
var loggerContext, _this$contacts3, response, contactResponse, contactToDelete, _this$contacts4, errorStatus, _t14;
|
|
1135
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
1142
1136
|
while (1) switch (_context16.prev = _context16.next) {
|
|
1143
1137
|
case 0:
|
|
1144
1138
|
loggerContext = {
|
|
@@ -1146,15 +1140,15 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
1146
1140
|
method: _constants2.METHODS.DELETE_CONTACT
|
|
1147
1141
|
};
|
|
1148
1142
|
_Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with contactId: ").concat(contactId), loggerContext);
|
|
1149
|
-
_context16.prev =
|
|
1143
|
+
_context16.prev = 1;
|
|
1150
1144
|
_Logger.default.info("Deleting contact : ".concat(contactId), loggerContext);
|
|
1151
|
-
_context16.next =
|
|
1145
|
+
_context16.next = 2;
|
|
1152
1146
|
return this.webex.request({
|
|
1153
1147
|
// eslint-disable-next-line no-underscore-dangle
|
|
1154
|
-
uri: "".concat(this.
|
|
1148
|
+
uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER, "/").concat(contactId),
|
|
1155
1149
|
method: _types.HTTP_METHODS.DELETE
|
|
1156
1150
|
});
|
|
1157
|
-
case
|
|
1151
|
+
case 2:
|
|
1158
1152
|
response = _context16.sent;
|
|
1159
1153
|
contactResponse = {
|
|
1160
1154
|
statusCode: Number(response[_constants.STATUS_CODE]),
|
|
@@ -1169,22 +1163,20 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
1169
1163
|
}
|
|
1170
1164
|
_Logger.default.log("Contact ".concat(contactId, " successfully deleted"), loggerContext);
|
|
1171
1165
|
return _context16.abrupt("return", contactResponse);
|
|
1172
|
-
case
|
|
1173
|
-
_context16.prev =
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
|
|
1179
|
-
_context16.next = 22;
|
|
1166
|
+
case 3:
|
|
1167
|
+
_context16.prev = 3;
|
|
1168
|
+
_t14 = _context16["catch"](1);
|
|
1169
|
+
_Logger.default.error("Unable to delete contact ".concat(contactId, ": ").concat((0, _stringify.default)(_t14)), loggerContext);
|
|
1170
|
+
errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t14, loggerContext);
|
|
1171
|
+
_context16.next = 4;
|
|
1180
1172
|
return (0, _Utils.uploadLogs)();
|
|
1181
|
-
case
|
|
1173
|
+
case 4:
|
|
1182
1174
|
return _context16.abrupt("return", errorStatus);
|
|
1183
|
-
case
|
|
1175
|
+
case 5:
|
|
1184
1176
|
case "end":
|
|
1185
1177
|
return _context16.stop();
|
|
1186
1178
|
}
|
|
1187
|
-
}, _callee16, this, [[
|
|
1179
|
+
}, _callee16, this, [[1, 3]]);
|
|
1188
1180
|
}));
|
|
1189
1181
|
function deleteContact(_x17) {
|
|
1190
1182
|
return _deleteContact.apply(this, arguments);
|
|
@@ -1201,7 +1193,6 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
|
|
|
1201
1193
|
return this.sdkConnector;
|
|
1202
1194
|
}
|
|
1203
1195
|
}]);
|
|
1204
|
-
return ContactsClient;
|
|
1205
1196
|
}();
|
|
1206
1197
|
/**
|
|
1207
1198
|
* Creates a ContactsClient instance
|