@next-core/brick-kit 2.157.0 → 2.157.1

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
@@ -6348,36 +6348,6 @@ var UserAdminApi_searchAllUsersInfo = /*#__PURE__*/function () {
6348
6348
  };
6349
6349
  }();
6350
6350
 
6351
- /**
6352
- * @description 独立小产品Runtime接口
6353
- * @endpoint GET /api/v1/micro_app_standalone/runtime/:appId
6354
- */
6355
- var RuntimeApi_runtimeMicroAppStandalone = /*#__PURE__*/function () {
6356
- var _ref = _asyncToGenerator$3(function* (appId, options) {
6357
- return (/**! @contract easyops.api.micro_app_standalone.runtime.RuntimeMicroAppStandalone@1.0.1 */
6358
- (yield http.get("api/gateway/micro_app_standalone.runtime.RuntimeMicroAppStandalone/api/v1/micro_app_standalone/runtime/".concat(appId), options)).data
6359
- );
6360
- });
6361
- return function RuntimeApi_runtimeMicroAppStandalone(_x, _x2) {
6362
- return _ref.apply(this, arguments);
6363
- };
6364
- }();
6365
-
6366
- /**
6367
- * @description 查询独立部署小产品
6368
- * @endpoint POST /api/v1/micro_app_standalone/search
6369
- */
6370
- var RuntimeApi_searchMicroAppStandalone = /*#__PURE__*/function () {
6371
- var _ref = _asyncToGenerator$3(function* (data, options) {
6372
- return (/**! @contract easyops.api.micro_app_standalone.runtime.SearchMicroAppStandalone@1.0.1 */
6373
- (yield http.post("api/gateway/micro_app_standalone.runtime.SearchMicroAppStandalone/api/v1/micro_app_standalone/search", data, options)).data
6374
- );
6375
- });
6376
- return function RuntimeApi_searchMicroAppStandalone(_x, _x2) {
6377
- return _ref.apply(this, arguments);
6378
- };
6379
- }();
6380
-
6381
6351
  /**
6382
6352
  * Merge `app.defaultConfig` and `app.userConfig` to `app.config`.
6383
6353
  *
@@ -6559,6 +6529,36 @@ function initAnalytics() {
6559
6529
  }
6560
6530
  }
6561
6531
 
6532
+ /**
6533
+ * @description 独立小产品Runtime接口
6534
+ * @endpoint GET /api/v1/micro_app_standalone/runtime/:appId
6535
+ */
6536
+ var RuntimeApi_runtimeMicroAppStandalone = /*#__PURE__*/function () {
6537
+ var _ref = _asyncToGenerator$3(function* (appId, options) {
6538
+ return (/**! @contract easyops.api.micro_app_standalone.runtime.RuntimeMicroAppStandalone@1.0.1 */
6539
+ (yield http.get("api/gateway/micro_app_standalone.runtime.RuntimeMicroAppStandalone/api/v1/micro_app_standalone/runtime/".concat(appId), options)).data
6540
+ );
6541
+ });
6542
+ return function RuntimeApi_runtimeMicroAppStandalone(_x, _x2) {
6543
+ return _ref.apply(this, arguments);
6544
+ };
6545
+ }();
6546
+
6547
+ /**
6548
+ * @description 查询独立部署小产品
6549
+ * @endpoint POST /api/v1/micro_app_standalone/search
6550
+ */
6551
+ var RuntimeApi_searchMicroAppStandalone = /*#__PURE__*/function () {
6552
+ var _ref = _asyncToGenerator$3(function* (data, options) {
6553
+ return (/**! @contract easyops.api.micro_app_standalone.runtime.SearchMicroAppStandalone@1.0.1 */
6554
+ (yield http.post("api/gateway/micro_app_standalone.runtime.SearchMicroAppStandalone/api/v1/micro_app_standalone/search", data, options)).data
6555
+ );
6556
+ });
6557
+ return function RuntimeApi_searchMicroAppStandalone(_x, _x2) {
6558
+ return _ref.apply(this, arguments);
6559
+ };
6560
+ }();
6561
+
6562
6562
  var _excluded$4 = ["feature_flags"],
6563
6563
  _excluded2$1 = ["featureFlags", "misc"];
