@alicloud/alfa-core 1.5.1 → 1.5.2
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/es/utils/getConfig.js +25 -18
- package/lib/utils/getConfig.js +25 -18
- package/package.json +1 -1
- package/types/utils/getConfig.d.ts +2 -2
package/es/utils/getConfig.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
|
+
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; }
|
|
5
|
+
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) { _defineProperty(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; }
|
|
3
6
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
7
|
import parseEnv from '@alicloud/console-base-conf-parse-env';
|
|
5
8
|
import { getRelease } from './getRelease';
|
|
@@ -90,7 +93,7 @@ export var getConfig = /*#__PURE__*/function () {
|
|
|
90
93
|
*/
|
|
91
94
|
export var getConfigV2 = /*#__PURE__*/function () {
|
|
92
95
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(config) {
|
|
93
|
-
var releaseConfig, _ref5, relatedConsoleAppId, _ALIYUN_CONSOLE_CONFI, res;
|
|
96
|
+
var releaseConfig, _ref5, relatedConsoleAppId, currentConfig, _ALIYUN_CONSOLE_CONFI, res;
|
|
94
97
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
95
98
|
while (1) switch (_context2.prev = _context2.next) {
|
|
96
99
|
case 0:
|
|
@@ -99,35 +102,39 @@ export var getConfigV2 = /*#__PURE__*/function () {
|
|
|
99
102
|
case 2:
|
|
100
103
|
releaseConfig = _context2.sent;
|
|
101
104
|
_ref5 = releaseConfig.metadata || {}, relatedConsoleAppId = _ref5.relatedConsoleAppId;
|
|
105
|
+
currentConfig = {
|
|
106
|
+
ALIYUN_CONSOLE_CONFIG: window.ALIYUN_CONSOLE_CONFIG || {},
|
|
107
|
+
ALIYUN_CONSOLE_GLOBAL: window.ALIYUN_CONSOLE_GLOBAL || {}
|
|
108
|
+
};
|
|
102
109
|
if (!relatedConsoleAppId) {
|
|
103
|
-
_context2.next =
|
|
110
|
+
_context2.next = 17;
|
|
104
111
|
break;
|
|
105
112
|
}
|
|
106
113
|
if (!(relatedConsoleAppId === ((_ALIYUN_CONSOLE_CONFI = window.ALIYUN_CONSOLE_CONFIG) === null || _ALIYUN_CONSOLE_CONFI === void 0 ? void 0 : _ALIYUN_CONSOLE_CONFI.APP_ID))) {
|
|
107
|
-
_context2.next =
|
|
114
|
+
_context2.next = 8;
|
|
108
115
|
break;
|
|
109
116
|
}
|
|
110
|
-
return _context2.abrupt("return",
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
case 7:
|
|
115
|
-
_context2.prev = 7;
|
|
116
|
-
_context2.next = 10;
|
|
117
|
+
return _context2.abrupt("return", currentConfig);
|
|
118
|
+
case 8:
|
|
119
|
+
_context2.prev = 8;
|
|
120
|
+
_context2.next = 11;
|
|
117
121
|
return request.get("https://".concat(config.env !== 'prod' ? 'pre-' : '', "fecs.console.").concat(parseEnv().MAIN_DOMAIN, "/api/alfa/console/config?appId=").concat(relatedConsoleAppId));
|
|
118
|
-
case
|
|
122
|
+
case 11:
|
|
119
123
|
res = _context2.sent;
|
|
120
|
-
return _context2.abrupt("return",
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
case
|
|
125
|
-
|
|
124
|
+
return _context2.abrupt("return", {
|
|
125
|
+
ALIYUN_CONSOLE_CONFIG: _objectSpread(_objectSpread({}, window.ALIYUN_CONSOLE_CONFIG), res.data.data.ALIYUN_CONSOLE_CONFIG),
|
|
126
|
+
ALIYUN_CONSOLE_GLOBAL: res.data.data.ALIYUN_CONSOLE_GLOBAL
|
|
127
|
+
});
|
|
128
|
+
case 15:
|
|
129
|
+
_context2.prev = 15;
|
|
130
|
+
_context2.t0 = _context2["catch"](8);
|
|
126
131
|
case 17:
|
|
132
|
+
return _context2.abrupt("return", currentConfig);
|
|
133
|
+
case 18:
|
|
127
134
|
case "end":
|
|
128
135
|
return _context2.stop();
|
|
129
136
|
}
|
|
130
|
-
}, _callee2, null, [[
|
|
137
|
+
}, _callee2, null, [[8, 15]]);
|
|
131
138
|
}));
|
|
132
139
|
return function getConfigV2(_x2) {
|
|
133
140
|
return _ref4.apply(this, arguments);
|
package/lib/utils/getConfig.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getConfigV2 = exports.getConfig = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
12
|
var _consoleBaseConfParseEnv = _interopRequireDefault(require("@alicloud/console-base-conf-parse-env"));
|
|
@@ -14,6 +15,8 @@ var _cacheManager = _interopRequireDefault(require("./cacheManager"));
|
|
|
14
15
|
var _oss = require("./oss");
|
|
15
16
|
var _env = require("./env");
|
|
16
17
|
var _request = _interopRequireDefault(require("./request"));
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
17
20
|
var defaultConfig = {
|
|
18
21
|
ALL_CHANNEL_FEATURE_STATUS: {},
|
|
19
22
|
ALL_CHANNEL_LINKS: {},
|
|
@@ -97,7 +100,7 @@ var getConfig = exports.getConfig = /*#__PURE__*/function () {
|
|
|
97
100
|
*/
|
|
98
101
|
var getConfigV2 = exports.getConfigV2 = /*#__PURE__*/function () {
|
|
99
102
|
var _ref4 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(config) {
|
|
100
|
-
var releaseConfig, _ref5, relatedConsoleAppId, _ALIYUN_CONSOLE_CONFI, res;
|
|
103
|
+
var releaseConfig, _ref5, relatedConsoleAppId, currentConfig, _ALIYUN_CONSOLE_CONFI, res;
|
|
101
104
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
102
105
|
while (1) switch (_context2.prev = _context2.next) {
|
|
103
106
|
case 0:
|
|
@@ -106,35 +109,39 @@ var getConfigV2 = exports.getConfigV2 = /*#__PURE__*/function () {
|
|
|
106
109
|
case 2:
|
|
107
110
|
releaseConfig = _context2.sent;
|
|
108
111
|
_ref5 = releaseConfig.metadata || {}, relatedConsoleAppId = _ref5.relatedConsoleAppId;
|
|
112
|
+
currentConfig = {
|
|
113
|
+
ALIYUN_CONSOLE_CONFIG: window.ALIYUN_CONSOLE_CONFIG || {},
|
|
114
|
+
ALIYUN_CONSOLE_GLOBAL: window.ALIYUN_CONSOLE_GLOBAL || {}
|
|
115
|
+
};
|
|
109
116
|
if (!relatedConsoleAppId) {
|
|
110
|
-
_context2.next =
|
|
117
|
+
_context2.next = 17;
|
|
111
118
|
break;
|
|
112
119
|
}
|
|
113
120
|
if (!(relatedConsoleAppId === ((_ALIYUN_CONSOLE_CONFI = window.ALIYUN_CONSOLE_CONFIG) === null || _ALIYUN_CONSOLE_CONFI === void 0 ? void 0 : _ALIYUN_CONSOLE_CONFI.APP_ID))) {
|
|
114
|
-
_context2.next =
|
|
121
|
+
_context2.next = 8;
|
|
115
122
|
break;
|
|
116
123
|
}
|
|
117
|
-
return _context2.abrupt("return",
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
case 7:
|
|
122
|
-
_context2.prev = 7;
|
|
123
|
-
_context2.next = 10;
|
|
124
|
+
return _context2.abrupt("return", currentConfig);
|
|
125
|
+
case 8:
|
|
126
|
+
_context2.prev = 8;
|
|
127
|
+
_context2.next = 11;
|
|
124
128
|
return _request.default.get("https://".concat(config.env !== 'prod' ? 'pre-' : '', "fecs.console.").concat((0, _consoleBaseConfParseEnv.default)().MAIN_DOMAIN, "/api/alfa/console/config?appId=").concat(relatedConsoleAppId));
|
|
125
|
-
case
|
|
129
|
+
case 11:
|
|
126
130
|
res = _context2.sent;
|
|
127
|
-
return _context2.abrupt("return",
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
case
|
|
132
|
-
|
|
131
|
+
return _context2.abrupt("return", {
|
|
132
|
+
ALIYUN_CONSOLE_CONFIG: _objectSpread(_objectSpread({}, window.ALIYUN_CONSOLE_CONFIG), res.data.data.ALIYUN_CONSOLE_CONFIG),
|
|
133
|
+
ALIYUN_CONSOLE_GLOBAL: res.data.data.ALIYUN_CONSOLE_GLOBAL
|
|
134
|
+
});
|
|
135
|
+
case 15:
|
|
136
|
+
_context2.prev = 15;
|
|
137
|
+
_context2.t0 = _context2["catch"](8);
|
|
133
138
|
case 17:
|
|
139
|
+
return _context2.abrupt("return", currentConfig);
|
|
140
|
+
case 18:
|
|
134
141
|
case "end":
|
|
135
142
|
return _context2.stop();
|
|
136
143
|
}
|
|
137
|
-
}, _callee2, null, [[
|
|
144
|
+
}, _callee2, null, [[8, 15]]);
|
|
138
145
|
}));
|
|
139
146
|
return function getConfigV2(_x2) {
|
|
140
147
|
return _ref4.apply(this, arguments);
|
package/package.json
CHANGED