@lcap/nasl 4.5.0-beta.1 → 4.5.0-beta.3
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/out/automate/upgrader/2.12.d.ts.map +1 -1
- package/out/automate/upgrader/2.12.js +1 -0
- package/out/automate/upgrader/2.12.js.map +1 -1
- package/out/automate/upgrader/2.14.d.ts.map +1 -1
- package/out/automate/upgrader/2.14.js +1 -0
- package/out/automate/upgrader/2.14.js.map +1 -1
- package/out/automate/upgrader/2.16.d.ts.map +1 -1
- package/out/automate/upgrader/2.16.js +1 -0
- package/out/automate/upgrader/2.16.js.map +1 -1
- package/out/automate/upgrader/2.17.d.ts.map +1 -1
- package/out/automate/upgrader/2.17.js +1 -0
- package/out/automate/upgrader/2.17.js.map +1 -1
- package/out/automate/upgrader/2.18.d.ts.map +1 -1
- package/out/automate/upgrader/2.18.js +1 -0
- package/out/automate/upgrader/2.18.js.map +1 -1
- package/out/automate/upgrader/2.20.d.ts.map +1 -1
- package/out/automate/upgrader/2.20.js +1 -0
- package/out/automate/upgrader/2.20.js.map +1 -1
- package/out/concepts/index.mini.d.ts +10 -0
- package/out/concepts/index.mini.d.ts.map +1 -0
- package/out/concepts/index.mini.js +26 -0
- package/out/concepts/index.mini.js.map +1 -0
- package/out/generator/genBundleFiles.d.ts.map +1 -1
- package/out/generator/genBundleFiles.js +161 -24
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/permission.js +2 -2
- package/out/generator/permission.js.map +1 -1
- package/out/generator/release-body/utils.d.ts +1 -1
- package/out/generator/release-body/utils.d.ts.map +1 -1
- package/out/generator/release-body/utils.js +8 -6
- package/out/generator/release-body/utils.js.map +1 -1
- package/out/generator/rspack-broswer/bundle.d.ts +24 -0
- package/out/generator/rspack-broswer/bundle.d.ts.map +1 -0
- package/out/generator/rspack-broswer/bundle.js +442 -0
- package/out/generator/rspack-broswer/bundle.js.map +1 -0
- package/out/generator/rspack-broswer/container/client-lazyload-template.d.ts +9 -0
- package/out/generator/rspack-broswer/container/client-lazyload-template.d.ts.map +1 -0
- package/out/generator/rspack-broswer/container/client-lazyload-template.js +88 -0
- package/out/generator/rspack-broswer/container/client-lazyload-template.js.map +1 -0
- package/out/generator/rspack-broswer/container/file-system.d.ts +12 -0
- package/out/generator/rspack-broswer/container/file-system.d.ts.map +1 -0
- package/out/generator/rspack-broswer/container/file-system.js +58 -0
- package/out/generator/rspack-broswer/container/file-system.js.map +1 -0
- package/out/generator/rspack-broswer/container/index.d.ts +3 -0
- package/out/generator/rspack-broswer/container/index.d.ts.map +1 -0
- package/out/generator/rspack-broswer/container/index.js +15 -0
- package/out/generator/rspack-broswer/container/index.js.map +1 -0
- package/out/generator/rspack-broswer/index.d.ts +3 -0
- package/out/generator/rspack-broswer/index.d.ts.map +1 -0
- package/out/generator/rspack-broswer/index.js +19 -0
- package/out/generator/rspack-broswer/index.js.map +1 -0
- package/out/generator/rspack-broswer/loaders/vue/index.d.ts +2 -0
- package/out/generator/rspack-broswer/loaders/vue/index.d.ts.map +1 -0
- package/out/generator/rspack-broswer/loaders/vue/index.js +228 -0
- package/out/generator/rspack-broswer/loaders/vue/index.js.map +1 -0
- package/out/generator/rspack-broswer/plugins/lcap/constant.d.ts +3 -0
- package/out/generator/rspack-broswer/plugins/lcap/constant.d.ts.map +1 -0
- package/out/generator/rspack-broswer/plugins/lcap/constant.js +213 -0
- package/out/generator/rspack-broswer/plugins/lcap/constant.js.map +1 -0
- package/out/generator/rspack-broswer/plugins/lcap/index.d.ts +6 -0
- package/out/generator/rspack-broswer/plugins/lcap/index.d.ts.map +1 -0
- package/out/generator/rspack-broswer/plugins/lcap/index.js +175 -0
- package/out/generator/rspack-broswer/plugins/lcap/index.js.map +1 -0
- package/out/generator/rspack-broswer/plugins/missing-css-fallback/index.d.ts +10 -0
- package/out/generator/rspack-broswer/plugins/missing-css-fallback/index.d.ts.map +1 -0
- package/out/generator/rspack-broswer/plugins/missing-css-fallback/index.js +50 -0
- package/out/generator/rspack-broswer/plugins/missing-css-fallback/index.js.map +1 -0
- package/out/generator/ui-library-declaration/dependency.d.ts +20 -0
- package/out/generator/ui-library-declaration/dependency.d.ts.map +1 -1
- package/out/generator/ui-library-declaration/dependency.js +3 -2
- package/out/generator/ui-library-declaration/dependency.js.map +1 -1
- package/out/generator/ui-library-declaration/index.d.ts +1 -0
- package/out/generator/ui-library-declaration/index.d.ts.map +1 -1
- package/out/generator/ui-library-declaration/index.js +1 -0
- package/out/generator/ui-library-declaration/index.js.map +1 -1
- package/out/generator/ui-library-declaration/material.d.ts +2 -2
- package/out/generator/ui-library-declaration/material.d.ts.map +1 -1
- package/out/generator/ui-library-declaration/material.js +7 -3
- package/out/generator/ui-library-declaration/material.js.map +1 -1
- package/out/index.d.ts +2 -2
- package/out/index.d.ts.map +1 -1
- package/out/index.js +7 -1
- package/out/index.js.map +1 -1
- package/out/index.mini.d.ts +42 -0
- package/out/index.mini.d.ts.map +1 -0
- package/out/index.mini.js +89 -0
- package/out/index.mini.js.map +1 -0
- package/out/manager/diagnostic.d.ts +5 -5
- package/out/manager/diagnostic.d.ts.map +1 -1
- package/out/natural/exports/doctor/doctorView.d.ts +24 -0
- package/out/natural/exports/doctor/doctorView.d.ts.map +1 -0
- package/out/natural/exports/doctor/doctorView.js +351 -0
- package/out/natural/exports/doctor/doctorView.js.map +1 -0
- package/out/natural/exports/doctor/index.d.ts +4 -0
- package/out/natural/exports/doctor/index.d.ts.map +1 -0
- package/out/natural/exports/doctor/index.js +10 -0
- package/out/natural/exports/doctor/index.js.map +1 -0
- package/out/natural/exports/doctor/types.d.ts +109 -0
- package/out/natural/exports/doctor/types.d.ts.map +1 -0
- package/out/natural/exports/doctor/types.js +6 -0
- package/out/natural/exports/doctor/types.js.map +1 -0
- package/out/natural/exports/doctor/viewGraph.d.ts +20 -0
- package/out/natural/exports/doctor/viewGraph.d.ts.map +1 -0
- package/out/natural/exports/doctor/viewGraph.js +448 -0
- package/out/natural/exports/doctor/viewGraph.js.map +1 -0
- package/out/natural/exports/nasl2Files.d.ts.map +1 -1
- package/out/natural/exports/nasl2Files.js +113 -9
- package/out/natural/exports/nasl2Files.js.map +1 -1
- package/out/natural/exports/transform2BatchActions/apply.d.ts +11 -0
- package/out/natural/exports/transform2BatchActions/apply.d.ts.map +1 -0
- package/out/natural/exports/transform2BatchActions/apply.js +68 -0
- package/out/natural/exports/transform2BatchActions/apply.js.map +1 -0
- package/out/natural/exports/transform2BatchActions/diff/directories.d.ts +17 -0
- package/out/natural/exports/transform2BatchActions/diff/directories.d.ts.map +1 -0
- package/out/natural/exports/transform2BatchActions/diff/directories.js +215 -0
- package/out/natural/exports/transform2BatchActions/diff/directories.js.map +1 -0
- package/out/natural/exports/transform2BatchActions/diff/index.d.ts +21 -0
- package/out/natural/exports/transform2BatchActions/diff/index.d.ts.map +1 -0
- package/out/natural/exports/transform2BatchActions/diff/index.js +20 -0
- package/out/natural/exports/transform2BatchActions/diff/index.js.map +1 -0
- package/out/natural/exports/transform2BatchActions/diff/nodes.d.ts +186 -0
- package/out/natural/exports/transform2BatchActions/diff/nodes.d.ts.map +1 -0
- package/out/natural/exports/transform2BatchActions/diff/nodes.js +498 -0
- package/out/natural/exports/transform2BatchActions/diff/nodes.js.map +1 -0
- package/out/natural/exports/transform2BatchActions/diff/roles.d.ts +18 -0
- package/out/natural/exports/transform2BatchActions/diff/roles.d.ts.map +1 -0
- package/out/natural/exports/transform2BatchActions/diff/roles.js +61 -0
- package/out/natural/exports/transform2BatchActions/diff/roles.js.map +1 -0
- package/out/natural/exports/transform2BatchActions/index.d.ts +41 -0
- package/out/natural/exports/transform2BatchActions/index.d.ts.map +1 -0
- package/out/natural/exports/transform2BatchActions/index.js +61 -0
- package/out/natural/exports/transform2BatchActions/index.js.map +1 -0
- package/out/natural/exports/transform2BatchActions/parse.d.ts +24 -0
- package/out/natural/exports/transform2BatchActions/parse.d.ts.map +1 -0
- package/out/natural/exports/transform2BatchActions/parse.js +257 -0
- package/out/natural/exports/transform2BatchActions/parse.js.map +1 -0
- package/out/natural/exports/transform2BatchActions/types.d.ts +147 -0
- package/out/natural/exports/transform2BatchActions/types.d.ts.map +1 -0
- package/out/natural/exports/transform2BatchActions/types.js +7 -0
- package/out/natural/exports/transform2BatchActions/types.js.map +1 -0
- package/out/natural/index.d.ts +1 -0
- package/out/natural/index.d.ts.map +1 -1
- package/out/natural/index.js +1 -0
- package/out/natural/index.js.map +1 -1
- package/out/natural/old/parser/transformTS2UI.d.ts.map +1 -1
- package/out/natural/old/parser/transformTS2UI.js +4 -1
- package/out/natural/old/parser/transformTS2UI.js.map +1 -1
- package/out/natural/old/parser/transformTSCode.js +1 -1
- package/out/natural/old/parser/transformTSCode.js.map +1 -1
- package/out/natural/parser/parseNaturalTS.d.ts.map +1 -1
- package/out/natural/parser/parseNaturalTS.js +106 -2
- package/out/natural/parser/parseNaturalTS.js.map +1 -1
- package/out/natural/parser/parseNaturalTSXView.d.ts.map +1 -1
- package/out/natural/parser/parseNaturalTSXView.js +60 -7
- package/out/natural/parser/parseNaturalTSXView.js.map +1 -1
- package/out/natural/transforms/checker/checkIdentifierName.d.ts +6 -0
- package/out/natural/transforms/checker/checkIdentifierName.d.ts.map +1 -0
- package/out/natural/transforms/checker/checkIdentifierName.js +15 -0
- package/out/natural/transforms/checker/checkIdentifierName.js.map +1 -0
- package/out/natural/transforms/checker/checkKeywords.d.ts +33 -0
- package/out/natural/transforms/checker/checkKeywords.d.ts.map +1 -0
- package/out/natural/transforms/checker/checkKeywords.js +85 -0
- package/out/natural/transforms/checker/checkKeywords.js.map +1 -0
- package/out/natural/transforms/checker/checkViewElement.d.ts +10 -0
- package/out/natural/transforms/checker/checkViewElement.d.ts.map +1 -1
- package/out/natural/transforms/checker/checkViewElement.js +28 -1
- package/out/natural/transforms/checker/checkViewElement.js.map +1 -1
- package/out/natural/transforms/checker/index.d.ts +3 -1
- package/out/natural/transforms/checker/index.d.ts.map +1 -1
- package/out/natural/transforms/checker/index.js +10 -1
- package/out/natural/transforms/checker/index.js.map +1 -1
- package/out/natural/transforms/transform2AuthLogic.d.ts +4 -0
- package/out/natural/transforms/transform2AuthLogic.d.ts.map +1 -0
- package/out/natural/transforms/transform2AuthLogic.js +116 -0
- package/out/natural/transforms/transform2AuthLogic.js.map +1 -0
- package/out/natural/transforms/transform2Config.d.ts +17 -0
- package/out/natural/transforms/transform2Config.d.ts.map +1 -0
- package/out/natural/transforms/transform2Config.js +114 -0
- package/out/natural/transforms/transform2Config.js.map +1 -0
- package/out/natural/transforms/transform2Entity.d.ts +2 -2
- package/out/natural/transforms/transform2Entity.d.ts.map +1 -1
- package/out/natural/transforms/transform2Entity.js +11 -2
- package/out/natural/transforms/transform2Entity.js.map +1 -1
- package/out/natural/transforms/transform2Enum.d.ts.map +1 -1
- package/out/natural/transforms/transform2Enum.js +8 -1
- package/out/natural/transforms/transform2Enum.js.map +1 -1
- package/out/natural/transforms/transform2ExportInterface.d.ts +3 -0
- package/out/natural/transforms/transform2ExportInterface.d.ts.map +1 -0
- package/out/natural/transforms/transform2ExportInterface.js +96 -0
- package/out/natural/transforms/transform2ExportInterface.js.map +1 -0
- package/out/natural/transforms/transform2GlobalLogicDeclaration.d.ts.map +1 -1
- package/out/natural/transforms/transform2GlobalLogicDeclaration.js +4 -1
- package/out/natural/transforms/transform2GlobalLogicDeclaration.js.map +1 -1
- package/out/natural/transforms/transform2Logic.d.ts.map +1 -1
- package/out/natural/transforms/transform2Logic.js +8 -38
- package/out/natural/transforms/transform2Logic.js.map +1 -1
- package/out/natural/transforms/transform2LogicItem.d.ts +9 -2
- package/out/natural/transforms/transform2LogicItem.d.ts.map +1 -1
- package/out/natural/transforms/transform2LogicItem.js +169 -61
- package/out/natural/transforms/transform2LogicItem.js.map +1 -1
- package/out/natural/transforms/transform2OverriddenLogic.d.ts +3 -0
- package/out/natural/transforms/transform2OverriddenLogic.d.ts.map +1 -0
- package/out/natural/transforms/transform2OverriddenLogic.js +83 -0
- package/out/natural/transforms/transform2OverriddenLogic.js.map +1 -0
- package/out/natural/transforms/transform2Param.d.ts +1 -1
- package/out/natural/transforms/transform2Param.d.ts.map +1 -1
- package/out/natural/transforms/transform2Param.js +19 -1
- package/out/natural/transforms/transform2Param.js.map +1 -1
- package/out/natural/transforms/transform2Roles.d.ts +3 -0
- package/out/natural/transforms/transform2Roles.d.ts.map +1 -0
- package/out/natural/transforms/transform2Roles.js +34 -0
- package/out/natural/transforms/transform2Roles.js.map +1 -0
- package/out/natural/transforms/transform2Structure.d.ts.map +1 -1
- package/out/natural/transforms/transform2Structure.js +2 -0
- package/out/natural/transforms/transform2Structure.js.map +1 -1
- package/out/natural/transforms/transform2TypeAnnotation.d.ts.map +1 -1
- package/out/natural/transforms/transform2TypeAnnotation.js +8 -4
- package/out/natural/transforms/transform2TypeAnnotation.js.map +1 -1
- package/out/natural/transforms/transform2Variable.d.ts.map +1 -1
- package/out/natural/transforms/transform2Variable.js +4 -0
- package/out/natural/transforms/transform2Variable.js.map +1 -1
- package/out/natural/transforms/utils/createComponentLookupMap.js +3 -3
- package/out/natural/transforms/utils/createComponentLookupMap.js.map +1 -1
- package/out/natural/transforms/utils/ensureBindRoles.d.ts +9 -0
- package/out/natural/transforms/utils/ensureBindRoles.d.ts.map +1 -0
- package/out/natural/transforms/utils/ensureBindRoles.js +25 -0
- package/out/natural/transforms/utils/ensureBindRoles.js.map +1 -0
- package/out/natural/transforms/utils/flattenStatementsWithComments.d.ts +11 -0
- package/out/natural/transforms/utils/flattenStatementsWithComments.d.ts.map +1 -0
- package/out/natural/transforms/utils/flattenStatementsWithComments.js +36 -0
- package/out/natural/transforms/utils/flattenStatementsWithComments.js.map +1 -0
- package/out/natural/transforms/utils/parseDecorator.d.ts +4 -4
- package/out/natural/transforms/utils/parseDecorator.d.ts.map +1 -1
- package/out/natural/transforms/utils/parseDecorator.js +40 -24
- package/out/natural/transforms/utils/parseDecorator.js.map +1 -1
- package/out/natural/transforms/utils/parseLogicBody.d.ts +17 -0
- package/out/natural/transforms/utils/parseLogicBody.d.ts.map +1 -0
- package/out/natural/transforms/utils/parseLogicBody.js +47 -0
- package/out/natural/transforms/utils/parseLogicBody.js.map +1 -0
- package/out/natural/utils/index.d.ts +5 -0
- package/out/natural/utils/index.d.ts.map +1 -1
- package/out/natural/utils/index.js +11 -1
- package/out/natural/utils/index.js.map +1 -1
- package/out/natural/utils/nasl-file-types.d.ts +6 -1
- package/out/natural/utils/nasl-file-types.d.ts.map +1 -1
- package/out/natural/utils/nasl-file-types.js +77 -2
- package/out/natural/utils/nasl-file-types.js.map +1 -1
- package/out/server/extendBaseNode.d.ts.map +1 -1
- package/out/server/extendBaseNode.js +9 -3
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/naslServer.d.ts +18 -0
- package/out/server/naslServer.d.ts.map +1 -1
- package/out/server/naslServer.js +89 -0
- package/out/server/naslServer.js.map +1 -1
- package/out/server/naslUiComponentTs.d.ts +1 -2
- package/out/server/naslUiComponentTs.d.ts.map +1 -1
- package/out/server/naslUiComponentTs.default.d.ts +47 -0
- package/out/server/naslUiComponentTs.js +25 -49
- package/out/server/naslUiComponentTs.js.map +1 -1
- package/out/service/autofix/types.d.ts +2 -2
- package/out/service/autofix/types.d.ts.map +1 -1
- package/out/service/instruct-ruler/ruler.d.ts +3 -1
- package/out/service/instruct-ruler/ruler.d.ts.map +1 -1
- package/out/service/instruct-ruler/ruler.js +2 -1
- package/out/service/instruct-ruler/ruler.js.map +1 -1
- package/out/service/storage/init.d.ts +6 -0
- package/out/service/storage/init.d.ts.map +1 -1
- package/out/service/storage/init.js +22 -9
- package/out/service/storage/init.js.map +1 -1
- package/out/service/storage/operation.d.ts +9 -1
- package/out/service/storage/operation.d.ts.map +1 -1
- package/out/service/storage/operation.js +220 -100
- package/out/service/storage/operation.js.map +1 -1
- package/out/service/storage/specTools.d.ts.map +1 -1
- package/out/service/storage/specTools.js +25 -13
- package/out/service/storage/specTools.js.map +1 -1
- package/out/templator/genQueryComponent.d.ts +13 -1
- package/out/templator/genQueryComponent.d.ts.map +1 -1
- package/out/templator/genQueryComponent.js +18 -14
- package/out/templator/genQueryComponent.js.map +1 -1
- package/package.json +16 -10
- package/sandbox/stdlib/nasl.util.ts +16 -15
- package/out/natural/exports/transform2BatchActions.d.ts +0 -114
- package/out/natural/exports/transform2BatchActions.d.ts.map +0 -1
- package/out/natural/exports/transform2BatchActions.js +0 -1233
- package/out/natural/exports/transform2BatchActions.js.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* nasl.mini 入口
|
|
4
|
+
*
|
|
5
|
+
* 最小化 bundle,只包含 TDD 所需核心:
|
|
6
|
+
* - parseNaturalTS / parseNaturalTSXView(parse)
|
|
7
|
+
* - toNaturalTS(通过 BaseNode 方法及所有 Concept 实现)
|
|
8
|
+
* - nasl2Files / transform2BatchActions(文件导出)
|
|
9
|
+
* - createCompilerState(编译器状态工厂)
|
|
10
|
+
*
|
|
11
|
+
* **不包含(与完整 index.ts 相比剔除):**
|
|
12
|
+
* - NaslServer / extendBaseNode(server/index.ts)
|
|
13
|
+
* - @lcap/nasl-language-server-core
|
|
14
|
+
* - @lcap/nasl-unified-frontend-generator(generator)
|
|
15
|
+
* - @lcap/nasl-breakpoint(breakpoint)
|
|
16
|
+
* - old/* 兼容层(只保留 parseNaturalTSLogic,TDD logicCompiler 依赖它)
|
|
17
|
+
*
|
|
18
|
+
* 公共依赖抽取说明:
|
|
19
|
+
* getBuildInFunction / getSqlFunction 原先在 transform2LogicItem.ts 通过 naslServer 调用,
|
|
20
|
+
* 现已改为直接从 @lcap/nasl-concepts/service 导入,naslServer 不再是 parse/toNaturalTS 的依赖。
|
|
21
|
+
*
|
|
22
|
+
* **运行环境提示:**
|
|
23
|
+
* 该 bundle 以 `target: 'web'` 打包并用 `crypto-browserify` 作为 crypto polyfill,
|
|
24
|
+
* 推荐在浏览器(UMD 全局 `nasl`)中使用。
|
|
25
|
+
* 如需在 Node.js 中 require,请在 require 前自行注入 WebCrypto,例如:
|
|
26
|
+
* ```js
|
|
27
|
+
* if (typeof globalThis.crypto === 'undefined') {
|
|
28
|
+
* globalThis.crypto = require('crypto').webcrypto;
|
|
29
|
+
* }
|
|
30
|
+
* const nasl = require('.../nasl.mini.min.js');
|
|
31
|
+
* ```
|
|
32
|
+
* 否则首次走 uuid 路径会报错(参见 packages/nasl/tests/tdd/fixtures.mini.js)。
|
|
33
|
+
*/
|
|
34
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
35
|
+
if (k2 === undefined) k2 = k;
|
|
36
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
37
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
38
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
39
|
+
}
|
|
40
|
+
Object.defineProperty(o, k2, desc);
|
|
41
|
+
}) : (function(o, m, k, k2) {
|
|
42
|
+
if (k2 === undefined) k2 = k;
|
|
43
|
+
o[k2] = m[k];
|
|
44
|
+
}));
|
|
45
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
46
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
47
|
+
}) : function(o, v) {
|
|
48
|
+
o["default"] = v;
|
|
49
|
+
});
|
|
50
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
51
|
+
if (mod && mod.__esModule) return mod;
|
|
52
|
+
var result = {};
|
|
53
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
54
|
+
__setModuleDefault(result, mod);
|
|
55
|
+
return result;
|
|
56
|
+
};
|
|
57
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
58
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
59
|
+
};
|
|
60
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
|
+
exports.parseNaturalTSLogic = exports.Types = void 0;
|
|
62
|
+
const nasl_concepts_1 = require("@lcap/nasl-concepts");
|
|
63
|
+
const babelParser = __importStar(require("@babel/parser"));
|
|
64
|
+
const compiler = __importStar(require("vue-template-compiler"));
|
|
65
|
+
// 初始化 concepts(不依赖 server 侧的 elementsEventsMap,传入空 map 即可)
|
|
66
|
+
(0, nasl_concepts_1.initialize)({
|
|
67
|
+
getBabelParser: () => babelParser,
|
|
68
|
+
getVueCompiler: () => compiler,
|
|
69
|
+
getElementsEventsMap: () => ({}),
|
|
70
|
+
});
|
|
71
|
+
// ── concepts(包含所有 NASL 节点类及其 toNaturalTS 实现)──────────────────────
|
|
72
|
+
__exportStar(require("@lcap/nasl-concepts"), exports);
|
|
73
|
+
// ── translator(createCompilerState / shiftState / TranslatorState 等)─────────
|
|
74
|
+
__exportStar(require("./translator"), exports);
|
|
75
|
+
// ── types namespace ─────────────────────────────────────────────────────────────
|
|
76
|
+
exports.Types = __importStar(require("@lcap/nasl-types"));
|
|
77
|
+
// ── parse(核心 TDD 接口)───────────────────────────────────────────────────────
|
|
78
|
+
__exportStar(require("./natural/parser/parseNaturalTS"), exports);
|
|
79
|
+
__exportStar(require("./natural/parser/parseNaturalTSXView"), exports);
|
|
80
|
+
// ── generate(nasl2Files、transform2BatchActions)──────────────────────────────
|
|
81
|
+
__exportStar(require("./natural/exports/nasl2Files"), exports);
|
|
82
|
+
__exportStar(require("./natural/exports/transform2BatchActions"), exports);
|
|
83
|
+
// ── 公共工具(throwError、nasl-file-types 等)────────────────────────────────
|
|
84
|
+
__exportStar(require("./natural/utils"), exports);
|
|
85
|
+
// ── parseNaturalTSLogic(TDD logicCompiler 依赖,来自 old/parser)────────────
|
|
86
|
+
// 注意:transformTSCode.ts 只依赖 babel + transforms,不引入 server 或 language-server-core
|
|
87
|
+
var transformTSCode_1 = require("./natural/old/parser/transformTSCode");
|
|
88
|
+
Object.defineProperty(exports, "parseNaturalTSLogic", { enumerable: true, get: function () { return transformTSCode_1.parseNaturalTSLogic; } });
|
|
89
|
+
//# sourceMappingURL=index.mini.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mini.js","sourceRoot":"","sources":["../src/index.mini.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uDAAiD;AACjD,2DAA6C;AAC7C,gEAAkD;AAElD,2DAA2D;AAC3D,IAAA,0BAAU,EAAC;IACT,cAAc,EAAE,GAAG,EAAE,CAAC,WAAW;IACjC,cAAc,EAAE,GAAG,EAAE,CAAC,QAAQ;IAC9B,oBAAoB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;CACjC,CAAC,CAAC;AAEH,oEAAoE;AACpE,sDAAoC;AAEpC,+EAA+E;AAC/E,+CAA6B;AAE7B,mFAAmF;AACnF,0DAA0C;AAE1C,6EAA6E;AAC7E,kEAAgD;AAChD,uEAAqD;AAErD,+EAA+E;AAC/E,+DAA6C;AAC7C,2EAAyD;AAEzD,wEAAwE;AACxE,kDAAgC;AAEhC,yEAAyE;AACzE,iFAAiF;AACjF,wEAA2E;AAAlE,sHAAA,mBAAmB,OAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Diagnostic } from '@lcap/nasl-types';
|
|
1
|
+
import { Diagnostic as DiagnosticNS } from '@lcap/nasl-types';
|
|
2
2
|
import { BaseNode, SyntaxNode } from '../concepts';
|
|
3
|
-
export type Diagnostic =
|
|
4
|
-
export type DiagnosticRecord =
|
|
5
|
-
export declare class DiagnosticManager implements
|
|
3
|
+
export type Diagnostic = DiagnosticNS.Diagnostic<SyntaxNode>;
|
|
4
|
+
export type DiagnosticRecord = DiagnosticNS.DiagnosticRecord;
|
|
5
|
+
export declare class DiagnosticManager implements DiagnosticNS.DiagnosticManager<BaseNode> {
|
|
6
6
|
private initVersionByFilePath;
|
|
7
7
|
incrementVersionByFilePath(filePath: string): number;
|
|
8
8
|
getVersionByFilePath(filePath: string): number;
|
|
@@ -11,7 +11,7 @@ export declare class DiagnosticManager implements Diagnostic.DiagnosticManager<B
|
|
|
11
11
|
records: Array<DiagnosticRecord>;
|
|
12
12
|
private records_map;
|
|
13
13
|
push(record: DiagnosticRecord): void;
|
|
14
|
-
getRecord(id: string):
|
|
14
|
+
getRecord(id: string): DiagnosticNS.DiagnosticRecord;
|
|
15
15
|
deleteOwn(id: string): boolean;
|
|
16
16
|
clear(): void;
|
|
17
17
|
pushAll(records: DiagnosticRecord[]): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostic.d.ts","sourceRoot":"","sources":["../../src/manager/diagnostic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"diagnostic.d.ts","sourceRoot":"","sources":["../../src/manager/diagnostic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGnD,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAC7D,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,gBAAgB,CAAC;AAE7D,qBAAa,iBAAkB,YAAW,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAC;IAChF,OAAO,CAAC,qBAAqB;IAO7B,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAKpD,oBAAoB,CAAC,QAAQ,EAAE,MAAM;IAKrC,uBAAuB,CAAC,QAAQ,EAAE,MAAM;IAOxC,OAAO,CAAC,QAAQ,CAA+C;IACxD,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAM;IAG7C,OAAO,CAAC,WAAW,CAA6C;IAEhE,IAAI,CAAC,MAAM,EAAE,gBAAgB;IAS7B,SAAS,CAAC,EAAE,EAAE,MAAM;IAKpB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAE,OAAO;IAa7B,KAAK;IAKL,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE;IAI7B,kBAAkB,CAAC,OAAO,EAAG,gBAAgB,EAAE;CAOtD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* doctorView - Generates a diagnostic report for View navigation topology.
|
|
3
|
+
*
|
|
4
|
+
* Analyzes the App's view tree to produce:
|
|
5
|
+
* 1. View tree structure
|
|
6
|
+
* 2. Reverse references (which pages link to each page)
|
|
7
|
+
* 3. Unreferenced views
|
|
8
|
+
* 4. Per-role accessibility analysis
|
|
9
|
+
*/
|
|
10
|
+
import type { DoctorViewOptions, DoctorViewResultJSON } from './types';
|
|
11
|
+
/**
|
|
12
|
+
* Generate a diagnostic report for the App's view navigation structure.
|
|
13
|
+
*
|
|
14
|
+
* @param app - NASL App instance (from BaseNode.from(parseNaturalTS(content).toJSON()))
|
|
15
|
+
* @param options - Control which report sections to include
|
|
16
|
+
* @returns Formatted markdown report string
|
|
17
|
+
*/
|
|
18
|
+
export declare function doctorView(app: any, options?: DoctorViewOptions): string;
|
|
19
|
+
/**
|
|
20
|
+
* Generate a DoctorViewResult for the App's view navigation structure.
|
|
21
|
+
* Result extends ViewGraph with computed unrefViews.
|
|
22
|
+
*/
|
|
23
|
+
export declare function doctorViewJson(app: any, options?: Pick<DoctorViewOptions, 'unrefViewsIncludesRoots'>): DoctorViewResultJSON;
|
|
24
|
+
//# sourceMappingURL=doctorView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctorView.d.ts","sourceRoot":"","sources":["../../../../src/natural/exports/doctor/doctorView.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAoB,oBAAoB,EAA4C,MAAM,SAAS,CAAC;AAGnI;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAqCxE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,yBAAyB,CAAC,GAAG,oBAAoB,CAuB3H"}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.doctorViewJson = exports.doctorView = void 0;
|
|
4
|
+
const viewGraph_1 = require("./viewGraph");
|
|
5
|
+
/**
|
|
6
|
+
* Generate a diagnostic report for the App's view navigation structure.
|
|
7
|
+
*
|
|
8
|
+
* @param app - NASL App instance (from BaseNode.from(parseNaturalTS(content).toJSON()))
|
|
9
|
+
* @param options - Control which report sections to include
|
|
10
|
+
* @returns Formatted markdown report string
|
|
11
|
+
*/
|
|
12
|
+
function doctorView(app, options) {
|
|
13
|
+
const graph = (0, viewGraph_1.buildViewGraph)(app);
|
|
14
|
+
const includeRoots = !!options?.unrefViewsIncludesRoots;
|
|
15
|
+
const unrefViews = findUnreferencedPages(graph, !includeRoots).map((n) => n.path);
|
|
16
|
+
const hideCode = !!options?.hideCode;
|
|
17
|
+
// Determine which sections to output.
|
|
18
|
+
const hasExplicitSection = options?.viewTree !== undefined
|
|
19
|
+
|| options?.reverseRefs !== undefined
|
|
20
|
+
|| options?.unrefViews !== undefined
|
|
21
|
+
|| (options?.roleAccess !== undefined);
|
|
22
|
+
const showViewTree = hasExplicitSection ? !!options?.viewTree : true;
|
|
23
|
+
const showReverseRefs = hasExplicitSection ? !!options?.reverseRefs : true;
|
|
24
|
+
const showUnrefViews = hasExplicitSection ? !!options?.unrefViews : true;
|
|
25
|
+
const roles = options?.roleAccess || [];
|
|
26
|
+
const showRoleAccess = hasExplicitSection ? roles.length > 0 : false;
|
|
27
|
+
const parts = [];
|
|
28
|
+
if (showViewTree) {
|
|
29
|
+
parts.push(renderViewTree(graph, hideCode));
|
|
30
|
+
}
|
|
31
|
+
if (showReverseRefs) {
|
|
32
|
+
parts.push(renderReverseReferences(graph, hideCode));
|
|
33
|
+
}
|
|
34
|
+
if (showUnrefViews) {
|
|
35
|
+
parts.push(renderUnreferencedViews(graph, unrefViews));
|
|
36
|
+
}
|
|
37
|
+
if (showRoleAccess && roles.length > 0) {
|
|
38
|
+
parts.push(renderRoleAccessTrees(graph, roles, hideCode));
|
|
39
|
+
}
|
|
40
|
+
return parts.join('\n\n');
|
|
41
|
+
}
|
|
42
|
+
exports.doctorView = doctorView;
|
|
43
|
+
/**
|
|
44
|
+
* Generate a DoctorViewResult for the App's view navigation structure.
|
|
45
|
+
* Result extends ViewGraph with computed unrefViews.
|
|
46
|
+
*/
|
|
47
|
+
function doctorViewJson(app, options) {
|
|
48
|
+
const graph = (0, viewGraph_1.buildViewGraph)(app);
|
|
49
|
+
const includeRoots = !!options?.unrefViewsIncludesRoots;
|
|
50
|
+
const unreferenced = findUnreferencedPages(graph, !includeRoots);
|
|
51
|
+
// Convert Map/Set to plain objects/arrays for JSON serialization
|
|
52
|
+
const flatRouteMap = {};
|
|
53
|
+
for (const [k, v] of graph.flatRouteMap)
|
|
54
|
+
flatRouteMap[k] = v;
|
|
55
|
+
const forwardEdgeMap = {};
|
|
56
|
+
for (const [k, v] of graph.forwardEdgeMap)
|
|
57
|
+
forwardEdgeMap[k] = v;
|
|
58
|
+
const reverseEdgeMap = {};
|
|
59
|
+
for (const [k, v] of graph.reverseEdgeMap)
|
|
60
|
+
reverseEdgeMap[k] = v;
|
|
61
|
+
return {
|
|
62
|
+
flatRouteMap,
|
|
63
|
+
rootPaths: graph.rootPaths,
|
|
64
|
+
forwardEdgeMap,
|
|
65
|
+
reverseEdgeMap,
|
|
66
|
+
allRoleSet: [...graph.allRoleSet],
|
|
67
|
+
unrefViews: unreferenced.map((n) => n.path),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
exports.doctorViewJson = doctorViewJson;
|
|
71
|
+
// ============================================================================
|
|
72
|
+
// Section 1: View Tree
|
|
73
|
+
// ============================================================================
|
|
74
|
+
function renderViewTree(graph, hideCode) {
|
|
75
|
+
const lines = ['## 页面树\n'];
|
|
76
|
+
for (const rootPath of graph.rootPaths) {
|
|
77
|
+
renderViewSubtree(graph, rootPath, lines, 0, { abbreviateRoles: false }, hideCode);
|
|
78
|
+
}
|
|
79
|
+
return lines.join('\n');
|
|
80
|
+
}
|
|
81
|
+
// ============================================================================
|
|
82
|
+
// Section 2: Reverse References
|
|
83
|
+
// ============================================================================
|
|
84
|
+
function renderReverseReferences(graph, hideCode) {
|
|
85
|
+
const lines = ['## 反向引用\n'];
|
|
86
|
+
for (const rootPath of graph.rootPaths) {
|
|
87
|
+
renderReverseSubtree(graph, rootPath, lines, 0, hideCode);
|
|
88
|
+
}
|
|
89
|
+
return lines.join('\n');
|
|
90
|
+
}
|
|
91
|
+
// ============================================================================
|
|
92
|
+
// Section 3: Unreferenced Views
|
|
93
|
+
// ============================================================================
|
|
94
|
+
function renderUnreferencedViews(graph, unrefViews) {
|
|
95
|
+
const lines = ['## 没有默认跳转且没有被引用的页面\n'];
|
|
96
|
+
if (unrefViews.length) {
|
|
97
|
+
lines.push('**注意:以下页面没有默认跳转且没有被引用,可能实现存在问题。**\n');
|
|
98
|
+
for (const viewPath of unrefViews) {
|
|
99
|
+
const node = graph.flatRouteMap.get(viewPath);
|
|
100
|
+
if (!node)
|
|
101
|
+
continue;
|
|
102
|
+
const title = node.levels[node.levels.length - 1] || '';
|
|
103
|
+
lines.push(`- (${title})${node.path}(${formatParams(node)})${formatTags(node, { abbreviateRoles: false })}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
lines.push('链路通畅,没有问题。\n');
|
|
108
|
+
}
|
|
109
|
+
return lines.join('\n');
|
|
110
|
+
}
|
|
111
|
+
// ============================================================================
|
|
112
|
+
// Section 4: Per-Role Access Analysis
|
|
113
|
+
// ============================================================================
|
|
114
|
+
function renderRoleAccessTrees(graph, roles, hideCode) {
|
|
115
|
+
const lines = ['## 各角色可访问分析\n'];
|
|
116
|
+
for (const role of roles) {
|
|
117
|
+
lines.push(`### 角色 ${role} 可访问的页面树\n`);
|
|
118
|
+
lines.push('<!-- 下面树中没有出现的,表示该角色无法访问(包括页面鉴权不允许、没有跳转链路或跳转链接鉴权不允许到该页面,不包括逻辑中的动态鉴权) -->\n');
|
|
119
|
+
const reachable = computeReachablePages(graph, role);
|
|
120
|
+
for (const rootPath of graph.rootPaths) {
|
|
121
|
+
renderRoleSubtree(graph, rootPath, lines, 0, role, reachable, hideCode);
|
|
122
|
+
}
|
|
123
|
+
lines.push('');
|
|
124
|
+
}
|
|
125
|
+
return lines.join('\n');
|
|
126
|
+
}
|
|
127
|
+
function renderViewSubtree(graph, path, lines, indent, opts, hideCode) {
|
|
128
|
+
const node = graph.flatRouteMap.get(path);
|
|
129
|
+
if (!node)
|
|
130
|
+
return;
|
|
131
|
+
const title = node.levels[node.levels.length - 1] || '';
|
|
132
|
+
const prefix = makeTreePrefix(indent);
|
|
133
|
+
lines.push(`${prefix}(${title})${node.alias}(${formatParams(node)})${formatTags(node, opts)}`);
|
|
134
|
+
// Show forward edges (outgoing navigation)
|
|
135
|
+
const edges = graph.forwardEdgeMap.get(path) || [];
|
|
136
|
+
for (const edge of edges) {
|
|
137
|
+
const edgePrefix = makeEdgePrefix(indent + 1);
|
|
138
|
+
if (hideCode) {
|
|
139
|
+
lines.push(`${edgePrefix}跳转到:${edge.toPath}()`);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
lines.push(`${edgePrefix}跳转到:${edge.toPath}(),相关代码:\`${edge.codeSnippet}\``);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// Recurse children
|
|
146
|
+
for (const childPath of node.childrenPaths) {
|
|
147
|
+
renderViewSubtree(graph, childPath, lines, indent + 1, opts, hideCode);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function renderReverseSubtree(graph, path, lines, indent, hideCode) {
|
|
151
|
+
const node = graph.flatRouteMap.get(path);
|
|
152
|
+
if (!node)
|
|
153
|
+
return;
|
|
154
|
+
const title = node.levels[node.levels.length - 1] || '';
|
|
155
|
+
const prefix = makeTreePrefix(indent);
|
|
156
|
+
lines.push(`${prefix}(${title})${node.alias}(${formatParams(node)})${formatTags(node, { abbreviateRoles: false })}`);
|
|
157
|
+
// Show reverse edges (incoming navigation)
|
|
158
|
+
const edges = graph.reverseEdgeMap.get(path) || [];
|
|
159
|
+
for (const edge of edges) {
|
|
160
|
+
const edgePrefix = makeReverseEdgePrefix(indent + 1);
|
|
161
|
+
if (hideCode) {
|
|
162
|
+
lines.push(`${edgePrefix}被 ${edge.fromPath} 跳转引用`);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
lines.push(`${edgePrefix}被 ${edge.fromPath} 跳转引用,相关代码:\`${edge.codeSnippet}\``);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// Recurse children
|
|
169
|
+
for (const childPath of node.childrenPaths) {
|
|
170
|
+
renderReverseSubtree(graph, childPath, lines, indent + 1, hideCode);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function renderRoleSubtree(graph, path, lines, indent, role, reachable, hideCode) {
|
|
174
|
+
if (!reachable.has(path))
|
|
175
|
+
return;
|
|
176
|
+
const node = graph.flatRouteMap.get(path);
|
|
177
|
+
if (!node)
|
|
178
|
+
return;
|
|
179
|
+
const title = node.levels[node.levels.length - 1] || '';
|
|
180
|
+
const prefix = makeTreePrefix(indent);
|
|
181
|
+
lines.push(`${prefix}(${title})${node.alias}(${formatParams(node)})${formatTags(node, { abbreviateRoles: true })}`);
|
|
182
|
+
// Show forward edges only if the role can use them
|
|
183
|
+
const edges = graph.forwardEdgeMap.get(path) || [];
|
|
184
|
+
for (const edge of edges) {
|
|
185
|
+
if (reachable.has(edge.toPath) && canRoleUseEdge(edge, role)) {
|
|
186
|
+
const edgePrefix = makeEdgePrefix(indent + 1);
|
|
187
|
+
if (hideCode) {
|
|
188
|
+
lines.push(`${edgePrefix}跳转到:${edge.toPath}()`);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
lines.push(`${edgePrefix}跳转到:${edge.toPath}(),相关代码:\`${edge.codeSnippet}\``);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Recurse children
|
|
196
|
+
for (const childPath of node.childrenPaths) {
|
|
197
|
+
renderRoleSubtree(graph, childPath, lines, indent + 1, role, reachable, hideCode);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// ============================================================================
|
|
201
|
+
// Role Reachability Analysis (BFS on navigation graph)
|
|
202
|
+
// ============================================================================
|
|
203
|
+
/**
|
|
204
|
+
* Compute the set of view paths reachable by a given role.
|
|
205
|
+
*/
|
|
206
|
+
function computeReachablePages(graph, role) {
|
|
207
|
+
const reachable = new Set();
|
|
208
|
+
const queue = [];
|
|
209
|
+
for (const rootPath of graph.rootPaths) {
|
|
210
|
+
const node = graph.flatRouteMap.get(rootPath);
|
|
211
|
+
if (node && isPageAccessibleToRole(node, role)) {
|
|
212
|
+
reachable.add(rootPath);
|
|
213
|
+
queue.push(rootPath);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
while (queue.length > 0) {
|
|
217
|
+
const currentPath = queue.shift();
|
|
218
|
+
const node = graph.flatRouteMap.get(currentPath);
|
|
219
|
+
for (const childPath of node.childrenPaths) {
|
|
220
|
+
if (reachable.has(childPath))
|
|
221
|
+
continue;
|
|
222
|
+
const child = graph.flatRouteMap.get(childPath);
|
|
223
|
+
if (!child)
|
|
224
|
+
continue;
|
|
225
|
+
if (child.isIndex && isPageAccessibleToRole(child, role)) {
|
|
226
|
+
reachable.add(childPath);
|
|
227
|
+
queue.push(childPath);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const edges = graph.forwardEdgeMap.get(currentPath) || [];
|
|
231
|
+
for (const edge of edges) {
|
|
232
|
+
if (reachable.has(edge.toPath))
|
|
233
|
+
continue;
|
|
234
|
+
if (!canRoleUseEdge(edge, role))
|
|
235
|
+
continue;
|
|
236
|
+
const target = graph.flatRouteMap.get(edge.toPath);
|
|
237
|
+
if (!target)
|
|
238
|
+
continue;
|
|
239
|
+
if (isPageAccessibleToRole(target, role)) {
|
|
240
|
+
reachable.add(edge.toPath);
|
|
241
|
+
queue.push(edge.toPath);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// Post-pass: mark ancestors as reachable (nested routing)
|
|
246
|
+
const toAdd = [];
|
|
247
|
+
for (const path of reachable) {
|
|
248
|
+
let node = graph.flatRouteMap.get(path);
|
|
249
|
+
while (node && node.parentPath) {
|
|
250
|
+
if (reachable.has(node.parentPath))
|
|
251
|
+
break;
|
|
252
|
+
const parent = graph.flatRouteMap.get(node.parentPath);
|
|
253
|
+
if (parent && isPageAccessibleToRole(parent, role)) {
|
|
254
|
+
toAdd.push(node.parentPath);
|
|
255
|
+
}
|
|
256
|
+
node = parent;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
for (const p of toAdd) {
|
|
260
|
+
reachable.add(p);
|
|
261
|
+
}
|
|
262
|
+
return reachable;
|
|
263
|
+
}
|
|
264
|
+
function isPageAccessibleToRole(node, role) {
|
|
265
|
+
if (!node.auth)
|
|
266
|
+
return true;
|
|
267
|
+
return (node.bindRoles || []).includes(role);
|
|
268
|
+
}
|
|
269
|
+
function canRoleUseEdge(edge, role) {
|
|
270
|
+
if (!edge.elementAuth && edge.elementBindRoles.length === 0)
|
|
271
|
+
return true;
|
|
272
|
+
if (edge.elementBindRoles.length > 0) {
|
|
273
|
+
return edge.elementBindRoles.includes(role);
|
|
274
|
+
}
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
// ============================================================================
|
|
278
|
+
// Formatting Utilities
|
|
279
|
+
// ============================================================================
|
|
280
|
+
function formatParams(node) {
|
|
281
|
+
return node.paramsStrList?.join(', ') || '';
|
|
282
|
+
}
|
|
283
|
+
function formatTags(node, opts) {
|
|
284
|
+
const tags = [];
|
|
285
|
+
if (node.isIndex)
|
|
286
|
+
tags.push('#默认跳转');
|
|
287
|
+
if (!node.auth) {
|
|
288
|
+
tags.push('#不鉴权');
|
|
289
|
+
}
|
|
290
|
+
else if (node.bindRoles && node.bindRoles.length > 0) {
|
|
291
|
+
if (opts.abbreviateRoles) {
|
|
292
|
+
tags.push('#鉴权角色:略');
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
tags.push(`#鉴权角色:${JSON.stringify(node.bindRoles)}`);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
tags.push('#鉴权(未配置角色)');
|
|
300
|
+
}
|
|
301
|
+
return tags.length ? ' ' + tags.join(' ') : '';
|
|
302
|
+
}
|
|
303
|
+
function makeTreePrefix(indent) {
|
|
304
|
+
if (indent === 0)
|
|
305
|
+
return '├── ';
|
|
306
|
+
return ' '.repeat(indent) + '├── ';
|
|
307
|
+
}
|
|
308
|
+
function makeEdgePrefix(indent) {
|
|
309
|
+
return ' '.repeat(indent) + '└─► ';
|
|
310
|
+
}
|
|
311
|
+
function makeReverseEdgePrefix(indent) {
|
|
312
|
+
return ' '.repeat(indent) + '◄── ';
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Find pages that are not isIndex AND not referenced (no incoming edges).
|
|
316
|
+
* If ignoreRootView is true, root-level views are excluded.
|
|
317
|
+
* If a child is referenced, its ancestors are considered implicitly referenced.
|
|
318
|
+
*/
|
|
319
|
+
function findUnreferencedPages(graph, ignoreRootView) {
|
|
320
|
+
const referenced = new Set();
|
|
321
|
+
for (const [path, node] of graph.flatRouteMap) {
|
|
322
|
+
if (node.isIndex) {
|
|
323
|
+
referenced.add(path);
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
const incoming = graph.reverseEdgeMap.get(path) || [];
|
|
327
|
+
if (incoming.length > 0) {
|
|
328
|
+
referenced.add(path);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
// Propagate: if a child is referenced, mark all ancestors as implicitly referenced
|
|
332
|
+
for (const path of [...referenced]) {
|
|
333
|
+
let node = graph.flatRouteMap.get(path);
|
|
334
|
+
while (node && node.parentPath) {
|
|
335
|
+
if (referenced.has(node.parentPath))
|
|
336
|
+
break;
|
|
337
|
+
referenced.add(node.parentPath);
|
|
338
|
+
node = graph.flatRouteMap.get(node.parentPath);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
const result = [];
|
|
342
|
+
for (const [path, node] of graph.flatRouteMap) {
|
|
343
|
+
if (referenced.has(path))
|
|
344
|
+
continue;
|
|
345
|
+
if (ignoreRootView && node.parentPath === null)
|
|
346
|
+
continue;
|
|
347
|
+
result.push(node);
|
|
348
|
+
}
|
|
349
|
+
return result;
|
|
350
|
+
}
|
|
351
|
+
//# sourceMappingURL=doctorView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctorView.js","sourceRoot":"","sources":["../../../../src/natural/exports/doctor/doctorView.ts"],"names":[],"mappings":";;;AAUA,2CAA6C;AAE7C;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,GAAQ,EAAE,OAA2B;IAC9D,MAAM,KAAK,GAAG,IAAA,0BAAc,EAAC,GAAG,CAAC,CAAC;IAClC,MAAM,YAAY,GAAG,CAAC,CAAC,OAAO,EAAE,uBAAuB,CAAC;IACxD,MAAM,UAAU,GAAG,qBAAqB,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAClF,MAAM,QAAQ,GAAG,CAAC,CAAC,O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,CAAC;QACtD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,mFAAmF;IACnF,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC;QACnC,IAAI,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxC,OAAO,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAC/B,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;gBAAE,MAAM;YAC3C,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAChC,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;QAC9C,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,SAAS;QACnC,IAAI,cAAc,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI;YAAE,SAAS;QACzD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { doctorView, doctorViewJson } from './doctorView';
|
|
2
|
+
export { buildViewGraph, buildViewRoutes } from './viewGraph';
|
|
3
|
+
export type { DoctorViewOptions, DoctorViewResult, DoctorViewResultJSON, RouteItem, RouteItemTemp, ViewGraph, NavigationEdge } from './types';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/natural/exports/doctor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildViewRoutes = exports.buildViewGraph = exports.doctorViewJson = exports.doctorView = void 0;
|
|
4
|
+
var doctorView_1 = require("./doctorView");
|
|
5
|
+
Object.defineProperty(exports, "doctorView", { enumerable: true, get: function () { return doctorView_1.doctorView; } });
|
|
6
|
+
Object.defineProperty(exports, "doctorViewJson", { enumerable: true, get: function () { return doctorView_1.doctorViewJson; } });
|
|
7
|
+
var viewGraph_1 = require("./viewGraph");
|
|
8
|
+
Object.defineProperty(exports, "buildViewGraph", { enumerable: true, get: function () { return viewGraph_1.buildViewGraph; } });
|
|
9
|
+
Object.defineProperty(exports, "buildViewRoutes", { enumerable: true, get: function () { return viewGraph_1.buildViewRoutes; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/natural/exports/doctor/index.ts"],"names":[],"mappings":";;;AAAA,2CAA0D;AAAjD,wGAAA,UAAU,OAAA;AAAE,4GAAA,cAAc,OAAA;AACnC,yCAA8D;AAArD,2GAAA,cAAc,OAAA;AAAE,4GAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DoctorView - View topology analysis types
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Base route item - can be used standalone for simpler route listing scenarios.
|
|
6
|
+
*/
|
|
7
|
+
export interface RouteItem {
|
|
8
|
+
/** View titles from root parent to current view (Chinese display name) */
|
|
9
|
+
levels: string[];
|
|
10
|
+
/** View type */
|
|
11
|
+
type: 'layout' | 'crud' | 'overview_with_chart' | 'list' | 'form' | 'detail' | 'router_container' | 'other' | 'login' | '';
|
|
12
|
+
/** View name (used as route segment, alias) */
|
|
13
|
+
alias: string;
|
|
14
|
+
/** Full path from root, e.g. "/dashboard/customerManagement/customerList" */
|
|
15
|
+
path: string;
|
|
16
|
+
/** View description */
|
|
17
|
+
description: string;
|
|
18
|
+
/** Whether this is the default/index page */
|
|
19
|
+
isIndex?: boolean;
|
|
20
|
+
/** Whether auth is required (false means no auth) */
|
|
21
|
+
auth?: boolean;
|
|
22
|
+
/** Raw params NASL AST */
|
|
23
|
+
paramsAst?: any[];
|
|
24
|
+
/** Serialized params string, e.g. ["id: Integer", "name?: String"] */
|
|
25
|
+
paramsStrList?: string[];
|
|
26
|
+
/** Roles that can access this page (only meaningful when auth=true) */
|
|
27
|
+
bindRoles?: string[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Extended route item with tree navigation info.
|
|
31
|
+
* Used internally during graph building.
|
|
32
|
+
*/
|
|
33
|
+
export interface RouteItemTemp extends RouteItem {
|
|
34
|
+
/** Parent view's path (null for root views) */
|
|
35
|
+
parentPath: string | null;
|
|
36
|
+
/** Children paths (ordered) */
|
|
37
|
+
childrenPaths: string[];
|
|
38
|
+
/** Depth in the tree (0 = root) */
|
|
39
|
+
depth: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Represents a navigation edge (a link/destination from one view to another)
|
|
43
|
+
*/
|
|
44
|
+
export interface NavigationEdge {
|
|
45
|
+
/** Path of the source view containing this navigation */
|
|
46
|
+
fromPath: string;
|
|
47
|
+
/** Path of the target view */
|
|
48
|
+
toPath: string;
|
|
49
|
+
/** Code snippet showing the navigation element (single line, trimmed) */
|
|
50
|
+
codeSnippet: string;
|
|
51
|
+
/** Roles restriction on the element containing this destination (empty = no restriction) */
|
|
52
|
+
elementBindRoles: string[];
|
|
53
|
+
/** Whether the element has $auth=true */
|
|
54
|
+
elementAuth: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The complete topology graph for view navigation analysis.
|
|
58
|
+
* This is the reusable intermediate structure.
|
|
59
|
+
*/
|
|
60
|
+
export interface ViewGraph {
|
|
61
|
+
/** All view nodes indexed by path */
|
|
62
|
+
flatRouteMap: Map<string, RouteItemTemp>;
|
|
63
|
+
/** Ordered list of root view paths */
|
|
64
|
+
rootPaths: string[];
|
|
65
|
+
/** Forward edges: from path -> list of edges going OUT of that view */
|
|
66
|
+
forwardEdgeMap: Map<string, NavigationEdge[]>;
|
|
67
|
+
/** Reverse edges: to path -> list of edges coming IN to that view */
|
|
68
|
+
reverseEdgeMap: Map<string, NavigationEdge[]>;
|
|
69
|
+
/** All roles found across all views */
|
|
70
|
+
allRoleSet: Set<string>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Result of doctorView JSON analysis.
|
|
74
|
+
* Extends ViewGraph with computed unreferenced views.
|
|
75
|
+
*/
|
|
76
|
+
export interface DoctorViewResult extends ViewGraph {
|
|
77
|
+
/** Paths of unreferenced views */
|
|
78
|
+
unrefViews: string[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* JSON-serializable version of DoctorViewResult.
|
|
82
|
+
* Maps/Sets are converted to plain objects/arrays, field names kept consistent.
|
|
83
|
+
*/
|
|
84
|
+
export interface DoctorViewResultJSON {
|
|
85
|
+
flatRouteMap: Record<string, RouteItemTemp>;
|
|
86
|
+
rootPaths: string[];
|
|
87
|
+
forwardEdgeMap: Record<string, NavigationEdge[]>;
|
|
88
|
+
reverseEdgeMap: Record<string, NavigationEdge[]>;
|
|
89
|
+
allRoleSet: string[];
|
|
90
|
+
unrefViews: string[];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Options for doctorView report generation
|
|
94
|
+
*/
|
|
95
|
+
export interface DoctorViewOptions {
|
|
96
|
+
/** Output view tree section. Default: true (when no specific options given) */
|
|
97
|
+
viewTree?: boolean;
|
|
98
|
+
/** Output reverse references section. Default: true (when no specific options given) */
|
|
99
|
+
reverseRefs?: boolean;
|
|
100
|
+
/** Output unreferenced views section. Default: true (when no specific options given) */
|
|
101
|
+
unrefViews?: boolean;
|
|
102
|
+
/** Roles to analyze accessibility for. Empty/undefined = skip role access section */
|
|
103
|
+
roleAccess?: string[];
|
|
104
|
+
/** Include root views in unreferenced analysis. Default: false */
|
|
105
|
+
unrefViewsIncludesRoots?: boolean;
|
|
106
|
+
/** Hide code snippets in report. Default: false */
|
|
107
|
+
hideCode?: boolean;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=types.d.ts.map
|