@next-core/brick-kit 2.124.1 → 2.125.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/CHANGELOG.md +11 -0
- package/dist/index.bundle.js +91 -1
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +92 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/core/Runtime.d.ts.map +1 -1
- package/dist/types/internal/getStandaloneInstalledApps.d.ts +6 -0
- package/dist/types/internal/getStandaloneInstalledApps.d.ts.map +1 -0
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.125.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.124.1...@next-core/brick-kit@2.125.0) (2022-08-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* support INSTALLED_APPS in standalone mode ([c152053](https://github.com/easyops-cn/next-core/commit/c1520532597c88d1def251aafd44831c7a7fad56))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.124.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.124.0...@next-core/brick-kit@2.124.1) (2022-08-03)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @next-core/brick-kit
|
package/dist/index.bundle.js
CHANGED
|
@@ -3495,7 +3495,8 @@
|
|
|
3495
3495
|
}
|
|
3496
3496
|
|
|
3497
3497
|
hasInstalledApp(appId, matchVersion) {
|
|
3498
|
-
|
|
3498
|
+
var allMicroApps = window.STANDALONE_MICRO_APPS ? kernel.bootstrapData.offSiteStandaloneApps : kernel.bootstrapData.microApps;
|
|
3499
|
+
return allMicroApps.some(app => {
|
|
3499
3500
|
var foundApp = app.id === appId && app.installStatus !== "running";
|
|
3500
3501
|
|
|
3501
3502
|
if (!matchVersion || !foundApp) {
|
|
@@ -11334,6 +11335,88 @@
|
|
|
11334
11335
|
});
|
|
11335
11336
|
}
|
|
11336
11337
|
|
|
11338
|
+
/**
|
|
11339
|
+
* @description 查询独立部署小产品
|
|
11340
|
+
* @endpoint POST /api/v1/micro_app_standalone/search
|
|
11341
|
+
*/
|
|
11342
|
+
|
|
11343
|
+
|
|
11344
|
+
var RuntimeApi_searchMicroAppStandalone = /*#__PURE__*/function () {
|
|
11345
|
+
var _ref = _asyncToGenerator__default["default"](function* (data, options) {
|
|
11346
|
+
return (
|
|
11347
|
+
/**! @contract easyops.api.micro_app_standalone.runtime.SearchMicroAppStandalone@1.0.1 */
|
|
11348
|
+
(yield brickHttp.http.post("api/gateway/micro_app_standalone.runtime.SearchMicroAppStandalone/api/v1/micro_app_standalone/search", data, options)).data
|
|
11349
|
+
);
|
|
11350
|
+
});
|
|
11351
|
+
|
|
11352
|
+
return function RuntimeApi_searchMicroAppStandalone(_x, _x2) {
|
|
11353
|
+
return _ref.apply(this, arguments);
|
|
11354
|
+
};
|
|
11355
|
+
}();
|
|
11356
|
+
|
|
11357
|
+
var standaloneApps = [];
|
|
11358
|
+
var appIdSet = new Set();
|
|
11359
|
+
function preFetchStandaloneInstalledApps(_x) {
|
|
11360
|
+
return _preFetchStandaloneInstalledApps.apply(this, arguments);
|
|
11361
|
+
}
|
|
11362
|
+
|
|
11363
|
+
function _preFetchStandaloneInstalledApps() {
|
|
11364
|
+
_preFetchStandaloneInstalledApps = _asyncToGenerator__default["default"](function* (storyboard) {
|
|
11365
|
+
var saIds = brickUtils.scanInstalledAppsInStoryboard(storyboard);
|
|
11366
|
+
yield fetchStandaloneApps(saIds);
|
|
11367
|
+
});
|
|
11368
|
+
return _preFetchStandaloneInstalledApps.apply(this, arguments);
|
|
11369
|
+
}
|
|
11370
|
+
|
|
11371
|
+
function fetchStandaloneApps(_x2) {
|
|
11372
|
+
return _fetchStandaloneApps.apply(this, arguments);
|
|
11373
|
+
}
|
|
11374
|
+
|
|
11375
|
+
function _fetchStandaloneApps() {
|
|
11376
|
+
_fetchStandaloneApps = _asyncToGenerator__default["default"](function* (saIds) {
|
|
11377
|
+
// ignore apps which are already searched
|
|
11378
|
+
var searchIds = _.difference(saIds, Array.from(appIdSet));
|
|
11379
|
+
|
|
11380
|
+
if (searchIds.length === 0) {
|
|
11381
|
+
return;
|
|
11382
|
+
}
|
|
11383
|
+
|
|
11384
|
+
try {
|
|
11385
|
+
var result = yield RuntimeApi_searchMicroAppStandalone({
|
|
11386
|
+
query: {
|
|
11387
|
+
isActiveVersion: true,
|
|
11388
|
+
appId: {
|
|
11389
|
+
$in: searchIds
|
|
11390
|
+
}
|
|
11391
|
+
},
|
|
11392
|
+
fields: ["appId", "version"]
|
|
11393
|
+
});
|
|
11394
|
+
|
|
11395
|
+
for (var item of result.list) {
|
|
11396
|
+
standaloneApps.push({
|
|
11397
|
+
id: item.appId,
|
|
11398
|
+
currentVersion: item.version,
|
|
11399
|
+
installStatus: "ok"
|
|
11400
|
+
});
|
|
11401
|
+
}
|
|
11402
|
+
|
|
11403
|
+
for (var id of searchIds) {
|
|
11404
|
+
appIdSet.add(id);
|
|
11405
|
+
}
|
|
11406
|
+
} catch (error) {
|
|
11407
|
+
// Allow search micro app to fail, and
|
|
11408
|
+
// make it not crash when the backend service is not updated.
|
|
11409
|
+
// eslint-disable-next-line no-console
|
|
11410
|
+
console.error("get off site standalone micro app failed", error);
|
|
11411
|
+
}
|
|
11412
|
+
});
|
|
11413
|
+
return _fetchStandaloneApps.apply(this, arguments);
|
|
11414
|
+
}
|
|
11415
|
+
|
|
11416
|
+
function getStandaloneInstalledApps() {
|
|
11417
|
+
return standaloneApps;
|
|
11418
|
+
}
|
|
11419
|
+
|
|
11337
11420
|
class Router {
|
|
11338
11421
|
constructor(kernel) {
|
|
11339
11422
|
_defineProperty__default["default"](this, "defaultCollapsed", false);
|
|
@@ -11531,6 +11614,13 @@
|
|
|
11531
11614
|
|
|
11532
11615
|
if (isLoggedIn() && !getAuth().isAdmin) {
|
|
11533
11616
|
yield preCheckPermissions(storyboard);
|
|
11617
|
+
} // Standalone App 需要额外读取 Installed App 信息
|
|
11618
|
+
|
|
11619
|
+
|
|
11620
|
+
if (window.STANDALONE_MICRO_APPS && !window.NO_AUTH_GUARD) {
|
|
11621
|
+
// TODO: get standalone apps when NO_AUTH_GUARD, maybe from conf.yaml
|
|
11622
|
+
yield preFetchStandaloneInstalledApps(storyboard);
|
|
11623
|
+
_this3.kernel.bootstrapData.offSiteStandaloneApps = getStandaloneInstalledApps();
|
|
11534
11624
|
} // 如果找到匹配的 storyboard,那么根据路由匹配得到的 sub-storyboard 加载它的依赖库。
|
|
11535
11625
|
|
|
11536
11626
|
|