@next-core/easyops-runtime 0.9.0 → 0.9.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.
|
@@ -8,10 +8,10 @@ export function preCheckInstalledApps(storyboard, hasAppInBootstrap) {
|
|
|
8
8
|
if (window.STANDALONE_MICRO_APPS && !window.NO_AUTH_GUARD) {
|
|
9
9
|
var appIds = scanInstalledAppsUsage(storyboard);
|
|
10
10
|
var searchIds = [];
|
|
11
|
-
for (var
|
|
11
|
+
for (var appId of appIds) {
|
|
12
12
|
// Do not check these apps already checking or in bootstrap.
|
|
13
|
-
if (!checkingApps.has(
|
|
14
|
-
searchIds.push(
|
|
13
|
+
if (!checkingApps.has(appId) && !hasAppInBootstrap(appId)) {
|
|
14
|
+
searchIds.push(appId);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
if (searchIds.length === 0) {
|
|
@@ -30,19 +30,19 @@ export function preCheckInstalledApps(storyboard, hasAppInBootstrap) {
|
|
|
30
30
|
// eslint-disable-next-line no-console
|
|
31
31
|
console.error("Get off site standalone micro-apps failed", error);
|
|
32
32
|
});
|
|
33
|
-
var _loop = function (
|
|
34
|
-
checkingApps.set(
|
|
33
|
+
var _loop = function (_appId) {
|
|
34
|
+
checkingApps.set(_appId, promise.then(result => {
|
|
35
35
|
var _result$list;
|
|
36
|
-
var app = result === null || result === void 0 || (_result$list = result.list) === null || _result$list === void 0 ? void 0 : _result$list.find(item => item.appId ===
|
|
36
|
+
var app = result === null || result === void 0 || (_result$list = result.list) === null || _result$list === void 0 ? void 0 : _result$list.find(item => item.appId === _appId);
|
|
37
37
|
var checkedApp = app ? _objectSpread(_objectSpread({}, app), {}, {
|
|
38
|
-
id:
|
|
38
|
+
id: _appId
|
|
39
39
|
}) : undefined;
|
|
40
|
-
checkedApps.set(
|
|
40
|
+
checkedApps.set(_appId, checkedApp);
|
|
41
41
|
return checkedApp;
|
|
42
42
|
}));
|
|
43
43
|
};
|
|
44
|
-
for (var
|
|
45
|
-
_loop(
|
|
44
|
+
for (var _appId of searchIds) {
|
|
45
|
+
_loop(_appId);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkInstalledApps.js","names":["traverseStoryboardExpressions","collectInstalledAppsHasUsage","RuntimeApi_searchMicroAppStandalone","checkingApps","Map","checkedApps","preCheckInstalledApps","storyboard","hasAppInBootstrap","window","STANDALONE_MICRO_APPS","NO_AUTH_GUARD","appIds","scanInstalledAppsUsage","searchIds","appId","has","push","length","promise","query","$in","fields","catch","error","console","_loop","
|
|
1
|
+
{"version":3,"file":"checkInstalledApps.js","names":["traverseStoryboardExpressions","collectInstalledAppsHasUsage","RuntimeApi_searchMicroAppStandalone","checkingApps","Map","checkedApps","preCheckInstalledApps","storyboard","hasAppInBootstrap","window","STANDALONE_MICRO_APPS","NO_AUTH_GUARD","appIds","scanInstalledAppsUsage","searchIds","appId","has","push","length","promise","query","$in","fields","catch","error","console","_loop","_appId","set","then","result","_result$list","app","list","find","item","checkedApp","_objectSpread","id","undefined","waitForCheckingApps","_x","_waitForCheckingApps","apply","arguments","_asyncToGenerator","Promise","all","map","get","getCheckedApp","_storyboard$meta","usage","usedArgs","Set","customTemplates","menus","meta","routes","node","parent"],"sources":["../../src/checkInstalledApps.ts"],"sourcesContent":["import type { MicroApp, Storyboard } from \"@next-core/types\";\nimport {\n traverseStoryboardExpressions,\n collectInstalledAppsHasUsage,\n type MemberCallUsage,\n} from \"@next-core/utils/storyboard\";\nimport { RuntimeApi_searchMicroAppStandalone } from \"@next-api-sdk/micro-app-standalone-sdk\";\n\ntype AppForCheck = Pick<MicroApp, \"id\" | \"currentVersion\" | \"installStatus\">;\n\nconst checkingApps = new Map<string, Promise<AppForCheck | undefined>>();\nconst checkedApps = new Map<string, AppForCheck | undefined>();\n\nexport function preCheckInstalledApps(\n storyboard: Storyboard,\n hasAppInBootstrap: (appId: string) => boolean\n) {\n if (window.STANDALONE_MICRO_APPS && !window.NO_AUTH_GUARD) {\n const appIds = scanInstalledAppsUsage(storyboard);\n const searchIds: string[] = [];\n for (const appId of appIds) {\n // Do not check these apps already checking or in bootstrap.\n if (!checkingApps.has(appId) && !hasAppInBootstrap(appId)) {\n searchIds.push(appId);\n }\n }\n if (searchIds.length === 0) {\n return;\n }\n const promise = RuntimeApi_searchMicroAppStandalone({\n query: { appId: { $in: searchIds } },\n fields: [\"appId\", \"currentVersion\", \"installStatus\"],\n }).catch((error) => {\n // Allow search micro app to fail, and\n // make it not crash when the backend service is not updated.\n // eslint-disable-next-line no-console\n console.error(\"Get off site standalone micro-apps failed\", error);\n });\n for (const appId of searchIds) {\n checkingApps.set(\n appId,\n promise.then((result) => {\n const app = result?.list?.find((item) => item.appId === appId);\n const checkedApp = app\n ? {\n ...app,\n id: appId,\n }\n : undefined;\n checkedApps.set(appId, checkedApp);\n return checkedApp;\n })\n );\n }\n }\n}\n\nexport async function waitForCheckingApps(appIds: string[]) {\n await Promise.all(appIds.map((appId) => checkingApps.get(appId)));\n}\n\nexport function getCheckedApp(appId: string) {\n if (window.STANDALONE_MICRO_APPS) {\n return checkedApps.get(appId);\n }\n}\n\nfunction scanInstalledAppsUsage(storyboard: Storyboard) {\n const usage: MemberCallUsage = {\n usedArgs: new Set(),\n };\n // `INSTALLED_APPS.has(...)` is not available in storyboard functions\n const { customTemplates, menus } = storyboard.meta ?? {};\n traverseStoryboardExpressions(\n [storyboard.routes, customTemplates, menus],\n (node, parent) => {\n collectInstalledAppsHasUsage(usage, node, parent);\n },\n \"INSTALLED_APPS\"\n );\n return [...usage.usedArgs];\n}\n"],"mappings":";;AACA,SACEA,6BAA6B,EAC7BC,4BAA4B,QAEvB,6BAA6B;AACpC,SAASC,mCAAmC,QAAQ,wCAAwC;AAI5F,IAAMC,YAAY,GAAG,IAAIC,GAAG,CAA2C,CAAC;AACxE,IAAMC,WAAW,GAAG,IAAID,GAAG,CAAkC,CAAC;AAE9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,CAAC,GAAGR,KAAK,CAACC,QAAQ,CAAC;AAC5B","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/easyops-runtime",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/easyops-runtime",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"repository": {
|
|
@@ -44,20 +44,20 @@
|
|
|
44
44
|
"@next-api-sdk/cmdb-sdk": "^1.1.0",
|
|
45
45
|
"@next-api-sdk/micro-app-sdk": "^1.2.1",
|
|
46
46
|
"@next-api-sdk/micro-app-standalone-sdk": "^1.1.0",
|
|
47
|
-
"@next-core/cook": "^2.2.
|
|
48
|
-
"@next-core/http": "^1.2.
|
|
49
|
-
"@next-core/pipes": "^2.0.
|
|
50
|
-
"@next-core/runtime": "^1.41.
|
|
47
|
+
"@next-core/cook": "^2.2.16",
|
|
48
|
+
"@next-core/http": "^1.2.2",
|
|
49
|
+
"@next-core/pipes": "^2.0.20",
|
|
50
|
+
"@next-core/runtime": "^1.41.2",
|
|
51
51
|
"@next-core/types": "^1.10.0",
|
|
52
|
-
"@next-core/utils": "^1.7.
|
|
52
|
+
"@next-core/utils": "^1.7.2",
|
|
53
53
|
"js-yaml": "^3.14.1",
|
|
54
54
|
"lodash": "^4.17.21"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@next-core/build-next-libs": "^1.0.
|
|
58
|
-
"@next-core/test-next": "^1.1.
|
|
57
|
+
"@next-core/build-next-libs": "^1.0.15",
|
|
58
|
+
"@next-core/test-next": "^1.1.1",
|
|
59
59
|
"jest-websocket-mock": "^2.5.0",
|
|
60
60
|
"whatwg-fetch": "^3.6.20"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "db50cd31e4f0e9ad071aae54d84e5f2c686749cc"
|
|
63
63
|
}
|