@webex/webex-core 3.12.0 → 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/.repo-context.json +653 -0
- package/.sdd/manifest.json +605 -0
- package/AGENTS.md +209 -0
- package/README.md +5 -2
- package/dist/config.js +45 -0
- package/dist/config.js.map +1 -1
- package/dist/credentials-config.js +12 -0
- package/dist/credentials-config.js.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/interceptors/catalog-url.js +87 -0
- package/dist/interceptors/catalog-url.js.map +1 -0
- package/dist/interceptors/payload-transformer.js +25 -4
- package/dist/interceptors/payload-transformer.js.map +1 -1
- package/dist/lib/batcher.js +23 -7
- package/dist/lib/batcher.js.map +1 -1
- package/dist/lib/credentials/credentials.js +103 -4
- package/dist/lib/credentials/credentials.js.map +1 -1
- package/dist/lib/credentials/token.js +1 -1
- package/dist/lib/domains.js +90 -0
- package/dist/lib/domains.js.map +1 -0
- package/dist/lib/services/service-catalog.js +108 -18
- package/dist/lib/services/service-catalog.js.map +1 -1
- package/dist/lib/services/services.js +242 -38
- package/dist/lib/services/services.js.map +1 -1
- package/dist/lib/services-v2/service-catalog.js +14 -13
- package/dist/lib/services-v2/service-catalog.js.map +1 -1
- package/dist/lib/services-v2/services-v2.js +255 -42
- package/dist/lib/services-v2/services-v2.js.map +1 -1
- package/dist/lib/static-asset-loader.js +153 -0
- package/dist/lib/static-asset-loader.js.map +1 -0
- package/dist/plugins/logger.js +1 -1
- package/dist/webex-core.js +11 -3
- package/dist/webex-core.js.map +1 -1
- package/docs/adr/index.md +32 -0
- package/docs/architecture.md +298 -0
- package/docs/getting-started.md +96 -0
- package/docs/index.md +55 -0
- package/docs/specs/README.md +76 -0
- package/package.json +13 -13
- package/schemas/repo-context.schema.json +796 -0
- package/src/config.js +49 -0
- package/src/credentials-config.js +13 -0
- package/src/docs/README.md +732 -0
- package/src/index.js +2 -0
- package/src/interceptors/catalog-url.js +66 -0
- package/src/interceptors/docs/README.md +658 -0
- package/src/interceptors/payload-transformer.js +23 -1
- package/src/lib/batcher.js +25 -10
- package/src/lib/credentials/credentials.js +93 -3
- package/src/lib/credentials/docs/README.md +846 -0
- package/src/lib/domains.ts +94 -0
- package/src/lib/services/docs/README.md +737 -0
- package/src/lib/services/service-catalog.js +112 -16
- package/src/lib/services/services.js +220 -22
- package/src/lib/services-v2/docs/README.md +751 -0
- package/src/lib/services-v2/service-catalog.ts +16 -12
- package/src/lib/services-v2/services-v2.ts +234 -24
- package/src/lib/static-asset-loader.ts +128 -0
- package/src/lib/storage/docs/README.md +646 -0
- package/src/webex-core.js +8 -0
- package/test/fixtures/activation-email.ts +22 -0
- package/test/integration/spec/services/services.js +183 -112
- package/test/integration/spec/services-v2/services-v2.js +169 -98
- package/test/unit/spec/credentials/credentials.js +247 -3
- package/test/unit/spec/interceptors/auth.js +56 -0
- package/test/unit/spec/interceptors/catalog-url.js +224 -0
- package/test/unit/spec/interceptors/payload-transformer.js +119 -1
- package/test/unit/spec/lib/batcher.js +56 -0
- package/test/unit/spec/services/service-catalog.js +368 -11
- package/test/unit/spec/services/services.js +466 -2
- package/test/unit/spec/services-v2/service-catalog.ts +134 -11
- package/test/unit/spec/services-v2/services-v2.ts +588 -0
- package/test/unit/spec/static-asset-loader.ts +224 -0
- package/test/unit/spec/webex-core.js +77 -1
|
@@ -73,6 +73,21 @@ var Services = _webexPlugin.default.extend({
|
|
|
73
73
|
validateDomains: ['boolean', false, true],
|
|
74
74
|
initFailed: ['boolean', false, false]
|
|
75
75
|
},
|
|
76
|
+
session: {
|
|
77
|
+
/**
|
|
78
|
+
* Becomes `true` once the initial catalog collection has completed
|
|
79
|
+
* (successfully or otherwise) and any in-flight credentials refresh has
|
|
80
|
+
* settled. Blocks `webex.ready` so consumers can rely on `webex.ready`
|
|
81
|
+
* implying "catalogs populated AND credential state stable".
|
|
82
|
+
* @instance
|
|
83
|
+
* @memberof Services
|
|
84
|
+
* @type {boolean}
|
|
85
|
+
*/
|
|
86
|
+
ready: {
|
|
87
|
+
default: false,
|
|
88
|
+
type: 'boolean'
|
|
89
|
+
}
|
|
90
|
+
},
|
|
76
91
|
_catalogs: new _weakMap.default(),
|
|
77
92
|
_serviceUrls: null,
|
|
78
93
|
_hostCatalog: null,
|
|
@@ -244,15 +259,21 @@ var Services = _webexPlugin.default.extend({
|
|
|
244
259
|
return !!((_hostCatalog$host = hostCatalog[host]) !== null && _hostCatalog$host !== void 0 && _hostCatalog$host.length);
|
|
245
260
|
},
|
|
246
261
|
/**
|
|
247
|
-
* Checks if the current environment is an integration (INT) environment
|
|
248
|
-
*
|
|
262
|
+
* Checks if the current environment is an integration (INT) environment.
|
|
263
|
+
* Uses the explicit environment config when set, otherwise examines the u2c discovery URL.
|
|
249
264
|
* INT environments use discovery URLs containing 'intb' (e.g., u2c-intb.ciscospark.com).
|
|
250
265
|
* @returns {boolean} True if INT environment, false otherwise
|
|
251
266
|
*/
|
|
252
267
|
isIntegrationEnvironment: function isIntegrationEnvironment() {
|
|
253
268
|
try {
|
|
254
|
-
var _this$webex, _this$webex$config, _this$
|
|
255
|
-
var
|
|
269
|
+
var _this$webex, _this$webex$config, _this$webex2, _this$webex2$config, _this$webex2$config$s, _this$webex2$config$s2;
|
|
270
|
+
var configuredEnvironment = (_this$webex = this.webex) === null || _this$webex === void 0 ? void 0 : (_this$webex$config = _this$webex.config) === null || _this$webex$config === void 0 ? void 0 : _this$webex$config.environment;
|
|
271
|
+
if (configuredEnvironment !== undefined) {
|
|
272
|
+
var isIntFromConfig = configuredEnvironment === 'integration';
|
|
273
|
+
this.logger.info("services: isIntegrationEnvironment: ".concat(isIntFromConfig, " (config)"));
|
|
274
|
+
return isIntFromConfig;
|
|
275
|
+
}
|
|
276
|
+
var u2cUrl = ((_this$webex2 = this.webex) === null || _this$webex2 === void 0 ? void 0 : (_this$webex2$config = _this$webex2.config) === null || _this$webex2$config === void 0 ? void 0 : (_this$webex2$config$s = _this$webex2$config.services) === null || _this$webex2$config$s === void 0 ? void 0 : (_this$webex2$config$s2 = _this$webex2$config$s.discovery) === null || _this$webex2$config$s2 === void 0 ? void 0 : _this$webex2$config$s2.u2c) || '';
|
|
256
277
|
var isInt = u2cUrl.includes('intb');
|
|
257
278
|
this.logger.info("services: isIntegrationEnvironment: ".concat(isInt));
|
|
258
279
|
return isInt;
|
|
@@ -1060,9 +1081,11 @@ var Services = _webexPlugin.default.extend({
|
|
|
1060
1081
|
authorization: token
|
|
1061
1082
|
};
|
|
1062
1083
|
}
|
|
1063
|
-
|
|
1084
|
+
var sendRequest = function sendRequest() {
|
|
1064
1085
|
return _this7.request(requestObject);
|
|
1065
|
-
}
|
|
1086
|
+
};
|
|
1087
|
+
var responsePromise = this.webex.internal.newMetrics ? this.webex.internal.newMetrics.callDiagnosticLatencies.measureLatency(sendRequest, 'internal.get.u2c.time') : sendRequest();
|
|
1088
|
+
return responsePromise.then(function (_ref12) {
|
|
1066
1089
|
var body = _ref12.body;
|
|
1067
1090
|
return body;
|
|
1068
1091
|
});
|
|
@@ -1350,6 +1373,7 @@ var Services = _webexPlugin.default.extend({
|
|
|
1350
1373
|
|
|
1351
1374
|
// Destructure the credentials plugin.
|
|
1352
1375
|
var credentials = this.webex.credentials;
|
|
1376
|
+
var catalog = this._getCatalog();
|
|
1353
1377
|
|
|
1354
1378
|
// Init a promise chain. Must be done as a Promise.resolve() to allow
|
|
1355
1379
|
// credentials#getOrgId() to properly throw.
|
|
@@ -1366,9 +1390,13 @@ var Services = _webexPlugin.default.extend({
|
|
|
1366
1390
|
}).then(function () {
|
|
1367
1391
|
// Validate if the token is authorized.
|
|
1368
1392
|
if (credentials.canAuthorize) {
|
|
1369
|
-
// Attempt to collect the postauth catalog
|
|
1370
|
-
|
|
1371
|
-
|
|
1393
|
+
// Attempt to collect the postauth catalog, then mark the catalog
|
|
1394
|
+
// ready. Setting `isReady` here - rather than only in the init
|
|
1395
|
+
// callers - means a slow postauth fetch that loses the gated-init
|
|
1396
|
+
// timeout race still marks the catalog ready once it completes.
|
|
1397
|
+
return _this0.updateServices().then(function () {
|
|
1398
|
+
catalog.isReady = true;
|
|
1399
|
+
}).catch(function () {
|
|
1372
1400
|
_this0.initFailed = true;
|
|
1373
1401
|
_this0.logger.warn('services: cannot retrieve postauth catalog');
|
|
1374
1402
|
});
|
|
@@ -1378,6 +1406,62 @@ var Services = _webexPlugin.default.extend({
|
|
|
1378
1406
|
return _promise.default.resolve();
|
|
1379
1407
|
});
|
|
1380
1408
|
},
|
|
1409
|
+
/**
|
|
1410
|
+
* Await any in-flight credentials refresh, then flip `services.ready` so
|
|
1411
|
+
* `webex.ready` can fire. Closes the parallel-refresh window: if a credential
|
|
1412
|
+
* refresh is in flight when initial catalog collection settles, we must not
|
|
1413
|
+
* signal ready until the refresh has resolved - otherwise downstream
|
|
1414
|
+
* consumers may observe `canAuthorize`/token state that is about to change
|
|
1415
|
+
* under them.
|
|
1416
|
+
*
|
|
1417
|
+
* @private
|
|
1418
|
+
* @returns {Promise<void>}
|
|
1419
|
+
*/
|
|
1420
|
+
_finalizeReady: function _finalizeReady() {
|
|
1421
|
+
var _this1 = this;
|
|
1422
|
+
return (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
1423
|
+
var credentials;
|
|
1424
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
1425
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1426
|
+
case 0:
|
|
1427
|
+
credentials = _this1.webex.credentials;
|
|
1428
|
+
if (!(credentials && credentials.isRefreshing)) {
|
|
1429
|
+
_context4.next = 1;
|
|
1430
|
+
break;
|
|
1431
|
+
}
|
|
1432
|
+
_context4.next = 1;
|
|
1433
|
+
return new _promise.default(function (resolve) {
|
|
1434
|
+
credentials.once('change:isRefreshing', resolve);
|
|
1435
|
+
});
|
|
1436
|
+
case 1:
|
|
1437
|
+
_this1.ready = true;
|
|
1438
|
+
case 2:
|
|
1439
|
+
case "end":
|
|
1440
|
+
return _context4.stop();
|
|
1441
|
+
}
|
|
1442
|
+
}, _callee4);
|
|
1443
|
+
}))();
|
|
1444
|
+
},
|
|
1445
|
+
/**
|
|
1446
|
+
* Build a promise that rejects once the catalog init timeout elapses. Race
|
|
1447
|
+
* this against catalog collection so a hung request never leaves
|
|
1448
|
+
* `services.ready` false forever - that would stall `webex.ready` and leave
|
|
1449
|
+
* consumers waiting on it indefinitely. Timeout is configurable via
|
|
1450
|
+
* `config.services.catalogInitTimeout` (defaults to 15s in config). Created
|
|
1451
|
+
* lazily so paths that skip catalog collection never schedule a stray timer.
|
|
1452
|
+
*
|
|
1453
|
+
* @private
|
|
1454
|
+
* @returns {Promise<never>}
|
|
1455
|
+
*/
|
|
1456
|
+
_makeInitTimeout: function _makeInitTimeout() {
|
|
1457
|
+
var _this$webex$config3, _this$webex$config3$s;
|
|
1458
|
+
var initTimeoutMs = (_this$webex$config3 = this.webex.config) === null || _this$webex$config3 === void 0 ? void 0 : (_this$webex$config3$s = _this$webex$config3.services) === null || _this$webex$config3$s === void 0 ? void 0 : _this$webex$config3$s.catalogInitTimeout;
|
|
1459
|
+
return new _promise.default(function (_, reject) {
|
|
1460
|
+
setTimeout(function () {
|
|
1461
|
+
return reject(new Error("services: init timed out after ".concat(initTimeoutMs, "ms")));
|
|
1462
|
+
}, initTimeoutMs);
|
|
1463
|
+
});
|
|
1464
|
+
},
|
|
1381
1465
|
/**
|
|
1382
1466
|
* Initializer
|
|
1383
1467
|
*
|
|
@@ -1386,7 +1470,7 @@ var Services = _webexPlugin.default.extend({
|
|
|
1386
1470
|
* @returns {Services}
|
|
1387
1471
|
*/
|
|
1388
1472
|
initialize: function initialize() {
|
|
1389
|
-
var
|
|
1473
|
+
var _this10 = this;
|
|
1390
1474
|
var catalog = new _serviceCatalog.default();
|
|
1391
1475
|
var registry = new _serviceRegistry.default();
|
|
1392
1476
|
var state = new _serviceState.default();
|
|
@@ -1394,56 +1478,176 @@ var Services = _webexPlugin.default.extend({
|
|
|
1394
1478
|
this.registries.set(this.webex, registry);
|
|
1395
1479
|
this.states.set(this.webex, state);
|
|
1396
1480
|
|
|
1397
|
-
// Listen for configuration changes once.
|
|
1481
|
+
// Listen for configuration changes once. The config is not populated on the
|
|
1482
|
+
// webex instance until the `change:config` event fires, so any decision that
|
|
1483
|
+
// depends on config values (such as the gated-vs-ungated init below) must be
|
|
1484
|
+
// made from within this handler rather than synchronously in `initialize()`.
|
|
1398
1485
|
this.listenToOnce(this.webex, 'change:config', function () {
|
|
1399
|
-
|
|
1400
|
-
|
|
1486
|
+
var _this10$webex$config, _this10$webex$config$;
|
|
1487
|
+
_this10.initConfig();
|
|
1401
1488
|
|
|
1489
|
+
// Feature flag: when enabled, `webex.ready` is blocked until the initial
|
|
1490
|
+
// catalog collection has settled AND any in-flight credentials refresh has
|
|
1491
|
+
// completed. When disabled (the default), preserves the pre-existing
|
|
1492
|
+
// behavior where `webex.ready` fires as soon as `webex.loaded` does and
|
|
1493
|
+
// the catalog is collected out-of-band.
|
|
1494
|
+
var waitForCatalogInit = ((_this10$webex$config = _this10.webex.config) === null || _this10$webex$config === void 0 ? void 0 : (_this10$webex$config$ = _this10$webex$config.services) === null || _this10$webex$config$ === void 0 ? void 0 : _this10$webex$config$.waitForCatalogInit) === true;
|
|
1495
|
+
if (waitForCatalogInit) {
|
|
1496
|
+
_this10._initializeCatalogsGated(catalog);
|
|
1497
|
+
} else {
|
|
1498
|
+
// Not gating - immediately mark ready so we do not block webex.ready.
|
|
1499
|
+
_this10.ready = true;
|
|
1500
|
+
_this10._initializeCatalogsUngated(catalog);
|
|
1501
|
+
}
|
|
1502
|
+
});
|
|
1503
|
+
},
|
|
1504
|
+
/**
|
|
1505
|
+
* Original (pre-verified-ready) initialization path. Runs on `webex.ready`
|
|
1506
|
+
* and collects catalogs opportunistically without blocking anything.
|
|
1507
|
+
*
|
|
1508
|
+
* @private
|
|
1509
|
+
* @param {ServiceCatalog} catalog
|
|
1510
|
+
* @returns {void}
|
|
1511
|
+
*/
|
|
1512
|
+
_initializeCatalogsUngated: function _initializeCatalogsUngated(catalog) {
|
|
1513
|
+
var _this11 = this;
|
|
1402
1514
|
// wait for webex instance to be ready before attempting
|
|
1403
1515
|
// to update the service catalogs
|
|
1404
1516
|
// this can cause a race condition because credentials may
|
|
1405
1517
|
// not be valid when services is initialized
|
|
1406
|
-
this.listenToOnce(this.webex, 'ready', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
1407
|
-
var cachedCatalog, supertoken, email;
|
|
1408
|
-
return _regenerator.default.wrap(function (
|
|
1409
|
-
while (1) switch (
|
|
1518
|
+
this.listenToOnce(this.webex, 'ready', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
1519
|
+
var cachedCatalog, supertoken, _this11$webex$config, _this11$webex$config$, email;
|
|
1520
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
1521
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
1410
1522
|
case 0:
|
|
1411
|
-
|
|
1412
|
-
return
|
|
1523
|
+
_context5.next = 1;
|
|
1524
|
+
return _this11._loadCatalogFromCache();
|
|
1525
|
+
case 1:
|
|
1526
|
+
cachedCatalog = _context5.sent;
|
|
1527
|
+
if (!cachedCatalog) {
|
|
1528
|
+
_context5.next = 2;
|
|
1529
|
+
break;
|
|
1530
|
+
}
|
|
1531
|
+
catalog.isReady = true;
|
|
1532
|
+
return _context5.abrupt("return");
|
|
1533
|
+
case 2:
|
|
1534
|
+
supertoken = _this11.webex.credentials.supertoken; // Validate if the supertoken exists.
|
|
1535
|
+
if (!(supertoken && supertoken.access_token)) {
|
|
1536
|
+
_context5.next = 3;
|
|
1537
|
+
break;
|
|
1538
|
+
}
|
|
1539
|
+
// `initServiceCatalogs` marks the catalog ready internally once the
|
|
1540
|
+
// postauth catalog is collected.
|
|
1541
|
+
_this11.initServiceCatalogs().catch(function (error) {
|
|
1542
|
+
_this11.initFailed = true;
|
|
1543
|
+
_this11.logger.error("services: failed to init initial services when credentials available, ".concat(error === null || error === void 0 ? void 0 : error.message));
|
|
1544
|
+
});
|
|
1545
|
+
_context5.next = 5;
|
|
1546
|
+
break;
|
|
1547
|
+
case 3:
|
|
1548
|
+
email = _this11.webex.config.email;
|
|
1549
|
+
if (!(((_this11$webex$config = _this11.webex.config) === null || _this11$webex$config === void 0 ? void 0 : (_this11$webex$config$ = _this11$webex$config.services) === null || _this11$webex$config$ === void 0 ? void 0 : _this11$webex$config$.skipPreauthCatalogOnUnauthenticated) === true)) {
|
|
1550
|
+
_context5.next = 4;
|
|
1551
|
+
break;
|
|
1552
|
+
}
|
|
1553
|
+
_this11.logger.info('services: skipping preauth catalog collection while unauthenticated as per the config');
|
|
1554
|
+
return _context5.abrupt("return");
|
|
1555
|
+
case 4:
|
|
1556
|
+
_this11.collectPreauthCatalog(email ? {
|
|
1557
|
+
email: email
|
|
1558
|
+
} : undefined).catch(function (error) {
|
|
1559
|
+
_this11.initFailed = true;
|
|
1560
|
+
_this11.logger.error("services: failed to init initial services when no credentials available, ".concat(error === null || error === void 0 ? void 0 : error.message));
|
|
1561
|
+
});
|
|
1562
|
+
case 5:
|
|
1563
|
+
case "end":
|
|
1564
|
+
return _context5.stop();
|
|
1565
|
+
}
|
|
1566
|
+
}, _callee5);
|
|
1567
|
+
})));
|
|
1568
|
+
},
|
|
1569
|
+
/**
|
|
1570
|
+
* Verified-ready initialization path. Blocks `webex.ready` until the initial
|
|
1571
|
+
* catalog fetch has settled (or timed out) AND any in-flight credentials
|
|
1572
|
+
* refresh has completed. Also handles the fresh-login case where OAuth
|
|
1573
|
+
* completes after `loaded` fires.
|
|
1574
|
+
*
|
|
1575
|
+
* @private
|
|
1576
|
+
* @param {ServiceCatalog} catalog
|
|
1577
|
+
* @returns {void}
|
|
1578
|
+
*/
|
|
1579
|
+
_initializeCatalogsGated: function _initializeCatalogsGated(catalog) {
|
|
1580
|
+
var _this12 = this;
|
|
1581
|
+
// Wait for storage to be loaded before attempting to update the service
|
|
1582
|
+
// catalogs. We listen for 'loaded' instead of 'ready' because `services.ready`
|
|
1583
|
+
// now blocks `webex.ready` - listening to 'ready' would deadlock.
|
|
1584
|
+
this.listenToOnce(this.webex, 'loaded', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
1585
|
+
var cachedCatalog, supertoken, _this12$webex$config, _this12$webex$config$, email;
|
|
1586
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
1587
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1588
|
+
case 0:
|
|
1589
|
+
_context6.next = 1;
|
|
1590
|
+
return _this12._loadCatalogFromCache();
|
|
1413
1591
|
case 1:
|
|
1414
|
-
cachedCatalog =
|
|
1592
|
+
cachedCatalog = _context6.sent;
|
|
1415
1593
|
if (!cachedCatalog) {
|
|
1416
|
-
|
|
1594
|
+
_context6.next = 3;
|
|
1417
1595
|
break;
|
|
1418
1596
|
}
|
|
1419
1597
|
catalog.isReady = true;
|
|
1420
|
-
|
|
1598
|
+
_context6.next = 2;
|
|
1599
|
+
return _this12._finalizeReady();
|
|
1421
1600
|
case 2:
|
|
1422
|
-
|
|
1601
|
+
return _context6.abrupt("return");
|
|
1602
|
+
case 3:
|
|
1603
|
+
supertoken = _this12.webex.credentials.supertoken; // Validate if the supertoken exists.
|
|
1423
1604
|
if (supertoken && supertoken.access_token) {
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1605
|
+
// `initServiceCatalogs` marks the catalog ready internally once the
|
|
1606
|
+
// postauth catalog is collected - even if it loses the timeout race
|
|
1607
|
+
// below, so a slow fetch still eventually flips `catalog.isReady`.
|
|
1608
|
+
_promise.default.race([_this12.initServiceCatalogs(), _this12._makeInitTimeout()]).catch(function (error) {
|
|
1609
|
+
_this12.initFailed = true;
|
|
1610
|
+
_this12.logger.error("services: failed to init initial services when credentials available, ".concat(error === null || error === void 0 ? void 0 : error.message));
|
|
1611
|
+
}).finally(function () {
|
|
1612
|
+
return _this12._finalizeReady();
|
|
1429
1613
|
});
|
|
1430
1614
|
} else {
|
|
1431
|
-
email =
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1615
|
+
email = _this12.webex.config.email; // Handle fresh login: 'loaded' fires before OAuth completes, so listen
|
|
1616
|
+
// for `canAuthorize` flipping true and then collect the postauth catalog.
|
|
1617
|
+
_this12.listenToOnce(_this12.webex, 'change:canAuthorize', function () {
|
|
1618
|
+
if (_this12.webex.canAuthorize && !catalog.status.postauth.ready) {
|
|
1619
|
+
// `initServiceCatalogs` marks the catalog ready internally.
|
|
1620
|
+
_this12.initServiceCatalogs().catch(function (error) {
|
|
1621
|
+
_this12.logger.error("services: failed to init service catalogs after auth, ".concat(error === null || error === void 0 ? void 0 : error.message));
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1437
1624
|
});
|
|
1625
|
+
if (((_this12$webex$config = _this12.webex.config) === null || _this12$webex$config === void 0 ? void 0 : (_this12$webex$config$ = _this12$webex$config.services) === null || _this12$webex$config$ === void 0 ? void 0 : _this12$webex$config$.skipPreauthCatalogOnUnauthenticated) === true) {
|
|
1626
|
+
// Skip the preauth catalog fetch (it will be collected manually
|
|
1627
|
+
// later), but still finalize `services.ready` so `webex.ready` is not
|
|
1628
|
+
// stalled while unauthenticated. No timeout is created here so there
|
|
1629
|
+
// is no stray timer or unhandled rejection.
|
|
1630
|
+
_this12.logger.info('services: skipping preauth catalog collection while unauthenticated as per the config');
|
|
1631
|
+
_this12._finalizeReady();
|
|
1632
|
+
} else {
|
|
1633
|
+
_promise.default.race([_this12.collectPreauthCatalog(email ? {
|
|
1634
|
+
email: email
|
|
1635
|
+
} : undefined), _this12._makeInitTimeout()]).catch(function (error) {
|
|
1636
|
+
_this12.initFailed = true;
|
|
1637
|
+
_this12.logger.error("services: failed to init initial services when no credentials available, ".concat(error === null || error === void 0 ? void 0 : error.message));
|
|
1638
|
+
}).finally(function () {
|
|
1639
|
+
return _this12._finalizeReady();
|
|
1640
|
+
});
|
|
1641
|
+
}
|
|
1438
1642
|
}
|
|
1439
|
-
case
|
|
1643
|
+
case 4:
|
|
1440
1644
|
case "end":
|
|
1441
|
-
return
|
|
1645
|
+
return _context6.stop();
|
|
1442
1646
|
}
|
|
1443
|
-
},
|
|
1647
|
+
}, _callee6);
|
|
1444
1648
|
})));
|
|
1445
1649
|
},
|
|
1446
|
-
version: "3.
|
|
1650
|
+
version: "3.13.0-next.1"
|
|
1447
1651
|
});
|
|
1448
1652
|
/* eslint-enable no-underscore-dangle */
|
|
1449
1653
|
var _default = exports.default = Services;
|