@alicloud/alfa-core 1.5.0-alpha.2 → 1.5.0-alpha.3
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/index.js +1 -1
- package/es/utils/getConfig.js +51 -0
- package/es/utils/interceptors/requestInterceptor.js +37 -0
- package/es/utils/interceptors/responseInterceptor.js +1 -1
- package/es/utils/request.js +2 -0
- package/es/utils/uid.js +1 -1
- package/lib/index.js +7 -0
- package/lib/utils/getConfig.js +52 -1
- package/lib/utils/interceptors/requestInterceptor.js +44 -0
- package/lib/utils/interceptors/responseInterceptor.js +1 -1
- package/lib/utils/request.js +2 -0
- package/lib/utils/uid.js +1 -1
- package/package.json +3 -4
- package/stories/demos/constants.ts +6 -6
- package/types/index.d.ts +1 -1
- package/types/types/index.d.ts +4 -0
- package/types/utils/getConfig.d.ts +28 -1
- package/types/utils/interceptors/requestInterceptor.d.ts +2 -0
package/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { createMicroApp } from './createMicroApp';
|
|
|
2
2
|
export { addRequestInterceptor } from './utils/interceptors';
|
|
3
3
|
export { getRelease } from './utils/getRelease';
|
|
4
4
|
export { getManifest } from './utils/getManifest';
|
|
5
|
-
export { getConfig } from './utils/getConfig';
|
|
5
|
+
export { getConfig, getConfigV2 } from './utils/getConfig';
|
|
6
6
|
export { getI18nMessages } from './utils/getI18nMessages';
|
|
7
7
|
export { getLocale, getEnv } from './utils';
|
|
8
8
|
export { default as BaseLoader } from './base';
|
package/es/utils/getConfig.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import parseEnv from '@alicloud/console-base-conf-parse-env';
|
|
4
5
|
import { getRelease } from './getRelease';
|
|
5
6
|
import cache from './cacheManager';
|
|
6
7
|
import { getMicroAppConfig } from './oss';
|
|
7
8
|
import { getEnv } from './env';
|
|
9
|
+
import request from './request';
|
|
8
10
|
var defaultConfig = {
|
|
9
11
|
ALL_CHANNEL_FEATURE_STATUS: {},
|
|
10
12
|
ALL_CHANNEL_LINKS: {},
|
|
@@ -81,4 +83,53 @@ export var getConfig = /*#__PURE__*/function () {
|
|
|
81
83
|
return function getConfig(_x) {
|
|
82
84
|
return _ref.apply(this, arguments);
|
|
83
85
|
};
|
|
86
|
+
}();
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 支持从 fecs 接口获取业务配置,获取到的数据和控制台一致,不需要额外处理
|
|
90
|
+
*/
|
|
91
|
+
export var getConfigV2 = /*#__PURE__*/function () {
|
|
92
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(config) {
|
|
93
|
+
var releaseConfig, _ref5, relatedConsoleAppId, _ALIYUN_CONSOLE_CONFI, res;
|
|
94
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
95
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
96
|
+
case 0:
|
|
97
|
+
_context2.next = 2;
|
|
98
|
+
return getRelease(config);
|
|
99
|
+
case 2:
|
|
100
|
+
releaseConfig = _context2.sent;
|
|
101
|
+
_ref5 = releaseConfig.metadata || {}, relatedConsoleAppId = _ref5.relatedConsoleAppId;
|
|
102
|
+
if (!relatedConsoleAppId) {
|
|
103
|
+
_context2.next = 16;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
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 = 7;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
return _context2.abrupt("return", {
|
|
111
|
+
ALIYUN_CONSOLE_CONFIG: window.ALIYUN_CONSOLE_CONFIG,
|
|
112
|
+
ALIYUN_CONSOLE_GLOBAL: window.ALIYUN_CONSOLE_GLOBAL || {}
|
|
113
|
+
});
|
|
114
|
+
case 7:
|
|
115
|
+
_context2.prev = 7;
|
|
116
|
+
_context2.next = 10;
|
|
117
|
+
return request.get("//fecs.console.".concat(parseEnv().MAIN_DOMAIN, "/api/alfa/console/config?=appId=").concat(relatedConsoleAppId));
|
|
118
|
+
case 10:
|
|
119
|
+
res = _context2.sent;
|
|
120
|
+
return _context2.abrupt("return", res.data);
|
|
121
|
+
case 14:
|
|
122
|
+
_context2.prev = 14;
|
|
123
|
+
_context2.t0 = _context2["catch"](7);
|
|
124
|
+
case 16:
|
|
125
|
+
return _context2.abrupt("return", undefined);
|
|
126
|
+
case 17:
|
|
127
|
+
case "end":
|
|
128
|
+
return _context2.stop();
|
|
129
|
+
}
|
|
130
|
+
}, _callee2, null, [[7, 14]]);
|
|
131
|
+
}));
|
|
132
|
+
return function getConfigV2(_x2) {
|
|
133
|
+
return _ref4.apply(this, arguments);
|
|
134
|
+
};
|
|
84
135
|
}();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
// 兼容非公有云环境
|
|
4
|
+
var getCurrentCdnHost = function getCurrentCdnHost() {
|
|
5
|
+
try {
|
|
6
|
+
var _document$currentScri;
|
|
7
|
+
var _URL = new URL(((_document$currentScri = document.currentScript) === null || _document$currentScri === void 0 ? void 0 : _document$currentScri.src) || ''),
|
|
8
|
+
hostname = _URL.hostname;
|
|
9
|
+
var parts = hostname.split('.');
|
|
10
|
+
return parts.length > 2 ? parts.slice(-2).join('.') : hostname;
|
|
11
|
+
} catch (e) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export default function requestInterceptor(_x) {
|
|
16
|
+
return _requestInterceptor.apply(this, arguments);
|
|
17
|
+
}
|
|
18
|
+
function _requestInterceptor() {
|
|
19
|
+
_requestInterceptor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(config) {
|
|
20
|
+
var hostname;
|
|
21
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
22
|
+
while (1) switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
hostname = getCurrentCdnHost(); // if cdn is not alicdn, replace it
|
|
25
|
+
if (hostname && config.url) {
|
|
26
|
+
// 非公有云下无 cws2
|
|
27
|
+
config.url = config.url.replace(new RegExp('.alicdn.com'), ".".concat(hostname)).replace('cws2.', 'cws.');
|
|
28
|
+
}
|
|
29
|
+
return _context.abrupt("return", config);
|
|
30
|
+
case 3:
|
|
31
|
+
case "end":
|
|
32
|
+
return _context.stop();
|
|
33
|
+
}
|
|
34
|
+
}, _callee);
|
|
35
|
+
}));
|
|
36
|
+
return _requestInterceptor.apply(this, arguments);
|
|
37
|
+
}
|
|
@@ -78,7 +78,7 @@ function _responseInterceptor() {
|
|
|
78
78
|
}
|
|
79
79
|
return _context.abrupt("return", response);
|
|
80
80
|
case 6:
|
|
81
|
-
config.url = url === null || url === void 0 ? void 0 : url.replace(/:\/\/cws\.
|
|
81
|
+
config.url = url === null || url === void 0 ? void 0 : url.replace(/:\/\/cws\.[a-z0-9-]+\.com\//, '://cws2.alicdn.com/');
|
|
82
82
|
_context.next = 9;
|
|
83
83
|
return axios(config);
|
|
84
84
|
case 9:
|
package/es/utils/request.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import requestInterceptor from './interceptors/requestInterceptor';
|
|
2
3
|
import networkErrorInterceptor from './interceptors/networkErrorInterceptor';
|
|
3
4
|
import responseInterceptor from './interceptors/responseInterceptor';
|
|
4
5
|
var instance = axios.create();
|
|
6
|
+
instance.interceptors.request.use(requestInterceptor, undefined);
|
|
5
7
|
instance.interceptors.response.use(undefined, networkErrorInterceptor);
|
|
6
8
|
instance.interceptors.response.use(responseInterceptor, undefined);
|
|
7
9
|
instance.interceptors.response.use(undefined, networkErrorInterceptor);
|
package/es/utils/uid.js
CHANGED
|
@@ -6,7 +6,7 @@ import { getCookie } from '@alicloud/cookie';
|
|
|
6
6
|
*/
|
|
7
7
|
export var getMainUid = function getMainUid() {
|
|
8
8
|
var _ALIYUN_CONSOLE_CONFI;
|
|
9
|
-
return ((_ALIYUN_CONSOLE_CONFI = window.ALIYUN_CONSOLE_CONFIG) === null || _ALIYUN_CONSOLE_CONFI === void 0 ? void 0 : _ALIYUN_CONSOLE_CONFI.MAIN_ACCOUNT_PK) || getCookie('login_aliyunid_pk') || undefined;
|
|
9
|
+
return ((_ALIYUN_CONSOLE_CONFI = window.ALIYUN_CONSOLE_CONFIG) === null || _ALIYUN_CONSOLE_CONFI === void 0 ? void 0 : _ALIYUN_CONSOLE_CONFI.MAIN_ACCOUNT_PK) || getCookie('login_aliyunid_pk') || getCookie('login_apsaraid_pk') || undefined;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
/**
|
package/lib/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var _exportNames = {
|
|
|
10
10
|
getRelease: true,
|
|
11
11
|
getManifest: true,
|
|
12
12
|
getConfig: true,
|
|
13
|
+
getConfigV2: true,
|
|
13
14
|
getI18nMessages: true,
|
|
14
15
|
getLocale: true,
|
|
15
16
|
getEnv: true,
|
|
@@ -55,6 +56,12 @@ Object.defineProperty(exports, "getConfig", {
|
|
|
55
56
|
return _getConfig.getConfig;
|
|
56
57
|
}
|
|
57
58
|
});
|
|
59
|
+
Object.defineProperty(exports, "getConfigV2", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function get() {
|
|
62
|
+
return _getConfig.getConfigV2;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
58
65
|
Object.defineProperty(exports, "getEnv", {
|
|
59
66
|
enumerable: true,
|
|
60
67
|
get: function get() {
|
package/lib/utils/getConfig.js
CHANGED
|
@@ -4,14 +4,16 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.getConfig = void 0;
|
|
7
|
+
exports.getConfigV2 = exports.getConfig = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _consoleBaseConfParseEnv = _interopRequireDefault(require("@alicloud/console-base-conf-parse-env"));
|
|
11
12
|
var _getRelease = require("./getRelease");
|
|
12
13
|
var _cacheManager = _interopRequireDefault(require("./cacheManager"));
|
|
13
14
|
var _oss = require("./oss");
|
|
14
15
|
var _env = require("./env");
|
|
16
|
+
var _request = _interopRequireDefault(require("./request"));
|
|
15
17
|
var defaultConfig = {
|
|
16
18
|
ALL_CHANNEL_FEATURE_STATUS: {},
|
|
17
19
|
ALL_CHANNEL_LINKS: {},
|
|
@@ -88,4 +90,53 @@ var getConfig = exports.getConfig = /*#__PURE__*/function () {
|
|
|
88
90
|
return function getConfig(_x) {
|
|
89
91
|
return _ref.apply(this, arguments);
|
|
90
92
|
};
|
|
93
|
+
}();
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 支持从 fecs 接口获取业务配置,获取到的数据和控制台一致,不需要额外处理
|
|
97
|
+
*/
|
|
98
|
+
var getConfigV2 = exports.getConfigV2 = /*#__PURE__*/function () {
|
|
99
|
+
var _ref4 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(config) {
|
|
100
|
+
var releaseConfig, _ref5, relatedConsoleAppId, _ALIYUN_CONSOLE_CONFI, res;
|
|
101
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
102
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
103
|
+
case 0:
|
|
104
|
+
_context2.next = 2;
|
|
105
|
+
return (0, _getRelease.getRelease)(config);
|
|
106
|
+
case 2:
|
|
107
|
+
releaseConfig = _context2.sent;
|
|
108
|
+
_ref5 = releaseConfig.metadata || {}, relatedConsoleAppId = _ref5.relatedConsoleAppId;
|
|
109
|
+
if (!relatedConsoleAppId) {
|
|
110
|
+
_context2.next = 16;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
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 = 7;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
return _context2.abrupt("return", {
|
|
118
|
+
ALIYUN_CONSOLE_CONFIG: window.ALIYUN_CONSOLE_CONFIG,
|
|
119
|
+
ALIYUN_CONSOLE_GLOBAL: window.ALIYUN_CONSOLE_GLOBAL || {}
|
|
120
|
+
});
|
|
121
|
+
case 7:
|
|
122
|
+
_context2.prev = 7;
|
|
123
|
+
_context2.next = 10;
|
|
124
|
+
return _request.default.get("//fecs.console.".concat((0, _consoleBaseConfParseEnv.default)().MAIN_DOMAIN, "/api/alfa/console/config?=appId=").concat(relatedConsoleAppId));
|
|
125
|
+
case 10:
|
|
126
|
+
res = _context2.sent;
|
|
127
|
+
return _context2.abrupt("return", res.data);
|
|
128
|
+
case 14:
|
|
129
|
+
_context2.prev = 14;
|
|
130
|
+
_context2.t0 = _context2["catch"](7);
|
|
131
|
+
case 16:
|
|
132
|
+
return _context2.abrupt("return", undefined);
|
|
133
|
+
case 17:
|
|
134
|
+
case "end":
|
|
135
|
+
return _context2.stop();
|
|
136
|
+
}
|
|
137
|
+
}, _callee2, null, [[7, 14]]);
|
|
138
|
+
}));
|
|
139
|
+
return function getConfigV2(_x2) {
|
|
140
|
+
return _ref4.apply(this, arguments);
|
|
141
|
+
};
|
|
91
142
|
}();
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = requestInterceptor;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
// 兼容非公有云环境
|
|
11
|
+
var getCurrentCdnHost = function getCurrentCdnHost() {
|
|
12
|
+
try {
|
|
13
|
+
var _document$currentScri;
|
|
14
|
+
var _URL = new URL(((_document$currentScri = document.currentScript) === null || _document$currentScri === void 0 ? void 0 : _document$currentScri.src) || ''),
|
|
15
|
+
hostname = _URL.hostname;
|
|
16
|
+
var parts = hostname.split('.');
|
|
17
|
+
return parts.length > 2 ? parts.slice(-2).join('.') : hostname;
|
|
18
|
+
} catch (e) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
function requestInterceptor(_x) {
|
|
23
|
+
return _requestInterceptor.apply(this, arguments);
|
|
24
|
+
}
|
|
25
|
+
function _requestInterceptor() {
|
|
26
|
+
_requestInterceptor = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(config) {
|
|
27
|
+
var hostname;
|
|
28
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
29
|
+
while (1) switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
hostname = getCurrentCdnHost(); // if cdn is not alicdn, replace it
|
|
32
|
+
if (hostname && config.url) {
|
|
33
|
+
// 非公有云下无 cws2
|
|
34
|
+
config.url = config.url.replace(new RegExp('.alicdn.com'), ".".concat(hostname)).replace('cws2.', 'cws.');
|
|
35
|
+
}
|
|
36
|
+
return _context.abrupt("return", config);
|
|
37
|
+
case 3:
|
|
38
|
+
case "end":
|
|
39
|
+
return _context.stop();
|
|
40
|
+
}
|
|
41
|
+
}, _callee);
|
|
42
|
+
}));
|
|
43
|
+
return _requestInterceptor.apply(this, arguments);
|
|
44
|
+
}
|
|
@@ -85,7 +85,7 @@ function _responseInterceptor() {
|
|
|
85
85
|
}
|
|
86
86
|
return _context.abrupt("return", response);
|
|
87
87
|
case 6:
|
|
88
|
-
config.url = url === null || url === void 0 ? void 0 : url.replace(/:\/\/cws\.
|
|
88
|
+
config.url = url === null || url === void 0 ? void 0 : url.replace(/:\/\/cws\.[a-z0-9-]+\.com\//, '://cws2.alicdn.com/');
|
|
89
89
|
_context.next = 9;
|
|
90
90
|
return (0, _axios.default)(config);
|
|
91
91
|
case 9:
|
package/lib/utils/request.js
CHANGED
|
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _axios = _interopRequireDefault(require("axios"));
|
|
9
|
+
var _requestInterceptor = _interopRequireDefault(require("./interceptors/requestInterceptor"));
|
|
9
10
|
var _networkErrorInterceptor = _interopRequireDefault(require("./interceptors/networkErrorInterceptor"));
|
|
10
11
|
var _responseInterceptor = _interopRequireDefault(require("./interceptors/responseInterceptor"));
|
|
11
12
|
var instance = _axios.default.create();
|
|
13
|
+
instance.interceptors.request.use(_requestInterceptor.default, undefined);
|
|
12
14
|
instance.interceptors.response.use(undefined, _networkErrorInterceptor.default);
|
|
13
15
|
instance.interceptors.response.use(_responseInterceptor.default, undefined);
|
|
14
16
|
instance.interceptors.response.use(undefined, _networkErrorInterceptor.default);
|
package/lib/utils/uid.js
CHANGED
|
@@ -13,7 +13,7 @@ var _cookie = require("@alicloud/cookie");
|
|
|
13
13
|
*/
|
|
14
14
|
var getMainUid = exports.getMainUid = function getMainUid() {
|
|
15
15
|
var _ALIYUN_CONSOLE_CONFI;
|
|
16
|
-
return ((_ALIYUN_CONSOLE_CONFI = window.ALIYUN_CONSOLE_CONFIG) === null || _ALIYUN_CONSOLE_CONFI === void 0 ? void 0 : _ALIYUN_CONSOLE_CONFI.MAIN_ACCOUNT_PK) || (0, _cookie.getCookie)('login_aliyunid_pk') || undefined;
|
|
16
|
+
return ((_ALIYUN_CONSOLE_CONFI = window.ALIYUN_CONSOLE_CONFIG) === null || _ALIYUN_CONSOLE_CONFI === void 0 ? void 0 : _ALIYUN_CONSOLE_CONFI.MAIN_ACCOUNT_PK) || (0, _cookie.getCookie)('login_aliyunid_pk') || (0, _cookie.getCookie)('login_apsaraid_pk') || undefined;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alicloud/alfa-core",
|
|
3
|
-
"version": "1.5.0-alpha.
|
|
3
|
+
"version": "1.5.0-alpha.3",
|
|
4
4
|
"description": "MicroFront End SDK for alicloud",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"typescript": "^4.0.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@alicloud/console-base-conf-parse-env": "^1.4.
|
|
26
|
+
"@alicloud/console-base-conf-parse-env": "^1.4.6",
|
|
27
27
|
"@alicloud/console-logger-sls": "^1.2.31",
|
|
28
28
|
"@alicloud/cookie": "^1.5.3",
|
|
29
29
|
"@babel/runtime": "^7.24.1",
|
|
@@ -32,9 +32,8 @@
|
|
|
32
32
|
"crypto-js": "^4.1.1",
|
|
33
33
|
"qs": "^6.14.0",
|
|
34
34
|
"tslib": "^2.4.0",
|
|
35
|
-
"@alicloud/console-os-kernal": "^1.4.
|
|
35
|
+
"@alicloud/console-os-kernal": "^1.4.38-alpha.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "6387c6b9e984da70641716a25ff92d382cc4d7ca",
|
|
38
37
|
"scripts": {
|
|
39
38
|
"build": "breezr build --engine webpack",
|
|
40
39
|
"babel": "breezr build --engine babel",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export const appManifest = {
|
|
2
|
-
name:
|
|
2
|
+
name: 'os-example',
|
|
3
3
|
entry: {
|
|
4
4
|
styles: [
|
|
5
|
-
|
|
5
|
+
'//g.alicdn.com/ConsoleOS/OSExample/0.0.5/index.css',
|
|
6
6
|
],
|
|
7
7
|
scripts: [
|
|
8
|
-
|
|
9
|
-
]
|
|
10
|
-
}
|
|
11
|
-
}
|
|
8
|
+
'//g.alicdn.com/ConsoleOS/OSExample/0.0.5/index.js',
|
|
9
|
+
],
|
|
10
|
+
},
|
|
11
|
+
};
|
package/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { createMicroApp } from './createMicroApp';
|
|
|
2
2
|
export { addRequestInterceptor } from './utils/interceptors';
|
|
3
3
|
export { getRelease } from './utils/getRelease';
|
|
4
4
|
export { getManifest } from './utils/getManifest';
|
|
5
|
-
export { getConfig } from './utils/getConfig';
|
|
5
|
+
export { getConfig, getConfigV2 } from './utils/getConfig';
|
|
6
6
|
export { getI18nMessages } from './utils/getI18nMessages';
|
|
7
7
|
export { getLocale, getEnv } from './utils';
|
|
8
8
|
export { default as BaseLoader } from './base';
|
package/types/types/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export interface IWin {
|
|
|
35
35
|
portalType: string;
|
|
36
36
|
MAIN_ACCOUNT_PK: string;
|
|
37
37
|
CURRENT_PK: string;
|
|
38
|
+
APP_ID?: string;
|
|
38
39
|
}>;
|
|
39
40
|
}
|
|
40
41
|
export interface IAppManifest {
|
|
@@ -100,6 +101,9 @@ export interface AlfaReleaseConfig {
|
|
|
100
101
|
'next-versions'?: Record<Version, {
|
|
101
102
|
featureStatus: AlfaFeature;
|
|
102
103
|
}>;
|
|
104
|
+
metadata?: {
|
|
105
|
+
relatedConsoleAppId?: string;
|
|
106
|
+
};
|
|
103
107
|
}
|
|
104
108
|
type AlfaChannelLinks = Partial<Record<Channel, ChannelLinks>>;
|
|
105
109
|
type AlfaChannelFeatures = Partial<Record<Channel, ChannelFeatures>>;
|
|
@@ -1,7 +1,34 @@
|
|
|
1
|
-
import { AlfaDynamicConfig, IAppConfig } from '../types';
|
|
1
|
+
import type { AlfaDynamicConfig, IAppConfig } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* 获取 Alfa 平台配置的 Config
|
|
4
4
|
* @param config
|
|
5
5
|
* @returns
|
|
6
6
|
*/
|
|
7
7
|
export declare const getConfig: (config: IAppConfig) => Promise<AlfaDynamicConfig>;
|
|
8
|
+
/**
|
|
9
|
+
* 支持从 fecs 接口获取业务配置,获取到的数据和控制台一致,不需要额外处理
|
|
10
|
+
*/
|
|
11
|
+
export declare const getConfigV2: (config: IAppConfig) => Promise<{
|
|
12
|
+
ALIYUN_CONSOLE_CONFIG: Partial<{
|
|
13
|
+
fEnv: import("../types").EnvEnum;
|
|
14
|
+
LOCALE: string;
|
|
15
|
+
CHANNEL: string;
|
|
16
|
+
CHANNEL_LINKS: Partial<Record<string, string>>;
|
|
17
|
+
CHANNEL_FEATURE_STATUS: Partial<Record<string, {
|
|
18
|
+
status: boolean;
|
|
19
|
+
attribute: {
|
|
20
|
+
customAttrs: Record<string, unknown>;
|
|
21
|
+
regions: string[] | {
|
|
22
|
+
region: string[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}>>;
|
|
26
|
+
FEATURE_STATUS: Partial<Record<string, boolean>>;
|
|
27
|
+
SEC_TOKEN: string;
|
|
28
|
+
portalType: string;
|
|
29
|
+
MAIN_ACCOUNT_PK: string;
|
|
30
|
+
CURRENT_PK: string;
|
|
31
|
+
APP_ID?: string | undefined;
|
|
32
|
+
}> | undefined;
|
|
33
|
+
ALIYUN_CONSOLE_GLOBAL: Record<string, any>;
|
|
34
|
+
} | undefined>;
|