@lcap/nasl 1.0.2 → 2.12.0-beta
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/engine/index.js +11 -0
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/uniqueName.js +1 -1
- package/out/automate/engine/uniqueName.js.map +1 -1
- package/out/automate/engine/utils.d.ts +1 -0
- package/out/automate/engine/utils.js +89 -67
- package/out/automate/engine/utils.js.map +1 -1
- package/out/concepts/App__.d.ts +51 -49
- package/out/concepts/App__.js +86 -54
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +1 -1
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.js +1 -1
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/Assignment__.js +1 -1
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.js +1 -1
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +1 -1
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +3 -3
- 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__.js +11 -6
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.js +1 -1
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.js +8 -3
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +1 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +23 -21
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +9 -8
- package/out/concepts/CallQueryComponent__.js +89 -79
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +2 -2
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js +1 -1
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.d.ts +1 -0
- package/out/concepts/ConfigGroup__.js +8 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.js +1 -1
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +1 -0
- package/out/concepts/ConfigProperty__.js +4 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.d.ts +1 -0
- package/out/concepts/Configuration__.js +4 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Constant__.js +1 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataElement__.js +1 -1
- package/out/concepts/DataElement__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +143 -0
- package/out/concepts/DataSource__.js +316 -0
- package/out/concepts/DataSource__.js.map +1 -0
- package/out/concepts/Destination__.js +8 -8
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +3 -3
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +5 -0
- package/out/concepts/EntityIndex__.js +7 -1
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +9 -0
- package/out/concepts/EntityProperty__.js +20 -3
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +5 -0
- package/out/concepts/Entity__.js +21 -11
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.js +1 -1
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.js +11 -5
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +3 -3
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.d.ts +18 -0
- package/out/concepts/Function__.js +96 -1
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +3 -13
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +9 -9
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js +1 -1
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js +19 -12
- 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/LogicItem__.js +1 -1
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js +41 -42
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +1 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +1 -85
- package/out/concepts/Module__.js +6 -107
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +0 -86
- package/out/concepts/Namespace__.js +1 -108
- package/out/concepts/Namespace__.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/Param__.d.ts +2 -1
- package/out/concepts/Param__.js +1 -1
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.js +1 -1
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +1 -1
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +26 -11
- 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/Process__.js +17 -10
- 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 +9 -2
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.d.ts +4 -0
- package/out/concepts/QueryFromExpression__.js +14 -3
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.js +1 -1
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.d.ts +4 -0
- package/out/concepts/QueryJoinExpression__.js +15 -4
- 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/QuerySelectExpression__.js +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.js +1 -1
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.js +1 -1
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js +11 -4
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/Slot__.js +1 -1
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +10 -0
- package/out/concepts/SqlQueryComponent__.js +32 -5
- 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/StringLiteral__.js +1 -1
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +1 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +20 -13
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +6 -6
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +1 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/Theme__.js +1 -1
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.js +1 -1
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +8 -0
- package/out/concepts/TypeAnnotation__.js +46 -4
- 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 +1 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.js +1 -1
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.js +1 -1
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.js +1 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +1 -1
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js +1 -1
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.js +18 -18
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +25 -23
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +5 -5
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +278 -0
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/index__.d.ts +1 -0
- package/out/concepts/index__.js +1 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/generator/genBundleFiles.js +8 -3
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.js +13 -12
- package/out/generator/genMetaData.js.map +1 -1
- package/out/server/createUiTs.js +1 -0
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/getLogics.js +9 -1
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getProcesses.d.ts +3 -0
- package/out/server/getProcesses.js +61 -1
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/naslServer.js +128 -6
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.js +10 -1
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.js +19 -1
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +2 -2
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +15 -11
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +15 -12
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +25 -21
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +12 -12
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +21 -20
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +6 -3
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.js +5 -5
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genSelectBlock.js +8 -7
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +17 -15
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +15 -11
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +2 -2
- package/out/templator/utils.js.map +1 -1
- package/out/test/integration/connect-file.js +6 -6
- package/out/test/integration/connect-file.js.map +1 -1
- package/out/translator/index.js +1 -1
- package/out/translator/index.js.map +1 -1
- package/out/utils/index.d.ts +4 -0
- package/out/utils/index.js +32 -1
- package/out/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/automate/engine/index.js +12 -1
- package/src/automate/engine/uniqueName.js +1 -1
- package/src/automate/engine/utils.js +92 -67
- package/src/concepts/App__.ts +165 -95
- package/src/concepts/Argument__.ts +1 -1
- package/src/concepts/Assignee__.ts +1 -1
- package/src/concepts/Assignment__.ts +1 -1
- package/src/concepts/Attribute__.ts +1 -1
- package/src/concepts/BinaryExpression__.ts +1 -1
- package/src/concepts/BindAttribute__.ts +3 -3
- package/src/concepts/BindDirective__.ts +1 -1
- package/src/concepts/BindEvent__.ts +10 -6
- package/src/concepts/BooleanLiteral__.ts +1 -1
- package/src/concepts/CallFunction__.ts +19 -16
- package/src/concepts/CallInterface__.ts +1 -1
- package/src/concepts/CallLogic__.ts +23 -23
- package/src/concepts/CallQueryComponent__.ts +96 -113
- package/src/concepts/Comment__.ts +2 -2
- package/src/concepts/CompletionProperty__.ts +1 -1
- package/src/concepts/ConfigGroup__.ts +4 -2
- package/src/concepts/ConfigPropertyValue__.ts +1 -1
- package/src/concepts/ConfigProperty__.ts +5 -1
- package/src/concepts/Configuration__.ts +4 -1
- package/src/concepts/Constant__.ts +1 -1
- package/src/concepts/DataElement__.ts +1 -1
- package/src/concepts/DataSource__.ts +389 -0
- package/src/concepts/Destination__.ts +24 -8
- package/src/concepts/End__.ts +3 -3
- package/src/concepts/EntityIndex__.ts +8 -1
- package/src/concepts/EntityProperty__.ts +21 -3
- package/src/concepts/Entity__.ts +24 -12
- package/src/concepts/EnumItem__.ts +1 -1
- package/src/concepts/Enum__.ts +24 -5
- package/src/concepts/Event__.ts +1 -1
- package/src/concepts/ForEachStatement__.ts +3 -3
- package/src/concepts/Function__.ts +97 -3
- package/src/concepts/Identifier__.ts +12 -13
- package/src/concepts/IfStatement__.ts +10 -10
- package/src/concepts/InterfaceParam__.ts +1 -1
- package/src/concepts/Interface__.ts +20 -12
- package/src/concepts/JSBlock__.ts +1 -1
- package/src/concepts/LogicItem__.ts +1 -1
- package/src/concepts/Logic__.ts +41 -39
- package/src/concepts/MemberExpression__.ts +1 -1
- package/src/concepts/Module__.ts +9 -204
- package/src/concepts/Namespace__.ts +1 -204
- package/src/concepts/NullLiteral__.ts +1 -1
- package/src/concepts/NumericLiteral__.ts +1 -1
- package/src/concepts/Param__.ts +3 -2
- package/src/concepts/Point__.ts +1 -1
- package/src/concepts/ProcessComponent__.ts +1 -1
- package/src/concepts/ProcessElement__.ts +29 -13
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +17 -11
- package/src/concepts/QueryAggregateExpression__.ts +1 -1
- package/src/concepts/QueryFieldExpression__.ts +10 -2
- package/src/concepts/QueryFromExpression__.ts +14 -3
- package/src/concepts/QueryGroupByExpression__.ts +1 -1
- package/src/concepts/QueryJoinExpression__.ts +15 -4
- package/src/concepts/QueryLimitExpression__.ts +1 -1
- package/src/concepts/QueryOrderByExpression__.ts +1 -1
- package/src/concepts/QuerySelectExpression__.ts +1 -1
- package/src/concepts/Rect__.ts +1 -1
- package/src/concepts/Return__.ts +1 -1
- package/src/concepts/Role__.ts +11 -5
- package/src/concepts/Slot__.ts +1 -1
- package/src/concepts/SqlQueryComponent__.ts +30 -11
- package/src/concepts/Start__.ts +1 -1
- package/src/concepts/StringLiteral__.ts +1 -1
- package/src/concepts/StructureProperty__.ts +1 -1
- package/src/concepts/Structure__.ts +20 -12
- package/src/concepts/SwitchCase__.ts +6 -6
- package/src/concepts/SwitchStatement__.ts +1 -1
- package/src/concepts/Theme__.ts +1 -1
- package/src/concepts/Transactional__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +45 -23
- package/src/concepts/TypeParam__.ts +1 -1
- package/src/concepts/UnaryExpression__.ts +1 -1
- package/src/concepts/Unparsed__.ts +1 -1
- package/src/concepts/UseComponent__.ts +1 -1
- package/src/concepts/ValidationRule__.ts +1 -1
- package/src/concepts/Variable__.ts +1 -1
- package/src/concepts/ViewComponent__.ts +1 -1
- package/src/concepts/ViewElement__.ts +19 -19
- package/src/concepts/View__.ts +25 -23
- package/src/concepts/WhileStatement__.ts +5 -5
- package/src/concepts/basics/stdlib/nasl.util.ts +279 -0
- package/src/concepts/index__.ts +1 -0
- package/src/generator/genBundleFiles.ts +8 -3
- package/src/generator/genMetaData.ts +13 -13
- package/src/server/createUiTs.ts +1 -0
- package/src/server/getLogics.ts +11 -3
- package/src/server/getProcesses.ts +61 -0
- package/src/server/naslServer.ts +124 -6
- package/src/server/process2LogicNamespace.ts +29 -19
- package/src/server/translator.ts +22 -1
- package/src/service/storage/init.ts +2 -2
- package/src/templator/genCreateBlock.ts +16 -13
- package/src/templator/genCurdEditMultipleKeyBlock.ts +16 -13
- package/src/templator/genCurdMultipleKeyBlock.ts +26 -22
- package/src/templator/genEditTableBlock.ts +14 -13
- package/src/templator/genGridViewBlock.ts +22 -21
- package/src/templator/genListViewBlock.ts +9 -5
- package/src/templator/genQueryComponent.ts +6 -6
- package/src/templator/genSelectBlock.ts +9 -8
- package/src/templator/genTableBlock.ts +18 -16
- package/src/templator/genUpdateBlock.ts +16 -12
- package/src/templator/utils.ts +2 -2
- package/src/test/integration/connect-file.ts +6 -6
- package/src/translator/index.ts +1 -1
- package/src/utils/index.ts +32 -0
package/out/utils/index.js
CHANGED
|
@@ -14,12 +14,43 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.shouldLoadCss = exports.specialOfficialCustoms = exports.officialCustoms = exports.waitPromise = exports.clearObjectDeep = exports.clearObject = exports.throttle = exports.getGlobalEnv = void 0;
|
|
17
|
+
exports.shouldLoadCss = exports.specialOfficialCustoms = exports.officialCustoms = exports.waitPromise = exports.clearObjectDeep = exports.clearObject = exports.throttle = exports.getGlobalEnv = exports.findConceptKeyWordIndexFromNamespace = exports.findConceptKeyWordByNamespace = exports.findClosestModule = void 0;
|
|
18
18
|
__exportStar(require("./string"), exports);
|
|
19
19
|
__exportStar(require("./traverse"), exports);
|
|
20
20
|
__exportStar(require("./logger"), exports);
|
|
21
21
|
const compare_versions_1 = require("compare-versions");
|
|
22
22
|
const traverse_1 = require("./traverse");
|
|
23
|
+
// 查找最近的模块
|
|
24
|
+
function findClosestModule(node) {
|
|
25
|
+
let moduleNode = node;
|
|
26
|
+
while (moduleNode && !['App', 'Module'].includes(moduleNode.concept)) {
|
|
27
|
+
moduleNode = moduleNode.parentNode;
|
|
28
|
+
}
|
|
29
|
+
return moduleNode;
|
|
30
|
+
}
|
|
31
|
+
exports.findClosestModule = findClosestModule;
|
|
32
|
+
// 从namespace获取关键字
|
|
33
|
+
function findConceptKeyWordByNamespace(namespace) {
|
|
34
|
+
const namespaceArr = namespace?.split('.') || [];
|
|
35
|
+
const start = namespaceArr[0];
|
|
36
|
+
const mod = start === 'app' ? 1 : 0;
|
|
37
|
+
const keywordViews = namespaceArr.filter((namespaceItem, index) => index % 2 === mod);
|
|
38
|
+
return keywordViews.pop();
|
|
39
|
+
}
|
|
40
|
+
exports.findConceptKeyWordByNamespace = findConceptKeyWordByNamespace;
|
|
41
|
+
// 从namespace中查找concept关键字
|
|
42
|
+
function findConceptKeyWordIndexFromNamespace(namespace, keyword) {
|
|
43
|
+
const namespaceArr = namespace?.split('.') || [];
|
|
44
|
+
const start = namespaceArr[0];
|
|
45
|
+
const mod = start === 'app' ? 1 : 0;
|
|
46
|
+
return namespaceArr.findIndex((namespaceItem, index) => {
|
|
47
|
+
if (index % 2 === mod) {
|
|
48
|
+
return namespaceItem === keyword;
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.findConceptKeyWordIndexFromNamespace = findConceptKeyWordIndexFromNamespace;
|
|
23
54
|
function getGlobalEnv() {
|
|
24
55
|
return typeof window !== 'undefined' ? window.appInfo.env : global.appInfoEnv;
|
|
25
56
|
}
|
package/out/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,6CAA2B;AAC3B,2CAAyB;AAEzB,uDAA2C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils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WAAW,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AAAxF,QAAA,WAAW,eAA6E;AAErG,qBAAqB;AACR,QAAA,eAAe,GAAG;IAC3B,eAAe;IACf,kBAAkB;IAClB,kBAAkB;IAClB,YAAY;IACZ,YAAY;IACZ,eAAe;IACf,eAAe;IACf,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,aAAa;IACb,kBAAkB;IAClB,YAAY;CACf,CAAC;AACF,8BAA8B;AACjB,QAAA,sBAAsB,GAAG,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC7F,yBAAyB;AAClB,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,OAAe,EAAW,EAAE,CAAC,CAAC,CAAC,uBAAe,CAAC,QAAQ,CAAC,IAAI,CAAC;OACpG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;OACrB,CAAC,8BAAsB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,IAAA,0BAAO,EAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAF/F,QAAA,aAAa,iBAEkF"}
|
package/package.json
CHANGED
|
@@ -324,6 +324,7 @@ export function autoTemplate(node) {
|
|
|
324
324
|
const stack = [];
|
|
325
325
|
const startNode = node;
|
|
326
326
|
let rootNode = true;
|
|
327
|
+
const finalOps = [];
|
|
327
328
|
function iterator(node) {
|
|
328
329
|
if (node && !visitedMap.has(node)) {
|
|
329
330
|
const meta = new TemplateMeta(node);
|
|
@@ -341,12 +342,21 @@ export function autoTemplate(node) {
|
|
|
341
342
|
break;
|
|
342
343
|
case TRACK_TYPE.PROPERTY:
|
|
343
344
|
case TRACK_TYPE.ARRAY:
|
|
344
|
-
iterator(property);
|
|
345
|
+
iterator(property);
|
|
345
346
|
const pmeta = visitedMap.get(property);
|
|
346
347
|
meta.addBinds(type, propertyName, pmeta);
|
|
347
348
|
break;
|
|
349
|
+
case TRACK_TYPE.ARRAY_NO_FURTHER:
|
|
350
|
+
finalOps.push(() => {
|
|
351
|
+
const pmeta = visitedMap.get(property);
|
|
352
|
+
if(pmeta) {
|
|
353
|
+
meta.addBinds(TRACK_TYPE.ARRAY, propertyName, pmeta);
|
|
354
|
+
}
|
|
355
|
+
})
|
|
356
|
+
break;
|
|
348
357
|
case TRACK_TYPE.CALLEE:
|
|
349
358
|
iterator(rootNode);
|
|
359
|
+
iterator(calleeNode);
|
|
350
360
|
const cmeta = visitedMap.get(calleeNode);
|
|
351
361
|
if (AppPropertyName) {
|
|
352
362
|
meta.addRootBinds(AppPropertyName, visitedMap.get(rootNode));
|
|
@@ -399,6 +409,7 @@ export function autoTemplate(node) {
|
|
|
399
409
|
}
|
|
400
410
|
|
|
401
411
|
iterator(node);
|
|
412
|
+
finalOps.forEach(f => { f(); });
|
|
402
413
|
return autoScript(stack);
|
|
403
414
|
}
|
|
404
415
|
|
|
@@ -3,7 +3,7 @@ class uniqueName {
|
|
|
3
3
|
NamesWeakMap = new Map();
|
|
4
4
|
initAppUniqueNames(app) {
|
|
5
5
|
const NamesWeakMap = this.NamesWeakMap;
|
|
6
|
-
NamesWeakMap.set('
|
|
6
|
+
NamesWeakMap.set('DataSource', new Set(app.getDataSourceExistingNames()));
|
|
7
7
|
NamesWeakMap.set('Structure', new Set(app.getStructureExistingNames()));
|
|
8
8
|
NamesWeakMap.set('Enum', new Set(app.getEnumExistingNames()));
|
|
9
9
|
NamesWeakMap.set('Logic', new Set(app.getLogicExistingNames()));
|
|
@@ -80,6 +80,7 @@ export const TRACK_TYPE = {
|
|
|
80
80
|
PLAIN: 'plain',
|
|
81
81
|
PROPERTY: 'property',
|
|
82
82
|
ARRAY: 'array',
|
|
83
|
+
ARRAY_NO_FURTHER: 'array_no_further',
|
|
83
84
|
CALLEE: 'callee',
|
|
84
85
|
CALLEE_TEMPLATE: 'callee_template',
|
|
85
86
|
MODULE: 'module',
|
|
@@ -118,6 +119,10 @@ function getRelatedProperyName(nspropertyname) {
|
|
|
118
119
|
return '';
|
|
119
120
|
}
|
|
120
121
|
|
|
122
|
+
const TRACKING_ONLY_ONE_LAYER = [
|
|
123
|
+
'DataSource'
|
|
124
|
+
]
|
|
125
|
+
|
|
121
126
|
const BACKTRACKING_IGNORE_NAMESPACE = [
|
|
122
127
|
'nasl.core',
|
|
123
128
|
'',
|
|
@@ -154,7 +159,6 @@ const ROLE_PROPERTY = 'bindRoles';
|
|
|
154
159
|
|
|
155
160
|
export function tracking(node, startNode, callback) {
|
|
156
161
|
const { propertyMap } = getConceptMeta(node.concept);
|
|
157
|
-
// console.log(propertyMap)
|
|
158
162
|
for (const p of propertyMap) {
|
|
159
163
|
// console.log(p)
|
|
160
164
|
const [propertyName, _data] = p;
|
|
@@ -166,13 +170,20 @@ export function tracking(node, startNode, callback) {
|
|
|
166
170
|
}
|
|
167
171
|
continue;
|
|
168
172
|
}
|
|
173
|
+
const isOnlyOneLayerTracking = TRACKING_ONLY_ONE_LAYER.includes(node.concept);
|
|
169
174
|
const property = node[propertyName];
|
|
170
175
|
if (Array.isArray(property)) {
|
|
171
176
|
if (property.length > 0) {
|
|
172
177
|
if (property[0] instanceof BaseNode) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
178
|
+
if (!isOnlyOneLayerTracking) {
|
|
179
|
+
property.forEach((p) => {
|
|
180
|
+
callback(TRACK_TYPE.ARRAY, propertyName, p);
|
|
181
|
+
});
|
|
182
|
+
} else {
|
|
183
|
+
property.forEach((p) => {
|
|
184
|
+
callback(TRACK_TYPE.ARRAY_NO_FURTHER, propertyName, p);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
176
187
|
} else {
|
|
177
188
|
if (ROLE_PROPERTY === propertyName) {
|
|
178
189
|
const rootNode = node.rootNode;
|
|
@@ -208,7 +219,7 @@ export function tracking(node, startNode, callback) {
|
|
|
208
219
|
|
|
209
220
|
const rootNode = node.rootNode;
|
|
210
221
|
const ns = node[propertyName];
|
|
211
|
-
if (!ns) {
|
|
222
|
+
if (!ns || !node[relatedPropertyName]) {
|
|
212
223
|
callback(TRACK_TYPE.PLAIN, propertyName, property);
|
|
213
224
|
callback(TRACK_TYPE.PLAIN, relatedPropertyName, node[relatedPropertyName]);
|
|
214
225
|
break;
|
|
@@ -218,71 +229,84 @@ export function tracking(node, startNode, callback) {
|
|
|
218
229
|
callback(TRACK_TYPE.PLAIN, propertyName, property);
|
|
219
230
|
callback(TRACK_TYPE.PLAIN, relatedPropertyName, node[relatedPropertyName]);
|
|
220
231
|
} else {
|
|
221
|
-
const r1 = /app\.(?:entities|processes)\.([^.]+)\.logics/.exec(ns);
|
|
222
|
-
const r2 = /app\.processes\.([^.]+)\.elements\.([^.]+)\.logics/.exec(ns);
|
|
223
232
|
const calleeN = node[relatedPropertyName];
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
233
|
+
|
|
234
|
+
const r1 = /app\.processes\.([^.]+)\.logics/.exec(ns);
|
|
235
|
+
const r2 = /app\.processes\.([^.]+)\.elements\.([^.]+)\.logics/.exec(ns);
|
|
236
|
+
if(r1 || r2) {
|
|
237
|
+
// Process 处理
|
|
238
|
+
if (r2) {
|
|
239
|
+
const nodeName = r2[1];
|
|
240
|
+
const subNodename = r2[2];
|
|
241
|
+
if (subNodename) {
|
|
242
|
+
// 目前只有 userTask
|
|
243
|
+
const process = rootNode.processes.find((p) => p.name === nodeName);
|
|
244
|
+
if (process) {
|
|
245
|
+
const usertask = process.elements.find((e) => e.name === subNodename);
|
|
246
|
+
if (usertask) {
|
|
247
|
+
callback(TRACK_TYPE.CALLEE_TEMPLATE, propertyName, node[propertyName], {
|
|
248
|
+
rootNode: process,
|
|
249
|
+
metaNodes: [process, usertask],
|
|
250
|
+
nstemplate: `function(meta, meta2){ return "app.processes" + meta.name + ".elements." + meta2.name + ".logics"; }`,
|
|
251
|
+
nametemplate: `function(meta, meta2){ return "complete"; }`,
|
|
252
|
+
relatedPropertyName,
|
|
253
|
+
AppPropertyName: 'processes',
|
|
254
|
+
});
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
241
257
|
}
|
|
242
258
|
}
|
|
259
|
+
} else if (r1){
|
|
260
|
+
const nodeName = r1[1];
|
|
261
|
+
const process = rootNode.processes.find((p) => p.name === nodeName);
|
|
262
|
+
if (/launch/.test(calleeN) && process) {
|
|
263
|
+
// const prefix = /(launch|complete).+/.exec(calleeN)[1];
|
|
264
|
+
callback(TRACK_TYPE.CALLEE_TEMPLATE, propertyName, node[propertyName], {
|
|
265
|
+
rootNode: process,
|
|
266
|
+
metaNodes: [process],
|
|
267
|
+
nstemplate: `function(meta){ return "app.processes" + meta.name + ".logics"; }`,
|
|
268
|
+
nametemplate: `function(){ return "${calleeN}"; }`,
|
|
269
|
+
relatedPropertyName,
|
|
270
|
+
AppPropertyName: 'processes',
|
|
271
|
+
});
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
243
274
|
}
|
|
244
|
-
}
|
|
245
|
-
const nodeName = r1[1];
|
|
246
|
-
const process = rootNode.processes.find((p) => p.name === nodeName);
|
|
247
|
-
if (/launch/.test(calleeN) && process) {
|
|
248
|
-
// const prefix = /(launch|complete).+/.exec(calleeN)[1];
|
|
249
|
-
callback(TRACK_TYPE.CALLEE_TEMPLATE, propertyName, node[propertyName], {
|
|
250
|
-
rootNode: process,
|
|
251
|
-
metaNodes: [process],
|
|
252
|
-
nstemplate: `function(meta){ return "app.processes" + meta.name + ".logics"; }`,
|
|
253
|
-
nametemplate: `function(){ return "${calleeN}"; }`,
|
|
254
|
-
relatedPropertyName,
|
|
255
|
-
AppPropertyName: 'processes',
|
|
256
|
-
});
|
|
257
|
-
break;
|
|
258
|
-
}
|
|
275
|
+
}
|
|
259
276
|
|
|
260
|
-
|
|
261
|
-
|
|
277
|
+
const r3 = /app\.dataSources\.([^.]+)\.entities\.([^.]+)\.logics/.exec(ns);
|
|
278
|
+
if(r3) {
|
|
279
|
+
const datasourceName = r3[1];
|
|
280
|
+
const entityName = r3[2];
|
|
281
|
+
|
|
282
|
+
if (/get|create|update|delete|batchCreate|batchUpdate|batchDelete|import/.test(calleeN)) {
|
|
262
283
|
// const prefix = /(get|create|update|delete|batchCreate|batchUpdate|batchDelete|import)/.exec(calleeN)[1];
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
if (calleeNode) {
|
|
277
|
-
backtracking({
|
|
278
|
-
node,
|
|
279
|
-
startNode,
|
|
280
|
-
calleeNode,
|
|
281
|
-
propertyName,
|
|
282
|
-
relatedPropertyName,
|
|
283
|
-
}, callback);
|
|
284
|
+
const datasource = rootNode.dataSources.find(d => d.name === datasourceName);
|
|
285
|
+
if (datasource) {
|
|
286
|
+
const entity = datasource.entities.find((e) => e.name === entityName);
|
|
287
|
+
callback(TRACK_TYPE.CALLEE_TEMPLATE, propertyName, node[propertyName], {
|
|
288
|
+
rootNode: datasource,
|
|
289
|
+
metaNodes: [datasource, entity],
|
|
290
|
+
nstemplate: `function(meta, meta2){ return "app.dataSources" + meta.name + ".entities." + meta2.name + ".logics"; }`,
|
|
291
|
+
nametemplate: `function(){ return "${calleeN}"; }`,
|
|
292
|
+
relatedPropertyName,
|
|
293
|
+
AppPropertyName: 'dataSources',
|
|
294
|
+
});
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
284
297
|
}
|
|
285
298
|
}
|
|
299
|
+
const nsPath = `${ns}.${calleeN}`;
|
|
300
|
+
const calleeNode = getNodeByNodeCallee(rootNode, nsPath);
|
|
301
|
+
if (calleeNode) {
|
|
302
|
+
backtracking({
|
|
303
|
+
node,
|
|
304
|
+
startNode,
|
|
305
|
+
calleeNode,
|
|
306
|
+
propertyName,
|
|
307
|
+
relatedPropertyName,
|
|
308
|
+
}, callback);
|
|
309
|
+
}
|
|
286
310
|
}
|
|
287
311
|
break;
|
|
288
312
|
|
|
@@ -296,10 +320,11 @@ export function tracking(node, startNode, callback) {
|
|
|
296
320
|
callback(TRACK_TYPE.PROPERTY_TEMPLATE, propertyName, property, {
|
|
297
321
|
getRelatedVar: () => {
|
|
298
322
|
const queryCom = node.getAncestor('CallQueryComponent');
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
323
|
+
const entityNamespace = queryCom?.from?.entityNamespace;
|
|
324
|
+
if (queryCom && entityNamespace && property) {
|
|
325
|
+
const rootNode = queryCom.rootNode;
|
|
326
|
+
const entity = getNodeByNodeCallee(rootNode, `${entityNamespace}.${property}`);
|
|
327
|
+
return entity;
|
|
303
328
|
}
|
|
304
329
|
return null;
|
|
305
330
|
},
|
|
@@ -361,7 +386,7 @@ export function backtracking({ node, startNode, calleeNode, propertyName, relate
|
|
|
361
386
|
while (t) {
|
|
362
387
|
const pnode = t.parentNode;
|
|
363
388
|
if (pnode === approot) {
|
|
364
|
-
AppPropertyName = getAppPropertyName(
|
|
389
|
+
AppPropertyName = getAppPropertyName(t);
|
|
365
390
|
}
|
|
366
391
|
if (pnode !== approot && pnode !== startNode) {
|
|
367
392
|
t = pnode;
|