@next-core/brick-kit 2.125.0 → 2.126.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/CHANGELOG.md +39 -0
- package/dist/index.bundle.js +153 -79
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +153 -79
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Kernel.d.ts.map +1 -1
- package/dist/types/core/Router.d.ts +1 -2
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/core/standaloneBootstrap.d.ts.map +1 -1
- package/dist/types/internal/mergePreviewRoutes.d.ts +3 -0
- package/dist/types/internal/mergePreviewRoutes.d.ts.map +1 -0
- package/package.json +6 -6
package/dist/index.esm.js
CHANGED
|
@@ -2924,7 +2924,7 @@ function getNextInternalOptions(internalOptions, isArray, key) {
|
|
|
2924
2924
|
}
|
|
2925
2925
|
|
|
2926
2926
|
var _excluded$6 = ["children"],
|
|
2927
|
-
_excluded2$
|
|
2927
|
+
_excluded2$2 = ["items", "app"];
|
|
2928
2928
|
var symbolAppId = Symbol("appId");
|
|
2929
2929
|
// Caching menu requests to avoid flicker.
|
|
2930
2930
|
var menuCache = new Map();
|
|
@@ -3108,7 +3108,7 @@ function _processMenu() {
|
|
|
3108
3108
|
items,
|
|
3109
3109
|
app
|
|
3110
3110
|
} = _yield$fetchMenuById,
|
|
3111
|
-
restMenuData = _objectWithoutProperties(_yield$fetchMenuById, _excluded2$
|
|
3111
|
+
restMenuData = _objectWithoutProperties(_yield$fetchMenuById, _excluded2$2);
|
|
3112
3112
|
|
|
3113
3113
|
var menuData = _objectSpread(_objectSpread({}, yield computeRealValueWithOverrideApp(restMenuData, app[0].appId, context, kernel)), {}, {
|
|
3114
3114
|
items: yield computeMenuItemsWithOverrideApp(items, context, kernel)
|
|
@@ -5795,6 +5795,24 @@ function clearPollTimeout() {
|
|
|
5795
5795
|
timeoutIdList.clear();
|
|
5796
5796
|
}
|
|
5797
5797
|
|
|
5798
|
+
/**
|
|
5799
|
+
* @description 独立小产品Runtime接口
|
|
5800
|
+
* @endpoint GET /api/v1/runtime_standalone
|
|
5801
|
+
*/
|
|
5802
|
+
|
|
5803
|
+
|
|
5804
|
+
var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
|
|
5805
|
+
var _ref = _asyncToGenerator$4(function* (options) {
|
|
5806
|
+
return (
|
|
5807
|
+
/**! @contract easyops.api.api_gateway.bootstrap_standalone.RuntimeStandalone@1.0.1 */
|
|
5808
|
+
(yield http.get("api/v1/runtime_standalone", options)).data
|
|
5809
|
+
);
|
|
5810
|
+
});
|
|
5811
|
+
|
|
5812
|
+
return function BootstrapStandaloneApi_runtimeStandalone(_x) {
|
|
5813
|
+
return _ref.apply(this, arguments);
|
|
5814
|
+
};
|
|
5815
|
+
}();
|
|
5798
5816
|
/**
|
|
5799
5817
|
* @description 获取系统初始化信息
|
|
5800
5818
|
* @endpoint GET /api/auth/v2/bootstrap
|
|
@@ -6887,6 +6905,43 @@ var UserAdminApi_searchAllUsersInfo = /*#__PURE__*/function () {
|
|
|
6887
6905
|
};
|
|
6888
6906
|
}();
|
|
6889
6907
|
|
|
6908
|
+
/**
|
|
6909
|
+
* @description 独立小产品Runtime接口
|
|
6910
|
+
* @endpoint GET /api/v1/micro_app_standalone/runtime/:appId
|
|
6911
|
+
*/
|
|
6912
|
+
|
|
6913
|
+
|
|
6914
|
+
var RuntimeApi_runtimeMicroAppStandalone = /*#__PURE__*/function () {
|
|
6915
|
+
var _ref = _asyncToGenerator$4(function* (appId, options) {
|
|
6916
|
+
return (
|
|
6917
|
+
/**! @contract easyops.api.micro_app_standalone.runtime.RuntimeMicroAppStandalone@1.0.1 */
|
|
6918
|
+
(yield http.get("api/gateway/micro_app_standalone.runtime.RuntimeMicroAppStandalone/api/v1/micro_app_standalone/runtime/".concat(appId), options)).data
|
|
6919
|
+
);
|
|
6920
|
+
});
|
|
6921
|
+
|
|
6922
|
+
return function RuntimeApi_runtimeMicroAppStandalone(_x, _x2) {
|
|
6923
|
+
return _ref.apply(this, arguments);
|
|
6924
|
+
};
|
|
6925
|
+
}();
|
|
6926
|
+
/**
|
|
6927
|
+
* @description 查询独立部署小产品
|
|
6928
|
+
* @endpoint POST /api/v1/micro_app_standalone/search
|
|
6929
|
+
*/
|
|
6930
|
+
|
|
6931
|
+
|
|
6932
|
+
var RuntimeApi_searchMicroAppStandalone = /*#__PURE__*/function () {
|
|
6933
|
+
var _ref = _asyncToGenerator$4(function* (data, options) {
|
|
6934
|
+
return (
|
|
6935
|
+
/**! @contract easyops.api.micro_app_standalone.runtime.SearchMicroAppStandalone@1.0.1 */
|
|
6936
|
+
(yield http.post("api/gateway/micro_app_standalone.runtime.SearchMicroAppStandalone/api/v1/micro_app_standalone/search", data, options)).data
|
|
6937
|
+
);
|
|
6938
|
+
});
|
|
6939
|
+
|
|
6940
|
+
return function RuntimeApi_searchMicroAppStandalone(_x, _x2) {
|
|
6941
|
+
return _ref.apply(this, arguments);
|
|
6942
|
+
};
|
|
6943
|
+
}();
|
|
6944
|
+
|
|
6890
6945
|
/**
|
|
6891
6946
|
* Merge `app.defaultConfig` and `app.userConfig` to `app.config`.
|
|
6892
6947
|
*
|
|
@@ -7079,15 +7134,21 @@ function initAnalytics() {
|
|
|
7079
7134
|
}
|
|
7080
7135
|
}
|
|
7081
7136
|
|
|
7082
|
-
var _excluded$4 = ["feature_flags"]
|
|
7137
|
+
var _excluded$4 = ["feature_flags"],
|
|
7138
|
+
_excluded2$1 = ["featureFlags", "misc"];
|
|
7083
7139
|
function standaloneBootstrap() {
|
|
7084
7140
|
return _standaloneBootstrap.apply(this, arguments);
|
|
7085
7141
|
}
|
|
7086
7142
|
|
|
7087
7143
|
function _standaloneBootstrap() {
|
|
7088
7144
|
_standaloneBootstrap = _asyncToGenerator$4(function* () {
|
|
7089
|
-
var [bootstrapResult, confString] = yield Promise.all([http.get(window.BOOTSTRAP_FILE), http.get("".concat(window.APP_ROOT, "conf.yaml"), {
|
|
7145
|
+
var [bootstrapResult, confString, runtimeData] = yield Promise.all([http.get(window.BOOTSTRAP_FILE), http.get("".concat(window.APP_ROOT, "conf.yaml"), {
|
|
7090
7146
|
responseType: "text"
|
|
7147
|
+
}), yield BootstrapStandaloneApi_runtimeStandalone().catch(function (error) {
|
|
7148
|
+
// make it not crash when the backend service is not updated.
|
|
7149
|
+
// eslint-disable-next-line no-console
|
|
7150
|
+
console.warn("request runtime api from api-gateway failed: ", error, ", something might went wrong running standalone micro app");
|
|
7151
|
+
return undefined;
|
|
7091
7152
|
})]);
|
|
7092
7153
|
var conf;
|
|
7093
7154
|
|
|
@@ -7135,6 +7196,24 @@ function _standaloneBootstrap() {
|
|
|
7135
7196
|
}
|
|
7136
7197
|
}
|
|
7137
7198
|
|
|
7199
|
+
if (runtimeData) {
|
|
7200
|
+
var runtimeSetings = runtimeData.settings;
|
|
7201
|
+
|
|
7202
|
+
if (!isEmpty(runtimeSetings)) {
|
|
7203
|
+
// Merge Feature Flags
|
|
7204
|
+
if (!settings) {
|
|
7205
|
+
settings = runtimeSetings;
|
|
7206
|
+
} else {
|
|
7207
|
+
// Merge Feature Flags & Misc
|
|
7208
|
+
var rest = _objectWithoutProperties(runtimeSetings, _excluded2$1);
|
|
7209
|
+
|
|
7210
|
+
settings.featureFlags = _objectSpread(_objectSpread({}, settings.featureFlags), runtimeSetings.featureFlags);
|
|
7211
|
+
settings.misc = _objectSpread(_objectSpread({}, settings.misc), runtimeSetings.misc);
|
|
7212
|
+
settings = Object.assign(settings, rest);
|
|
7213
|
+
}
|
|
7214
|
+
}
|
|
7215
|
+
}
|
|
7216
|
+
|
|
7138
7217
|
return _objectSpread(_objectSpread({}, bootstrapResult), {}, {
|
|
7139
7218
|
settings
|
|
7140
7219
|
});
|
|
@@ -8856,6 +8935,27 @@ class Kernel {
|
|
|
8856
8935
|
Object.assign(storyboard, {
|
|
8857
8936
|
$$fulfilled: true
|
|
8858
8937
|
});
|
|
8938
|
+
|
|
8939
|
+
if (!window.NO_AUTH_GUARD) {
|
|
8940
|
+
var appRuntimeData;
|
|
8941
|
+
|
|
8942
|
+
try {
|
|
8943
|
+
appRuntimeData = yield RuntimeApi_runtimeMicroAppStandalone(storyboard.app.id);
|
|
8944
|
+
} catch (error) {
|
|
8945
|
+
// make it not crash when the backend service is not updated.
|
|
8946
|
+
// eslint-disable-next-line no-console
|
|
8947
|
+
console.warn("request standalone runtime api from micro-app-standalone failed: ", error, ", something might went wrong running standalone micro app");
|
|
8948
|
+
}
|
|
8949
|
+
|
|
8950
|
+
if (appRuntimeData) {
|
|
8951
|
+
// merge user config
|
|
8952
|
+
storyboard.app.userConfig = _objectSpread(_objectSpread({}, storyboard.app.userConfig), appRuntimeData.userConfig); // get inject menus (Actually, appRuntimeData contains both main and inject menus)
|
|
8953
|
+
|
|
8954
|
+
storyboard.meta = _objectSpread(_objectSpread({}, storyboard.meta), {}, {
|
|
8955
|
+
injectMenus: appRuntimeData.injectMenus
|
|
8956
|
+
});
|
|
8957
|
+
}
|
|
8958
|
+
}
|
|
8859
8959
|
} else {
|
|
8860
8960
|
var {
|
|
8861
8961
|
routes,
|
|
@@ -9370,15 +9470,20 @@ class Kernel {
|
|
|
9370
9470
|
}
|
|
9371
9471
|
|
|
9372
9472
|
getStandaloneMenus(menuId) {
|
|
9373
|
-
var
|
|
9473
|
+
var _currentStoryboard$me, _currentStoryboard$me2;
|
|
9374
9474
|
|
|
9375
9475
|
var currentAppId = this.currentApp.id;
|
|
9376
9476
|
var currentStoryboard = this.bootstrapData.storyboards.find(storyboard => storyboard.app.id === currentAppId);
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9477
|
+
var menus = (_currentStoryboard$me = currentStoryboard.meta) !== null && _currentStoryboard$me !== void 0 && _currentStoryboard$me.injectMenus ? cloneDeep(currentStoryboard.meta.injectMenus) : (_currentStoryboard$me2 = currentStoryboard.meta) !== null && _currentStoryboard$me2 !== void 0 && _currentStoryboard$me2.menus ? cloneDeep(currentStoryboard.meta.menus) : [];
|
|
9478
|
+
return menus.filter(menu => menu.menuId === menuId).map(menu => {
|
|
9479
|
+
var _menu$app;
|
|
9480
|
+
|
|
9481
|
+
return _objectSpread(_objectSpread({}, menu), (_menu$app = menu.app) !== null && _menu$app !== void 0 && _menu$app.length && menu.app[0].appId ? {} : {
|
|
9482
|
+
app: [{
|
|
9483
|
+
appId: currentAppId
|
|
9484
|
+
}]
|
|
9485
|
+
});
|
|
9486
|
+
});
|
|
9382
9487
|
}
|
|
9383
9488
|
|
|
9384
9489
|
getProviderBrick(provider) {
|
|
@@ -11336,25 +11441,6 @@ function registerFormRenderer() {
|
|
|
11336
11441
|
});
|
|
11337
11442
|
}
|
|
11338
11443
|
|
|
11339
|
-
/**
|
|
11340
|
-
* @description 查询独立部署小产品
|
|
11341
|
-
* @endpoint POST /api/v1/micro_app_standalone/search
|
|
11342
|
-
*/
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
var RuntimeApi_searchMicroAppStandalone = /*#__PURE__*/function () {
|
|
11346
|
-
var _ref = _asyncToGenerator$4(function* (data, options) {
|
|
11347
|
-
return (
|
|
11348
|
-
/**! @contract easyops.api.micro_app_standalone.runtime.SearchMicroAppStandalone@1.0.1 */
|
|
11349
|
-
(yield http.post("api/gateway/micro_app_standalone.runtime.SearchMicroAppStandalone/api/v1/micro_app_standalone/search", data, options)).data
|
|
11350
|
-
);
|
|
11351
|
-
});
|
|
11352
|
-
|
|
11353
|
-
return function RuntimeApi_searchMicroAppStandalone(_x, _x2) {
|
|
11354
|
-
return _ref.apply(this, arguments);
|
|
11355
|
-
};
|
|
11356
|
-
}();
|
|
11357
|
-
|
|
11358
11444
|
var standaloneApps = [];
|
|
11359
11445
|
var appIdSet = new Set();
|
|
11360
11446
|
function preFetchStandaloneInstalledApps(_x) {
|
|
@@ -11418,6 +11504,38 @@ function getStandaloneInstalledApps() {
|
|
|
11418
11504
|
return standaloneApps;
|
|
11419
11505
|
}
|
|
11420
11506
|
|
|
11507
|
+
function mergePreviewRoutes(routes) {
|
|
11508
|
+
var mergedRoutes = routes;
|
|
11509
|
+
var specificTemplatePreviewIndex = findLastIndex(mergedRoutes, route => route.path.startsWith("${APP.homepage}/_dev_only_/template-preview/"));
|
|
11510
|
+
mergedRoutes = [...mergedRoutes.slice(0, specificTemplatePreviewIndex + 1), {
|
|
11511
|
+
path: "${APP.homepage}/_dev_only_/template-preview/:templateId",
|
|
11512
|
+
bricks: [{
|
|
11513
|
+
brick: "span"
|
|
11514
|
+
}],
|
|
11515
|
+
menu: false,
|
|
11516
|
+
exact: true
|
|
11517
|
+
}, ...mergedRoutes.slice(specificTemplatePreviewIndex + 1)];
|
|
11518
|
+
var specificSnippetPreviewIndex = findLastIndex(mergedRoutes, route => route.path.startsWith("${APP.homepage}/_dev_only_/snippet-preview/"));
|
|
11519
|
+
mergedRoutes = [...mergedRoutes.slice(0, specificSnippetPreviewIndex + 1), {
|
|
11520
|
+
path: "${APP.homepage}/_dev_only_/snippet-preview/:snippetId",
|
|
11521
|
+
bricks: [{
|
|
11522
|
+
brick: "span"
|
|
11523
|
+
}],
|
|
11524
|
+
menu: false,
|
|
11525
|
+
exact: true
|
|
11526
|
+
}, ...mergedRoutes.slice(specificSnippetPreviewIndex + 1)];
|
|
11527
|
+
var specificFormPreviewIndex = findLastIndex(mergedRoutes, route => route.path.startsWith("${APP.homepage}/_dev_only_/form-preview/"));
|
|
11528
|
+
mergedRoutes = [...mergedRoutes.slice(0, specificFormPreviewIndex + 1), {
|
|
11529
|
+
path: "${APP.homepage}/_dev_only_/form-preview/:FormId",
|
|
11530
|
+
bricks: [{
|
|
11531
|
+
brick: "span"
|
|
11532
|
+
}],
|
|
11533
|
+
menu: false,
|
|
11534
|
+
exact: true
|
|
11535
|
+
}, ...mergedRoutes.slice(specificFormPreviewIndex + 1)];
|
|
11536
|
+
return mergedRoutes;
|
|
11537
|
+
}
|
|
11538
|
+
|
|
11421
11539
|
class Router {
|
|
11422
11540
|
constructor(kernel) {
|
|
11423
11541
|
_defineProperty$1(this, "defaultCollapsed", false);
|
|
@@ -11693,8 +11811,7 @@ class Router {
|
|
|
11693
11811
|
};
|
|
11694
11812
|
|
|
11695
11813
|
try {
|
|
11696
|
-
var mergedRoutes =
|
|
11697
|
-
|
|
11814
|
+
var mergedRoutes = mergePreviewRoutes(storyboard.routes);
|
|
11698
11815
|
yield locationContext.mountRoutes(mergedRoutes, undefined, mountRoutesResult);
|
|
11699
11816
|
} catch (error) {
|
|
11700
11817
|
// eslint-disable-next-line no-console
|
|
@@ -11822,9 +11939,10 @@ class Router {
|
|
|
11822
11939
|
|
|
11823
11940
|
menuInBg.forEach(brick => {
|
|
11824
11941
|
appendBrick(brick, mountPoints.portal);
|
|
11825
|
-
});
|
|
11942
|
+
}); // When we have a matched route other than an abstract route,
|
|
11943
|
+
// we say *page found*, otherwise, *page not found*.
|
|
11826
11944
|
|
|
11827
|
-
if (
|
|
11945
|
+
if (route && route.type !== "routes" || failed) {
|
|
11828
11946
|
main.length > 0 && mountTree(main, mountPoints.main);
|
|
11829
11947
|
portal.length > 0 && mountTree(portal, mountPoints.portal);
|
|
11830
11948
|
afterMountTree(mountPoints.main);
|
|
@@ -11864,9 +11982,9 @@ class Router {
|
|
|
11864
11982
|
_this3.kernel.prefetchDepsOfStoryboard(storyboard);
|
|
11865
11983
|
});
|
|
11866
11984
|
} else {
|
|
11867
|
-
|
|
11985
|
+
setTimeout(() => {
|
|
11868
11986
|
_this3.kernel.prefetchDepsOfStoryboard(storyboard);
|
|
11869
|
-
});
|
|
11987
|
+
}, 0);
|
|
11870
11988
|
}
|
|
11871
11989
|
|
|
11872
11990
|
return;
|
|
@@ -11904,50 +12022,6 @@ class Router {
|
|
|
11904
12022
|
subMenu: mountResult.menuBar.subMenu
|
|
11905
12023
|
};
|
|
11906
12024
|
}
|
|
11907
|
-
|
|
11908
|
-
MergePreviewRouter(router) {
|
|
11909
|
-
var mergedRoutes = router;
|
|
11910
|
-
var specificTemplatePreviewIndex = findLastIndex(mergedRoutes, route => route.path.startsWith("${APP.homepage}/_dev_only_/template-preview/"));
|
|
11911
|
-
|
|
11912
|
-
if (specificTemplatePreviewIndex > -1) {
|
|
11913
|
-
mergedRoutes = [...mergedRoutes.slice(0, specificTemplatePreviewIndex + 1), {
|
|
11914
|
-
path: "${APP.homepage}/_dev_only_/template-preview/:templateId",
|
|
11915
|
-
bricks: [{
|
|
11916
|
-
brick: "span"
|
|
11917
|
-
}],
|
|
11918
|
-
menu: false,
|
|
11919
|
-
exact: true
|
|
11920
|
-
}, ...mergedRoutes.slice(specificTemplatePreviewIndex + 1)];
|
|
11921
|
-
}
|
|
11922
|
-
|
|
11923
|
-
var specificSnippetPreviewIndex = findLastIndex(mergedRoutes, route => route.path.startsWith("${APP.homepage}/_dev_only_/snippet-preview/"));
|
|
11924
|
-
|
|
11925
|
-
if (specificSnippetPreviewIndex > -1) {
|
|
11926
|
-
mergedRoutes = [...mergedRoutes.slice(0, specificSnippetPreviewIndex + 1), {
|
|
11927
|
-
path: "${APP.homepage}/_dev_only_/snippet-preview/:snippetId",
|
|
11928
|
-
bricks: [{
|
|
11929
|
-
brick: "span"
|
|
11930
|
-
}],
|
|
11931
|
-
menu: false,
|
|
11932
|
-
exact: true
|
|
11933
|
-
}, ...mergedRoutes.slice(specificSnippetPreviewIndex + 1)];
|
|
11934
|
-
}
|
|
11935
|
-
|
|
11936
|
-
var specificFormPreviewIndex = findLastIndex(mergedRoutes, route => route.path.startsWith("${APP.homepage}/_dev_only_/form-preview/"));
|
|
11937
|
-
|
|
11938
|
-
if (specificFormPreviewIndex > -1) {
|
|
11939
|
-
mergedRoutes = [...mergedRoutes.slice(0, specificFormPreviewIndex + 1), {
|
|
11940
|
-
path: "${APP.homepage}/_dev_only_/form-preview/:FormId",
|
|
11941
|
-
bricks: [{
|
|
11942
|
-
brick: "span"
|
|
11943
|
-
}],
|
|
11944
|
-
menu: false,
|
|
11945
|
-
exact: true
|
|
11946
|
-
}, ...mergedRoutes.slice(specificFormPreviewIndex + 1)];
|
|
11947
|
-
}
|
|
11948
|
-
|
|
11949
|
-
return mergedRoutes;
|
|
11950
|
-
}
|
|
11951
12025
|
/* istanbul ignore next */
|
|
11952
12026
|
|
|
11953
12027
|
|