@webex/calling 3.12.0-webex-services-ready.4 → 3.13.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/dist/CallRecording/WxcCallRecordingConnector.js +345 -174
- package/dist/CallRecording/WxcCallRecordingConnector.js.map +1 -1
- package/dist/CallRecording/WxcCallRecordingConnector.test.js +354 -182
- package/dist/CallRecording/WxcCallRecordingConnector.test.js.map +1 -1
- package/dist/CallRecording/callRecordingFixtures.js +40 -9
- package/dist/CallRecording/callRecordingFixtures.js.map +1 -1
- package/dist/CallRecording/constants.js +12 -27
- package/dist/CallRecording/constants.js.map +1 -1
- package/dist/CallRecording/types.js +21 -16
- package/dist/CallRecording/types.js.map +1 -1
- package/dist/CallRecording/userhub.js +117 -0
- package/dist/CallRecording/userhub.js.map +1 -0
- package/dist/CallRecording/utils.js +3 -3
- package/dist/CallRecording/utils.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +19 -13
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +383 -185
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +3 -1
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +12 -2
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +15 -8
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +617 -527
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/constants.js +5 -2
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +23 -2
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +87 -17
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +559 -411
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +646 -83
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js +26 -0
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/Errors/types.js +2 -0
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/types.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/common/Utils.js +124 -105
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +346 -243
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/callUtils.js +187 -0
- package/dist/common/callUtils.js.map +1 -0
- package/dist/common/callUtils.test.js +313 -0
- package/dist/common/callUtils.test.js.map +1 -0
- package/dist/common/constants.js +27 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/index.js +11 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/testUtil.js +2 -1
- package/dist/common/testUtil.js.map +1 -1
- package/dist/mobius-socket/mobius-socket-events.test.js +1 -0
- package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -1
- package/dist/mobius-socket/mobius-socket.test.js +12 -12
- package/dist/mobius-socket/mobius-socket.test.js.map +1 -1
- package/dist/mobius-socket/socket/socket-base.js +10 -0
- package/dist/mobius-socket/socket/socket-base.js.map +1 -1
- package/dist/mobius-socket/socket.test.js +34 -14
- package/dist/mobius-socket/socket.test.js.map +1 -1
- package/dist/module/CallRecording/WxcCallRecordingConnector.js +155 -63
- package/dist/module/CallRecording/callRecordingFixtures.js +38 -8
- package/dist/module/CallRecording/constants.js +11 -12
- package/dist/module/CallRecording/userhub.js +100 -0
- package/dist/module/CallingClient/CallingClient.js +12 -11
- package/dist/module/CallingClient/calling/CallerId/index.js +2 -2
- package/dist/module/CallingClient/calling/call.js +10 -3
- package/dist/module/CallingClient/constants.js +3 -0
- package/dist/module/CallingClient/line/index.js +9 -1
- package/dist/module/CallingClient/registration/register.js +69 -16
- package/dist/module/CallingClient/registration/types.js +5 -1
- package/dist/module/Errors/types.js +2 -0
- package/dist/module/common/Utils.js +43 -43
- package/dist/module/common/callUtils.js +90 -0
- package/dist/module/common/constants.js +11 -0
- package/dist/module/common/index.js +1 -0
- package/dist/module/common/testUtil.js +1 -0
- package/dist/module/mobius-socket/socket/socket-base.js +8 -0
- package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts +6 -2
- package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts.map +1 -1
- package/dist/types/CallRecording/callRecordingFixtures.d.ts +95 -4
- package/dist/types/CallRecording/callRecordingFixtures.d.ts.map +1 -1
- package/dist/types/CallRecording/constants.d.ts +11 -12
- package/dist/types/CallRecording/constants.d.ts.map +1 -1
- package/dist/types/CallRecording/types.d.ts +11 -3
- package/dist/types/CallRecording/types.d.ts.map +1 -1
- package/dist/types/CallRecording/userhub.d.ts +44 -0
- package/dist/types/CallRecording/userhub.d.ts.map +1 -0
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.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/line/index.d.ts +2 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +3 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +22 -0
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/types.d.ts +2 -0
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/Errors/types.d.ts +2 -0
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Events/types.d.ts +1 -1
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +1 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +4 -6
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/callUtils.d.ts +6 -0
- package/dist/types/common/callUtils.d.ts.map +1 -0
- package/dist/types/common/constants.d.ts +6 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/index.d.ts +1 -0
- package/dist/types/common/index.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/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -1
- package/package.json +12 -11
|
@@ -12,9 +12,8 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
12
12
|
value: true
|
|
13
13
|
});
|
|
14
14
|
exports.WxcCallRecordingConnector = void 0;
|
|
15
|
-
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
16
15
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
17
|
-
var
|
|
16
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
18
17
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
19
18
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
20
19
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
@@ -22,6 +21,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
22
21
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
|
|
23
22
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
|
|
24
23
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
24
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/typeof"));
|
|
25
25
|
var _SDKConnector = _interopRequireDefault(require("../SDKConnector"));
|
|
26
26
|
var _types = require("../common/types");
|
|
27
27
|
var _Logger = _interopRequireDefault(require("../Logger"));
|
|
@@ -31,18 +31,46 @@ var _types2 = require("../Events/types");
|
|
|
31
31
|
var _impl = require("../Events/impl");
|
|
32
32
|
var _types3 = require("./types");
|
|
33
33
|
var _constants2 = require("./constants");
|
|
34
|
+
var _userhub = require("./userhub");
|
|
34
35
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
35
36
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
36
37
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
37
38
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable dot-notation */ /* eslint-disable no-underscore-dangle */
|
|
39
|
+
/**
|
|
40
|
+
* User Hub error bodies are non-enumerable on WebexHttpError, so JSON.stringify drops them.
|
|
41
|
+
* Keep the server message (no tokens) so the sample can show why the list failed.
|
|
42
|
+
*/
|
|
43
|
+
function readUserhubErrorDetail(err) {
|
|
44
|
+
if (!err || (0, _typeof2.default)(err) !== 'object') {
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
47
|
+
var body = err.body;
|
|
48
|
+
if (typeof body === 'string') {
|
|
49
|
+
return body.slice(0, 500);
|
|
50
|
+
}
|
|
51
|
+
if (!body || (0, _typeof2.default)(body) !== 'object') {
|
|
52
|
+
return '';
|
|
53
|
+
}
|
|
54
|
+
var record = body;
|
|
55
|
+
var parts = [record.errorCode, record.message, record.error, record.trackingId].filter(function (part) {
|
|
56
|
+
return typeof part === 'string' && part.trim();
|
|
57
|
+
});
|
|
58
|
+
if (parts.length > 0) {
|
|
59
|
+
return parts.join(' ').slice(0, 500);
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
return (0, _stringify.default)(body).slice(0, 500);
|
|
63
|
+
} catch (_unused) {
|
|
64
|
+
return '';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
38
68
|
/**
|
|
39
69
|
* Webex Calling (WXC) backend connector for Post Call Recording.
|
|
40
70
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* `callRecording:*` events). The {@link CallRecording} facade selects this connector when the
|
|
45
|
-
* resolved calling backend is WXC.
|
|
71
|
+
* Userhub NG only (`webex-user-hub-service` / `webappng/api/v1/hub/convergedRecordings`),
|
|
72
|
+
* matching the working browser POC and native desktop. Hydra download links CORS-fail
|
|
73
|
+
* in browser hosts; userhub playback / aibridge links do not.
|
|
46
74
|
*/
|
|
47
75
|
var WxcCallRecordingConnector = exports.WxcCallRecordingConnector = /*#__PURE__*/function (_Eventing) {
|
|
48
76
|
/**
|
|
@@ -50,13 +78,11 @@ var WxcCallRecordingConnector = exports.WxcCallRecordingConnector = /*#__PURE__*
|
|
|
50
78
|
* @param logger - Logger interface used to set the log level for the module.
|
|
51
79
|
*/
|
|
52
80
|
function WxcCallRecordingConnector(webex, logger) {
|
|
53
|
-
var _this$webex$internal$, _this$webex$internal$2;
|
|
54
81
|
var _this;
|
|
55
82
|
(0, _classCallCheck2.default)(this, WxcCallRecordingConnector);
|
|
56
83
|
_this = _callSuper(this, WxcCallRecordingConnector);
|
|
57
84
|
(0, _defineProperty2.default)(_this, "sdkConnector", void 0);
|
|
58
85
|
(0, _defineProperty2.default)(_this, "webex", void 0);
|
|
59
|
-
(0, _defineProperty2.default)(_this, "recordingServiceUrl", void 0);
|
|
60
86
|
// `event` is optional because SDKConnector.registerListener invokes callbacks as `(data?: T)`.
|
|
61
87
|
// `data` uses optional chaining at runtime because malformed Mercury payloads may omit it.
|
|
62
88
|
(0, _defineProperty2.default)(_this, "handleRecordingCreatedEvent", /*#__PURE__*/function () {
|
|
@@ -155,69 +181,212 @@ var WxcCallRecordingConnector = exports.WxcCallRecordingConnector = /*#__PURE__*
|
|
|
155
181
|
_SDKConnector.default.setWebex(webex);
|
|
156
182
|
}
|
|
157
183
|
_this.webex = _this.sdkConnector.getWebex();
|
|
158
|
-
|
|
159
|
-
// Resolve the Post Call Recording base URL (hydra developer API) directly from the u2c
|
|
160
|
-
// service catalog. The catalog is populated by the host SDK's service discovery, so no
|
|
161
|
-
// dedicated recording plugin is required.
|
|
162
|
-
_this.recordingServiceUrl = ((_this$webex$internal$ = _this.webex.internal.services._serviceUrls) === null || _this$webex$internal$ === void 0 ? void 0 : _this$webex$internal$.hydraDeveloperApi) || _this.webex.internal.services.get((_this$webex$internal$2 = _this.webex.internal.services._activeServices) === null || _this$webex$internal$2 === void 0 ? void 0 : _this$webex$internal$2.hydraDeveloperApi);
|
|
163
184
|
_this.registerRecordingListeners();
|
|
164
185
|
_Logger.default.setLogger(logger.level, _constants2.CALL_RECORDING_FILE);
|
|
165
186
|
return _this;
|
|
166
187
|
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Builds the `convergedRecordings` collection URL with the list query parameters.
|
|
170
|
-
*
|
|
171
|
-
* The converged recordings API only returns results when the request is bounded by BOTH a
|
|
172
|
-
* `from` and a `to` timestamp, so this method always sends both (a `from`-only request comes
|
|
173
|
-
* back empty). When the caller does not supply an explicit `from`, it is derived from the
|
|
174
|
-
* `days` lookback (`now - days`, default {@link DEFAULT_NUMBER_OF_DAYS}); when `to` is omitted
|
|
175
|
-
* it defaults to the current time (`now`). `status` and `max` default to `available` and `30`.
|
|
176
|
-
* The remaining filters (`serviceType`, `format`, `ownerType`, `storageRegion`, `locationId`,
|
|
177
|
-
* `topic`) are pass-through and only appended when the caller provides them.
|
|
178
|
-
*
|
|
179
|
-
* @param options - Optional time window/filtering/pagination from {@link GetRecordingsOptions}.
|
|
180
|
-
* @returns The fully-qualified request URL.
|
|
181
|
-
*/
|
|
182
188
|
(0, _inherits2.default)(WxcCallRecordingConnector, _Eventing);
|
|
183
189
|
return (0, _createClass2.default)(WxcCallRecordingConnector, [{
|
|
184
|
-
key: "
|
|
185
|
-
value: function
|
|
186
|
-
var
|
|
187
|
-
var
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
key: "resolveUserhubBaseUrl",
|
|
191
|
+
value: function resolveUserhubBaseUrl() {
|
|
192
|
+
var _this$webex$internal$;
|
|
193
|
+
var catalogUrl = ((_this$webex$internal$ = this.webex.internal.services._serviceUrls) === null || _this$webex$internal$ === void 0 ? void 0 : _this$webex$internal$[_constants2.USERHUB_SERVICE_NAME]) || (typeof this.webex.internal.services.get === 'function' ? this.webex.internal.services.get(_constants2.USERHUB_SERVICE_NAME) : '');
|
|
194
|
+
return (0, _userhub.joinUserhubRecordingsUrl)(catalogUrl || '');
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* List query: `orderType=DESC&orderBy=appCreateTime&status=available&category=calling&offset&limit`.
|
|
199
|
+
* User Hub does not need `siteurl` for calling recordings. A wrong site name returns 500.
|
|
200
|
+
*/
|
|
201
|
+
}, {
|
|
202
|
+
key: "buildUserhubRecordingsUrl",
|
|
203
|
+
value: function buildUserhubRecordingsUrl(options) {
|
|
204
|
+
var _options$status, _options$max;
|
|
205
|
+
var baseUrl = this.resolveUserhubBaseUrl();
|
|
206
|
+
if (!baseUrl) {
|
|
207
|
+
return '';
|
|
194
208
|
}
|
|
195
|
-
var
|
|
196
|
-
params.append(_constants2.
|
|
197
|
-
params.append(_constants2.
|
|
209
|
+
var params = new URLSearchParams();
|
|
210
|
+
params.append(_constants2.ORDER_TYPE, _constants2.DEFAULT_ORDER_TYPE);
|
|
211
|
+
params.append(_constants2.ORDER_BY, _constants2.DEFAULT_ORDER_BY);
|
|
198
212
|
params.append(_constants2.STATUS, (_options$status = options === null || options === void 0 ? void 0 : options.status) !== null && _options$status !== void 0 ? _options$status : _constants2.DEFAULT_STATUS);
|
|
199
|
-
params.append(_constants2.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
var optionalParams = [[_constants2.SERVICE_TYPE, options === null || options === void 0 ? void 0 : options.serviceType], [_constants2.FORMAT, options === null || options === void 0 ? void 0 : options.format], [_constants2.OWNER_TYPE, options === null || options === void 0 ? void 0 : options.ownerType], [_constants2.STORAGE_REGION, options === null || options === void 0 ? void 0 : options.storageRegion], [_constants2.LOCATION_ID, options === null || options === void 0 ? void 0 : options.locationId], [_constants2.TOPIC, options === null || options === void 0 ? void 0 : options.topic]];
|
|
204
|
-
optionalParams.forEach(function (_ref4) {
|
|
205
|
-
var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
|
|
206
|
-
key = _ref5[0],
|
|
207
|
-
value = _ref5[1];
|
|
208
|
-
if (value) {
|
|
209
|
-
params.append(key, value);
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
return "".concat(this.recordingServiceUrl, "/").concat(_constants2.CONVERGED_RECORDINGS, "?").concat(params.toString());
|
|
213
|
+
params.append(_constants2.CATEGORY, _constants2.DEFAULT_CATEGORY);
|
|
214
|
+
params.append(_constants2.OFFSET, _constants2.DEFAULT_OFFSET);
|
|
215
|
+
params.append(_constants2.LIMIT, "".concat((_options$max = options === null || options === void 0 ? void 0 : options.max) !== null && _options$max !== void 0 ? _options$max : _constants2.DEFAULT_MAX));
|
|
216
|
+
return "".concat(baseUrl, "?").concat(params.toString());
|
|
213
217
|
}
|
|
214
|
-
|
|
218
|
+
}, {
|
|
219
|
+
key: "buildUserhubRecordingUrl",
|
|
220
|
+
value: function buildUserhubRecordingUrl(recordingId) {
|
|
221
|
+
var baseUrl = this.resolveUserhubBaseUrl();
|
|
222
|
+
if (!baseUrl) {
|
|
223
|
+
return '';
|
|
224
|
+
}
|
|
225
|
+
return "".concat(baseUrl, "/").concat(encodeURIComponent(recordingId));
|
|
226
|
+
}
|
|
227
|
+
}, {
|
|
228
|
+
key: "buildUserhubSoftDeleteUrl",
|
|
229
|
+
value: function buildUserhubSoftDeleteUrl() {
|
|
230
|
+
var baseUrl = this.resolveUserhubBaseUrl();
|
|
231
|
+
return baseUrl ? "".concat(baseUrl, "/").concat(_constants2.SOFT_DELETE) : '';
|
|
232
|
+
}
|
|
233
|
+
}, {
|
|
234
|
+
key: "userhubRequest",
|
|
235
|
+
value: function () {
|
|
236
|
+
var _userhubRequest = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(url, method, body) {
|
|
237
|
+
var logMethod,
|
|
238
|
+
error,
|
|
239
|
+
supertoken,
|
|
240
|
+
statusCode,
|
|
241
|
+
_args4 = arguments,
|
|
242
|
+
_t2;
|
|
243
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
244
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
245
|
+
case 0:
|
|
246
|
+
logMethod = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : _constants2.METHODS.GET_RECORDINGS;
|
|
247
|
+
if (url) {
|
|
248
|
+
_context4.next = 1;
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
error = new Error('User Hub recordings URL is empty');
|
|
252
|
+
error.statusCode = 503;
|
|
253
|
+
throw error;
|
|
254
|
+
case 1:
|
|
255
|
+
supertoken = this.webex.credentials.supertoken; // The pasted access token. webex.request calls getUserToken(), which downscopes
|
|
256
|
+
// that token (drops spark:kms). User Hub 500s on the downscoped token. The Teams
|
|
257
|
+
// POC sends the original user token with Accept and WebexUserRequest only.
|
|
258
|
+
if (!supertoken) {
|
|
259
|
+
_context4.next = 2;
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
return _context4.abrupt("return", this.userhubFetch(url, method, body, supertoken));
|
|
263
|
+
case 2:
|
|
264
|
+
_context4.prev = 2;
|
|
265
|
+
_context4.next = 3;
|
|
266
|
+
return this.webex.request(_objectSpread({
|
|
267
|
+
uri: url,
|
|
268
|
+
method: method,
|
|
269
|
+
headers: (0, _defineProperty2.default)({
|
|
270
|
+
Accept: 'application/json'
|
|
271
|
+
}, _constants2.WEBEX_USER_REQUEST_HEADER, 'true')
|
|
272
|
+
}, body ? {
|
|
273
|
+
body: body
|
|
274
|
+
} : {}));
|
|
275
|
+
case 3:
|
|
276
|
+
return _context4.abrupt("return", _context4.sent);
|
|
277
|
+
case 4:
|
|
278
|
+
_context4.prev = 4;
|
|
279
|
+
_t2 = _context4["catch"](2);
|
|
280
|
+
statusCode = Number(_t2 === null || _t2 === void 0 ? void 0 : _t2.statusCode);
|
|
281
|
+
if (!(statusCode !== 500)) {
|
|
282
|
+
_context4.next = 5;
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
throw _t2;
|
|
286
|
+
case 5:
|
|
287
|
+
_Logger.default.info('User Hub returned 500 from webex.request; retrying with the user token only', {
|
|
288
|
+
file: _constants2.CALL_RECORDING_FILE,
|
|
289
|
+
method: logMethod
|
|
290
|
+
});
|
|
291
|
+
return _context4.abrupt("return", this.userhubFetch(url, method, body));
|
|
292
|
+
case 6:
|
|
293
|
+
case "end":
|
|
294
|
+
return _context4.stop();
|
|
295
|
+
}
|
|
296
|
+
}, _callee4, this, [[2, 4]]);
|
|
297
|
+
}));
|
|
298
|
+
function userhubRequest(_x4, _x5, _x6) {
|
|
299
|
+
return _userhubRequest.apply(this, arguments);
|
|
300
|
+
}
|
|
301
|
+
return userhubRequest;
|
|
302
|
+
}()
|
|
303
|
+
/**
|
|
304
|
+
* Same request the Teams userhub POC uses: the original user token,
|
|
305
|
+
* Accept, and WebexUserRequest. No cisco-device-url or spark-user-agent.
|
|
306
|
+
*/
|
|
307
|
+
}, {
|
|
308
|
+
key: "userhubFetch",
|
|
309
|
+
value: (function () {
|
|
310
|
+
var _userhubFetch = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(url, method, body, tokenOverride) {
|
|
311
|
+
var token, rendered, authorization, headers, response, text, parsed, payload, _t3;
|
|
312
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
313
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
314
|
+
case 0:
|
|
315
|
+
if (!(tokenOverride !== null && tokenOverride !== void 0)) {
|
|
316
|
+
_context5.next = 1;
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
_t3 = tokenOverride;
|
|
320
|
+
_context5.next = 3;
|
|
321
|
+
break;
|
|
322
|
+
case 1:
|
|
323
|
+
_context5.next = 2;
|
|
324
|
+
return this.webex.credentials.getUserToken();
|
|
325
|
+
case 2:
|
|
326
|
+
_t3 = _context5.sent;
|
|
327
|
+
case 3:
|
|
328
|
+
token = _t3;
|
|
329
|
+
// Token#toString() is already "Bearer <access_token>". Prefixing again is a 401.
|
|
330
|
+
rendered = String(token);
|
|
331
|
+
authorization = /^Bearer\s/i.test(rendered) ? rendered : "Bearer ".concat(rendered);
|
|
332
|
+
headers = (0, _defineProperty2.default)({
|
|
333
|
+
Accept: 'application/json',
|
|
334
|
+
Authorization: authorization
|
|
335
|
+
}, _constants2.WEBEX_USER_REQUEST_HEADER, 'true');
|
|
336
|
+
if (body) {
|
|
337
|
+
headers['Content-Type'] = 'application/json';
|
|
338
|
+
}
|
|
339
|
+
_context5.next = 4;
|
|
340
|
+
return fetch(url, _objectSpread({
|
|
341
|
+
method: method,
|
|
342
|
+
headers: headers
|
|
343
|
+
}, body ? {
|
|
344
|
+
body: (0, _stringify.default)(body)
|
|
345
|
+
} : {}));
|
|
346
|
+
case 4:
|
|
347
|
+
response = _context5.sent;
|
|
348
|
+
_context5.next = 5;
|
|
349
|
+
return response.text();
|
|
350
|
+
case 5:
|
|
351
|
+
text = _context5.sent;
|
|
352
|
+
if (text) {
|
|
353
|
+
try {
|
|
354
|
+
parsed = JSON.parse(text);
|
|
355
|
+
} catch (_unused2) {
|
|
356
|
+
parsed = {
|
|
357
|
+
message: text
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
payload = {
|
|
362
|
+
statusCode: response.status,
|
|
363
|
+
body: parsed
|
|
364
|
+
};
|
|
365
|
+
if (response.ok) {
|
|
366
|
+
_context5.next = 6;
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
throw payload;
|
|
370
|
+
case 6:
|
|
371
|
+
return _context5.abrupt("return", payload);
|
|
372
|
+
case 7:
|
|
373
|
+
case "end":
|
|
374
|
+
return _context5.stop();
|
|
375
|
+
}
|
|
376
|
+
}, _callee5, this);
|
|
377
|
+
}));
|
|
378
|
+
function userhubFetch(_x7, _x8, _x9, _x0) {
|
|
379
|
+
return _userhubFetch.apply(this, arguments);
|
|
380
|
+
}
|
|
381
|
+
return userhubFetch;
|
|
382
|
+
}()
|
|
215
383
|
/**
|
|
216
384
|
* Reads Post Call Recordings, dispatching to the matching operation based on the request `type`.
|
|
217
385
|
* The concrete response type is inferred per request via {@link RecordingResponseFor}.
|
|
218
386
|
*
|
|
219
387
|
* @param request - The discriminated read request.
|
|
220
388
|
*/
|
|
389
|
+
)
|
|
221
390
|
}, {
|
|
222
391
|
key: "getCallRecording",
|
|
223
392
|
value: function getCallRecording(request) {
|
|
@@ -259,55 +428,71 @@ var WxcCallRecordingConnector = exports.WxcCallRecordingConnector = /*#__PURE__*
|
|
|
259
428
|
}, {
|
|
260
429
|
key: "getRecordings",
|
|
261
430
|
value: (function () {
|
|
262
|
-
var _getRecordings = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
263
|
-
var loggerContext, _response$headers, _response$body, _body$
|
|
264
|
-
return _regenerator.default.wrap(function (
|
|
265
|
-
while (1) switch (
|
|
431
|
+
var _getRecordings = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(options) {
|
|
432
|
+
var loggerContext, requestUrl, _response$headers, _response$body, _ref4, _body$recordings, _responseDetails$data, _responseDetails$data2, response, body, recordings, responseDetails, serverDetail, errorInfo, handled, _handled$data, detail, _t4;
|
|
433
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
434
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
266
435
|
case 0:
|
|
267
436
|
loggerContext = {
|
|
268
437
|
file: _constants2.CALL_RECORDING_FILE,
|
|
269
438
|
method: _constants2.METHODS.GET_RECORDINGS
|
|
270
439
|
};
|
|
271
440
|
_Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with options=").concat((0, _stringify.default)(options !== null && options !== void 0 ? options : {})), loggerContext);
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
return this.
|
|
276
|
-
uri: url,
|
|
277
|
-
method: _types.HTTP_METHODS.GET,
|
|
278
|
-
service: _types.ALLOWED_SERVICES.HYDRA_DEVELOPER_API
|
|
279
|
-
}, options !== null && options !== void 0 && options.webexUserRequest ? {
|
|
280
|
-
headers: (0, _defineProperty2.default)({}, _constants2.WEBEX_USER_REQUEST_HEADER, 'true')
|
|
281
|
-
} : {}));
|
|
441
|
+
requestUrl = '';
|
|
442
|
+
_context6.prev = 1;
|
|
443
|
+
_context6.next = 2;
|
|
444
|
+
return this.buildUserhubRecordingsUrl(options);
|
|
282
445
|
case 2:
|
|
283
|
-
|
|
446
|
+
requestUrl = _context6.sent;
|
|
447
|
+
_context6.next = 3;
|
|
448
|
+
return this.userhubRequest(requestUrl, _types.HTTP_METHODS.GET);
|
|
449
|
+
case 3:
|
|
450
|
+
response = _context6.sent;
|
|
284
451
|
_Logger.default.log("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);
|
|
285
452
|
body = (_response$body = response.body) !== null && _response$body !== void 0 ? _response$body : {};
|
|
453
|
+
recordings = ((_ref4 = (_body$recordings = body.recordings) !== null && _body$recordings !== void 0 ? _body$recordings : body.items) !== null && _ref4 !== void 0 ? _ref4 : []).map(_userhub.mapUserhubRecording).filter(function (item) {
|
|
454
|
+
return item.id;
|
|
455
|
+
});
|
|
286
456
|
responseDetails = {
|
|
287
457
|
statusCode: Number(response.statusCode) || _constants.SUCCESS_STATUS_CODE,
|
|
288
458
|
data: {
|
|
289
|
-
recordings:
|
|
459
|
+
recordings: recordings
|
|
290
460
|
},
|
|
291
461
|
message: _constants.SUCCESS_MESSAGE
|
|
292
462
|
};
|
|
293
463
|
_Logger.default.log("Successfully retrieved ".concat((_responseDetails$data = (_responseDetails$data2 = responseDetails.data.recordings) === null || _responseDetails$data2 === void 0 ? void 0 : _responseDetails$data2.length) !== null && _responseDetails$data !== void 0 ? _responseDetails$data : 0, " recordings"), loggerContext);
|
|
294
|
-
return
|
|
295
|
-
case 3:
|
|
296
|
-
_context4.prev = 3;
|
|
297
|
-
_t2 = _context4["catch"](1);
|
|
298
|
-
_Logger.default.error("Failed to get recordings: ".concat((0, _stringify.default)(_t2)), loggerContext);
|
|
299
|
-
_context4.next = 4;
|
|
300
|
-
return (0, _Utils.uploadLogs)();
|
|
464
|
+
return _context6.abrupt("return", responseDetails);
|
|
301
465
|
case 4:
|
|
302
|
-
|
|
303
|
-
|
|
466
|
+
_context6.prev = 4;
|
|
467
|
+
_t4 = _context6["catch"](1);
|
|
468
|
+
serverDetail = readUserhubErrorDetail(_t4);
|
|
469
|
+
_Logger.default.error("Failed to get recordings: ".concat(serverDetail || (0, _stringify.default)(_t4)), loggerContext);
|
|
470
|
+
_context6.next = 5;
|
|
471
|
+
return (0, _Utils.uploadLogs)();
|
|
304
472
|
case 5:
|
|
473
|
+
errorInfo = _t4;
|
|
474
|
+
_context6.next = 6;
|
|
475
|
+
return (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
|
|
476
|
+
case 6:
|
|
477
|
+
handled = _context6.sent;
|
|
478
|
+
if (Number(handled.statusCode) === 500) {
|
|
479
|
+
detail = [serverDetail || ((_handled$data = handled.data) === null || _handled$data === void 0 ? void 0 : _handled$data.error), requestUrl ? "url=".concat(requestUrl) : ''].filter(function (part) {
|
|
480
|
+
return part;
|
|
481
|
+
}).join(' | ');
|
|
482
|
+
if (detail) {
|
|
483
|
+
handled.data.error = detail;
|
|
484
|
+
}
|
|
485
|
+
} else if (serverDetail) {
|
|
486
|
+
handled.data.error = serverDetail;
|
|
487
|
+
}
|
|
488
|
+
return _context6.abrupt("return", handled);
|
|
489
|
+
case 7:
|
|
305
490
|
case "end":
|
|
306
|
-
return
|
|
491
|
+
return _context6.stop();
|
|
307
492
|
}
|
|
308
|
-
},
|
|
493
|
+
}, _callee6, this, [[1, 4]]);
|
|
309
494
|
}));
|
|
310
|
-
function getRecordings(
|
|
495
|
+
function getRecordings(_x1) {
|
|
311
496
|
return _getRecordings.apply(this, arguments);
|
|
312
497
|
}
|
|
313
498
|
return getRecordings;
|
|
@@ -320,52 +505,48 @@ var WxcCallRecordingConnector = exports.WxcCallRecordingConnector = /*#__PURE__*
|
|
|
320
505
|
}, {
|
|
321
506
|
key: "getRecording",
|
|
322
507
|
value: (function () {
|
|
323
|
-
var _getRecording = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
324
|
-
var loggerContext, _response$headers2,
|
|
325
|
-
return _regenerator.default.wrap(function (
|
|
326
|
-
while (1) switch (
|
|
508
|
+
var _getRecording = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7(recordingId) {
|
|
509
|
+
var loggerContext, _response$headers2, response, recording, responseDetails, errorInfo, _t5;
|
|
510
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
511
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
327
512
|
case 0:
|
|
328
513
|
loggerContext = {
|
|
329
514
|
file: _constants2.CALL_RECORDING_FILE,
|
|
330
515
|
method: _constants2.METHODS.GET_RECORDING
|
|
331
516
|
};
|
|
332
517
|
_Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with recordingId=").concat(recordingId), loggerContext);
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
return this.webex.request({
|
|
337
|
-
uri: url,
|
|
338
|
-
method: _types.HTTP_METHODS.GET,
|
|
339
|
-
service: _types.ALLOWED_SERVICES.HYDRA_DEVELOPER_API
|
|
340
|
-
});
|
|
518
|
+
_context7.prev = 1;
|
|
519
|
+
_context7.next = 2;
|
|
520
|
+
return this.userhubRequest(this.buildUserhubRecordingUrl(recordingId), _types.HTTP_METHODS.GET, undefined, _constants2.METHODS.GET_RECORDING);
|
|
341
521
|
case 2:
|
|
342
|
-
response =
|
|
522
|
+
response = _context7.sent;
|
|
343
523
|
_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);
|
|
524
|
+
recording = (0, _userhub.mapUserhubRecording)((0, _userhub.unwrapUserhubRecording)(response.body));
|
|
344
525
|
responseDetails = {
|
|
345
526
|
statusCode: Number(response.statusCode) || _constants.SUCCESS_STATUS_CODE,
|
|
346
527
|
data: {
|
|
347
|
-
recording:
|
|
528
|
+
recording: recording
|
|
348
529
|
},
|
|
349
530
|
message: _constants.SUCCESS_MESSAGE
|
|
350
531
|
};
|
|
351
532
|
_Logger.default.log("Successfully retrieved recording ".concat(recordingId), loggerContext);
|
|
352
|
-
return
|
|
533
|
+
return _context7.abrupt("return", responseDetails);
|
|
353
534
|
case 3:
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
_Logger.default.error("Failed to get recording: ".concat((0, _stringify.default)(
|
|
357
|
-
|
|
535
|
+
_context7.prev = 3;
|
|
536
|
+
_t5 = _context7["catch"](1);
|
|
537
|
+
_Logger.default.error("Failed to get recording: ".concat(readUserhubErrorDetail(_t5) || (0, _stringify.default)(_t5)), loggerContext);
|
|
538
|
+
_context7.next = 4;
|
|
358
539
|
return (0, _Utils.uploadLogs)();
|
|
359
540
|
case 4:
|
|
360
|
-
errorInfo =
|
|
361
|
-
return
|
|
541
|
+
errorInfo = _t5;
|
|
542
|
+
return _context7.abrupt("return", (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext));
|
|
362
543
|
case 5:
|
|
363
544
|
case "end":
|
|
364
|
-
return
|
|
545
|
+
return _context7.stop();
|
|
365
546
|
}
|
|
366
|
-
},
|
|
547
|
+
}, _callee7, this, [[1, 3]]);
|
|
367
548
|
}));
|
|
368
|
-
function getRecording(
|
|
549
|
+
function getRecording(_x10) {
|
|
369
550
|
return _getRecording.apply(this, arguments);
|
|
370
551
|
}
|
|
371
552
|
return getRecording;
|
|
@@ -376,8 +557,8 @@ var WxcCallRecordingConnector = exports.WxcCallRecordingConnector = /*#__PURE__*
|
|
|
376
557
|
* Note (documented API gap): the recording API does not expose a confirmed server-side query parameter
|
|
377
558
|
* to filter by call session id, so a list is fetched and filtered client-side on
|
|
378
559
|
* `serviceData.callSessionId`. The scan is bounded by the list query, so `options` is forwarded
|
|
379
|
-
* to {@link getRecordings} to let callers
|
|
380
|
-
*
|
|
560
|
+
* to {@link getRecordings} to let callers change `status` or `max` when the target session may
|
|
561
|
+
* fall outside the first page.
|
|
381
562
|
*
|
|
382
563
|
* @param callSessionId - The call session id to filter by.
|
|
383
564
|
* @param options - Optional list query forwarded to {@link getRecordings} to control the
|
|
@@ -387,26 +568,26 @@ var WxcCallRecordingConnector = exports.WxcCallRecordingConnector = /*#__PURE__*
|
|
|
387
568
|
}, {
|
|
388
569
|
key: "getRecordingsByCallSessionId",
|
|
389
570
|
value: (function () {
|
|
390
|
-
var _getRecordingsByCallSessionId = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
571
|
+
var _getRecordingsByCallSessionId = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(callSessionId, options) {
|
|
391
572
|
var _listResponse$data$re;
|
|
392
573
|
var loggerContext, listResponse, filtered;
|
|
393
|
-
return _regenerator.default.wrap(function (
|
|
394
|
-
while (1) switch (
|
|
574
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
575
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
395
576
|
case 0:
|
|
396
577
|
loggerContext = {
|
|
397
578
|
file: _constants2.CALL_RECORDING_FILE,
|
|
398
579
|
method: _constants2.METHODS.GET_RECORDINGS_BY_CALL_SESSION_ID
|
|
399
580
|
};
|
|
400
581
|
_Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with callSessionId=").concat(callSessionId), loggerContext);
|
|
401
|
-
|
|
582
|
+
_context8.next = 1;
|
|
402
583
|
return this.getRecordings(options);
|
|
403
584
|
case 1:
|
|
404
|
-
listResponse =
|
|
585
|
+
listResponse = _context8.sent;
|
|
405
586
|
if (!(listResponse.statusCode !== _constants.SUCCESS_STATUS_CODE)) {
|
|
406
|
-
|
|
587
|
+
_context8.next = 2;
|
|
407
588
|
break;
|
|
408
589
|
}
|
|
409
|
-
return
|
|
590
|
+
return _context8.abrupt("return", listResponse);
|
|
410
591
|
case 2:
|
|
411
592
|
filtered = ((_listResponse$data$re = listResponse.data.recordings) !== null && _listResponse$data$re !== void 0 ? _listResponse$data$re : []).filter(function (recording) {
|
|
412
593
|
var _recording$serviceDat;
|
|
@@ -417,7 +598,7 @@ var WxcCallRecordingConnector = exports.WxcCallRecordingConnector = /*#__PURE__*
|
|
|
417
598
|
} else {
|
|
418
599
|
_Logger.default.log("Successfully retrieved ".concat(filtered.length, " recordings for call session ").concat(callSessionId), loggerContext);
|
|
419
600
|
}
|
|
420
|
-
return
|
|
601
|
+
return _context8.abrupt("return", {
|
|
421
602
|
statusCode: _constants.SUCCESS_STATUS_CODE,
|
|
422
603
|
data: {
|
|
423
604
|
recordings: filtered
|
|
@@ -426,11 +607,11 @@ var WxcCallRecordingConnector = exports.WxcCallRecordingConnector = /*#__PURE__*
|
|
|
426
607
|
});
|
|
427
608
|
case 3:
|
|
428
609
|
case "end":
|
|
429
|
-
return
|
|
610
|
+
return _context8.stop();
|
|
430
611
|
}
|
|
431
|
-
},
|
|
612
|
+
}, _callee8, this);
|
|
432
613
|
}));
|
|
433
|
-
function getRecordingsByCallSessionId(
|
|
614
|
+
function getRecordingsByCallSessionId(_x11, _x12) {
|
|
434
615
|
return _getRecordingsByCallSessionId.apply(this, arguments);
|
|
435
616
|
}
|
|
436
617
|
return getRecordingsByCallSessionId;
|
|
@@ -443,59 +624,55 @@ var WxcCallRecordingConnector = exports.WxcCallRecordingConnector = /*#__PURE__*
|
|
|
443
624
|
}, {
|
|
444
625
|
key: "getRecordingMetadata",
|
|
445
626
|
value: (function () {
|
|
446
|
-
var _getRecordingMetadata = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
447
|
-
var loggerContext, _response$headers3,
|
|
448
|
-
return _regenerator.default.wrap(function (
|
|
449
|
-
while (1) switch (
|
|
627
|
+
var _getRecordingMetadata = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9(recordingId) {
|
|
628
|
+
var loggerContext, _response$headers3, response, metadata, responseDetails, errorInfo, _t6;
|
|
629
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
630
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
450
631
|
case 0:
|
|
451
632
|
loggerContext = {
|
|
452
633
|
file: _constants2.CALL_RECORDING_FILE,
|
|
453
634
|
method: _constants2.METHODS.GET_RECORDING_METADATA
|
|
454
635
|
};
|
|
455
636
|
_Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with recordingId=").concat(recordingId), loggerContext);
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
return this.webex.request({
|
|
460
|
-
uri: url,
|
|
461
|
-
method: _types.HTTP_METHODS.GET,
|
|
462
|
-
service: _types.ALLOWED_SERVICES.HYDRA_DEVELOPER_API
|
|
463
|
-
});
|
|
637
|
+
_context9.prev = 1;
|
|
638
|
+
_context9.next = 2;
|
|
639
|
+
return this.userhubRequest(this.buildUserhubRecordingUrl(recordingId), _types.HTTP_METHODS.GET, undefined, _constants2.METHODS.GET_RECORDING_METADATA);
|
|
464
640
|
case 2:
|
|
465
|
-
response =
|
|
641
|
+
response = _context9.sent;
|
|
466
642
|
_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);
|
|
643
|
+
metadata = (0, _userhub.mapUserhubMetadata)((0, _userhub.unwrapUserhubRecording)(response.body));
|
|
467
644
|
responseDetails = {
|
|
468
645
|
statusCode: Number(response.statusCode) || _constants.SUCCESS_STATUS_CODE,
|
|
469
646
|
data: {
|
|
470
|
-
metadata:
|
|
647
|
+
metadata: metadata
|
|
471
648
|
},
|
|
472
649
|
message: _constants.SUCCESS_MESSAGE
|
|
473
650
|
};
|
|
474
651
|
_Logger.default.log("Successfully retrieved metadata for recording ".concat(recordingId), loggerContext);
|
|
475
|
-
return
|
|
652
|
+
return _context9.abrupt("return", responseDetails);
|
|
476
653
|
case 3:
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
_Logger.default.error("Failed to get recording metadata: ".concat((0, _stringify.default)(
|
|
480
|
-
|
|
654
|
+
_context9.prev = 3;
|
|
655
|
+
_t6 = _context9["catch"](1);
|
|
656
|
+
_Logger.default.error("Failed to get recording metadata: ".concat(readUserhubErrorDetail(_t6) || (0, _stringify.default)(_t6)), loggerContext);
|
|
657
|
+
_context9.next = 4;
|
|
481
658
|
return (0, _Utils.uploadLogs)();
|
|
482
659
|
case 4:
|
|
483
|
-
errorInfo =
|
|
484
|
-
return
|
|
660
|
+
errorInfo = _t6;
|
|
661
|
+
return _context9.abrupt("return", (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext));
|
|
485
662
|
case 5:
|
|
486
663
|
case "end":
|
|
487
|
-
return
|
|
664
|
+
return _context9.stop();
|
|
488
665
|
}
|
|
489
|
-
},
|
|
666
|
+
}, _callee9, this, [[1, 3]]);
|
|
490
667
|
}));
|
|
491
|
-
function getRecordingMetadata(
|
|
668
|
+
function getRecordingMetadata(_x13) {
|
|
492
669
|
return _getRecordingMetadata.apply(this, arguments);
|
|
493
670
|
}
|
|
494
671
|
return getRecordingMetadata;
|
|
495
672
|
}()
|
|
496
673
|
/**
|
|
497
|
-
* Moves a recording to the recycle bin (soft delete).
|
|
498
|
-
* `POST
|
|
674
|
+
* Moves a recording to the recycle bin (soft delete).
|
|
675
|
+
* `POST {userhub}/.../convergedRecordings/softDelete` with `recordUUIDs: [recordingId]`.
|
|
499
676
|
* Requires `spark:recordings_write` on the access token.
|
|
500
677
|
*
|
|
501
678
|
* Mercury emits `convergedRecordings.updated` + `eventSubType: TRASH`, which this connector
|
|
@@ -508,31 +685,25 @@ var WxcCallRecordingConnector = exports.WxcCallRecordingConnector = /*#__PURE__*
|
|
|
508
685
|
}, {
|
|
509
686
|
key: "deleteRecording",
|
|
510
687
|
value: (function () {
|
|
511
|
-
var _deleteRecording = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
688
|
+
var _deleteRecording = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0(recordingId,
|
|
512
689
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- kept for ICallRecording signature parity; soft delete ignores options
|
|
513
690
|
_options) {
|
|
514
|
-
var loggerContext, _response$headers4,
|
|
515
|
-
return _regenerator.default.wrap(function (
|
|
516
|
-
while (1) switch (
|
|
691
|
+
var loggerContext, _response$headers4, response, responseDetails, errorInfo, _t7;
|
|
692
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
693
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
517
694
|
case 0:
|
|
518
695
|
loggerContext = {
|
|
519
696
|
file: _constants2.CALL_RECORDING_FILE,
|
|
520
697
|
method: _constants2.METHODS.DELETE_RECORDING
|
|
521
698
|
};
|
|
522
699
|
_Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with recordingId=").concat(recordingId), loggerContext);
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
method: _types.HTTP_METHODS.POST,
|
|
529
|
-
service: _types.ALLOWED_SERVICES.HYDRA_DEVELOPER_API,
|
|
530
|
-
body: {
|
|
531
|
-
recordingIds: [recordingId]
|
|
532
|
-
}
|
|
533
|
-
});
|
|
700
|
+
_context0.prev = 1;
|
|
701
|
+
_context0.next = 2;
|
|
702
|
+
return this.userhubRequest(this.buildUserhubSoftDeleteUrl(), _types.HTTP_METHODS.POST, {
|
|
703
|
+
recordUUIDs: [recordingId]
|
|
704
|
+
}, _constants2.METHODS.DELETE_RECORDING);
|
|
534
705
|
case 2:
|
|
535
|
-
response =
|
|
706
|
+
response = _context0.sent;
|
|
536
707
|
_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);
|
|
537
708
|
responseDetails = {
|
|
538
709
|
statusCode: Number(response.statusCode) || _constants.SUCCESS_STATUS_CODE,
|
|
@@ -540,23 +711,23 @@ var WxcCallRecordingConnector = exports.WxcCallRecordingConnector = /*#__PURE__*
|
|
|
540
711
|
message: _constants.SUCCESS_MESSAGE
|
|
541
712
|
};
|
|
542
713
|
_Logger.default.log("Successfully moved recording ".concat(recordingId, " to recycle bin"), loggerContext);
|
|
543
|
-
return
|
|
714
|
+
return _context0.abrupt("return", responseDetails);
|
|
544
715
|
case 3:
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
_Logger.default.error("Failed to delete recording: ".concat((0, _stringify.default)(
|
|
548
|
-
|
|
716
|
+
_context0.prev = 3;
|
|
717
|
+
_t7 = _context0["catch"](1);
|
|
718
|
+
_Logger.default.error("Failed to delete recording: ".concat(readUserhubErrorDetail(_t7) || (0, _stringify.default)(_t7)), loggerContext);
|
|
719
|
+
_context0.next = 4;
|
|
549
720
|
return (0, _Utils.uploadLogs)();
|
|
550
721
|
case 4:
|
|
551
|
-
errorInfo =
|
|
552
|
-
return
|
|
722
|
+
errorInfo = _t7;
|
|
723
|
+
return _context0.abrupt("return", (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext));
|
|
553
724
|
case 5:
|
|
554
725
|
case "end":
|
|
555
|
-
return
|
|
726
|
+
return _context0.stop();
|
|
556
727
|
}
|
|
557
|
-
},
|
|
728
|
+
}, _callee0, this, [[1, 3]]);
|
|
558
729
|
}));
|
|
559
|
-
function deleteRecording(
|
|
730
|
+
function deleteRecording(_x14, _x15) {
|
|
560
731
|
return _deleteRecording.apply(this, arguments);
|
|
561
732
|
}
|
|
562
733
|
return deleteRecording;
|