@next-core/brick-kit 2.125.0 → 2.126.0

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/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$1 = ["items", "app"];
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$1);
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 _cloneDeep, _currentStoryboard$me;
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
- return ((_cloneDeep = cloneDeep((_currentStoryboard$me = currentStoryboard.meta) === null || _currentStoryboard$me === void 0 ? void 0 : _currentStoryboard$me.menus)) !== null && _cloneDeep !== void 0 ? _cloneDeep : []).filter(menu => menu.menuId === menuId).map(menu => _objectSpread(_objectSpread({}, menu), {}, {
9378
- app: [{
9379
- appId: currentAppId
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) {