@lcap/nasl 3.3.0-alpha.1 → 3.3.0-alpha.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.20.js.map +1 -1
- package/out/bak/translator.js +52 -1
- package/out/bak/translator.js.map +1 -1
- package/out/breakpoint/shared/utils.js +0 -2
- package/out/breakpoint/shared/utils.js.map +1 -1
- package/out/common/Command.d.ts +1 -0
- package/out/common/Command.js +9 -1
- package/out/common/Command.js.map +1 -1
- package/out/concepts/Abort__.js +2 -1
- package/out/concepts/Abort__.js.map +1 -1
- package/out/concepts/Anchor__.js +1 -1
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.js +2 -2
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/Argument__.js +1 -1
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.js +1 -1
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.js +2 -2
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/BackendVariable__.js +1 -1
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/Backend__.js +1 -1
- package/out/concepts/Backend__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js +2 -2
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +2 -2
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +2 -0
- package/out/concepts/BindAttribute__.js +79 -4
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +1 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +2 -1
- package/out/concepts/BindEvent__.js +44 -37
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.js +1 -1
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.js +1 -1
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallAuthInterface__.js +1 -1
- package/out/concepts/CallAuthInterface__.js.map +1 -1
- package/out/concepts/CallConnector__.js +1 -1
- package/out/concepts/CallConnector__.js.map +1 -1
- package/out/concepts/CallFunction__.js +2 -2
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +2 -2
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +69 -12
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +1 -1
- package/out/concepts/CallQueryComponent__.js +1 -1
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +1 -1
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Connection__.js +9 -10
- package/out/concepts/Connection__.js.map +1 -1
- package/out/concepts/Constant__.js +1 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataSource__.js +1 -1
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.js +2 -2
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +1 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.js +1 -1
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.js +2 -2
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.js +2 -2
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.js +2 -2
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.js +2 -2
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +27 -37
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Frontend__.js +1 -1
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.js +2 -2
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +1 -1
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Interface__.js +1 -1
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js +1 -1
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/JavaLogic__.js +1 -1
- package/out/concepts/JavaLogic__.js.map +1 -1
- package/out/concepts/LogicItem__.js +3 -2
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js +2 -1
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js +1 -1
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.js +2 -2
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +1 -0
- package/out/concepts/MemberExpression__.js +117 -2
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +1 -1
- package/out/concepts/Module__.js +34 -35
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/NewComposite__.js +2 -2
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.js +2 -2
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.js +2 -2
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.js +1 -1
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.js +1 -1
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js +1 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js +2 -2
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.js +1 -1
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +1 -1
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.js +1 -1
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.js +1 -1
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js +1 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.js +1 -1
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +1 -1
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js +1 -1
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js +1 -1
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/Return__.js +2 -2
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js +1 -1
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.js +1 -1
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js +2 -2
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.js +1 -1
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js +2 -2
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.js +1 -1
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +2 -2
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +2 -2
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +1 -1
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +2 -2
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TriggerLauncher__.js +1 -1
- package/out/concepts/TriggerLauncher__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +4 -3
- package/out/concepts/TypeAnnotation__.js +116 -75
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.js +1 -1
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +2 -2
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +14 -14
- package/out/concepts/ValidationRule__.js +28 -24
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +2 -2
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +88 -87
- package/out/concepts/ViewElement__.js +268 -204
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +6 -0
- package/out/concepts/View__.js +254 -11
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +2 -2
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.browser.js +1 -0
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.event.js +2 -0
- package/out/concepts/basics/stdlib/nasl.event.js.map +1 -1
- package/out/generator/genBundleFiles.js +90 -1
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genReleaseBody.js +1 -1
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/permission.js +3 -3
- package/out/generator/permission.js.map +1 -1
- package/out/index.d.ts +1 -0
- package/out/index.js +1 -0
- package/out/index.js.map +1 -1
- package/out/natural/genNaturalTS.js +7 -3
- package/out/natural/genNaturalTS.js.map +1 -1
- package/out/natural/knowledgeMap.js +12 -12
- package/out/natural/knowledgeMap.js.map +1 -1
- package/out/natural/transformTSCode.d.ts +1 -1
- package/out/natural/transformTSCode.js +115 -141
- package/out/natural/transformTSCode.js.map +1 -1
- package/out/server/extendBaseNode.js +69 -44
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.js +72 -63
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.js +20 -23
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +1 -0
- package/out/server/getMemberIdentifier.js +149 -1
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/naslServer.d.ts +3 -3
- package/out/server/naslServer.js +182 -132
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +43 -33
- package/out/server/translator.js.map +1 -1
- package/out/service/defaultErrorMessage.json +6 -6
- package/out/service/storage/init.js +16 -0
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +5 -3
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +12 -8
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +8 -7
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.d.ts +1 -1
- package/out/templator/genEditTableBlock.js +12 -6
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genEnumSelectBlock.js +2 -2
- package/out/templator/genEnumSelectBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.d.ts +2 -2
- package/out/templator/genGridViewBlock.js +20 -7
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.d.ts +2 -2
- package/out/templator/genListViewBlock.js +13 -5
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.d.ts +2 -2
- package/out/templator/genSelectBlock.js +8 -6
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.d.ts +1 -1
- package/out/templator/genTableBlock.js +10 -5
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +5 -3
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/package.json +3 -1
- package/sandbox/stdlib/nasl.auth.ts +40 -44
- package/sandbox/stdlib/nasl.core.ts +8 -1
- package/sandbox/stdlib/nasl.http.ts +22 -22
- package/sandbox-natural/stdlib/nasl.util.ts +74 -15
- package/src/automate/upgrader/2.20.js +17 -13
- package/src/bak/translator.js +50 -1
- package/src/breakpoint/shared/utils.ts +0 -2
- package/src/common/Command.ts +8 -0
- package/src/concepts/Abort__.ts +2 -2
- package/src/concepts/Anchor__.ts +2 -2
- package/src/concepts/AnonymousFunction__.ts +3 -3
- package/src/concepts/Argument__.ts +2 -2
- package/src/concepts/Assignee__.ts +1 -1
- package/src/concepts/AssignmentLine__.ts +2 -2
- package/src/concepts/Assignment__.ts +3 -3
- package/src/concepts/BackendVariable__.ts +2 -2
- package/src/concepts/Backend__.ts +1 -1
- package/src/concepts/BatchAssignment__.ts +3 -3
- package/src/concepts/BinaryExpression__.ts +3 -3
- package/src/concepts/BindAttribute__.ts +69 -4
- package/src/concepts/BindDirective__.ts +2 -2
- package/src/concepts/BindEvent__.ts +44 -64
- package/src/concepts/BindStyle__.ts +2 -2
- package/src/concepts/BooleanLiteral__.ts +2 -2
- package/src/concepts/CallAuthInterface__.ts +2 -2
- package/src/concepts/CallConnector__.ts +2 -2
- package/src/concepts/CallFunction__.ts +3 -3
- package/src/concepts/CallInterface__.ts +3 -3
- package/src/concepts/CallLogic__.ts +69 -13
- package/src/concepts/CallQueryComponent__.ts +2 -2
- package/src/concepts/Comment__.ts +2 -2
- package/src/concepts/ConfigProperty__.ts +2 -2
- package/src/concepts/Connection__.ts +15 -21
- package/src/concepts/Constant__.ts +2 -2
- package/src/concepts/DataSource__.ts +1 -1
- package/src/concepts/Destination__.ts +3 -3
- package/src/concepts/End__.ts +2 -2
- package/src/concepts/EntityIndex__.ts +2 -2
- package/src/concepts/EntityProperty__.ts +3 -3
- package/src/concepts/Entity__.ts +2 -2
- package/src/concepts/EnumItem__.ts +3 -3
- package/src/concepts/Enum__.ts +2 -2
- package/src/concepts/ForEachStatement__.ts +35 -46
- package/src/concepts/Frontend__.ts +1 -1
- package/src/concepts/Function__.ts +3 -3
- package/src/concepts/Identifier__.ts +2 -2
- package/src/concepts/IfStatement__.ts +3 -3
- package/src/concepts/Interface__.ts +1 -1
- package/src/concepts/JSBlock__.ts +2 -2
- package/src/concepts/JavaLogic__.ts +2 -2
- package/src/concepts/LogicItem__.ts +3 -3
- package/src/concepts/Logic__.ts +2 -1
- package/src/concepts/MatchCase__.ts +2 -2
- package/src/concepts/Match__.ts +3 -3
- package/src/concepts/MemberExpression__.ts +112 -4
- package/src/concepts/Module__.ts +41 -58
- package/src/concepts/NewComposite__.ts +3 -3
- package/src/concepts/NewList__.ts +3 -3
- package/src/concepts/NewMap__.ts +3 -3
- package/src/concepts/New__.ts +2 -2
- package/src/concepts/NullLiteral__.ts +2 -2
- package/src/concepts/NumericLiteral__.ts +2 -2
- package/src/concepts/OqlQueryComponent__.ts +3 -3
- package/src/concepts/Param__.ts +2 -2
- package/src/concepts/ProcessElement__.ts +2 -2
- package/src/concepts/ProcessOutcome__.ts +2 -2
- package/src/concepts/ProcessOutcomes__.ts +2 -2
- package/src/concepts/Process__.ts +1 -1
- package/src/concepts/QueryAggregateExpression__.ts +2 -2
- package/src/concepts/QueryFieldExpression__.ts +2 -2
- package/src/concepts/QueryFromExpression__.ts +2 -2
- package/src/concepts/QueryJoinExpression__.ts +2 -2
- package/src/concepts/QueryLimitExpression__.ts +2 -2
- package/src/concepts/QueryOrderByExpression__.ts +2 -2
- package/src/concepts/Return__.ts +3 -3
- package/src/concepts/Role__.ts +1 -1
- package/src/concepts/SelectMembers__.ts +2 -2
- package/src/concepts/SqlQueryComponent__.ts +3 -3
- package/src/concepts/Start__.ts +2 -2
- package/src/concepts/StringInterpolation__.ts +3 -3
- package/src/concepts/StringLiteral__.ts +2 -2
- package/src/concepts/StructureProperty__.ts +3 -3
- package/src/concepts/Structure__.ts +2 -2
- package/src/concepts/SwitchCase__.ts +2 -2
- package/src/concepts/SwitchStatement__.ts +3 -3
- package/src/concepts/TriggerLauncher__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +145 -125
- package/src/concepts/TypeParam__.ts +2 -2
- package/src/concepts/UnaryExpression__.ts +3 -3
- package/src/concepts/ValidationRule__.ts +554 -524
- package/src/concepts/Variable__.ts +3 -3
- package/src/concepts/ViewElement__.ts +2445 -2498
- package/src/concepts/View__.ts +258 -10
- package/src/concepts/WhileStatement__.ts +3 -3
- package/src/concepts/basics/stdlib/nasl.browser.ts +1 -0
- package/src/concepts/basics/stdlib/nasl.event.ts +2 -0
- package/src/generator/genBundleFiles.ts +91 -1
- package/src/generator/genReleaseBody.ts +1 -1
- package/src/generator/permission.ts +3 -3
- package/src/index.ts +1 -0
- package/src/natural/genNaturalTS.ts +8 -4
- package/src/natural/knowledgeMap.ts +12 -12
- package/src/natural/transformTSCode.ts +139 -151
- package/src/server/extendBaseNode.ts +71 -45
- package/src/server/formatTsUtils.ts +64 -64
- package/src/server/getLogics.ts +23 -30
- package/src/server/getMemberIdentifier.ts +143 -0
- package/src/server/naslServer.ts +174 -148
- package/src/server/translator.ts +40 -39
- package/src/service/defaultErrorMessage.json +6 -6
- package/src/service/storage/init.ts +17 -0
- package/src/templator/genCreateBlock.ts +5 -3
- package/src/templator/genCurdEditMultipleKeyBlock.ts +12 -8
- package/src/templator/genCurdMultipleKeyBlock.ts +8 -7
- package/src/templator/genEditTableBlock.ts +12 -7
- package/src/templator/genEnumSelectBlock.ts +2 -2
- package/src/templator/genGetBlock.ts +6 -6
- package/src/templator/genGridViewBlock.ts +22 -9
- package/src/templator/genListViewBlock.ts +14 -5
- package/src/templator/genSelectBlock.ts +8 -6
- package/src/templator/genTableBlock.ts +10 -9
- package/src/templator/genUpdateBlock.ts +5 -3
- package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +11 -0
- package/test/concepts/validation-rule/__snapshots__/toJS.spec.ts.snap +10 -0
- package/test/concepts/validation-rule/fixtures/argument-without-keyword.json +34 -0
- package/test/concepts/validation-rule/fixtures/empty-rule.json +9 -0
- package/test/concepts/validation-rule/validation-rule.spec.ts +15 -0
package/out/server/naslServer.js
CHANGED
|
@@ -37,11 +37,11 @@ exports.NaslServer = exports.getDisplayString2Type = void 0;
|
|
|
37
37
|
const fs = __importStar(require("fs-extra"));
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
39
|
const worker_threads_1 = require("worker_threads");
|
|
40
|
-
|
|
40
|
+
/// #endif
|
|
41
41
|
const config_1 = require("../config");
|
|
42
42
|
const sentry_1 = require("../sentry");
|
|
43
43
|
const Messager_1 = __importDefault(require("../common/Messager"));
|
|
44
|
-
const getMemberIdentifier_1 = require("
|
|
44
|
+
const getMemberIdentifier_1 = require("../server/getMemberIdentifier");
|
|
45
45
|
const concepts_1 = require("../concepts");
|
|
46
46
|
const translator_1 = require("../translator");
|
|
47
47
|
const storage_1 = __importDefault(require("../service/storage"));
|
|
@@ -57,6 +57,7 @@ const jsoner = __importStar(require("../service/storage/jsoner"));
|
|
|
57
57
|
const EventEmitter_1 = require("../common/EventEmitter");
|
|
58
58
|
const utils_1 = require("../utils");
|
|
59
59
|
const decorators_1 = require("../decorators");
|
|
60
|
+
const decimal_js_1 = require("decimal.js");
|
|
60
61
|
const utils_2 = require("../automate/engine/utils");
|
|
61
62
|
const EmbeddedTSFileLineMap = {
|
|
62
63
|
Entity: 3,
|
|
@@ -69,9 +70,9 @@ const EmbeddedTSFileOffsetMap = {
|
|
|
69
70
|
ConfigProperty: 12,
|
|
70
71
|
};
|
|
71
72
|
const SentryMessager = (0, sentry_1.sentryMonitorTSWorkerMessager)(Messager_1.default);
|
|
72
|
-
let isChangeInterface = false;
|
|
73
|
-
let actionArr = [];
|
|
74
|
-
let timer = null;
|
|
73
|
+
let isChangeInterface = false; //判断是否导入接口
|
|
74
|
+
let actionArr = []; //用于导入接口收集更改的节点
|
|
75
|
+
let timer = null; //超时器用于收集导入接口相关
|
|
75
76
|
const __naslStdlibFileCacheMap = new Map(); // naslStdlib文件缓存
|
|
76
77
|
// 联合类型切割取出类型
|
|
77
78
|
function getDisplayString2Type(displayString) {
|
|
@@ -90,17 +91,19 @@ function getDisplayString2Type(displayString) {
|
|
|
90
91
|
if (/<([^()]+)>/g.exec(item)) {
|
|
91
92
|
return item;
|
|
92
93
|
}
|
|
93
|
-
if (item.includes(' ')) {
|
|
94
|
+
else if (item.includes(' ')) {
|
|
94
95
|
const strs = item.split(' ');
|
|
95
96
|
const type = strs[strs.length - 1];
|
|
96
97
|
return type;
|
|
97
98
|
}
|
|
98
|
-
if (item.includes('.')) {
|
|
99
|
+
else if (item.includes('.')) {
|
|
99
100
|
const strs = item.split('.');
|
|
100
101
|
const type = strs[strs.length - 1];
|
|
101
102
|
return type;
|
|
102
103
|
}
|
|
103
|
-
|
|
104
|
+
else {
|
|
105
|
+
return item;
|
|
106
|
+
}
|
|
104
107
|
});
|
|
105
108
|
if (targetType) {
|
|
106
109
|
return typeList.filter((item) => item !== targetType);
|
|
@@ -187,7 +190,7 @@ let NaslServer = class NaslServer {
|
|
|
187
190
|
// 这个方法是 5.0 加入标准库的,但是这里 ts 版本是 4.x,ci 会挂,所以需要忽略
|
|
188
191
|
// @ts-ignore
|
|
189
192
|
const findLastIndex = this.changeStackList.findLastIndex((changeStackItem) => {
|
|
190
|
-
const
|
|
193
|
+
const target = changeStackItem.target;
|
|
191
194
|
const { fileNode: targetFileNode } = this.getCurrentSource(target);
|
|
192
195
|
return targetFileNode === fileNode;
|
|
193
196
|
});
|
|
@@ -198,8 +201,10 @@ let NaslServer = class NaslServer {
|
|
|
198
201
|
// 如果当前列表里有,这个文件节点,最后一个是field的话,直接return掉,不用塞这个update了
|
|
199
202
|
return;
|
|
200
203
|
}
|
|
201
|
-
|
|
202
|
-
|
|
204
|
+
else {
|
|
205
|
+
// 如果最后一项是普通的update的话,就可以去掉,后面那个会在塞过来
|
|
206
|
+
this.changeStackList.pop();
|
|
207
|
+
}
|
|
203
208
|
}
|
|
204
209
|
this.changeStackList.push(item.originEvent);
|
|
205
210
|
}
|
|
@@ -229,7 +234,7 @@ let NaslServer = class NaslServer {
|
|
|
229
234
|
}, { cache: true });
|
|
230
235
|
Object.keys(naslStdlibMap_1.default).forEach(async (libFileName) => {
|
|
231
236
|
await this.addFile({
|
|
232
|
-
file:
|
|
237
|
+
file: '/' + libFileName,
|
|
233
238
|
fileContent: naslStdlibMap_1.default[libFileName],
|
|
234
239
|
}, { cache: true });
|
|
235
240
|
});
|
|
@@ -449,7 +454,7 @@ let NaslServer = class NaslServer {
|
|
|
449
454
|
});
|
|
450
455
|
}
|
|
451
456
|
if (module instanceof concepts_1.App) {
|
|
452
|
-
module.connections
|
|
457
|
+
module.connections?.forEach?.((connection) => {
|
|
453
458
|
try {
|
|
454
459
|
const result = connection.toEmbeddedTSFile();
|
|
455
460
|
results.push(result);
|
|
@@ -459,7 +464,7 @@ let NaslServer = class NaslServer {
|
|
|
459
464
|
}
|
|
460
465
|
catch (err) { }
|
|
461
466
|
});
|
|
462
|
-
module.triggerLaunchers
|
|
467
|
+
module.triggerLaunchers?.forEach?.((triggerLauncher) => {
|
|
463
468
|
try {
|
|
464
469
|
const result = triggerLauncher.toEmbeddedTSFile();
|
|
465
470
|
results.push(result);
|
|
@@ -556,7 +561,7 @@ let NaslServer = class NaslServer {
|
|
|
556
561
|
cacheFile(options) {
|
|
557
562
|
__naslStdlibFileCacheMap.set(options.file, options);
|
|
558
563
|
}
|
|
559
|
-
/**
|
|
564
|
+
/**u
|
|
560
565
|
* 只新增文件
|
|
561
566
|
* @param {*} files
|
|
562
567
|
*/
|
|
@@ -585,15 +590,15 @@ let NaslServer = class NaslServer {
|
|
|
585
590
|
}
|
|
586
591
|
/// #if process.env.NODE_ENV === 'development'
|
|
587
592
|
// 首次尝试请求
|
|
588
|
-
await storage_1.default.post(
|
|
593
|
+
await storage_1.default.post('/api/App/debugEmbedded?id=' + app.id, openFiles[0]).catch(() => (openDebugEmbedded = false));
|
|
589
594
|
if (openDebugEmbedded && globalThis.window) {
|
|
590
595
|
// For TS build
|
|
591
596
|
try {
|
|
592
597
|
let canDebug = true;
|
|
593
|
-
await storage_1.default.post(
|
|
598
|
+
await storage_1.default.post('/api/App/debugEmbedded?id=' + app.id, openFiles[0]).catch(() => (canDebug = false));
|
|
594
599
|
if (canDebug) {
|
|
595
600
|
await Promise.all(openFiles.map(async (file) => {
|
|
596
|
-
const res = await storage_1.default.post(
|
|
601
|
+
const res = await storage_1.default.post('/api/App/debugEmbedded?id=' + app.id, file);
|
|
597
602
|
return res.data;
|
|
598
603
|
}));
|
|
599
604
|
}
|
|
@@ -642,7 +647,9 @@ let NaslServer = class NaslServer {
|
|
|
642
647
|
noFilterList,
|
|
643
648
|
});
|
|
644
649
|
}
|
|
645
|
-
|
|
650
|
+
else {
|
|
651
|
+
console.log('没找到节点', node, currentSource, fileNode);
|
|
652
|
+
}
|
|
646
653
|
}
|
|
647
654
|
_getValueSelectCompletion(args) {
|
|
648
655
|
return this.messager.requestCommand('getValueSelectCompletion', args);
|
|
@@ -686,7 +693,9 @@ let NaslServer = class NaslServer {
|
|
|
686
693
|
if (!res.length) {
|
|
687
694
|
return [];
|
|
688
695
|
}
|
|
689
|
-
|
|
696
|
+
else {
|
|
697
|
+
return [{ title: '基础类型', children: res }];
|
|
698
|
+
}
|
|
690
699
|
}
|
|
691
700
|
}
|
|
692
701
|
catch (err) {
|
|
@@ -732,7 +741,7 @@ let NaslServer = class NaslServer {
|
|
|
732
741
|
.replace(/__name:"AStructure_\w{8}";/g, '')
|
|
733
742
|
.replace(/dataSources.([^.]+).entities.([^;]+)/g, ($1, $2, $3) => `${$3}(${$2})`);
|
|
734
743
|
}
|
|
735
|
-
if (typeStr.startsWith('{') && typeStr.endsWith('}')) {
|
|
744
|
+
else if (typeStr.startsWith('{') && typeStr.endsWith('}')) {
|
|
736
745
|
/**
|
|
737
746
|
* {
|
|
738
747
|
text: nasl.core.String;
|
|
@@ -785,7 +794,7 @@ let NaslServer = class NaslServer {
|
|
|
785
794
|
return;
|
|
786
795
|
const types = /<([^()]+)>/g.exec(displayString);
|
|
787
796
|
const typeStr = types && types[1];
|
|
788
|
-
const
|
|
797
|
+
const app = node.app;
|
|
789
798
|
if (typeStr.includes('__name: "AStructure_')) {
|
|
790
799
|
const properties = [];
|
|
791
800
|
typeStr.replace(/([^:\s]+):\s+([^;]+);/g, ($1, name, typeKey) => {
|
|
@@ -807,7 +816,7 @@ let NaslServer = class NaslServer {
|
|
|
807
816
|
});
|
|
808
817
|
return concepts_1.TypeAnnotation.createTypeAnonymousStructure(properties);
|
|
809
818
|
}
|
|
810
|
-
if (typeStr.startsWith('structures'))
|
|
819
|
+
else if (typeStr.startsWith('structures'))
|
|
811
820
|
return app.findNodeByCompleteName(`app.${typeStr}`);
|
|
812
821
|
}
|
|
813
822
|
}
|
|
@@ -865,7 +874,9 @@ let NaslServer = class NaslServer {
|
|
|
865
874
|
noFilterList,
|
|
866
875
|
});
|
|
867
876
|
}
|
|
868
|
-
|
|
877
|
+
else {
|
|
878
|
+
console.log('没找到节点', currentSource, fileNode);
|
|
879
|
+
}
|
|
869
880
|
}
|
|
870
881
|
_getSelectNextCompletion(args) {
|
|
871
882
|
return this.messager.requestCommand('getSelectNextCompletion', args);
|
|
@@ -893,7 +904,7 @@ let NaslServer = class NaslServer {
|
|
|
893
904
|
await this.IncrementalAnnotationJSON(records);
|
|
894
905
|
}
|
|
895
906
|
await Promise.all(records.map(async (record) => {
|
|
896
|
-
const
|
|
907
|
+
const node = record.node;
|
|
897
908
|
if (!node)
|
|
898
909
|
return;
|
|
899
910
|
// 先获取原来的节点先清除一下之前有异常的节点,下面重新赋值
|
|
@@ -947,7 +958,7 @@ let NaslServer = class NaslServer {
|
|
|
947
958
|
record.suggestionDiagnostics.push(diagnostic);
|
|
948
959
|
return null;
|
|
949
960
|
}
|
|
950
|
-
if (currentNode.concept === 'OqlQueryComponent') {
|
|
961
|
+
else if (currentNode.concept === 'OqlQueryComponent') {
|
|
951
962
|
// OQL别名错误降级为警告
|
|
952
963
|
if (diagnostic.originalDiagnostic && diagnostic.originalDiagnostic?.text.includes('__OQL_ALIAS_WARNING__')) {
|
|
953
964
|
// 重置 图标和错误等级
|
|
@@ -991,7 +1002,7 @@ let NaslServer = class NaslServer {
|
|
|
991
1002
|
return diag;
|
|
992
1003
|
// 一些已知警告的单独处理
|
|
993
1004
|
}
|
|
994
|
-
if ([
|
|
1005
|
+
else if ([
|
|
995
1006
|
`'__LogicEmpty' is declared but its value is never read.`,
|
|
996
1007
|
`'__destinationEmpty__' is declared but its value is never read.`,
|
|
997
1008
|
`'__devConfigValueEmpty' is declared but its value is never read.`,
|
|
@@ -1000,7 +1011,7 @@ let NaslServer = class NaslServer {
|
|
|
1000
1011
|
].includes(diag.text)) {
|
|
1001
1012
|
return this._resolveDiagnostic(diag, record.node, record);
|
|
1002
1013
|
}
|
|
1003
|
-
if (diag.text.includes(` is declared but its value is never read.`)) {
|
|
1014
|
+
else if (diag.text.includes(` is declared but its value is never read.`)) {
|
|
1004
1015
|
// 局部变量和输入变量未使用的警告
|
|
1005
1016
|
const fromModule = record.node.parentNode.concept === 'Module';
|
|
1006
1017
|
const fromConnector = record.node.parentNode.concept === 'Connector';
|
|
@@ -1028,7 +1039,7 @@ let NaslServer = class NaslServer {
|
|
|
1028
1039
|
};
|
|
1029
1040
|
return diagnostic;
|
|
1030
1041
|
}
|
|
1031
|
-
if (minRange.node instanceof concepts_1.Variable) {
|
|
1042
|
+
else if (minRange.node instanceof concepts_1.Variable) {
|
|
1032
1043
|
const diagnostic = {
|
|
1033
1044
|
node: minRange.node,
|
|
1034
1045
|
severity: 'warning',
|
|
@@ -1209,7 +1220,7 @@ let NaslServer = class NaslServer {
|
|
|
1209
1220
|
const typeAnnotation = item.__TypeAnnotation;
|
|
1210
1221
|
// 仅处理有类型的情况,返回类型为void的情况由其他地方处理成报错
|
|
1211
1222
|
if (typeAnnotation) {
|
|
1212
|
-
const
|
|
1223
|
+
const sortedTypeKey = typeAnnotation.sortedTypeKey;
|
|
1213
1224
|
if (!typeAnnotationMap[sortedTypeKey]) {
|
|
1214
1225
|
typeAnnotationMap[sortedTypeKey] = {
|
|
1215
1226
|
typeAnnotation,
|
|
@@ -1263,7 +1274,7 @@ let NaslServer = class NaslServer {
|
|
|
1263
1274
|
const typeAnnotation = value.__TypeAnnotation;
|
|
1264
1275
|
// 仅处理有类型的情况,返回类型为void的情况由其他地方处理成报错
|
|
1265
1276
|
if (typeAnnotation) {
|
|
1266
|
-
const
|
|
1277
|
+
const sortedTypeKey = typeAnnotation.sortedTypeKey;
|
|
1267
1278
|
if (!typeAnnotationMap[sortedTypeKey]) {
|
|
1268
1279
|
typeAnnotationMap[sortedTypeKey] = {
|
|
1269
1280
|
typeAnnotation,
|
|
@@ -1535,17 +1546,17 @@ let NaslServer = class NaslServer {
|
|
|
1535
1546
|
catch (err) {
|
|
1536
1547
|
console.log(err);
|
|
1537
1548
|
}
|
|
1538
|
-
if (!jsCode.
|
|
1549
|
+
if (!jsCode.startsWith(`${node.name} = `))
|
|
1539
1550
|
return;
|
|
1540
1551
|
// 页面局部变量
|
|
1541
1552
|
if (node instanceof concepts_1.Variable && node.parentNode instanceof concepts_1.View) {
|
|
1542
1553
|
// 跟页面局部变量无关的赋值过滤
|
|
1543
|
-
if (!jsCode.
|
|
1554
|
+
if (!jsCode.startsWith(`this.${node.name} = `))
|
|
1544
1555
|
return;
|
|
1545
1556
|
// 直接赋值 logic 内局部变量、输入参数直接提示系统无法推断类型
|
|
1546
|
-
if (nodeIn.logic?.params.find((param) => jsCode.
|
|
1547
|
-
nodeIn.logic?.virtualParams.find((vParam) => jsCode.
|
|
1548
|
-
nodeIn.logic?.variables.find((variable) => jsCode.
|
|
1557
|
+
if (nodeIn.logic?.params.find((param) => jsCode.startsWith(param.name)) ||
|
|
1558
|
+
nodeIn.logic?.virtualParams.find((vParam) => jsCode.startsWith(vParam.name)) ||
|
|
1559
|
+
nodeIn.logic?.variables.find((variable) => jsCode.startsWith(variable.name))) {
|
|
1549
1560
|
if (!nodeIn.tsErrorDetail) {
|
|
1550
1561
|
const diagnostic = {
|
|
1551
1562
|
node: nodeIn,
|
|
@@ -1585,17 +1596,17 @@ let NaslServer = class NaslServer {
|
|
|
1585
1596
|
if (Array.isArray(node.bindExpressions)) {
|
|
1586
1597
|
const exp = node.bindExpressions.find((bindExpression) => this.hasComponentLogics(bindExpression));
|
|
1587
1598
|
if (exp) {
|
|
1588
|
-
//
|
|
1589
|
-
//
|
|
1590
|
-
//
|
|
1599
|
+
//const element: any = node.getAncestor('ViewElement');
|
|
1600
|
+
//const api = config.allNodesAPI[element?.tag];
|
|
1601
|
+
//const attr = api?.attrs?.find?.((attr) => {
|
|
1591
1602
|
// return attr.name === node.name;
|
|
1592
|
-
//
|
|
1603
|
+
//});
|
|
1593
1604
|
const map = {
|
|
1594
1605
|
BindAttribute: '属性',
|
|
1595
1606
|
BindDirective: '指令',
|
|
1596
1607
|
BindStyle: '样式属性',
|
|
1597
1608
|
};
|
|
1598
|
-
|
|
1609
|
+
//“${attr?.title || node.title || node.name}”
|
|
1599
1610
|
const diagnostic = {
|
|
1600
1611
|
node,
|
|
1601
1612
|
severity: 'error',
|
|
@@ -1767,7 +1778,7 @@ let NaslServer = class NaslServer {
|
|
|
1767
1778
|
const { default: defaultVal } = precisionOption || {};
|
|
1768
1779
|
const precision = databaseTypeAnnotation ? databaseTypeAnnotation.arguments?.precision : defaultVal;
|
|
1769
1780
|
const ruleScale = typeAnnotation?.ruleMap?.scale;
|
|
1770
|
-
const scale = ruleScale !== undefined ?
|
|
1781
|
+
const scale = ruleScale !== undefined ? ruleScale + '' : '';
|
|
1771
1782
|
let ensureScale = true;
|
|
1772
1783
|
switch (typeName) {
|
|
1773
1784
|
case 'String': {
|
|
@@ -1866,7 +1877,7 @@ let NaslServer = class NaslServer {
|
|
|
1866
1877
|
// 储存小数部分
|
|
1867
1878
|
const memoryScaleStr = memoryStr.slice(0, +(scale || '0'));
|
|
1868
1879
|
// 储存绝对值
|
|
1869
|
-
const memoryAbsVal = memoryIntAbsStr + (memoryScaleStr ?
|
|
1880
|
+
const memoryAbsVal = memoryIntAbsStr + (memoryScaleStr ? '.' + memoryScaleStr : '');
|
|
1870
1881
|
const decimalMemoryAbsVal = new decimal_js_1.Decimal(memoryAbsVal);
|
|
1871
1882
|
[
|
|
1872
1883
|
{
|
|
@@ -1934,7 +1945,7 @@ let NaslServer = class NaslServer {
|
|
|
1934
1945
|
diagnostics.push(diagnostic);
|
|
1935
1946
|
}
|
|
1936
1947
|
fileNode?.sourceMap.forEach((value, node) => {
|
|
1937
|
-
//
|
|
1948
|
+
//OQL支持返回复合类型数据了
|
|
1938
1949
|
// SqlQueryComponent内部返回值类型,如果是嵌套的就需要报错
|
|
1939
1950
|
// if ((node instanceof OqlQueryComponent || node instanceof SqlQueryComponent) && (node as SqlQueryComponent).getTypeBanError()) {
|
|
1940
1951
|
// const diagnostic = {
|
|
@@ -1950,7 +1961,7 @@ let NaslServer = class NaslServer {
|
|
|
1950
1961
|
const typeAnnotation = (0, formatTsUtils_1.type2TypeAnnotation)(node.__nodeType);
|
|
1951
1962
|
if (!node.typeAnnotation && typeAnnotation) {
|
|
1952
1963
|
if (typeAnnotation.typeName === 'List' && typeAnnotation.typeKind === 'generic') {
|
|
1953
|
-
const
|
|
1964
|
+
const typeArguments = typeAnnotation.typeArguments;
|
|
1954
1965
|
if (typeArguments.length && typeArguments[0].isComplexType()) {
|
|
1955
1966
|
const diagnostic = {
|
|
1956
1967
|
node,
|
|
@@ -1976,7 +1987,7 @@ let NaslServer = class NaslServer {
|
|
|
1976
1987
|
catch (err) {
|
|
1977
1988
|
console.log(err);
|
|
1978
1989
|
}
|
|
1979
|
-
if (jsCode.
|
|
1990
|
+
if (jsCode.startsWith(`${node.name} = `)) {
|
|
1980
1991
|
used = true;
|
|
1981
1992
|
if (!nodeIn.tsErrorDetail) {
|
|
1982
1993
|
const diagnostic = {
|
|
@@ -2157,6 +2168,17 @@ let NaslServer = class NaslServer {
|
|
|
2157
2168
|
node.tsErrorDetail = diagnostic;
|
|
2158
2169
|
diagnostics.push(diagnostic);
|
|
2159
2170
|
}
|
|
2171
|
+
if (node instanceof concepts_1.ForEachStatement && !node.end && node.each) {
|
|
2172
|
+
if (!['List'].includes(node.each.__TypeAnnotation?.typeName)) {
|
|
2173
|
+
const diagnostic = {
|
|
2174
|
+
node,
|
|
2175
|
+
severity: 'error',
|
|
2176
|
+
message: `ForEac1:循环列表:参数类型不匹配!结束值自动推导失败。`,
|
|
2177
|
+
};
|
|
2178
|
+
node.tsErrorDetail = diagnostic;
|
|
2179
|
+
diagnostics.push(diagnostic);
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2160
2182
|
/**
|
|
2161
2183
|
* 如果节点是内置函数
|
|
2162
2184
|
* 穷举在线上的情况,不在线上就void报错, callinterface 因为原来有报错,所以就忽略掉
|
|
@@ -2235,7 +2257,7 @@ let NaslServer = class NaslServer {
|
|
|
2235
2257
|
if (excludeList.includes(leftType.sortedTypeKey) && excludeList.includes(rightType.sortedTypeKey)) {
|
|
2236
2258
|
return null;
|
|
2237
2259
|
}
|
|
2238
|
-
if (excludeList2.includes(leftType.sortedTypeKey) || excludeList2.includes(rightType.sortedTypeKey)) {
|
|
2260
|
+
else if (excludeList2.includes(leftType.sortedTypeKey) || excludeList2.includes(rightType.sortedTypeKey)) {
|
|
2239
2261
|
return null;
|
|
2240
2262
|
}
|
|
2241
2263
|
const diagnostic = {
|
|
@@ -2272,7 +2294,7 @@ let NaslServer = class NaslServer {
|
|
|
2272
2294
|
if (typeKeyArr[0] === 'apis') {
|
|
2273
2295
|
const structureName = typeKeyArr[3];
|
|
2274
2296
|
const moduleName = typeKeyArr[1];
|
|
2275
|
-
const
|
|
2297
|
+
const app = typeAnnotation.upperNode.app;
|
|
2276
2298
|
if (!app) {
|
|
2277
2299
|
return null;
|
|
2278
2300
|
}
|
|
@@ -2289,13 +2311,15 @@ let NaslServer = class NaslServer {
|
|
|
2289
2311
|
}
|
|
2290
2312
|
return null;
|
|
2291
2313
|
}
|
|
2292
|
-
|
|
2314
|
+
else {
|
|
2315
|
+
return diag;
|
|
2316
|
+
}
|
|
2293
2317
|
});
|
|
2294
2318
|
if (actionArr.length) {
|
|
2295
2319
|
if (timer)
|
|
2296
2320
|
return;
|
|
2297
2321
|
timer = window.setTimeout(() => {
|
|
2298
|
-
const
|
|
2322
|
+
const app = actionArr[0].target.app;
|
|
2299
2323
|
app.emit('collect:start', {
|
|
2300
2324
|
actionMsg: '设置导入接口数据类型错误',
|
|
2301
2325
|
});
|
|
@@ -2357,7 +2381,9 @@ let NaslServer = class NaslServer {
|
|
|
2357
2381
|
*/
|
|
2358
2382
|
_findMinRange(diagnostic, fileNode) {
|
|
2359
2383
|
let minRange;
|
|
2360
|
-
const
|
|
2384
|
+
const sourceMap = fileNode.sourceMap;
|
|
2385
|
+
// 是否找到了行内准确的,是的话,就不走多行的
|
|
2386
|
+
let haveLineNode = false;
|
|
2361
2387
|
for (const [node, item] of sourceMap.entries()) {
|
|
2362
2388
|
/**
|
|
2363
2389
|
* 当前内容的开始行 <= 诊断开始的行 &&
|
|
@@ -2375,6 +2401,7 @@ let NaslServer = class NaslServer {
|
|
|
2375
2401
|
// if for的内容也是包括当前的所以会重新赋值
|
|
2376
2402
|
if (!minRange || item.code.length < minRange.item.code.length) {
|
|
2377
2403
|
minRange = { item, node };
|
|
2404
|
+
haveLineNode = true;
|
|
2378
2405
|
}
|
|
2379
2406
|
}
|
|
2380
2407
|
}
|
|
@@ -2384,28 +2411,32 @@ let NaslServer = class NaslServer {
|
|
|
2384
2411
|
if (!minRange) {
|
|
2385
2412
|
minRange = { node, item };
|
|
2386
2413
|
}
|
|
2387
|
-
else if (
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
}
|
|
2395
|
-
else if (diagnostic.start.offset < (0, translator_1.lsp2tspNumber)(minRange.item.range.start.character)) {
|
|
2396
|
-
minRange = { node, item };
|
|
2397
|
-
}
|
|
2398
|
-
}
|
|
2399
|
-
else if (item.range.end.line - item.range.start.line <= minRange.item.range.end.line - minRange.item.range.start.line) {
|
|
2400
|
-
// 行都一致 ,比较列
|
|
2401
|
-
if (minRange.item.range.start.line === item.range.start.line && minRange.item.range.end.line === item.range.end.line) {
|
|
2402
|
-
// 如果两个起始和结束的行都一样,那么就比较开始列, 要比原来大,说明更精准
|
|
2403
|
-
if (item.range.start.character > minRange.item.range.start.character) {
|
|
2414
|
+
else if (!haveLineNode) {
|
|
2415
|
+
if ((0, translator_1.lsp2tspNumber)(item.range.start.line) === diagnostic.start.line &&
|
|
2416
|
+
diagnostic.start.offset >= (0, translator_1.lsp2tspNumber)(item.range.start.character)) {
|
|
2417
|
+
// 如果当前遍历的内容的行和列都 小于之前的, 而且是有效的
|
|
2418
|
+
// 如果两个内容位置行数是一样的,就比较下找到内容的位置信息
|
|
2419
|
+
// 找到的内容的开始位置, 要大于申明内容开始的位置,要不就不包含在内了
|
|
2420
|
+
if (diagnostic.start.offset - item.range.start.character <= diagnostic.start.offset - minRange.item.range.start.character) {
|
|
2404
2421
|
minRange = { node, item };
|
|
2405
2422
|
}
|
|
2423
|
+
else {
|
|
2424
|
+
if (diagnostic.start.offset < (0, translator_1.lsp2tspNumber)(minRange.item.range.start.character)) {
|
|
2425
|
+
minRange = { node, item };
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2406
2428
|
}
|
|
2407
|
-
else {
|
|
2408
|
-
|
|
2429
|
+
else if (item.range.end.line - item.range.start.line <= minRange.item.range.end.line - minRange.item.range.start.line) {
|
|
2430
|
+
// 行都一致 ,比较列
|
|
2431
|
+
if (minRange.item.range.start.line === item.range.start.line && minRange.item.range.end.line === item.range.end.line) {
|
|
2432
|
+
// 如果两个起始和结束的行都一样,那么就比较开始列, 要比原来大,说明更精准
|
|
2433
|
+
if (item.range.start.character > minRange.item.range.start.character) {
|
|
2434
|
+
minRange = { node, item };
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
else {
|
|
2438
|
+
minRange = { node, item };
|
|
2439
|
+
}
|
|
2409
2440
|
}
|
|
2410
2441
|
}
|
|
2411
2442
|
}
|
|
@@ -2438,21 +2469,23 @@ let NaslServer = class NaslServer {
|
|
|
2438
2469
|
});
|
|
2439
2470
|
refsList = [...newRefs.refs];
|
|
2440
2471
|
}
|
|
2441
|
-
else
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2472
|
+
else {
|
|
2473
|
+
if (node instanceof concepts_1.Module) {
|
|
2474
|
+
const lists = node.logics || node.structures || node.enums;
|
|
2475
|
+
const moduleName = fileNode.getEmbeddedFilePath();
|
|
2476
|
+
if (lists.length) {
|
|
2477
|
+
const item = lists[0];
|
|
2478
|
+
const { fileNode } = this.getCurrentSource(item);
|
|
2479
|
+
if (fileNode) {
|
|
2480
|
+
const newRefs = await this.references({
|
|
2481
|
+
file: fileNode.getEmbeddedFilePath(),
|
|
2482
|
+
line: 1,
|
|
2483
|
+
offset: 22, //固定的位置,module的位置信息
|
|
2484
|
+
});
|
|
2485
|
+
refsList = newRefs.refs.filter((item) => !item.file.startsWith(moduleName));
|
|
2486
|
+
// 多塞一个 ,删除的时候就有值了, 上面过滤了之后可能是空的
|
|
2487
|
+
refsList.unshift(newRefs.refs[0]);
|
|
2488
|
+
}
|
|
2456
2489
|
}
|
|
2457
2490
|
}
|
|
2458
2491
|
}
|
|
@@ -2511,7 +2544,7 @@ let NaslServer = class NaslServer {
|
|
|
2511
2544
|
const groupByLength = callQueryComponent.groupBy.filter((item) => item.groupElement?.propertyName && item.groupElement.asName).length;
|
|
2512
2545
|
if (!groupByLength && !aggregateLength && callQueryComponentTypeAnnotation.typeKind === 'anonymousStructure') {
|
|
2513
2546
|
// 拿到 List 的泛型(匿名数据结构)的所有属性
|
|
2514
|
-
const
|
|
2547
|
+
const properties = callQueryComponentTypeAnnotation.properties[0].typeAnnotation.typeArguments[0].properties;
|
|
2515
2548
|
const targetProperty = properties.find((p) => p.name === utils.firstLowerCase(node.name));
|
|
2516
2549
|
if (!targetProperty) {
|
|
2517
2550
|
continue;
|
|
@@ -2561,7 +2594,7 @@ let NaslServer = class NaslServer {
|
|
|
2561
2594
|
if (node instanceof concepts_1.Param && (node.parentNode instanceof concepts_1.View || node.parentNode instanceof concepts_1.Process)) {
|
|
2562
2595
|
const viewNode = node.parentNode;
|
|
2563
2596
|
const { currentSource } = this.getCurrentSource(viewNode);
|
|
2564
|
-
const
|
|
2597
|
+
const code = currentSource.code;
|
|
2565
2598
|
const viewIndex = code.indexOf(' {');
|
|
2566
2599
|
const viewRefs = await this.references({
|
|
2567
2600
|
file: fileNode.getEmbeddedFilePath(),
|
|
@@ -2600,7 +2633,7 @@ let NaslServer = class NaslServer {
|
|
|
2600
2633
|
*/
|
|
2601
2634
|
if (node instanceof concepts_1.ViewElement) {
|
|
2602
2635
|
if (currentSource) {
|
|
2603
|
-
const
|
|
2636
|
+
const code = currentSource.code;
|
|
2604
2637
|
const prefix = '__elements.';
|
|
2605
2638
|
const prefixIndex = code.indexOf(prefix) !== -1 ? code.indexOf(prefix) : 0;
|
|
2606
2639
|
const methodsNameIndex = prefixIndex + prefix.length;
|
|
@@ -2625,7 +2658,7 @@ let NaslServer = class NaslServer {
|
|
|
2625
2658
|
}
|
|
2626
2659
|
if (node instanceof concepts_1.Process) {
|
|
2627
2660
|
if (currentSource) {
|
|
2628
|
-
const
|
|
2661
|
+
const code = currentSource.code;
|
|
2629
2662
|
const prefix = '__ProcessIdentification__';
|
|
2630
2663
|
let positions = [];
|
|
2631
2664
|
let pos = code.indexOf(prefix);
|
|
@@ -2650,7 +2683,7 @@ let NaslServer = class NaslServer {
|
|
|
2650
2683
|
if ((node instanceof concepts_1.Param || node instanceof concepts_1.Return) && node.parentNode instanceof concepts_1.Process) {
|
|
2651
2684
|
const { currentSource } = this.getCurrentSource(node.parentNode);
|
|
2652
2685
|
if (currentSource) {
|
|
2653
|
-
const
|
|
2686
|
+
const code = currentSource.code;
|
|
2654
2687
|
const prefix = '__ProcessIdentification__';
|
|
2655
2688
|
const positions = [];
|
|
2656
2689
|
let pos = code.indexOf(prefix);
|
|
@@ -2678,7 +2711,7 @@ let NaslServer = class NaslServer {
|
|
|
2678
2711
|
}
|
|
2679
2712
|
if (node instanceof concepts_1.ProcessElement) {
|
|
2680
2713
|
if (currentSource) {
|
|
2681
|
-
const
|
|
2714
|
+
const code = currentSource.code;
|
|
2682
2715
|
const prefix = '__ProcessIdentification__';
|
|
2683
2716
|
let positions = [];
|
|
2684
2717
|
let pos = code.indexOf(prefix);
|
|
@@ -2702,7 +2735,7 @@ let NaslServer = class NaslServer {
|
|
|
2702
2735
|
if (node instanceof concepts_1.Return && node.parentNode instanceof concepts_1.ProcessElement) {
|
|
2703
2736
|
const { currentSource } = this.getCurrentSource(node.parentNode);
|
|
2704
2737
|
if (currentSource) {
|
|
2705
|
-
const
|
|
2738
|
+
const code = currentSource.code;
|
|
2706
2739
|
const prefix = '__ProcessIdentification__';
|
|
2707
2740
|
const positions = [];
|
|
2708
2741
|
let pos = code.indexOf(prefix);
|
|
@@ -2766,13 +2799,16 @@ let NaslServer = class NaslServer {
|
|
|
2766
2799
|
// }
|
|
2767
2800
|
minRange.setTypeMethods = 'setTypeName';
|
|
2768
2801
|
}
|
|
2802
|
+
if (minRange.node instanceof concepts_1.CallConnector) {
|
|
2803
|
+
minRange.setTypeMethods = 'setCalleeConnectionName';
|
|
2804
|
+
}
|
|
2769
2805
|
// 如果节点是logic修改引发calllogic修改
|
|
2770
2806
|
if (minRange.node instanceof concepts_1.CallLogic && node instanceof concepts_1.Logic) {
|
|
2771
2807
|
minRange.setTypeMethods = 'setCalleeName';
|
|
2772
2808
|
}
|
|
2773
2809
|
if (minRange.node instanceof concepts_1.CallLogic && node instanceof concepts_1.ViewElement) {
|
|
2774
2810
|
minRange.setTypeMethods = 'setCalleeNamespace';
|
|
2775
|
-
minRange.newValue =
|
|
2811
|
+
minRange.newValue = 'elements.' + newValue + '.logics';
|
|
2776
2812
|
}
|
|
2777
2813
|
// 如果节点是实体修改引发calllogic修改
|
|
2778
2814
|
if (minRange.node instanceof concepts_1.CallLogic &&
|
|
@@ -2789,9 +2825,9 @@ let NaslServer = class NaslServer {
|
|
|
2789
2825
|
* 3.然后把namespace中的 $替换成 ''
|
|
2790
2826
|
*
|
|
2791
2827
|
*/
|
|
2792
|
-
const
|
|
2828
|
+
const tsCalleeNamespace = minRange.node.tsCalleeNamespace;
|
|
2793
2829
|
// 先看下标位置
|
|
2794
|
-
const
|
|
2830
|
+
const lineText = record.lineText;
|
|
2795
2831
|
const index = lineText.indexOf(tsCalleeNamespace);
|
|
2796
2832
|
// 在把开始结束位置的-开始位置,来知道是哪里要替换
|
|
2797
2833
|
const start = record.start.offset - index - 1;
|
|
@@ -2826,12 +2862,12 @@ let NaslServer = class NaslServer {
|
|
|
2826
2862
|
if (minRange.node instanceof concepts_1.Identifier) {
|
|
2827
2863
|
// 匹配到的内容,当前这一行的内容;
|
|
2828
2864
|
// 因为要用下面的点位信息
|
|
2829
|
-
const
|
|
2865
|
+
const name = minRange.node.name;
|
|
2830
2866
|
// 如果name不改,那就是要改命名空间
|
|
2831
2867
|
if (node instanceof concepts_1.Frontend || newValue === name) {
|
|
2832
|
-
const
|
|
2868
|
+
const namespace = minRange.node.namespace;
|
|
2833
2869
|
// 先看下标位置
|
|
2834
|
-
const
|
|
2870
|
+
const lineText = record.lineText;
|
|
2835
2871
|
const index = lineText.indexOf(namespace);
|
|
2836
2872
|
// 在把开始结束位置的-开始位置,来知道是哪里要替换
|
|
2837
2873
|
const start = record.start.offset - index - 1;
|
|
@@ -2863,7 +2899,7 @@ let NaslServer = class NaslServer {
|
|
|
2863
2899
|
// 枚举key的特殊性,因为它不是原来的key+value形式的
|
|
2864
2900
|
// 是加了中括号啥的,所以直接赋值新值
|
|
2865
2901
|
if (node instanceof concepts_1.EnumItem) {
|
|
2866
|
-
const newTextValue =
|
|
2902
|
+
const newTextValue = node.parentNode.name + '.' + newValue;
|
|
2867
2903
|
minRange.newValue = newTextValue;
|
|
2868
2904
|
}
|
|
2869
2905
|
else {
|
|
@@ -2903,7 +2939,7 @@ let NaslServer = class NaslServer {
|
|
|
2903
2939
|
}
|
|
2904
2940
|
else if (minRange.node instanceof concepts_1.BindAttribute && minRange.node.name === 'url') {
|
|
2905
2941
|
// 如果是查找到 上传地址的链接引用
|
|
2906
|
-
let newName = newValue.replace(/[A-Z]/g, (item) =>
|
|
2942
|
+
let newName = newValue.replace(/[A-Z]/g, (item) => '-' + item.toLowerCase());
|
|
2907
2943
|
newName = newName[0] === '-' ? newName.slice(1) : newName;
|
|
2908
2944
|
const newTextValue = node.parentNode.name === 'defaultDS' ? `/api/${newName}/import` : `/api/${node.parentNode.name}/${newName}/import`;
|
|
2909
2945
|
minRange.setTypeMethods = 'setUrlValue';
|
|
@@ -2943,11 +2979,11 @@ let NaslServer = class NaslServer {
|
|
|
2943
2979
|
* 3.然后把namespace中的 $替换成 ''
|
|
2944
2980
|
*
|
|
2945
2981
|
*/
|
|
2946
|
-
const
|
|
2947
|
-
const
|
|
2948
|
-
const oldValue =
|
|
2982
|
+
const tsCalleeNamespace = minRange.node.tsCalleeNamespace;
|
|
2983
|
+
const tsName = minRange.node.tsName;
|
|
2984
|
+
const oldValue = tsCalleeNamespace + '.' + tsName;
|
|
2949
2985
|
// 先看下标位置
|
|
2950
|
-
const
|
|
2986
|
+
const lineText = record.lineText;
|
|
2951
2987
|
const index = lineText.indexOf(oldValue);
|
|
2952
2988
|
// 在把开始结束位置的-开始位置,来知道是哪里要替换
|
|
2953
2989
|
const start = record.start.offset - index - 1;
|
|
@@ -2965,11 +3001,11 @@ let NaslServer = class NaslServer {
|
|
|
2965
3001
|
}
|
|
2966
3002
|
}
|
|
2967
3003
|
if (node instanceof concepts_1.Frontend && minRange.node instanceof concepts_1.Destination) {
|
|
2968
|
-
const
|
|
2969
|
-
const
|
|
2970
|
-
const oldValue =
|
|
3004
|
+
const tsCalleeNamespace = minRange.node.tsCalleeNamespace;
|
|
3005
|
+
const tsName = minRange.node.tsName;
|
|
3006
|
+
const oldValue = tsCalleeNamespace + '.' + tsName;
|
|
2971
3007
|
// 先看下标位置
|
|
2972
|
-
const
|
|
3008
|
+
const lineText = record.lineText;
|
|
2973
3009
|
const index = lineText.indexOf(oldValue);
|
|
2974
3010
|
// 在把开始结束位置的-开始位置,来知道是哪里要替换
|
|
2975
3011
|
const start = record.start.offset - index - 1;
|
|
@@ -2989,7 +3025,7 @@ let NaslServer = class NaslServer {
|
|
|
2989
3025
|
// 页面逻辑直接赋值就可以, 因为是相对路径
|
|
2990
3026
|
if (node instanceof concepts_1.ViewElement) {
|
|
2991
3027
|
minRange.setTypeMethods = 'setCalleeNamespace';
|
|
2992
|
-
minRange.newValue =
|
|
3028
|
+
minRange.newValue = 'elements.' + newValue + '.logics';
|
|
2993
3029
|
}
|
|
2994
3030
|
else {
|
|
2995
3031
|
/**
|
|
@@ -3001,10 +3037,10 @@ let NaslServer = class NaslServer {
|
|
|
3001
3037
|
* 2.在匹配到的内容中取转后的namespace的位置
|
|
3002
3038
|
* 3.然后把namespace中的 $替换成 ''
|
|
3003
3039
|
*/
|
|
3004
|
-
const
|
|
3040
|
+
const tsCalleeNamespace = minRange.node.tsCalleeNamespace;
|
|
3005
3041
|
const oldValue = tsCalleeNamespace;
|
|
3006
3042
|
// 先看下标位置
|
|
3007
|
-
const
|
|
3043
|
+
const lineText = record.lineText;
|
|
3008
3044
|
const index = lineText.indexOf(oldValue);
|
|
3009
3045
|
// 在把开始结束位置的-开始位置,来知道是哪里要替换
|
|
3010
3046
|
const start = record.start.offset - index - 1;
|
|
@@ -3067,7 +3103,7 @@ let NaslServer = class NaslServer {
|
|
|
3067
3103
|
if (node instanceof concepts_1.DataSource) {
|
|
3068
3104
|
const setTypeNamespace = (typeNamespace, record) => {
|
|
3069
3105
|
// 先看下标位置
|
|
3070
|
-
const
|
|
3106
|
+
const lineText = record.lineText;
|
|
3071
3107
|
const index = lineText.indexOf(typeNamespace);
|
|
3072
3108
|
// 在把开始结束位置的-开始位置,来知道是哪里要替换
|
|
3073
3109
|
const start = record.start.offset - index - 1;
|
|
@@ -3193,7 +3229,7 @@ let NaslServer = class NaslServer {
|
|
|
3193
3229
|
if (a.node.concept === 'QueryFieldExpression') {
|
|
3194
3230
|
return 1;
|
|
3195
3231
|
}
|
|
3196
|
-
if (b.node.concept === 'QueryFieldExpression') {
|
|
3232
|
+
else if (b.node.concept === 'QueryFieldExpression') {
|
|
3197
3233
|
return -1;
|
|
3198
3234
|
}
|
|
3199
3235
|
return 0;
|
|
@@ -3321,7 +3357,7 @@ let NaslServer = class NaslServer {
|
|
|
3321
3357
|
const queue = [];
|
|
3322
3358
|
// 先插入自己,如果没有在往上找,
|
|
3323
3359
|
// 一直到file节点的父级
|
|
3324
|
-
while (!(parantNode instanceof concepts_1.App)) {
|
|
3360
|
+
while (parantNode && !(parantNode instanceof concepts_1.App)) {
|
|
3325
3361
|
// 找到上一级 在map对象中构造出他的子集
|
|
3326
3362
|
currentNode = parantNode;
|
|
3327
3363
|
parantNode = parantNode.parentNode;
|
|
@@ -3441,7 +3477,7 @@ let NaslServer = class NaslServer {
|
|
|
3441
3477
|
getCurrentSource(node) {
|
|
3442
3478
|
if (node instanceof concepts_1.App || node instanceof concepts_1.Theme)
|
|
3443
3479
|
return { fileNode: null };
|
|
3444
|
-
let
|
|
3480
|
+
let sourceMap = node.sourceMap;
|
|
3445
3481
|
let fileNode = node;
|
|
3446
3482
|
// 如果没有sourceMap,就继续向上找 ,或者到module结束
|
|
3447
3483
|
// 如果 节点找到 app 或者module 停止 或者entity找到DataSource为止
|
|
@@ -3479,16 +3515,30 @@ let NaslServer = class NaslServer {
|
|
|
3479
3515
|
getFieldKeySelectCompletion(node, fieldKey) {
|
|
3480
3516
|
const { currentSource, fileNode } = this.getCurrentSource(node);
|
|
3481
3517
|
if (currentSource && fileNode) {
|
|
3518
|
+
const range = {
|
|
3519
|
+
line: (0, translator_1.lsp2tspNumber)(currentSource.range.start.line),
|
|
3520
|
+
offset: (0, translator_1.lsp2tspNumber)(currentSource.range.start.character),
|
|
3521
|
+
};
|
|
3522
|
+
// foreach 在最后一行自动补全
|
|
3523
|
+
if (node.concept === 'ForEachStatement') {
|
|
3524
|
+
range.line = currentSource.range.end.line;
|
|
3525
|
+
range.offset = 0;
|
|
3526
|
+
}
|
|
3527
|
+
else if (node.concept === 'BindAttribute') {
|
|
3528
|
+
range.offset = range.offset + 7;
|
|
3529
|
+
}
|
|
3530
|
+
else if (node.concept === 'BindDirective') {
|
|
3531
|
+
range.offset = range.offset + 5;
|
|
3532
|
+
}
|
|
3482
3533
|
return this._getFieldKeySelectCompletion({
|
|
3483
3534
|
file: fileNode.getEmbeddedFilePath(),
|
|
3484
|
-
range
|
|
3485
|
-
line: (0, translator_1.lsp2tspNumber)(currentSource.range.start.line),
|
|
3486
|
-
offset: (0, translator_1.lsp2tspNumber)(currentSource.range.start.character),
|
|
3487
|
-
},
|
|
3535
|
+
range,
|
|
3488
3536
|
getFieldKey: fieldKey,
|
|
3489
3537
|
});
|
|
3490
3538
|
}
|
|
3491
|
-
|
|
3539
|
+
else {
|
|
3540
|
+
console.log('没找到节点', currentSource, fileNode);
|
|
3541
|
+
}
|
|
3492
3542
|
}
|
|
3493
3543
|
_getFieldKeySelectCompletion(args) {
|
|
3494
3544
|
return this.messager.requestCommand('getFieldKeySelectCompletion', args);
|
|
@@ -3536,7 +3586,7 @@ let NaslServer = class NaslServer {
|
|
|
3536
3586
|
});
|
|
3537
3587
|
return [...fileNodes];
|
|
3538
3588
|
}
|
|
3539
|
-
|
|
3589
|
+
/**获取当前节点的已知类型
|
|
3540
3590
|
* @param node 当前要获取类型的节点
|
|
3541
3591
|
* @returns 不需要去查就可以返回类型的节点
|
|
3542
3592
|
*/
|
|
@@ -3689,7 +3739,7 @@ let NaslServer = class NaslServer {
|
|
|
3689
3739
|
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
3690
3740
|
indexOf = subStr.length - lastLen;
|
|
3691
3741
|
}
|
|
3692
|
-
fileDetail.offset
|
|
3742
|
+
fileDetail.offset = fileDetail.offset + indexOf;
|
|
3693
3743
|
}
|
|
3694
3744
|
else if (node.concept === 'MemberExpression' ||
|
|
3695
3745
|
node.concept === 'Identifier' ||
|
|
@@ -3700,7 +3750,7 @@ let NaslServer = class NaslServer {
|
|
|
3700
3750
|
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
3701
3751
|
// MemberExpression取最后一位当做类型
|
|
3702
3752
|
const indexOf = item.code.length - lastLen;
|
|
3703
|
-
fileDetail.offset
|
|
3753
|
+
fileDetail.offset = fileDetail.offset + indexOf;
|
|
3704
3754
|
}
|
|
3705
3755
|
}
|
|
3706
3756
|
else if (node.concept === 'Match') {
|
|
@@ -3733,7 +3783,7 @@ let NaslServer = class NaslServer {
|
|
|
3733
3783
|
const item = resultMap?.[file]?.[line]?.[offset];
|
|
3734
3784
|
const itemType = item?.[0]?.nodeType;
|
|
3735
3785
|
const nodeTypeAnnotation = (0, formatTsUtils_1.type2TypeAnnotation)(itemType);
|
|
3736
|
-
const
|
|
3786
|
+
const node = newQuickInfoNodes[index].node;
|
|
3737
3787
|
types.set(node, Object.freeze(nodeTypeAnnotation));
|
|
3738
3788
|
node.__nodeType = itemType ? (Object.isFrozen(itemType) ? itemType : Object.freeze(itemType)) : null;
|
|
3739
3789
|
});
|
|
@@ -3769,7 +3819,7 @@ let NaslServer = class NaslServer {
|
|
|
3769
3819
|
const typeAnnotation = value;
|
|
3770
3820
|
if (!node.typeAnnotation && typeAnnotation) {
|
|
3771
3821
|
if (typeAnnotation.typeName === 'List' && typeAnnotation.typeKind === 'generic') {
|
|
3772
|
-
const
|
|
3822
|
+
const typeArguments = typeAnnotation.typeArguments;
|
|
3773
3823
|
if (typeArguments.length && typeArguments[0].isComplexType()) {
|
|
3774
3824
|
node.__TypeAnnotation = null;
|
|
3775
3825
|
return;
|
|
@@ -3800,7 +3850,7 @@ let NaslServer = class NaslServer {
|
|
|
3800
3850
|
// 全量标注并且返回json
|
|
3801
3851
|
async getNaslAnnotatedJSON(app, releaseFlag) {
|
|
3802
3852
|
if (this.changeStackList?.length) {
|
|
3803
|
-
throw new Error(`当前还有${this.changeStackList.length}
|
|
3853
|
+
throw new Error(`当前还有${this.changeStackList.length}个文件还在执行更新操作`);
|
|
3804
3854
|
}
|
|
3805
3855
|
const nodes = [];
|
|
3806
3856
|
this.file2NodeMap.forEach((fileNode, filePath) => {
|
|
@@ -3985,7 +4035,7 @@ let NaslServer = class NaslServer {
|
|
|
3985
4035
|
}
|
|
3986
4036
|
}
|
|
3987
4037
|
// 用户自己声明的用用户的
|
|
3988
|
-
const callObj = App.findNodeByCompleteName(
|
|
4038
|
+
const callObj = App.findNodeByCompleteName(parent.calleeNamespace + '.' + parent.calleeName);
|
|
3989
4039
|
const index = parent.arguments.indexOf(node);
|
|
3990
4040
|
const param = callObj?.params?.[index] || {};
|
|
3991
4041
|
// 取出参数的类型
|
|
@@ -4245,7 +4295,7 @@ let NaslServer = class NaslServer {
|
|
|
4245
4295
|
*/
|
|
4246
4296
|
async incidentalAction(action, fileNode, targetNode, oldpath) {
|
|
4247
4297
|
if ((action === 'create' || action === 'delete' || (action === 'update' && oldpath)) && fileNode === targetNode) {
|
|
4248
|
-
|
|
4298
|
+
//删除、更改、新增端
|
|
4249
4299
|
if (fileNode instanceof concepts_1.Frontend && (fileNode.views?.length || fileNode.variables?.length)) {
|
|
4250
4300
|
const fileNodeChildren = [...fileNode.views, ...fileNode.variables];
|
|
4251
4301
|
for (let i = 0; i < fileNodeChildren.length; i++) {
|
|
@@ -4263,7 +4313,7 @@ let NaslServer = class NaslServer {
|
|
|
4263
4313
|
else if (action === 'update' && oldpath) {
|
|
4264
4314
|
const parentPath = oldpath.replace('.ts', '/');
|
|
4265
4315
|
const foldName = fileNodeItem.concept === 'View' ? 'views' : 'variables';
|
|
4266
|
-
const currentOldPath =
|
|
4316
|
+
const currentOldPath = parentPath + foldName + '/' + fileNodeItem.name + '.ts';
|
|
4267
4317
|
// 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
|
|
4268
4318
|
await this.handleRename(fileNodeItem, fileNodeItem, result, currentOldPath);
|
|
4269
4319
|
await this.incidentalAction(action, fileNodeItem, fileNodeItem, currentOldPath);
|
|
@@ -4287,7 +4337,7 @@ let NaslServer = class NaslServer {
|
|
|
4287
4337
|
}
|
|
4288
4338
|
else if (action === 'update' && oldpath) {
|
|
4289
4339
|
const parentPath = oldpath.replace('.ts', '/');
|
|
4290
|
-
const currentOldPath =
|
|
4340
|
+
const currentOldPath = parentPath + fileNodeItem.name + '.ts';
|
|
4291
4341
|
// 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
|
|
4292
4342
|
await this.handleRename(fileNodeItem, fileNodeItem, result, currentOldPath);
|
|
4293
4343
|
await this.incidentalAction(action, fileNodeItem, fileNodeItem, currentOldPath);
|
|
@@ -4332,7 +4382,7 @@ let NaslServer = class NaslServer {
|
|
|
4332
4382
|
try {
|
|
4333
4383
|
const result = entity.toEmbeddedTSFile();
|
|
4334
4384
|
const parentPath = oldpath.replace('.ts', '/');
|
|
4335
|
-
const currentOldPath =
|
|
4385
|
+
const currentOldPath = parentPath + '/entities/' + entity.name + '.ts';
|
|
4336
4386
|
// 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
|
|
4337
4387
|
await this.handleRename(entity, entity, result, currentOldPath);
|
|
4338
4388
|
}
|
|
@@ -4346,7 +4396,7 @@ let NaslServer = class NaslServer {
|
|
|
4346
4396
|
async receiveHandleChange($event) {
|
|
4347
4397
|
this.singleFileChangeIng = true;
|
|
4348
4398
|
// 行为
|
|
4349
|
-
const
|
|
4399
|
+
const action = $event.action;
|
|
4350
4400
|
const targetNode = $event.target;
|
|
4351
4401
|
// Connection 相关配置的更新不需要写入文件
|
|
4352
4402
|
if (targetNode?.parentNode instanceof concepts_1.Connection) {
|