@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/dist/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
4
4
|
import _asyncToGenerator$4 from '@babel/runtime/helpers/asyncToGenerator';
|
|
5
5
|
import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
|
|
6
6
|
import React, { useState, useEffect, useRef, forwardRef, useImperativeHandle, useMemo, useContext, createContext, useReducer, useCallback } from 'react';
|
|
7
|
-
import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, matchPath, scanAppGetMenuInAny, asyncProcessBrick, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
7
|
+
import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, matchPath, scanAppGetMenuInAny, asyncProcessBrick, scanInstalledAppsInStoryboard, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
8
8
|
import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, sortBy, merge, isEmpty, isObject as isObject$1, pick, orderBy, omit, findLastIndex, noop, isString } from 'lodash';
|
|
9
9
|
import { http, HttpResponseError, HttpFetchError } from '@next-core/brick-http';
|
|
10
10
|
import moment from 'moment';
|
|
@@ -3496,7 +3496,8 @@ class Runtime {
|
|
|
3496
3496
|
}
|
|
3497
3497
|
|
|
3498
3498
|
hasInstalledApp(appId, matchVersion) {
|
|
3499
|
-
|
|
3499
|
+
var allMicroApps = window.STANDALONE_MICRO_APPS ? kernel.bootstrapData.offSiteStandaloneApps : kernel.bootstrapData.microApps;
|
|
3500
|
+
return allMicroApps.some(app => {
|
|
3500
3501
|
var foundApp = app.id === appId && app.installStatus !== "running";
|
|
3501
3502
|
|
|
3502
3503
|
if (!matchVersion || !foundApp) {
|
|
@@ -11335,6 +11336,88 @@ function registerFormRenderer() {
|
|
|
11335
11336
|
});
|
|
11336
11337
|
}
|
|
11337
11338
|
|
|
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
|
+
var standaloneApps = [];
|
|
11359
|
+
var appIdSet = new Set();
|
|
11360
|
+
function preFetchStandaloneInstalledApps(_x) {
|
|
11361
|
+
return _preFetchStandaloneInstalledApps.apply(this, arguments);
|
|
11362
|
+
}
|
|
11363
|
+
|
|
11364
|
+
function _preFetchStandaloneInstalledApps() {
|
|
11365
|
+
_preFetchStandaloneInstalledApps = _asyncToGenerator$4(function* (storyboard) {
|
|
11366
|
+
var saIds = scanInstalledAppsInStoryboard(storyboard);
|
|
11367
|
+
yield fetchStandaloneApps(saIds);
|
|
11368
|
+
});
|
|
11369
|
+
return _preFetchStandaloneInstalledApps.apply(this, arguments);
|
|
11370
|
+
}
|
|
11371
|
+
|
|
11372
|
+
function fetchStandaloneApps(_x2) {
|
|
11373
|
+
return _fetchStandaloneApps.apply(this, arguments);
|
|
11374
|
+
}
|
|
11375
|
+
|
|
11376
|
+
function _fetchStandaloneApps() {
|
|
11377
|
+
_fetchStandaloneApps = _asyncToGenerator$4(function* (saIds) {
|
|
11378
|
+
// ignore apps which are already searched
|
|
11379
|
+
var searchIds = difference(saIds, Array.from(appIdSet));
|
|
11380
|
+
|
|
11381
|
+
if (searchIds.length === 0) {
|
|
11382
|
+
return;
|
|
11383
|
+
}
|
|
11384
|
+
|
|
11385
|
+
try {
|
|
11386
|
+
var result = yield RuntimeApi_searchMicroAppStandalone({
|
|
11387
|
+
query: {
|
|
11388
|
+
isActiveVersion: true,
|
|
11389
|
+
appId: {
|
|
11390
|
+
$in: searchIds
|
|
11391
|
+
}
|
|
11392
|
+
},
|
|
11393
|
+
fields: ["appId", "version"]
|
|
11394
|
+
});
|
|
11395
|
+
|
|
11396
|
+
for (var item of result.list) {
|
|
11397
|
+
standaloneApps.push({
|
|
11398
|
+
id: item.appId,
|
|
11399
|
+
currentVersion: item.version,
|
|
11400
|
+
installStatus: "ok"
|
|
11401
|
+
});
|
|
11402
|
+
}
|
|
11403
|
+
|
|
11404
|
+
for (var id of searchIds) {
|
|
11405
|
+
appIdSet.add(id);
|
|
11406
|
+
}
|
|
11407
|
+
} catch (error) {
|
|
11408
|
+
// Allow search micro app to fail, and
|
|
11409
|
+
// make it not crash when the backend service is not updated.
|
|
11410
|
+
// eslint-disable-next-line no-console
|
|
11411
|
+
console.error("get off site standalone micro app failed", error);
|
|
11412
|
+
}
|
|
11413
|
+
});
|
|
11414
|
+
return _fetchStandaloneApps.apply(this, arguments);
|
|
11415
|
+
}
|
|
11416
|
+
|
|
11417
|
+
function getStandaloneInstalledApps() {
|
|
11418
|
+
return standaloneApps;
|
|
11419
|
+
}
|
|
11420
|
+
|
|
11338
11421
|
class Router {
|
|
11339
11422
|
constructor(kernel) {
|
|
11340
11423
|
_defineProperty$1(this, "defaultCollapsed", false);
|
|
@@ -11532,6 +11615,13 @@ class Router {
|
|
|
11532
11615
|
|
|
11533
11616
|
if (isLoggedIn() && !getAuth().isAdmin) {
|
|
11534
11617
|
yield preCheckPermissions(storyboard);
|
|
11618
|
+
} // Standalone App 需要额外读取 Installed App 信息
|
|
11619
|
+
|
|
11620
|
+
|
|
11621
|
+
if (window.STANDALONE_MICRO_APPS && !window.NO_AUTH_GUARD) {
|
|
11622
|
+
// TODO: get standalone apps when NO_AUTH_GUARD, maybe from conf.yaml
|
|
11623
|
+
yield preFetchStandaloneInstalledApps(storyboard);
|
|
11624
|
+
_this3.kernel.bootstrapData.offSiteStandaloneApps = getStandaloneInstalledApps();
|
|
11535
11625
|
} // 如果找到匹配的 storyboard,那么根据路由匹配得到的 sub-storyboard 加载它的依赖库。
|
|
11536
11626
|
|
|
11537
11627
|
|