6564
6564
  function standaloneBootstrap() {
@@ -6566,14 +6566,23 @@ function standaloneBootstrap() {
6566
6566
  }
6567
6567
  function _standaloneBootstrap() {
6568
6568
  _standaloneBootstrap = _asyncToGenerator$3(function* () {
6569
- var [bootstrapResult, confString, runtimeData] = yield Promise.all([http.get(window.BOOTSTRAP_FILE), http.get("".concat(window.APP_ROOT, "conf.yaml"), {
6569
+ var requests = [http.get(window.BOOTSTRAP_FILE), http.get("".concat(window.APP_ROOT, "conf.yaml"), {
6570
6570
  responseType: "text"
6571
- }), yield BootstrapStandaloneApi_runtimeStandalone().catch(function (error) {
6571
+ }), BootstrapStandaloneApi_runtimeStandalone().catch(function (error) {
6572
6572
  // make it not crash when the backend service is not updated.
6573
6573
  // eslint-disable-next-line no-console
6574
6574
  console.warn("request runtime api from api-gateway failed: ", error, ", something might went wrong running standalone micro app");
6575
- return undefined;
6576
- })]);
6575
+ return;
6576
+ })];
6577
+ if (!window.NO_AUTH_GUARD) {
6578
+ var matches;
6579
+ var appId = window.APP_ID || (window.APP_ROOT && (matches = window.APP_ROOT.match(/^(?:\/next)?\/sa-static\/([^/]+)\/versions\//)) ? matches[1] : null);
6580
+ if (appId) {
6581
+ // No need to wait.
6582
+ safeGetRuntimeMicroAppStandalone(appId);
6583
+ }
6584
+ }
6585
+ var [bootstrapResult, confString, runtimeData] = yield Promise.all(requests);
6577
6586
  var conf;
6578
6587
  try {
6579
6588
  conf = confString ? yaml.safeLoad(confString, {
@@ -6614,16 +6623,16 @@ function _standaloneBootstrap() {
6614
6623
  }
6615
6624
  }
6616
6625
  if (runtimeData) {
6617
- var runtimeSetings = runtimeData.settings;
6618
- if (!isEmpty(runtimeSetings)) {
6626
+ var runtimeSettings = runtimeData.settings;
6627
+ if (!isEmpty(runtimeSettings)) {
6619
6628
  // Merge Feature Flags
6620
6629
  if (!settings) {
6621
- settings = runtimeSetings;
6630
+ settings = runtimeSettings;
6622
6631
  } else {
6623
6632
  // Merge Feature Flags & Misc
6624
- var rest = _objectWithoutProperties(runtimeSetings, _excluded2$1);
6625
- settings.featureFlags = _objectSpread(_objectSpread({}, settings.featureFlags), runtimeSetings.featureFlags);
6626
- settings.misc = _objectSpread(_objectSpread({}, settings.misc), runtimeSetings.misc);
6633
+ var rest = _objectWithoutProperties(runtimeSettings, _excluded2$1);
6634
+ settings.featureFlags = _objectSpread(_objectSpread({}, settings.featureFlags), runtimeSettings.featureFlags);
6635
+ settings.misc = _objectSpread(_objectSpread({}, settings.misc), runtimeSettings.misc);
6627
6636
  settings = Object.assign(settings, rest);
6628
6637
  }
6629
6638
  }
@@ -6634,6 +6643,24 @@ function _standaloneBootstrap() {
6634
6643
  });
6635
6644
  return _standaloneBootstrap.apply(this, arguments);
6636
6645
  }
6646
+ var appRuntimeDataMap = new Map();
6647
+ function safeGetRuntimeMicroAppStandalone(_x) {
6648
+ return _safeGetRuntimeMicroAppStandalone.apply(this, arguments);
6649
+ }
6650
+ function _safeGetRuntimeMicroAppStandalone() {
6651
+ _safeGetRuntimeMicroAppStandalone = _asyncToGenerator$3(function* (appId) {
6652
+ if (appRuntimeDataMap.has(appId)) {
6653
+ return appRuntimeDataMap.get(appId);
6654
+ }
6655
+ var promise = RuntimeApi_runtimeMicroAppStandalone(appId).catch(function (error) {
6656
+ // make it not crash when the backend service is not updated.
6657
+ // eslint-disable-next-line no-console
6658
+ console.warn("request standalone runtime api from micro-app-standalone failed: ", error, ", something might went wrong running standalone micro app");
6659
+ });
6660
+ appRuntimeDataMap.set(appId, promise);
6661
+ });
6662
+ return _safeGetRuntimeMicroAppStandalone.apply(this, arguments);
6663
+ }
6637
6664
 
6638
6665
  /**
6639
6666
  * Take input from [0, n] and return it as [0, 1]
@@ -8235,7 +8262,8 @@ class Kernel {
8235
8262
  if (!window.NO_AUTH_GUARD) {
8236
8263
  var appRuntimeData;
8237
8264
  try {
8238
- appRuntimeData = yield RuntimeApi_runtimeMicroAppStandalone(storyboard.app.id);
8265
+ // Note: the request maybe have fired already during bootstrap.
8266
+ appRuntimeData = yield safeGetRuntimeMicroAppStandalone(storyboard.app.id);
8239
8267
  } catch (error) {
8240
8268
  // make it not crash when the backend service is not updated.
8241
8269
  // eslint-disable-next-line no-console