@webex/webex-core 3.0.0-beta.2 → 3.0.0-beta.21
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/config.js +1 -11
- package/dist/config.js.map +1 -1
- package/dist/credentials-config.js +44 -64
- package/dist/credentials-config.js.map +1 -1
- package/dist/index.js +0 -76
- package/dist/index.js.map +1 -1
- package/dist/interceptors/auth.js +22 -55
- package/dist/interceptors/auth.js.map +1 -1
- package/dist/interceptors/default-options.js +0 -20
- package/dist/interceptors/default-options.js.map +1 -1
- package/dist/interceptors/embargo.js +0 -21
- package/dist/interceptors/embargo.js.map +1 -1
- package/dist/interceptors/network-timing.js +2 -21
- package/dist/interceptors/network-timing.js.map +1 -1
- package/dist/interceptors/payload-transformer.js +2 -22
- package/dist/interceptors/payload-transformer.js.map +1 -1
- package/dist/interceptors/rate-limit.js +25 -57
- package/dist/interceptors/rate-limit.js.map +1 -1
- package/dist/interceptors/redirect.js +4 -33
- package/dist/interceptors/redirect.js.map +1 -1
- package/dist/interceptors/request-event.js +3 -30
- package/dist/interceptors/request-event.js.map +1 -1
- package/dist/interceptors/request-logger.js +1 -30
- package/dist/interceptors/request-logger.js.map +1 -1
- package/dist/interceptors/request-timing.js +3 -22
- package/dist/interceptors/request-timing.js.map +1 -1
- package/dist/interceptors/response-logger.js +2 -31
- package/dist/interceptors/response-logger.js.map +1 -1
- package/dist/interceptors/user-agent.js +2 -29
- package/dist/interceptors/user-agent.js.map +1 -1
- package/dist/interceptors/webex-tracking-id.js +5 -28
- package/dist/interceptors/webex-tracking-id.js.map +1 -1
- package/dist/interceptors/webex-user-agent.js +5 -38
- package/dist/interceptors/webex-user-agent.js.map +1 -1
- package/dist/lib/batcher.js +3 -51
- package/dist/lib/batcher.js.map +1 -1
- package/dist/lib/credentials/credentials.js +39 -119
- package/dist/lib/credentials/credentials.js.map +1 -1
- package/dist/lib/credentials/grant-errors.js +0 -49
- package/dist/lib/credentials/grant-errors.js.map +1 -1
- package/dist/lib/credentials/index.js +1 -13
- package/dist/lib/credentials/index.js.map +1 -1
- package/dist/lib/credentials/scope.js +1 -7
- package/dist/lib/credentials/scope.js.map +1 -1
- package/dist/lib/credentials/token-collection.js +1 -7
- package/dist/lib/credentials/token-collection.js.map +1 -1
- package/dist/lib/credentials/token.js +39 -118
- package/dist/lib/credentials/token.js.map +1 -1
- package/dist/lib/page.js +13 -26
- package/dist/lib/page.js.map +1 -1
- package/dist/lib/services/constants.js +0 -2
- package/dist/lib/services/constants.js.map +1 -1
- package/dist/lib/services/index.js +1 -28
- package/dist/lib/services/index.js.map +1 -1
- package/dist/lib/services/interceptors/server-error.js +2 -23
- package/dist/lib/services/interceptors/server-error.js.map +1 -1
- package/dist/lib/services/interceptors/service.js +12 -34
- package/dist/lib/services/interceptors/service.js.map +1 -1
- package/dist/lib/services/metrics.js +0 -2
- package/dist/lib/services/metrics.js.map +1 -1
- package/dist/lib/services/service-catalog.js +10 -90
- package/dist/lib/services/service-catalog.js.map +1 -1
- package/dist/lib/services/service-fed-ramp.js +0 -2
- package/dist/lib/services/service-fed-ramp.js.map +1 -1
- package/dist/lib/services/service-host.js +47 -62
- package/dist/lib/services/service-host.js.map +1 -1
- package/dist/lib/services/service-registry.js +78 -90
- package/dist/lib/services/service-registry.js.map +1 -1
- package/dist/lib/services/service-state.js +3 -15
- package/dist/lib/services/service-state.js.map +1 -1
- package/dist/lib/services/service-url.js +4 -25
- package/dist/lib/services/service-url.js.map +1 -1
- package/dist/lib/services/services.js +122 -238
- package/dist/lib/services/services.js.map +1 -1
- package/dist/lib/stateless-webex-plugin.js +5 -28
- package/dist/lib/stateless-webex-plugin.js.map +1 -1
- package/dist/lib/storage/decorators.js +19 -62
- package/dist/lib/storage/decorators.js.map +1 -1
- package/dist/lib/storage/errors.js +0 -23
- package/dist/lib/storage/errors.js.map +1 -1
- package/dist/lib/storage/index.js +2 -16
- package/dist/lib/storage/index.js.map +1 -1
- package/dist/lib/storage/make-webex-plugin-store.js +11 -41
- package/dist/lib/storage/make-webex-plugin-store.js.map +1 -1
- package/dist/lib/storage/make-webex-store.js +8 -30
- package/dist/lib/storage/make-webex-store.js.map +1 -1
- package/dist/lib/storage/memory-store-adapter.js +1 -19
- package/dist/lib/storage/memory-store-adapter.js.map +1 -1
- package/dist/lib/webex-core-plugin-mixin.js +9 -29
- package/dist/lib/webex-core-plugin-mixin.js.map +1 -1
- package/dist/lib/webex-http-error.js +1 -31
- package/dist/lib/webex-http-error.js.map +1 -1
- package/dist/lib/webex-internal-core-plugin-mixin.js +9 -29
- package/dist/lib/webex-internal-core-plugin-mixin.js.map +1 -1
- package/dist/lib/webex-plugin.js +6 -40
- package/dist/lib/webex-plugin.js.map +1 -1
- package/dist/plugins/logger.js +3 -17
- package/dist/plugins/logger.js.map +1 -1
- package/dist/webex-core.js +79 -203
- package/dist/webex-core.js.map +1 -1
- package/dist/webex-internal-core.js +0 -10
- package/dist/webex-internal-core.js.map +1 -1
- package/package.json +14 -14
- package/src/config.js +9 -11
- package/src/credentials-config.js +110 -72
- package/src/index.js +4 -14
- package/src/interceptors/auth.js +36 -37
- package/src/interceptors/default-options.js +0 -1
- package/src/interceptors/embargo.js +1 -1
- package/src/interceptors/payload-transformer.js +1 -2
- package/src/interceptors/rate-limit.js +8 -5
- package/src/interceptors/redirect.js +14 -8
- package/src/interceptors/request-event.js +4 -8
- package/src/interceptors/request-logger.js +8 -5
- package/src/interceptors/response-logger.js +11 -8
- package/src/interceptors/user-agent.js +1 -2
- package/src/interceptors/webex-user-agent.js +3 -9
- package/src/lib/batcher.js +70 -69
- package/src/lib/credentials/credentials.js +112 -122
- package/src/lib/credentials/grant-errors.js +6 -7
- package/src/lib/credentials/index.js +1 -4
- package/src/lib/credentials/scope.js +1 -4
- package/src/lib/credentials/token-collection.js +1 -1
- package/src/lib/credentials/token.js +86 -80
- package/src/lib/page.js +10 -11
- package/src/lib/services/constants.js +3 -13
- package/src/lib/services/index.js +2 -2
- package/src/lib/services/interceptors/server-error.js +12 -7
- package/src/lib/services/interceptors/service.js +6 -5
- package/src/lib/services/metrics.js +1 -1
- package/src/lib/services/service-catalog.js +110 -100
- package/src/lib/services/service-fed-ramp.js +1 -2
- package/src/lib/services/service-host.js +10 -17
- package/src/lib/services/service-registry.js +69 -96
- package/src/lib/services/service-state.js +4 -6
- package/src/lib/services/service-url.js +24 -23
- package/src/lib/services/services.js +260 -251
- package/src/lib/stateless-webex-plugin.js +4 -2
- package/src/lib/storage/decorators.js +68 -66
- package/src/lib/storage/index.js +4 -6
- package/src/lib/storage/make-webex-plugin-store.js +34 -21
- package/src/lib/storage/make-webex-store.js +6 -7
- package/src/lib/storage/memory-store-adapter.js +3 -3
- package/src/lib/webex-core-plugin-mixin.js +10 -7
- package/src/lib/webex-http-error.js +7 -8
- package/src/lib/webex-internal-core-plugin-mixin.js +9 -6
- package/src/lib/webex-plugin.js +41 -34
- package/src/plugins/logger.js +8 -3
- package/src/webex-core.js +185 -116
- package/src/webex-internal-core.js +15 -9
- package/test/integration/spec/credentials/credentials.js +26 -30
- package/test/integration/spec/credentials/token.js +36 -33
- package/test/integration/spec/services/service-catalog.js +177 -156
- package/test/integration/spec/services/services.js +313 -304
- package/test/integration/spec/webex-core.js +98 -86
- package/test/unit/spec/_setup.js +26 -18
- package/test/unit/spec/credentials/credentials.js +189 -154
- package/test/unit/spec/credentials/token.js +94 -76
- package/test/unit/spec/interceptors/auth.js +291 -243
- package/test/unit/spec/interceptors/default-options.js +36 -24
- package/test/unit/spec/interceptors/embargo.js +32 -27
- package/test/unit/spec/interceptors/network-timing.js +2 -2
- package/test/unit/spec/interceptors/payload-transformer.js +61 -52
- package/test/unit/spec/interceptors/rate-limit.js +104 -75
- package/test/unit/spec/interceptors/redirect.js +22 -20
- package/test/unit/spec/interceptors/request-timing.js +18 -22
- package/test/unit/spec/interceptors/user-agent.js +28 -16
- package/test/unit/spec/interceptors/webex-tracking-id.js +14 -8
- package/test/unit/spec/interceptors/webex-user-agent.js +83 -37
- package/test/unit/spec/lib/batcher.js +36 -32
- package/test/unit/spec/lib/page.js +36 -32
- package/test/unit/spec/lib/webex-plugin.js +1 -1
- package/test/unit/spec/services/interceptors/server-error.js +67 -90
- package/test/unit/spec/services/interceptors/service.js +17 -28
- package/test/unit/spec/services/service-catalog.js +19 -27
- package/test/unit/spec/services/service-host.js +29 -26
- package/test/unit/spec/services/service-registry.js +128 -170
- package/test/unit/spec/services/service-state.js +13 -22
- package/test/unit/spec/services/service-url.js +24 -43
- package/test/unit/spec/services/services.js +85 -41
- package/test/unit/spec/storage/persist.js +6 -9
- package/test/unit/spec/storage/wait-for-value.js +22 -21
- package/test/unit/spec/webex-core.js +78 -57
- package/test/unit/spec/webex-internal-core.js +56 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["trailingSlashes","ServiceInterceptor","options","uri","normalizeOptions","validateOptions","services","webex","internal","service","resource","waitForService","name","then","serviceUrl","generateUri","catch","reject","Error","formattedService","replace","formattedResource","api","Interceptor"],"sources":["service.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\n\nconst trailingSlashes = /(?:^\\/)|(?:\\/$)/;\n\n/**\n * @class\n */\nexport default class ServiceInterceptor extends Interceptor {\n /**\n * @returns {ServiceInterceptor}\n */\n static create() {\n /* eslint no-invalid-this: [0] */\n return new ServiceInterceptor({webex: this});\n }\n\n /* eslint-disable no-param-reassign */\n /**\n * @see Interceptor#onRequest\n * @param {Object} options - The request PTO.\n * @returns {Object} - The mutated request PTO.\n */\n onRequest(options) {\n // Validate that the PTO includes a uri property.\n if (options.uri) {\n return options;\n }\n\n // Normalize and validate the PTO.\n this.normalizeOptions(options);\n this.validateOptions(options);\n\n // Destructure commonly referenced namespaces.\n const {services} = this.webex.internal;\n const {service, resource} = options;\n\n // Attempt to collect the service url.\n return services.waitForService({name: service})\n .then((serviceUrl) => {\n // Generate the combined service url and resource.\n options.uri = this.generateUri(serviceUrl, resource);\n\n return options;\n })\n .catch(()
|
|
1
|
+
{"version":3,"names":["trailingSlashes","ServiceInterceptor","options","uri","normalizeOptions","validateOptions","services","webex","internal","service","resource","waitForService","name","then","serviceUrl","generateUri","catch","reject","Error","formattedService","replace","formattedResource","api","Interceptor"],"sources":["service.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\n\nconst trailingSlashes = /(?:^\\/)|(?:\\/$)/;\n\n/**\n * @class\n */\nexport default class ServiceInterceptor extends Interceptor {\n /**\n * @returns {ServiceInterceptor}\n */\n static create() {\n /* eslint no-invalid-this: [0] */\n return new ServiceInterceptor({webex: this});\n }\n\n /* eslint-disable no-param-reassign */\n /**\n * @see Interceptor#onRequest\n * @param {Object} options - The request PTO.\n * @returns {Object} - The mutated request PTO.\n */\n onRequest(options) {\n // Validate that the PTO includes a uri property.\n if (options.uri) {\n return options;\n }\n\n // Normalize and validate the PTO.\n this.normalizeOptions(options);\n this.validateOptions(options);\n\n // Destructure commonly referenced namespaces.\n const {services} = this.webex.internal;\n const {service, resource} = options;\n\n // Attempt to collect the service url.\n return services\n .waitForService({name: service})\n .then((serviceUrl) => {\n // Generate the combined service url and resource.\n options.uri = this.generateUri(serviceUrl, resource);\n\n return options;\n })\n .catch(() =>\n Promise.reject(new Error(`service-interceptor: '${service}' is not a known service`))\n );\n }\n\n /* eslint-disable class-methods-use-this */\n /**\n * Generate a usable request uri string from a service url and a resouce.\n *\n * @param {string} serviceUrl - The service url.\n * @param {string} [resource] - The resouce to be appended to the service url.\n * @returns {string} - The combined service url and resource.\n */\n generateUri(serviceUrl, resource = '') {\n const formattedService = serviceUrl.replace(trailingSlashes, '');\n const formattedResource = resource.replace(trailingSlashes, '');\n\n return `${formattedService}/${formattedResource}`;\n }\n\n /**\n * Normalizes request options relative to service identification.\n *\n * @param {Object} options - The request PTO.\n * @returns {Object} - The mutated request PTO.\n */\n normalizeOptions(options) {\n // Validate if the api property is used.\n if (options.api) {\n // Assign the service property the value of the api property if necessary.\n options.service = options.service || options.api;\n delete options.api;\n }\n }\n\n /**\n * Validates that the appropriate options for this interceptor are present.\n *\n * @param {Object} options - The request PTO.\n * @returns {Object} - The mutated request PTO.\n */\n validateOptions(options) {\n if (!options.resource) {\n throw new Error('a `resource` parameter is required');\n }\n\n if (!options.service) {\n throw new Error(\"a valid 'service' parameter is required\");\n }\n }\n /* eslint-enable class-methods-use-this, no-param-reassign */\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIA;AAA6C;AAAA;AAE7C,IAAMA,eAAe,GAAG,iBAAiB;;AAEzC;AACA;AACA;AAFA,IAGqBC,kBAAkB;EAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA,OASrC;IACA;AACF;AACA;AACA;AACA;IACE,mBAAUC,OAAO,EAAE;MAAA;MACjB;MACA,IAAIA,OAAO,CAACC,GAAG,EAAE;QACf,OAAOD,OAAO;MAChB;;MAEA;MACA,IAAI,CAACE,gBAAgB,CAACF,OAAO,CAAC;MAC9B,IAAI,CAACG,eAAe,CAACH,OAAO,CAAC;;MAE7B;MACA,IAAOI,QAAQ,GAAI,IAAI,CAACC,KAAK,CAACC,QAAQ,CAA/BF,QAAQ;MACf,IAAOG,OAAO,GAAcP,OAAO,CAA5BO,OAAO;QAAEC,QAAQ,GAAIR,OAAO,CAAnBQ,QAAQ;;MAExB;MACA,OAAOJ,QAAQ,CACZK,cAAc,CAAC;QAACC,IAAI,EAAEH;MAAO,CAAC,CAAC,CAC/BI,IAAI,CAAC,UAACC,UAAU,EAAK;QACpB;QACAZ,OAAO,CAACC,GAAG,GAAG,KAAI,CAACY,WAAW,CAACD,UAAU,EAAEJ,QAAQ,CAAC;QAEpD,OAAOR,OAAO;MAChB,CAAC,CAAC,CACDc,KAAK,CAAC;QAAA,OACL,iBAAQC,MAAM,CAAC,IAAIC,KAAK,iCAA0BT,OAAO,8BAA2B,CAAC;MAAA,EACtF;IACL;;IAEA;IACA;AACF;AACA;AACA;AACA;AACA;AACA;EANE;IAAA;IAAA,OAOA,qBAAYK,UAAU,EAAiB;MAAA,IAAfJ,QAAQ,uEAAG,EAAE;MACnC,IAAMS,gBAAgB,GAAGL,UAAU,CAACM,OAAO,CAACpB,eAAe,EAAE,EAAE,CAAC;MAChE,IAAMqB,iBAAiB,GAAGX,QAAQ,CAACU,OAAO,CAACpB,eAAe,EAAE,EAAE,CAAC;MAE/D,iBAAUmB,gBAAgB,cAAIE,iBAAiB;IACjD;;IAEA;AACF;AACA;AACA;AACA;AACA;EALE;IAAA;IAAA,OAMA,0BAAiBnB,OAAO,EAAE;MACxB;MACA,IAAIA,OAAO,CAACoB,GAAG,EAAE;QACf;QACApB,OAAO,CAACO,OAAO,GAAGP,OAAO,CAACO,OAAO,IAAIP,OAAO,CAACoB,GAAG;QAChD,OAAOpB,OAAO,CAACoB,GAAG;MACpB;IACF;;IAEA;AACF;AACA;AACA;AACA;AACA;EALE;IAAA;IAAA,OAMA,yBAAgBpB,OAAO,EAAE;MACvB,IAAI,CAACA,OAAO,CAACQ,QAAQ,EAAE;QACrB,MAAM,IAAIQ,KAAK,CAAC,oCAAoC,CAAC;MACvD;MAEA,IAAI,CAAChB,OAAO,CAACO,OAAO,EAAE;QACpB,MAAM,IAAIS,KAAK,CAAC,yCAAyC,CAAC;MAC5D;IACF;IACA;EAAA;IAAA;IAAA;IAvFA;AACF;AACA;IACE,kBAAgB;MACd;MACA,OAAO,IAAIjB,kBAAkB,CAAC;QAACM,KAAK,EAAE;MAAI,CAAC,CAAC;IAC9C;EAAC;EAAA;AAAA,EAP6CgB,qBAAW;AAAA"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
|
|
9
7
|
exports.default = void 0;
|
|
10
8
|
// Metrics for service catalog
|
|
11
9
|
var _default = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["JS_SDK_SERVICE_NOT_FOUND"],"sources":["metrics.js"],"sourcesContent":["// Metrics for service catalog\nexport default {\n JS_SDK_SERVICE_NOT_FOUND: 'JS_SDK_SERVICE_NOT_FOUND'
|
|
1
|
+
{"version":3,"names":["JS_SDK_SERVICE_NOT_FOUND"],"sources":["metrics.js"],"sourcesContent":["// Metrics for service catalog\nexport default {\n JS_SDK_SERVICE_NOT_FOUND: 'JS_SDK_SERVICE_NOT_FOUND',\n};\n"],"mappings":";;;;;;;AAAA;AAAA,eACe;EACbA,wBAAwB,EAAE;AAC5B,CAAC;AAAA"}
|
|
@@ -1,59 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
|
|
4
|
-
|
|
5
4
|
var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
|
|
6
|
-
|
|
7
5
|
var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
|
|
8
|
-
|
|
9
6
|
var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
|
|
10
|
-
|
|
11
7
|
var _Object$keys3 = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
12
|
-
|
|
13
8
|
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
14
|
-
|
|
15
9
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
16
|
-
|
|
17
10
|
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
18
|
-
|
|
19
11
|
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
20
|
-
|
|
21
12
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
22
|
-
|
|
23
13
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
24
|
-
|
|
25
14
|
_Object$defineProperty(exports, "__esModule", {
|
|
26
15
|
value: true
|
|
27
16
|
});
|
|
28
|
-
|
|
29
17
|
exports.default = void 0;
|
|
30
|
-
|
|
31
18
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
32
|
-
|
|
33
19
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
34
|
-
|
|
35
20
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
36
|
-
|
|
37
21
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
|
|
38
|
-
|
|
39
22
|
var _url = _interopRequireDefault(require("url"));
|
|
40
|
-
|
|
41
23
|
var _ampersandState = _interopRequireDefault(require("ampersand-state"));
|
|
42
|
-
|
|
43
24
|
var _serviceUrl = _interopRequireDefault(require("./service-url"));
|
|
44
|
-
|
|
45
25
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys3(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
46
|
-
|
|
47
26
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
48
|
-
|
|
49
27
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
50
|
-
|
|
51
28
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
52
|
-
|
|
53
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
54
|
-
|
|
29
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
55
30
|
/* eslint-disable no-underscore-dangle */
|
|
56
|
-
|
|
57
31
|
/**
|
|
58
32
|
* @class
|
|
59
33
|
*/
|
|
@@ -98,7 +72,6 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
98
72
|
return [];
|
|
99
73
|
}]
|
|
100
74
|
},
|
|
101
|
-
|
|
102
75
|
/**
|
|
103
76
|
* @private
|
|
104
77
|
* Search the service url array to locate a `ServiceUrl`
|
|
@@ -113,7 +86,6 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
113
86
|
return serviceUrl.name === name;
|
|
114
87
|
});
|
|
115
88
|
},
|
|
116
|
-
|
|
117
89
|
/**
|
|
118
90
|
* @private
|
|
119
91
|
* Generate an array of `ServiceUrl`s that is organized from highest auth
|
|
@@ -123,7 +95,6 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
123
95
|
_listServiceUrls: function _listServiceUrls() {
|
|
124
96
|
return [].concat((0, _toConsumableArray2.default)(this.serviceGroups.override), (0, _toConsumableArray2.default)(this.serviceGroups.postauth), (0, _toConsumableArray2.default)(this.serviceGroups.signin), (0, _toConsumableArray2.default)(this.serviceGroups.preauth), (0, _toConsumableArray2.default)(this.serviceGroups.discovery));
|
|
125
97
|
},
|
|
126
|
-
|
|
127
98
|
/**
|
|
128
99
|
* @private
|
|
129
100
|
* Safely load one or more `ServiceUrl`s into this `Services` instance.
|
|
@@ -133,19 +104,16 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
133
104
|
*/
|
|
134
105
|
_loadServiceUrls: function _loadServiceUrls(serviceGroup, services) {
|
|
135
106
|
var _this = this;
|
|
136
|
-
|
|
137
107
|
// declare namespaces outside of loop
|
|
138
108
|
var existingService;
|
|
139
109
|
services.forEach(function (service) {
|
|
140
110
|
existingService = _this._getUrl(service.name, serviceGroup);
|
|
141
|
-
|
|
142
111
|
if (!existingService) {
|
|
143
112
|
_this.serviceGroups[serviceGroup].push(service);
|
|
144
113
|
}
|
|
145
114
|
});
|
|
146
115
|
return this;
|
|
147
116
|
},
|
|
148
|
-
|
|
149
117
|
/**
|
|
150
118
|
* @private
|
|
151
119
|
* Safely unload one or more `ServiceUrl`s into this `Services` instance
|
|
@@ -155,19 +123,16 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
155
123
|
*/
|
|
156
124
|
_unloadServiceUrls: function _unloadServiceUrls(serviceGroup, services) {
|
|
157
125
|
var _this2 = this;
|
|
158
|
-
|
|
159
126
|
// declare namespaces outside of loop
|
|
160
127
|
var existingService;
|
|
161
128
|
services.forEach(function (service) {
|
|
162
129
|
existingService = _this2._getUrl(service.name, serviceGroup);
|
|
163
|
-
|
|
164
130
|
if (existingService) {
|
|
165
131
|
_this2.serviceGroups[serviceGroup].splice(_this2.serviceGroups[serviceGroup].indexOf(existingService), 1);
|
|
166
132
|
}
|
|
167
133
|
});
|
|
168
134
|
return this;
|
|
169
135
|
},
|
|
170
|
-
|
|
171
136
|
/**
|
|
172
137
|
* Clear all collected catalog data and reset catalog status.
|
|
173
138
|
*
|
|
@@ -187,7 +152,6 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
187
152
|
ready: false
|
|
188
153
|
};
|
|
189
154
|
},
|
|
190
|
-
|
|
191
155
|
/**
|
|
192
156
|
* Search over all service groups to find a cluster id based
|
|
193
157
|
* on a given url.
|
|
@@ -196,27 +160,20 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
196
160
|
*/
|
|
197
161
|
findClusterId: function findClusterId(url) {
|
|
198
162
|
var incomingUrlObj = _url.default.parse(url);
|
|
199
|
-
|
|
200
163
|
var serviceUrlObj;
|
|
201
|
-
|
|
202
164
|
for (var _i = 0, _Object$keys = (0, _keys.default)(this.serviceGroups); _i < _Object$keys.length; _i++) {
|
|
203
165
|
var key = _Object$keys[_i];
|
|
204
|
-
|
|
205
166
|
var _iterator = _createForOfIteratorHelper(this.serviceGroups[key]),
|
|
206
|
-
|
|
207
|
-
|
|
167
|
+
_step;
|
|
208
168
|
try {
|
|
209
169
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
210
170
|
var service = _step.value;
|
|
211
171
|
serviceUrlObj = _url.default.parse(service.defaultUrl);
|
|
212
|
-
|
|
213
172
|
var _iterator2 = _createForOfIteratorHelper(service.hosts),
|
|
214
|
-
|
|
215
|
-
|
|
173
|
+
_step2;
|
|
216
174
|
try {
|
|
217
175
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
218
176
|
var _host = _step2.value;
|
|
219
|
-
|
|
220
177
|
if (incomingUrlObj.hostname === _host.host && _host.id) {
|
|
221
178
|
return _host.id;
|
|
222
179
|
}
|
|
@@ -226,27 +183,24 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
226
183
|
} finally {
|
|
227
184
|
_iterator2.f();
|
|
228
185
|
}
|
|
229
|
-
|
|
230
186
|
if (serviceUrlObj.hostname === incomingUrlObj.hostname && service.hosts.length > 0) {
|
|
231
187
|
// no exact match, so try to grab the first home cluster
|
|
232
188
|
var _iterator3 = _createForOfIteratorHelper(service.hosts),
|
|
233
|
-
|
|
234
|
-
|
|
189
|
+
_step3;
|
|
235
190
|
try {
|
|
236
191
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
237
192
|
var host = _step3.value;
|
|
238
|
-
|
|
239
193
|
if (host.homeCluster) {
|
|
240
194
|
return host.id;
|
|
241
195
|
}
|
|
242
|
-
}
|
|
196
|
+
}
|
|
243
197
|
|
|
198
|
+
// no match found still, so return the first entry
|
|
244
199
|
} catch (err) {
|
|
245
200
|
_iterator3.e(err);
|
|
246
201
|
} finally {
|
|
247
202
|
_iterator3.f();
|
|
248
203
|
}
|
|
249
|
-
|
|
250
204
|
return service.hosts[0].id;
|
|
251
205
|
}
|
|
252
206
|
}
|
|
@@ -256,10 +210,8 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
256
210
|
_iterator.f();
|
|
257
211
|
}
|
|
258
212
|
}
|
|
259
|
-
|
|
260
213
|
return undefined;
|
|
261
214
|
},
|
|
262
|
-
|
|
263
215
|
/**
|
|
264
216
|
* Search over all service groups and return a service value from a provided
|
|
265
217
|
* clusterId. Currently, this method will return either a service name, or a
|
|
@@ -276,28 +228,24 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
276
228
|
*/
|
|
277
229
|
findServiceFromClusterId: function findServiceFromClusterId() {
|
|
278
230
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
231
|
+
clusterId = _ref.clusterId,
|
|
232
|
+
_ref$priorityHost = _ref.priorityHost,
|
|
233
|
+
priorityHost = _ref$priorityHost === void 0 ? true : _ref$priorityHost,
|
|
234
|
+
serviceGroup = _ref.serviceGroup;
|
|
284
235
|
var serviceUrls = typeof serviceGroup === 'string' ? this.serviceGroups[serviceGroup] || [] : [].concat((0, _toConsumableArray2.default)(this.serviceGroups.override), (0, _toConsumableArray2.default)(this.serviceGroups.postauth), (0, _toConsumableArray2.default)(this.serviceGroups.signin), (0, _toConsumableArray2.default)(this.serviceGroups.preauth), (0, _toConsumableArray2.default)(this.serviceGroups.discovery));
|
|
285
236
|
var identifiedServiceUrl = serviceUrls.find(function (serviceUrl) {
|
|
286
237
|
return serviceUrl.hosts.find(function (host) {
|
|
287
238
|
return host.id === clusterId;
|
|
288
239
|
});
|
|
289
240
|
});
|
|
290
|
-
|
|
291
241
|
if (identifiedServiceUrl) {
|
|
292
242
|
return {
|
|
293
243
|
name: identifiedServiceUrl.name,
|
|
294
244
|
url: identifiedServiceUrl.get(priorityHost, clusterId)
|
|
295
245
|
};
|
|
296
246
|
}
|
|
297
|
-
|
|
298
247
|
return undefined;
|
|
299
248
|
},
|
|
300
|
-
|
|
301
249
|
/**
|
|
302
250
|
* Find a service based on the provided url.
|
|
303
251
|
* @param {string} url - Must be parsable by `Url`
|
|
@@ -305,23 +253,19 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
305
253
|
*/
|
|
306
254
|
findServiceUrlFromUrl: function findServiceUrlFromUrl(url) {
|
|
307
255
|
var incomingUrlObj = _url.default.parse(url);
|
|
308
|
-
|
|
309
256
|
var serviceUrls = [].concat((0, _toConsumableArray2.default)(this.serviceGroups.discovery), (0, _toConsumableArray2.default)(this.serviceGroups.preauth), (0, _toConsumableArray2.default)(this.serviceGroups.signin), (0, _toConsumableArray2.default)(this.serviceGroups.postauth), (0, _toConsumableArray2.default)(this.serviceGroups.override));
|
|
310
257
|
return serviceUrls.find(function (serviceUrl) {
|
|
311
258
|
if (incomingUrlObj.hostname === _url.default.parse(serviceUrl.defaultUrl).hostname) {
|
|
312
259
|
return true;
|
|
313
260
|
}
|
|
314
|
-
|
|
315
261
|
if (serviceUrl.hosts.find(function (host) {
|
|
316
262
|
return host.host === incomingUrlObj.hostname;
|
|
317
263
|
})) {
|
|
318
264
|
return true;
|
|
319
265
|
}
|
|
320
|
-
|
|
321
266
|
return false;
|
|
322
267
|
});
|
|
323
268
|
},
|
|
324
|
-
|
|
325
269
|
/**
|
|
326
270
|
* Finds an allowed domain that matches a specific url.
|
|
327
271
|
*
|
|
@@ -330,16 +274,13 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
330
274
|
*/
|
|
331
275
|
findAllowedDomain: function findAllowedDomain(url) {
|
|
332
276
|
var urlObj = _url.default.parse(url);
|
|
333
|
-
|
|
334
277
|
if (!urlObj.host) {
|
|
335
278
|
return undefined;
|
|
336
279
|
}
|
|
337
|
-
|
|
338
280
|
return this.allowedDomains.find(function (allowedDomain) {
|
|
339
281
|
return urlObj.host.includes(allowedDomain);
|
|
340
282
|
});
|
|
341
283
|
},
|
|
342
|
-
|
|
343
284
|
/**
|
|
344
285
|
* Get a service url from the current services list by name.
|
|
345
286
|
* @param {string} name
|
|
@@ -349,10 +290,8 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
349
290
|
*/
|
|
350
291
|
get: function get(name, priorityHost, serviceGroup) {
|
|
351
292
|
var serviceUrl = this._getUrl(name, serviceGroup);
|
|
352
|
-
|
|
353
293
|
return serviceUrl ? serviceUrl.get(priorityHost) : undefined;
|
|
354
294
|
},
|
|
355
|
-
|
|
356
295
|
/**
|
|
357
296
|
* Get the current allowed domains list.
|
|
358
297
|
*
|
|
@@ -361,7 +300,6 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
361
300
|
getAllowedDomains: function getAllowedDomains() {
|
|
362
301
|
return (0, _toConsumableArray2.default)(this.allowedDomains);
|
|
363
302
|
},
|
|
364
|
-
|
|
365
303
|
/**
|
|
366
304
|
* Creates an object where the keys are the service names
|
|
367
305
|
* and the values are the service urls.
|
|
@@ -372,16 +310,13 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
372
310
|
list: function list(priorityHost, serviceGroup) {
|
|
373
311
|
var output = {};
|
|
374
312
|
var serviceUrls = typeof serviceGroup === 'string' ? this.serviceGroups[serviceGroup] || [] : [].concat((0, _toConsumableArray2.default)(this.serviceGroups.discovery), (0, _toConsumableArray2.default)(this.serviceGroups.preauth), (0, _toConsumableArray2.default)(this.serviceGroups.signin), (0, _toConsumableArray2.default)(this.serviceGroups.postauth), (0, _toConsumableArray2.default)(this.serviceGroups.override));
|
|
375
|
-
|
|
376
313
|
if (serviceUrls) {
|
|
377
314
|
serviceUrls.forEach(function (serviceUrl) {
|
|
378
315
|
output[serviceUrl.name] = serviceUrl.get(priorityHost);
|
|
379
316
|
});
|
|
380
317
|
}
|
|
381
|
-
|
|
382
318
|
return output;
|
|
383
319
|
},
|
|
384
|
-
|
|
385
320
|
/**
|
|
386
321
|
* Mark a priority host service url as failed.
|
|
387
322
|
* This will mark the host associated with the
|
|
@@ -397,18 +332,14 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
397
332
|
*/
|
|
398
333
|
markFailedUrl: function markFailedUrl(url, noPriorityHosts) {
|
|
399
334
|
var _this3 = this;
|
|
400
|
-
|
|
401
335
|
var serviceUrl = this._getUrl((0, _keys.default)(this.list()).find(function (key) {
|
|
402
336
|
return _this3._getUrl(key).failHost(url);
|
|
403
337
|
}));
|
|
404
|
-
|
|
405
338
|
if (!serviceUrl) {
|
|
406
339
|
return undefined;
|
|
407
340
|
}
|
|
408
|
-
|
|
409
341
|
return noPriorityHosts ? serviceUrl.get(false) : serviceUrl.get(true);
|
|
410
342
|
},
|
|
411
|
-
|
|
412
343
|
/**
|
|
413
344
|
* Set the allowed domains for the catalog.
|
|
414
345
|
*
|
|
@@ -418,7 +349,6 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
418
349
|
setAllowedDomains: function setAllowedDomains(allowedDomains) {
|
|
419
350
|
this.allowedDomains = (0, _toConsumableArray2.default)(allowedDomains);
|
|
420
351
|
},
|
|
421
|
-
|
|
422
352
|
/**
|
|
423
353
|
* Update the current list of `ServiceUrl`s against a provided
|
|
424
354
|
* service hostmap.
|
|
@@ -430,19 +360,15 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
430
360
|
*/
|
|
431
361
|
updateServiceUrls: function updateServiceUrls(serviceGroup, serviceHostmap) {
|
|
432
362
|
var _this4 = this;
|
|
433
|
-
|
|
434
363
|
var currentServiceUrls = this.serviceGroups[serviceGroup];
|
|
435
364
|
var unusedUrls = currentServiceUrls.filter(function (serviceUrl) {
|
|
436
365
|
return serviceHostmap.every(function (item) {
|
|
437
366
|
return item.name !== serviceUrl.name;
|
|
438
367
|
});
|
|
439
368
|
});
|
|
440
|
-
|
|
441
369
|
this._unloadServiceUrls(serviceGroup, unusedUrls);
|
|
442
|
-
|
|
443
370
|
serviceHostmap.forEach(function (serviceObj) {
|
|
444
371
|
var service = _this4._getUrl(serviceObj.name, serviceGroup);
|
|
445
|
-
|
|
446
372
|
if (service) {
|
|
447
373
|
service.defaultUrl = serviceObj.defaultUrl;
|
|
448
374
|
service.hosts = serviceObj.hosts || [];
|
|
@@ -454,7 +380,6 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
454
380
|
this.trigger(serviceGroup);
|
|
455
381
|
return this;
|
|
456
382
|
},
|
|
457
|
-
|
|
458
383
|
/**
|
|
459
384
|
* Wait until the service catalog is available,
|
|
460
385
|
* or reject after a timeout of 60 seconds.
|
|
@@ -464,16 +389,13 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
464
389
|
*/
|
|
465
390
|
waitForCatalog: function waitForCatalog(serviceGroup, timeout) {
|
|
466
391
|
var _this5 = this;
|
|
467
|
-
|
|
468
392
|
return new _promise.default(function (resolve, reject) {
|
|
469
393
|
if (_this5.status[serviceGroup].ready) {
|
|
470
394
|
resolve();
|
|
471
395
|
}
|
|
472
|
-
|
|
473
396
|
var timeoutTimer = setTimeout(function () {
|
|
474
397
|
return reject(new Error("services: timeout occured while waiting for '".concat(serviceGroup, "' catalog to populate")));
|
|
475
398
|
}, timeout ? timeout * 1000 : 60000);
|
|
476
|
-
|
|
477
399
|
_this5.once(serviceGroup, function () {
|
|
478
400
|
clearTimeout(timeoutTimer);
|
|
479
401
|
resolve();
|
|
@@ -482,8 +404,6 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
482
404
|
}
|
|
483
405
|
});
|
|
484
406
|
/* eslint-enable no-underscore-dangle */
|
|
485
|
-
|
|
486
|
-
|
|
487
407
|
var _default = ServiceCatalog;
|
|
488
408
|
exports.default = _default;
|
|
489
409
|
//# sourceMappingURL=service-catalog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ServiceCatalog","AmpState","extend","namespace","props","serviceGroups","discovery","override","preauth","postauth","signin","status","ready","collecting","isReady","allowedDomains","_getUrl","name","serviceGroup","serviceUrls","find","serviceUrl","_listServiceUrls","_loadServiceUrls","services","existingService","forEach","service","push","_unloadServiceUrls","splice","indexOf","clean","length","findClusterId","url","incomingUrlObj","Url","parse","serviceUrlObj","key","defaultUrl","hosts","host","hostname","id","homeCluster","undefined","findServiceFromClusterId","clusterId","priorityHost","identifiedServiceUrl","get","findServiceUrlFromUrl","findAllowedDomain","urlObj","allowedDomain","includes","getAllowedDomains","list","output","markFailedUrl","noPriorityHosts","failHost","setAllowedDomains","updateServiceUrls","serviceHostmap","currentServiceUrls","unusedUrls","filter","every","item","serviceObj","ServiceUrl","trigger","waitForCatalog","timeout","resolve","reject","timeoutTimer","setTimeout","Error","once","clearTimeout"],"sources":["service-catalog.js"],"sourcesContent":["import Url from 'url';\n\nimport AmpState from 'ampersand-state';\n\nimport ServiceUrl from './service-url';\n\n/* eslint-disable no-underscore-dangle */\n/**\n * @class\n */\nconst ServiceCatalog = AmpState.extend({\n namespace: 'ServiceCatalog',\n\n props: {\n serviceGroups: ['object', true, (() => ({\n discovery: [],\n override: [],\n preauth: [],\n postauth: [],\n signin: []\n }))],\n status: ['object', true, (() => ({\n discovery: {\n ready: false,\n collecting: false\n },\n override: {\n ready: false,\n collecting: false\n },\n preauth: {\n ready: false,\n collecting: false\n },\n postauth: {\n ready: false,\n collecting: false\n },\n signin: {\n ready: false,\n collecting: false\n }\n }))],\n isReady: ['boolean', false, false],\n allowedDomains: ['array', false, (() => [])]\n },\n\n /**\n * @private\n * Search the service url array to locate a `ServiceUrl`\n * class object based on its name.\n * @param {string} name\n * @param {string} [serviceGroup]\n * @returns {ServiceUrl}\n */\n _getUrl(name, serviceGroup) {\n const serviceUrls = (typeof serviceGroup === 'string') ?\n this.serviceGroups[serviceGroup] || [] :\n [\n ...this.serviceGroups.override,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.discovery\n ];\n\n return serviceUrls.find((serviceUrl) => serviceUrl.name === name);\n },\n\n /**\n * @private\n * Generate an array of `ServiceUrl`s that is organized from highest auth\n * level to lowest auth level.\n * @returns {Array<ServiceUrl>} - array of `ServiceUrl`s\n */\n _listServiceUrls() {\n return [\n ...this.serviceGroups.override,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.discovery\n ];\n },\n\n /**\n * @private\n * Safely load one or more `ServiceUrl`s into this `Services` instance.\n * @param {string} serviceGroup\n * @param {Array<ServiceUrl>} services\n * @returns {Services}\n */\n _loadServiceUrls(serviceGroup, services) {\n // declare namespaces outside of loop\n let existingService;\n\n services.forEach((service) => {\n existingService = this._getUrl(service.name, serviceGroup);\n\n if (!existingService) {\n this.serviceGroups[serviceGroup].push(service);\n }\n });\n\n return this;\n },\n\n /**\n * @private\n * Safely unload one or more `ServiceUrl`s into this `Services` instance\n * @param {string} serviceGroup\n * @param {Array<ServiceUrl>} services\n * @returns {Services}\n */\n _unloadServiceUrls(serviceGroup, services) {\n // declare namespaces outside of loop\n let existingService;\n\n services.forEach((service) => {\n existingService = this._getUrl(service.name, serviceGroup);\n\n if (existingService) {\n this.serviceGroups[serviceGroup].splice(\n this.serviceGroups[serviceGroup].indexOf(existingService), 1\n );\n }\n });\n\n return this;\n },\n\n /**\n * Clear all collected catalog data and reset catalog status.\n *\n * @returns {void}\n */\n clean() {\n this.serviceGroups.preauth.length = 0;\n this.serviceGroups.signin.length = 0;\n this.serviceGroups.postauth.length = 0;\n this.status.preauth = {ready: false};\n this.status.signin = {ready: false};\n this.status.postauth = {ready: false};\n },\n\n /**\n * Search over all service groups to find a cluster id based\n * on a given url.\n * @param {string} url - Must be parsable by `Url`\n * @returns {string} - ClusterId of a given url\n */\n findClusterId(url) {\n const incomingUrlObj = Url.parse(url);\n let serviceUrlObj;\n\n for (const key of Object.keys(this.serviceGroups)) {\n for (const service of this.serviceGroups[key]) {\n serviceUrlObj = Url.parse(service.defaultUrl);\n\n for (const host of service.hosts) {\n if (incomingUrlObj.hostname === host.host && host.id) {\n return host.id;\n }\n }\n\n if (serviceUrlObj.hostname === incomingUrlObj.hostname &&\n service.hosts.length > 0) {\n // no exact match, so try to grab the first home cluster\n for (const host of service.hosts) {\n if (host.homeCluster) {\n return host.id;\n }\n }\n\n // no match found still, so return the first entry\n return service.hosts[0].id;\n }\n }\n }\n\n return undefined;\n },\n\n /**\n * Search over all service groups and return a service value from a provided\n * clusterId. Currently, this method will return either a service name, or a\n * service url depending on the `value` parameter. If the `value` parameter\n * is set to `name`, it will return a service name to be utilized within the\n * Services plugin methods.\n * @param {object} params\n * @param {string} params.clusterId - clusterId of found service\n * @param {boolean} [params.priorityHost = true] - returns priority host url if true\n * @param {string} [params.serviceGroup] - specify service group\n * @returns {object} service\n * @returns {string} service.name\n * @returns {string} service.url\n */\n findServiceFromClusterId({clusterId, priorityHost = true, serviceGroup} = {}) {\n const serviceUrls = (typeof serviceGroup === 'string') ?\n this.serviceGroups[serviceGroup] || [] : [\n ...this.serviceGroups.override,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.discovery\n ];\n\n const identifiedServiceUrl = serviceUrls.find(\n (serviceUrl) => serviceUrl.hosts.find(\n (host) => host.id === clusterId\n )\n );\n\n if (identifiedServiceUrl) {\n return {\n name: identifiedServiceUrl.name,\n url: identifiedServiceUrl.get(priorityHost, clusterId)\n };\n }\n\n return undefined;\n },\n\n /**\n * Find a service based on the provided url.\n * @param {string} url - Must be parsable by `Url`\n * @returns {serviceUrl} - ServiceUrl assocated with provided url\n */\n findServiceUrlFromUrl(url) {\n const incomingUrlObj = Url.parse(url);\n const serviceUrls = [\n ...this.serviceGroups.discovery,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.override\n ];\n\n return serviceUrls.find(\n (serviceUrl) => {\n if (incomingUrlObj.hostname ===\n Url.parse(serviceUrl.defaultUrl).hostname) {\n return true;\n }\n\n if (serviceUrl.hosts.find((host) => host.host === incomingUrlObj.hostname)) {\n return true;\n }\n\n return false;\n }\n );\n },\n\n /**\n * Finds an allowed domain that matches a specific url.\n *\n * @param {string} url - The url to match the allowed domains against.\n * @returns {string} - The matching allowed domain.\n */\n findAllowedDomain(url) {\n const urlObj = Url.parse(url);\n\n if (!urlObj.host) {\n return undefined;\n }\n\n return this.allowedDomains.find(\n (allowedDomain) => urlObj.host.includes(allowedDomain)\n );\n },\n\n /**\n * Get a service url from the current services list by name.\n * @param {string} name\n * @param {boolean} priorityHost\n * @param {string} serviceGroup\n * @returns {string}\n */\n get(name, priorityHost, serviceGroup) {\n const serviceUrl = this._getUrl(name, serviceGroup);\n\n return (serviceUrl) ? serviceUrl.get(priorityHost) : undefined;\n },\n\n /**\n * Get the current allowed domains list.\n *\n * @returns {Array<string>} - the current allowed domains list.\n */\n getAllowedDomains() {\n return [...this.allowedDomains];\n },\n\n /**\n * Creates an object where the keys are the service names\n * and the values are the service urls.\n * @param {boolean} priorityHost - use the highest priority if set to `true`\n * @param {string} [serviceGroup]\n * @returns {Record<string, string>}\n */\n list(priorityHost, serviceGroup) {\n const output = {};\n\n const serviceUrls = (typeof serviceGroup === 'string') ?\n this.serviceGroups[serviceGroup] || [] :\n [\n ...this.serviceGroups.discovery,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.override\n ];\n\n if (serviceUrls) {\n serviceUrls.forEach((serviceUrl) => {\n output[serviceUrl.name] = serviceUrl.get(priorityHost);\n });\n }\n\n return output;\n },\n\n /**\n * Mark a priority host service url as failed.\n * This will mark the host associated with the\n * `ServiceUrl` to be removed from the its\n * respective host array, and then return the next\n * viable host from the `ServiceUrls` host array,\n * or the `ServiceUrls` default url if no other priority\n * hosts are available, or if `noPriorityHosts` is set to\n * `true`.\n * @param {string} url\n * @param {boolean} noPriorityHosts\n * @returns {string}\n */\n markFailedUrl(url, noPriorityHosts) {\n const serviceUrl = this._getUrl(Object.keys(this.list()).find(\n (key) => this._getUrl(key).failHost(url)\n ));\n\n if (!serviceUrl) {\n return undefined;\n }\n\n return (noPriorityHosts) ? serviceUrl.get(false) : serviceUrl.get(true);\n },\n\n /**\n * Set the allowed domains for the catalog.\n *\n * @param {Array<string>} allowedDomains - allowed domains to be assigned.\n * @returns {void}\n */\n setAllowedDomains(allowedDomains) {\n this.allowedDomains = [...allowedDomains];\n },\n\n /**\n * Update the current list of `ServiceUrl`s against a provided\n * service hostmap.\n * @emits ServiceCatalog#preauthorized\n * @emits ServiceCatalog#postauthorized\n * @param {string} serviceGroup\n * @param {object} serviceHostmap\n * @returns {Services}\n */\n updateServiceUrls(serviceGroup, serviceHostmap) {\n const currentServiceUrls = this.serviceGroups[serviceGroup];\n\n const unusedUrls = currentServiceUrls.filter(\n (serviceUrl) => serviceHostmap.every(\n (item) => item.name !== serviceUrl.name\n )\n );\n\n this._unloadServiceUrls(serviceGroup, unusedUrls);\n\n serviceHostmap.forEach((serviceObj) => {\n const service = this._getUrl(serviceObj.name, serviceGroup);\n\n if (service) {\n service.defaultUrl = serviceObj.defaultUrl;\n service.hosts = serviceObj.hosts || [];\n }\n else {\n this._loadServiceUrls(serviceGroup, [new ServiceUrl({\n ...serviceObj\n })]);\n }\n });\n\n this.status[serviceGroup].ready = true;\n this.trigger(serviceGroup);\n\n return this;\n },\n\n /**\n * Wait until the service catalog is available,\n * or reject after a timeout of 60 seconds.\n * @param {string} serviceGroup\n * @param {number} [timeout] - in seconds\n * @returns {Promise<void>}\n */\n waitForCatalog(serviceGroup, timeout) {\n return new Promise((resolve, reject) => {\n if (this.status[serviceGroup].ready) {\n resolve();\n }\n\n const timeoutTimer = setTimeout(() => reject(\n new Error(`services: timeout occured while waiting for '${serviceGroup}' catalog to populate`)\n ), (timeout) ? timeout * 1000 : 60000);\n\n this.once(serviceGroup, () => {\n clearTimeout(timeoutTimer);\n resolve();\n });\n });\n }\n});\n/* eslint-enable no-underscore-dangle */\n\nexport default ServiceCatalog;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAEA;;;;;;;;;;;;AAEA;;AACA;AACA;AACA;AACA,IAAMA,cAAc,GAAGC,uBAAA,CAASC,MAAT,CAAgB;EACrCC,SAAS,EAAE,gBAD0B;EAGrCC,KAAK,EAAE;IACLC,aAAa,EAAE,CAAC,QAAD,EAAW,IAAX,EAAkB;MAAA,OAAO;QACtCC,SAAS,EAAE,EAD2B;QAEtCC,QAAQ,EAAE,EAF4B;QAGtCC,OAAO,EAAE,EAH6B;QAItCC,QAAQ,EAAE,EAJ4B;QAKtCC,MAAM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C,IAAIuD,mBAAJ,mBAChCD,UADgC,EAAD,CAApC;MAGD;IACF,CAZD;IAcA,KAAK7D,MAAL,CAAYO,YAAZ,EAA0BN,KAA1B,GAAkC,IAAlC;IACA,KAAK8D,OAAL,CAAaxD,YAAb;IAEA,OAAO,IAAP;EACD,CAlYoC;;EAoYrC;AACF;AACA;AACA;AACA;AACA;AACA;EACEyD,cA3YqC,0BA2YtBzD,YA3YsB,EA2YR0D,OA3YQ,EA2YC;IAAA;;IACpC,OAAO,qBAAY,UAACC,OAAD,EAAUC,MAAV,EAAqB;MACtC,IAAI,MAAI,CAACnE,MAAL,CAAYO,YAAZ,EAA0BN,KAA9B,EAAqC;QACnCiE,OAAO;MACR;;MAED,IAAME,YAAY,GAAGC,UAAU,CAAC;QAAA,OAAMF,MAAM,CAC1C,IAAIG,KAAJ,wDAA0D/D,YAA1D,2BAD0C,CAAZ;MAAA,CAAD,EAE3B0D,OAAD,GAAYA,OAAO,GAAG,IAAtB,GAA6B,KAFD,CAA/B;;MAIA,MAAI,CAACM,IAAL,CAAUhE,YAAV,EAAwB,YAAM;QAC5BiE,YAAY,CAACJ,YAAD,CAAZ;QACAF,OAAO;MACR,CAHD;IAID,CAbM,CAAP;EAcD;AA1ZoC,CAAhB,CAAvB;AA4ZA;;;eAEe7E,c"}
|
|
1
|
+
{"version":3,"names":["ServiceCatalog","AmpState","extend","namespace","props","serviceGroups","discovery","override","preauth","postauth","signin","status","ready","collecting","isReady","allowedDomains","_getUrl","name","serviceGroup","serviceUrls","find","serviceUrl","_listServiceUrls","_loadServiceUrls","services","existingService","forEach","service","push","_unloadServiceUrls","splice","indexOf","clean","length","findClusterId","url","incomingUrlObj","Url","parse","serviceUrlObj","key","defaultUrl","hosts","host","hostname","id","homeCluster","undefined","findServiceFromClusterId","clusterId","priorityHost","identifiedServiceUrl","get","findServiceUrlFromUrl","findAllowedDomain","urlObj","allowedDomain","includes","getAllowedDomains","list","output","markFailedUrl","noPriorityHosts","failHost","setAllowedDomains","updateServiceUrls","serviceHostmap","currentServiceUrls","unusedUrls","filter","every","item","serviceObj","ServiceUrl","trigger","waitForCatalog","timeout","resolve","reject","timeoutTimer","setTimeout","Error","once","clearTimeout"],"sources":["service-catalog.js"],"sourcesContent":["import Url from 'url';\n\nimport AmpState from 'ampersand-state';\n\nimport ServiceUrl from './service-url';\n\n/* eslint-disable no-underscore-dangle */\n/**\n * @class\n */\nconst ServiceCatalog = AmpState.extend({\n namespace: 'ServiceCatalog',\n\n props: {\n serviceGroups: [\n 'object',\n true,\n () => ({\n discovery: [],\n override: [],\n preauth: [],\n postauth: [],\n signin: [],\n }),\n ],\n status: [\n 'object',\n true,\n () => ({\n discovery: {\n ready: false,\n collecting: false,\n },\n override: {\n ready: false,\n collecting: false,\n },\n preauth: {\n ready: false,\n collecting: false,\n },\n postauth: {\n ready: false,\n collecting: false,\n },\n signin: {\n ready: false,\n collecting: false,\n },\n }),\n ],\n isReady: ['boolean', false, false],\n allowedDomains: ['array', false, () => []],\n },\n\n /**\n * @private\n * Search the service url array to locate a `ServiceUrl`\n * class object based on its name.\n * @param {string} name\n * @param {string} [serviceGroup]\n * @returns {ServiceUrl}\n */\n _getUrl(name, serviceGroup) {\n const serviceUrls =\n typeof serviceGroup === 'string'\n ? this.serviceGroups[serviceGroup] || []\n : [\n ...this.serviceGroups.override,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.discovery,\n ];\n\n return serviceUrls.find((serviceUrl) => serviceUrl.name === name);\n },\n\n /**\n * @private\n * Generate an array of `ServiceUrl`s that is organized from highest auth\n * level to lowest auth level.\n * @returns {Array<ServiceUrl>} - array of `ServiceUrl`s\n */\n _listServiceUrls() {\n return [\n ...this.serviceGroups.override,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.discovery,\n ];\n },\n\n /**\n * @private\n * Safely load one or more `ServiceUrl`s into this `Services` instance.\n * @param {string} serviceGroup\n * @param {Array<ServiceUrl>} services\n * @returns {Services}\n */\n _loadServiceUrls(serviceGroup, services) {\n // declare namespaces outside of loop\n let existingService;\n\n services.forEach((service) => {\n existingService = this._getUrl(service.name, serviceGroup);\n\n if (!existingService) {\n this.serviceGroups[serviceGroup].push(service);\n }\n });\n\n return this;\n },\n\n /**\n * @private\n * Safely unload one or more `ServiceUrl`s into this `Services` instance\n * @param {string} serviceGroup\n * @param {Array<ServiceUrl>} services\n * @returns {Services}\n */\n _unloadServiceUrls(serviceGroup, services) {\n // declare namespaces outside of loop\n let existingService;\n\n services.forEach((service) => {\n existingService = this._getUrl(service.name, serviceGroup);\n\n if (existingService) {\n this.serviceGroups[serviceGroup].splice(\n this.serviceGroups[serviceGroup].indexOf(existingService),\n 1\n );\n }\n });\n\n return this;\n },\n\n /**\n * Clear all collected catalog data and reset catalog status.\n *\n * @returns {void}\n */\n clean() {\n this.serviceGroups.preauth.length = 0;\n this.serviceGroups.signin.length = 0;\n this.serviceGroups.postauth.length = 0;\n this.status.preauth = {ready: false};\n this.status.signin = {ready: false};\n this.status.postauth = {ready: false};\n },\n\n /**\n * Search over all service groups to find a cluster id based\n * on a given url.\n * @param {string} url - Must be parsable by `Url`\n * @returns {string} - ClusterId of a given url\n */\n findClusterId(url) {\n const incomingUrlObj = Url.parse(url);\n let serviceUrlObj;\n\n for (const key of Object.keys(this.serviceGroups)) {\n for (const service of this.serviceGroups[key]) {\n serviceUrlObj = Url.parse(service.defaultUrl);\n\n for (const host of service.hosts) {\n if (incomingUrlObj.hostname === host.host && host.id) {\n return host.id;\n }\n }\n\n if (serviceUrlObj.hostname === incomingUrlObj.hostname && service.hosts.length > 0) {\n // no exact match, so try to grab the first home cluster\n for (const host of service.hosts) {\n if (host.homeCluster) {\n return host.id;\n }\n }\n\n // no match found still, so return the first entry\n return service.hosts[0].id;\n }\n }\n }\n\n return undefined;\n },\n\n /**\n * Search over all service groups and return a service value from a provided\n * clusterId. Currently, this method will return either a service name, or a\n * service url depending on the `value` parameter. If the `value` parameter\n * is set to `name`, it will return a service name to be utilized within the\n * Services plugin methods.\n * @param {object} params\n * @param {string} params.clusterId - clusterId of found service\n * @param {boolean} [params.priorityHost = true] - returns priority host url if true\n * @param {string} [params.serviceGroup] - specify service group\n * @returns {object} service\n * @returns {string} service.name\n * @returns {string} service.url\n */\n findServiceFromClusterId({clusterId, priorityHost = true, serviceGroup} = {}) {\n const serviceUrls =\n typeof serviceGroup === 'string'\n ? this.serviceGroups[serviceGroup] || []\n : [\n ...this.serviceGroups.override,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.discovery,\n ];\n\n const identifiedServiceUrl = serviceUrls.find((serviceUrl) =>\n serviceUrl.hosts.find((host) => host.id === clusterId)\n );\n\n if (identifiedServiceUrl) {\n return {\n name: identifiedServiceUrl.name,\n url: identifiedServiceUrl.get(priorityHost, clusterId),\n };\n }\n\n return undefined;\n },\n\n /**\n * Find a service based on the provided url.\n * @param {string} url - Must be parsable by `Url`\n * @returns {serviceUrl} - ServiceUrl assocated with provided url\n */\n findServiceUrlFromUrl(url) {\n const incomingUrlObj = Url.parse(url);\n const serviceUrls = [\n ...this.serviceGroups.discovery,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.override,\n ];\n\n return serviceUrls.find((serviceUrl) => {\n if (incomingUrlObj.hostname === Url.parse(serviceUrl.defaultUrl).hostname) {\n return true;\n }\n\n if (serviceUrl.hosts.find((host) => host.host === incomingUrlObj.hostname)) {\n return true;\n }\n\n return false;\n });\n },\n\n /**\n * Finds an allowed domain that matches a specific url.\n *\n * @param {string} url - The url to match the allowed domains against.\n * @returns {string} - The matching allowed domain.\n */\n findAllowedDomain(url) {\n const urlObj = Url.parse(url);\n\n if (!urlObj.host) {\n return undefined;\n }\n\n return this.allowedDomains.find((allowedDomain) => urlObj.host.includes(allowedDomain));\n },\n\n /**\n * Get a service url from the current services list by name.\n * @param {string} name\n * @param {boolean} priorityHost\n * @param {string} serviceGroup\n * @returns {string}\n */\n get(name, priorityHost, serviceGroup) {\n const serviceUrl = this._getUrl(name, serviceGroup);\n\n return serviceUrl ? serviceUrl.get(priorityHost) : undefined;\n },\n\n /**\n * Get the current allowed domains list.\n *\n * @returns {Array<string>} - the current allowed domains list.\n */\n getAllowedDomains() {\n return [...this.allowedDomains];\n },\n\n /**\n * Creates an object where the keys are the service names\n * and the values are the service urls.\n * @param {boolean} priorityHost - use the highest priority if set to `true`\n * @param {string} [serviceGroup]\n * @returns {Record<string, string>}\n */\n list(priorityHost, serviceGroup) {\n const output = {};\n\n const serviceUrls =\n typeof serviceGroup === 'string'\n ? this.serviceGroups[serviceGroup] || []\n : [\n ...this.serviceGroups.discovery,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.override,\n ];\n\n if (serviceUrls) {\n serviceUrls.forEach((serviceUrl) => {\n output[serviceUrl.name] = serviceUrl.get(priorityHost);\n });\n }\n\n return output;\n },\n\n /**\n * Mark a priority host service url as failed.\n * This will mark the host associated with the\n * `ServiceUrl` to be removed from the its\n * respective host array, and then return the next\n * viable host from the `ServiceUrls` host array,\n * or the `ServiceUrls` default url if no other priority\n * hosts are available, or if `noPriorityHosts` is set to\n * `true`.\n * @param {string} url\n * @param {boolean} noPriorityHosts\n * @returns {string}\n */\n markFailedUrl(url, noPriorityHosts) {\n const serviceUrl = this._getUrl(\n Object.keys(this.list()).find((key) => this._getUrl(key).failHost(url))\n );\n\n if (!serviceUrl) {\n return undefined;\n }\n\n return noPriorityHosts ? serviceUrl.get(false) : serviceUrl.get(true);\n },\n\n /**\n * Set the allowed domains for the catalog.\n *\n * @param {Array<string>} allowedDomains - allowed domains to be assigned.\n * @returns {void}\n */\n setAllowedDomains(allowedDomains) {\n this.allowedDomains = [...allowedDomains];\n },\n\n /**\n * Update the current list of `ServiceUrl`s against a provided\n * service hostmap.\n * @emits ServiceCatalog#preauthorized\n * @emits ServiceCatalog#postauthorized\n * @param {string} serviceGroup\n * @param {object} serviceHostmap\n * @returns {Services}\n */\n updateServiceUrls(serviceGroup, serviceHostmap) {\n const currentServiceUrls = this.serviceGroups[serviceGroup];\n\n const unusedUrls = currentServiceUrls.filter((serviceUrl) =>\n serviceHostmap.every((item) => item.name !== serviceUrl.name)\n );\n\n this._unloadServiceUrls(serviceGroup, unusedUrls);\n\n serviceHostmap.forEach((serviceObj) => {\n const service = this._getUrl(serviceObj.name, serviceGroup);\n\n if (service) {\n service.defaultUrl = serviceObj.defaultUrl;\n service.hosts = serviceObj.hosts || [];\n } else {\n this._loadServiceUrls(serviceGroup, [\n new ServiceUrl({\n ...serviceObj,\n }),\n ]);\n }\n });\n\n this.status[serviceGroup].ready = true;\n this.trigger(serviceGroup);\n\n return this;\n },\n\n /**\n * Wait until the service catalog is available,\n * or reject after a timeout of 60 seconds.\n * @param {string} serviceGroup\n * @param {number} [timeout] - in seconds\n * @returns {Promise<void>}\n */\n waitForCatalog(serviceGroup, timeout) {\n return new Promise((resolve, reject) => {\n if (this.status[serviceGroup].ready) {\n resolve();\n }\n\n const timeoutTimer = setTimeout(\n () =>\n reject(\n new Error(\n `services: timeout occured while waiting for '${serviceGroup}' catalog to populate`\n )\n ),\n timeout ? timeout * 1000 : 60000\n );\n\n this.once(serviceGroup, () => {\n clearTimeout(timeoutTimer);\n resolve();\n });\n });\n },\n});\n/* eslint-enable no-underscore-dangle */\n\nexport default ServiceCatalog;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAEA;AAEA;AAAuC;AAAA;AAAA;AAAA;AAAA;AAEvC;AACA;AACA;AACA;AACA,IAAMA,cAAc,GAAGC,uBAAQ,CAACC,MAAM,CAAC;EACrCC,SAAS,EAAE,gBAAgB;EAE3BC,KAAK,EAAE;IACLC,aAAa,EAAE,CACb,QAAQ,EACR,IAAI,EACJ;MAAA,OAAO;QAC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;AACA;AACA;EACEyD,cAAc,0BAACzD,YAAY,EAAE0D,OAAO,EAAE;IAAA;IACpC,OAAO,qBAAY,UAACC,OAAO,EAAEC,MAAM,EAAK;MACtC,IAAI,MAAI,CAACnE,MAAM,CAACO,YAAY,CAAC,CAACN,KAAK,EAAE;QACnCiE,OAAO,EAAE;MACX;MAEA,IAAME,YAAY,GAAGC,UAAU,CAC7B;QAAA,OACEF,MAAM,CACJ,IAAIG,KAAK,wDACyC/D,YAAY,2BAC7D,CACF;MAAA,GACH0D,OAAO,GAAGA,OAAO,GAAG,IAAI,GAAG,KAAK,CACjC;MAED,MAAI,CAACM,IAAI,CAAChE,YAAY,EAAE,YAAM;QAC5BiE,YAAY,CAACJ,YAAY,CAAC;QAC1BF,OAAO,EAAE;MACX,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;AACF,CAAC,CAAC;AACF;AAAA,eAEe7E,cAAc;AAAA"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
|
|
9
7
|
exports.default = void 0;
|
|
10
8
|
var _default = {
|
|
11
9
|
hydra: 'https://api-usgov.webex.com/v1',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["hydra","u2c"],"sources":["service-fed-ramp.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["hydra","u2c"],"sources":["service-fed-ramp.js"],"sourcesContent":["export default {\n hydra: 'https://api-usgov.webex.com/v1',\n u2c: 'https://u2c.gov.ciscospark.com/u2c/api/v1',\n};\n"],"mappings":";;;;;;;eAAe;EACbA,KAAK,EAAE,gCAAgC;EACvCC,GAAG,EAAE;AACP,CAAC;AAAA"}
|