@lcap/nasl 1.0.0 → 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 +39 -127
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/operators.d.ts +13 -0
- package/out/automate/engine/operators.js +63 -0
- package/out/automate/engine/operators.js.map +1 -0
- package/out/automate/engine/uniqueName.d.ts +6 -0
- package/out/automate/engine/uniqueName.js +39 -0
- package/out/automate/engine/uniqueName.js.map +1 -0
- package/out/automate/engine/utils.d.ts +1 -0
- package/out/automate/engine/utils.js +105 -67
- package/out/automate/engine/utils.js.map +1 -1
- package/out/common/BaseNode.d.ts +1 -1
- package/out/common/BaseNode.js +13 -3
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +52 -49
- package/out/concepts/App__.js +95 -60
- 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__.d.ts +11 -0
- package/out/concepts/Assignee__.js +36 -2
- 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 +4 -4
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +2 -2
- 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 +25 -5
- 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 +24 -22
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +35 -5
- package/out/concepts/CallQueryComponent__.js +344 -99
- 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 +9 -2
- 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 +5 -2
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.d.ts +1 -0
- package/out/concepts/Configuration__.js +5 -2
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Constant__.js +7 -7
- 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 +26 -9
- 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 +11 -3
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +9 -0
- package/out/concepts/EntityProperty__.js +23 -8
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +6 -3
- package/out/concepts/Entity__.js +28 -24
- 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__.d.ts +1 -0
- package/out/concepts/Enum__.js +15 -5
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +2 -2
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ForEachStatement__.d.ts +1 -1
- package/out/concepts/ForEachStatement__.js +5 -5
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.d.ts +18 -0
- package/out/concepts/Function__.js +100 -5
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +2 -12
- 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 +10 -5
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js +21 -14
- 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__.d.ts +4 -0
- package/out/concepts/Logic__.js +59 -46
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +1 -2
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +1 -85
- package/out/concepts/Module__.js +13 -114
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +0 -86
- package/out/concepts/Namespace__.js +12 -119
- 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 +3 -2
- package/out/concepts/Param__.js +15 -8
- 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 +3 -3
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +39 -18
- 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 +21 -14
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js +2 -2
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.d.ts +1 -0
- package/out/concepts/QueryFieldExpression__.js +12 -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__.d.ts +3 -0
- package/out/concepts/QueryGroupByExpression__.js +21 -1
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.d.ts +4 -0
- package/out/concepts/QueryJoinExpression__.js +16 -5
- package/out/concepts/QueryJoinExpression__.js.map +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 +2 -2
- 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__.d.ts +1 -1
- package/out/concepts/Return__.js +16 -11
- 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 +2 -9
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +6 -6
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +22 -15
- 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 +56 -6
- 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__.d.ts +1 -1
- package/out/concepts/Variable__.js +16 -11
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js +6 -6
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.js +21 -21
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +3 -1
- package/out/concepts/View__.js +53 -32
- 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.configuration.js +1 -1
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.interface.d.ts +2 -0
- package/out/concepts/basics/stdlib/nasl.interface.js +4 -4
- package/out/concepts/basics/stdlib/nasl.interface.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +268 -6
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js +1 -1
- package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js.map +1 -1
- package/out/concepts/basics/types/index.d.ts +1 -0
- package/out/concepts/basics/types/index.js +3 -1
- package/out/concepts/basics/types/index.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/enums/KEYWORDS.js +0 -9
- package/out/enums/KEYWORDS.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/manager/diagnostic.d.ts +1 -1
- package/out/server/createUiTs.js +1 -0
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/extendBaseNode.d.ts +1 -0
- package/out/server/extendBaseNode.js +323 -0
- package/out/server/extendBaseNode.js.map +1 -0
- package/out/server/getLogics.js +31 -2
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +47 -2
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +7 -2
- package/out/server/getProcesses.js +220 -20
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/getScope.d.ts +3 -1
- package/out/server/getScope.js +30 -14
- package/out/server/getScope.js.map +1 -1
- package/out/server/index.d.ts +1 -0
- package/out/server/index.js +1 -0
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +7 -5
- package/out/server/naslServer.js +249 -372
- 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.d.ts +1 -1
- package/out/server/translator.js +22 -2
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +32 -11
- 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/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.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 +11 -8
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genSelectBlock.js +13 -22
- 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 +16 -12
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +5 -3
- package/out/templator/utils.js +2 -1
- 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 +38 -2
- package/out/utils/index.js.map +1 -1
- package/out/utils/string.d.ts +1 -1
- package/out/utils/string.js +38 -9
- package/out/utils/string.js.map +1 -1
- package/package.json +1 -2
- package/src/automate/engine/index.js +38 -128
- package/src/automate/engine/operators.js +63 -0
- package/src/automate/engine/uniqueName.js +36 -0
- package/src/automate/engine/utils.js +108 -69
- package/src/common/BaseNode.ts +14 -3
- package/src/concepts/App__.ts +138 -101
- package/src/concepts/Argument__.ts +1 -1
- package/src/concepts/Assignee__.ts +32 -2
- 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 +4 -4
- package/src/concepts/BindDirective__.ts +2 -2
- package/src/concepts/BindEvent__.ts +10 -6
- package/src/concepts/BooleanLiteral__.ts +1 -1
- package/src/concepts/CallFunction__.ts +36 -18
- package/src/concepts/CallInterface__.ts +1 -1
- package/src/concepts/CallLogic__.ts +55 -24
- package/src/concepts/CallQueryComponent__.ts +357 -134
- package/src/concepts/Comment__.ts +2 -2
- package/src/concepts/CompletionProperty__.ts +1 -1
- package/src/concepts/ConfigGroup__.ts +5 -3
- package/src/concepts/ConfigPropertyValue__.ts +1 -1
- package/src/concepts/ConfigProperty__.ts +6 -2
- package/src/concepts/Configuration__.ts +5 -2
- package/src/concepts/Constant__.ts +7 -7
- package/src/concepts/DataElement__.ts +1 -1
- package/src/concepts/DataSource__.ts +389 -0
- package/src/concepts/Destination__.ts +28 -10
- package/src/concepts/End__.ts +3 -3
- package/src/concepts/EntityIndex__.ts +12 -3
- package/src/concepts/EntityProperty__.ts +24 -8
- package/src/concepts/Entity__.ts +39 -27
- package/src/concepts/EnumItem__.ts +1 -1
- package/src/concepts/Enum__.ts +16 -5
- package/src/concepts/Event__.ts +2 -2
- package/src/concepts/ForEachStatement__.ts +5 -5
- package/src/concepts/Function__.ts +101 -7
- package/src/concepts/Identifier__.ts +2 -12
- package/src/concepts/IfStatement__.ts +10 -10
- package/src/concepts/InterfaceParam__.ts +10 -5
- package/src/concepts/Interface__.ts +22 -14
- package/src/concepts/JSBlock__.ts +1 -1
- package/src/concepts/LogicItem__.ts +1 -1
- package/src/concepts/Logic__.ts +60 -43
- package/src/concepts/MemberExpression__.ts +1 -2
- package/src/concepts/Module__.ts +16 -211
- package/src/concepts/Namespace__.ts +12 -215
- package/src/concepts/NullLiteral__.ts +1 -1
- package/src/concepts/NumericLiteral__.ts +1 -1
- package/src/concepts/Param__.ts +17 -9
- package/src/concepts/Point__.ts +1 -1
- package/src/concepts/ProcessComponent__.ts +3 -3
- package/src/concepts/ProcessElement__.ts +43 -21
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +21 -15
- package/src/concepts/QueryAggregateExpression__.ts +2 -2
- package/src/concepts/QueryFieldExpression__.ts +14 -2
- package/src/concepts/QueryFromExpression__.ts +14 -3
- package/src/concepts/QueryGroupByExpression__.ts +24 -1
- package/src/concepts/QueryJoinExpression__.ts +16 -5
- package/src/concepts/QueryLimitExpression__.ts +9 -0
- package/src/concepts/QueryOrderByExpression__.ts +1 -1
- package/src/concepts/QuerySelectExpression__.ts +2 -2
- package/src/concepts/Rect__.ts +1 -1
- package/src/concepts/Return__.ts +16 -11
- 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 +2 -9
- package/src/concepts/StructureProperty__.ts +6 -6
- package/src/concepts/Structure__.ts +22 -14
- 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 +55 -25
- 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 +16 -11
- package/src/concepts/ViewComponent__.ts +6 -6
- package/src/concepts/ViewElement__.ts +21 -21
- package/src/concepts/View__.ts +54 -32
- package/src/concepts/WhileStatement__.ts +5 -5
- package/src/concepts/basics/stdlib/nasl.configuration.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.interface.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.util.ts +269 -6
- package/src/concepts/basics/stdlib/reference2TypeAnnotationList.ts +1 -1
- package/src/concepts/basics/types/index.ts +1 -0
- package/src/concepts/index__.ts +1 -0
- package/src/enums/KEYWORDS.ts +0 -9
- package/src/generator/genBundleFiles.ts +8 -3
- package/src/generator/genMetaData.ts +13 -13
- package/src/manager/diagnostic.ts +1 -1
- package/src/server/createUiTs.ts +1 -0
- package/src/server/extendBaseNode.ts +318 -0
- package/src/server/getLogics.ts +33 -4
- package/src/server/getMemberIdentifier.ts +49 -2
- package/src/server/getProcesses.ts +231 -21
- package/src/server/getScope.ts +41 -24
- package/src/server/index.ts +1 -0
- package/src/server/naslServer.ts +248 -366
- package/src/server/process2LogicNamespace.ts +29 -19
- package/src/server/translator.ts +25 -2
- package/src/service/storage/init.ts +32 -12
- 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/genGetBlock.ts +1 -1
- package/src/templator/genGridViewBlock.ts +22 -21
- package/src/templator/genListViewBlock.ts +9 -5
- package/src/templator/genQueryComponent.ts +12 -9
- package/src/templator/genSelectBlock.ts +14 -23
- package/src/templator/genTableBlock.ts +18 -16
- package/src/templator/genUpdateBlock.ts +17 -13
- package/src/templator/utils.ts +5 -2
- package/src/test/integration/connect-file.ts +6 -6
- package/src/translator/index.ts +1 -1
- package/src/utils/index.ts +38 -1
- package/src/utils/string.ts +39 -9
- package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +0 -3
- package/out/concepts/basics/stdlib/nasl.browser copy.js +0 -70
- package/out/concepts/basics/stdlib/nasl.browser copy.js.map +0 -1
- package/out/terms/LEVEL_NAME_MAP.d.ts +0 -26
- package/out/terms/LEVEL_NAME_MAP.js +0 -30
- package/out/terms/LEVEL_NAME_MAP.js.map +0 -1
package/out/utils/string.js
CHANGED
|
@@ -32,15 +32,44 @@ exports.firstLowerCase = firstLowerCase;
|
|
|
32
32
|
* @param set 数据集合,Array | Map | Set
|
|
33
33
|
* @param start 数字起始
|
|
34
34
|
*/
|
|
35
|
-
function unique(key, set, start = 1) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
function unique(key, set, start = 1, insensitive = false) {
|
|
36
|
+
let has;
|
|
37
|
+
if (insensitive) {
|
|
38
|
+
has = (_key) => {
|
|
39
|
+
const lkey = _key.toLowerCase();
|
|
40
|
+
if (set instanceof Set || set instanceof Map) {
|
|
41
|
+
// return set.has(_key);
|
|
42
|
+
const iterator = set.keys();
|
|
43
|
+
let i = iterator.next();
|
|
44
|
+
while (!i.done) {
|
|
45
|
+
const name = i.value;
|
|
46
|
+
if (name.toLowerCase() === lkey) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
i = iterator.next();
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
else if (Array.isArray(set))
|
|
54
|
+
// return set.includes(_key);
|
|
55
|
+
return set.some((s) => s.toLowerCase() === lkey);
|
|
56
|
+
else {
|
|
57
|
+
// return set[_key];
|
|
58
|
+
const keys = Object.keys(set);
|
|
59
|
+
return keys.some((k) => k.toLowerCase() === lkey);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
has = (_key) => {
|
|
65
|
+
if (set instanceof Set || set instanceof Map)
|
|
66
|
+
return set.has(_key);
|
|
67
|
+
else if (Array.isArray(set))
|
|
68
|
+
return set.includes(_key);
|
|
69
|
+
else
|
|
70
|
+
return set[_key];
|
|
71
|
+
};
|
|
72
|
+
}
|
|
44
73
|
while (has(key))
|
|
45
74
|
key = key.replace(/\d*$/, (m) => String(m === '' ? start : +m + 1));
|
|
46
75
|
return key;
|
package/out/utils/string.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AAAnG,QAAA,WAAW,eAAwF;AAEhH;;;;GAIG;AACI,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AAA3H,QAAA,WAAW,eAAgH;AACxI;;;GAGG;AACI,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AAA3F,QAAA,cAAc,kBAA6E;AACxG;;;GAGG;AACI,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AAA3F,QAAA,cAAc,kBAA6E;AAExG;;;;GAIG;AACH,SAAgB,MAAM,CAAC,GAAW,
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lcap/nasl",
|
|
3
3
|
"description": "NetEase Application Specific Language",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.12.0-beta",
|
|
5
5
|
"author": "Forrest <rainforest92@126.com>",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "tsc -watch -p ./",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"fs-extra": "^10.1.0",
|
|
39
39
|
"json-stringify-safe": "^5.0.1",
|
|
40
40
|
"lodash": "^4.17.21",
|
|
41
|
-
"module-alias": "^2.2.2",
|
|
42
41
|
"pluralize": "^8.0.0",
|
|
43
42
|
"postcss": "^8.4.14",
|
|
44
43
|
"qs": "^6.10.1",
|
|
@@ -2,6 +2,10 @@ import { uniq, omit } from 'lodash';
|
|
|
2
2
|
import { BaseNode } from '../../common/BaseNode';
|
|
3
3
|
import { tracking, TRACK_TYPE, IGNORE_PROPERTY } from './utils';
|
|
4
4
|
import { getConceptConstructor, getConceptMeta } from '../../decorators/index';
|
|
5
|
+
// import { unique, firstUpperCase } from '../../utils/string';
|
|
6
|
+
import uniqueNameModule from './uniqueName';
|
|
7
|
+
import operatorModule from './operators';
|
|
8
|
+
|
|
5
9
|
let id = 0;
|
|
6
10
|
class TemplateMeta {
|
|
7
11
|
constructor(node) {
|
|
@@ -168,7 +172,7 @@ class TemplateMeta {
|
|
|
168
172
|
// return `_set(${this.name}, "name", getGenUniqNameFunctionName(${this.name}, "${this.node.concept}"));`;
|
|
169
173
|
// _setTableName(${this.name}, ${this.name}.name + '_' + app.id.slice(0,6));`;
|
|
170
174
|
// }
|
|
171
|
-
return `_set(${this.name}, "name", getGenUniqNameFunctionName(${this.name}, "${this.node.concept}", app), (updatedObj) => { ${this.name} = updatedObj; })`;
|
|
175
|
+
return `_set(${this.name}, "name", _uniqueName.getGenUniqNameFunctionName(${this.name}, "${this.node.concept}", app), (updatedObj) => { ${this.name} = updatedObj; })`;
|
|
172
176
|
}
|
|
173
177
|
|
|
174
178
|
genRoleBind() {
|
|
@@ -245,126 +249,7 @@ function autoScript(stack) {
|
|
|
245
249
|
|
|
246
250
|
return `
|
|
247
251
|
(function () {
|
|
248
|
-
|
|
249
|
-
const has = (_key) => {
|
|
250
|
-
if (set instanceof Set || set instanceof Map)
|
|
251
|
-
return set.has(_key);
|
|
252
|
-
else if (Array.isArray(set))
|
|
253
|
-
return set.includes(_key);
|
|
254
|
-
else
|
|
255
|
-
return set[_key];
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
while (has(key))
|
|
259
|
-
key = key.replace(/\\d*$/, (m) => String(m === '' ? start : (+m) + 1));
|
|
260
|
-
return key;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function alphaUpper(name) {
|
|
264
|
-
if (!name) {
|
|
265
|
-
return '';
|
|
266
|
-
}
|
|
267
|
-
return name[0].toUpperCase() + name.substring(1);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
const NamesWeakMap = new Map();
|
|
271
|
-
|
|
272
|
-
function initAppUniqueNames(app) {
|
|
273
|
-
NamesWeakMap.set('Entity', new Set(app.getEntityExistingNames()));
|
|
274
|
-
NamesWeakMap.set('Structure', new Set(app.getStructureExistingNames()));
|
|
275
|
-
NamesWeakMap.set('Enum', new Set(app.getEnumExistingNames()));
|
|
276
|
-
NamesWeakMap.set('Logic', new Set(app.getLogicExistingNames()));
|
|
277
|
-
NamesWeakMap.set('Interface', new Set(app.getInterfaceExistingNames()));
|
|
278
|
-
NamesWeakMap.set('View', new Set(app.getViewExistingNames()));
|
|
279
|
-
NamesWeakMap.set('Process', new Set(app.getProcessExistingNames()));
|
|
280
|
-
NamesWeakMap.set('Role', new Set(app.getRoleExistingNames()));
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function getGenUniqNameFunctionName(item, concept, app) {
|
|
284
|
-
const p = item.parentNode;
|
|
285
|
-
if(!p) {
|
|
286
|
-
const nameSet = NamesWeakMap.get(concept);
|
|
287
|
-
const n = unique(item.name, nameSet);
|
|
288
|
-
nameSet.add(n);
|
|
289
|
-
return n;
|
|
290
|
-
}
|
|
291
|
-
const f1 = p["get" + concept + "UniqueName"];
|
|
292
|
-
const f2 = p["get" + concept + "ExistingNames"]
|
|
293
|
-
if(f1 && f2) {
|
|
294
|
-
const names = f2.call(p);
|
|
295
|
-
const t = names.filter(n => n === item.name);
|
|
296
|
-
if(t.length > 1) {
|
|
297
|
-
return f1.call(p, item.name);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return item.name;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
let BaseNodeConstructor;
|
|
304
|
-
let getConceptConstructor;
|
|
305
|
-
let getConceptMeta;
|
|
306
|
-
|
|
307
|
-
function instanceOfBaseNode(item) {
|
|
308
|
-
return (item instanceof BaseNodeConstructor);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
function _set(item, propertyName, value, callback) {
|
|
312
|
-
if(instanceOfBaseNode(value)) {
|
|
313
|
-
value.parentNode = item;
|
|
314
|
-
value.parentKey = propertyName;
|
|
315
|
-
}
|
|
316
|
-
if(item[propertyName] !== value) {
|
|
317
|
-
item.update({
|
|
318
|
-
[propertyName]: value,
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
if(instanceOfBaseNode(value) && callback) {
|
|
322
|
-
callback(item[propertyName]);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
function _push(item, propertyName, value) {
|
|
328
|
-
if(!item[propertyName]){
|
|
329
|
-
item[propertyName] = [];
|
|
330
|
-
}
|
|
331
|
-
value.parentNode = item;
|
|
332
|
-
value.parentKey = propertyName;
|
|
333
|
-
item[propertyName].push(value);
|
|
334
|
-
const index = item[propertyName].length;
|
|
335
|
-
value.create({
|
|
336
|
-
index,
|
|
337
|
-
parentNode: item,
|
|
338
|
-
parentKey: propertyName,
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function _create(concept) {
|
|
343
|
-
const _ctor = getConceptConstructor(concept);
|
|
344
|
-
const item = new _ctor();
|
|
345
|
-
const { propertyMap } = getConceptMeta(concept);
|
|
346
|
-
for(const p of propertyMap) {
|
|
347
|
-
const [propertyName] = p;
|
|
348
|
-
const t = item[propertyName];
|
|
349
|
-
if(Array.isArray(t)) {
|
|
350
|
-
_set(item, propertyName, []);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
return item;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
function _addModule(app, name, belongs, data) {
|
|
357
|
-
const ms = app[belongs];
|
|
358
|
-
const exist = ms.find(m => m.name === name);
|
|
359
|
-
if(!exist) {
|
|
360
|
-
app["addModuleIn" + alphaUpper(belongs)](data);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
function _bindRoles(){
|
|
365
|
-
return Array.prototype.map.call(arguments, r => r.name);
|
|
366
|
-
}
|
|
367
|
-
// let _tempConstructor;
|
|
252
|
+
const injectModule = {};
|
|
368
253
|
|
|
369
254
|
const exportRoles = function() {
|
|
370
255
|
return ${JSON.stringify(roleNASL)};
|
|
@@ -372,11 +257,17 @@ function autoScript(stack) {
|
|
|
372
257
|
|
|
373
258
|
const execTemplate = function(app, getCtor, getCMeta, base, rootBindCallback, roleCallback, finalCallback) {
|
|
374
259
|
let _templateObjects = [];
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
260
|
+
const {
|
|
261
|
+
_set,
|
|
262
|
+
_push,
|
|
263
|
+
_create,
|
|
264
|
+
_addModule,
|
|
265
|
+
_bindRoles
|
|
266
|
+
} = injectModule.operators;
|
|
267
|
+
|
|
268
|
+
const _uniqueName = new injectModule.uniqueName();
|
|
378
269
|
|
|
379
|
-
initAppUniqueNames(app);
|
|
270
|
+
_uniqueName.initAppUniqueNames(app);
|
|
380
271
|
|
|
381
272
|
app.emit('collect:start', {
|
|
382
273
|
actionMsg: '导入页面模板'
|
|
@@ -420,7 +311,10 @@ function autoScript(stack) {
|
|
|
420
311
|
|
|
421
312
|
return {
|
|
422
313
|
execTemplate,
|
|
423
|
-
exportRoles
|
|
314
|
+
exportRoles,
|
|
315
|
+
importModule(key, m) {
|
|
316
|
+
injectModule[key] = m;
|
|
317
|
+
},
|
|
424
318
|
}
|
|
425
319
|
})();`;
|
|
426
320
|
}
|
|
@@ -430,6 +324,7 @@ export function autoTemplate(node) {
|
|
|
430
324
|
const stack = [];
|
|
431
325
|
const startNode = node;
|
|
432
326
|
let rootNode = true;
|
|
327
|
+
const finalOps = [];
|
|
433
328
|
function iterator(node) {
|
|
434
329
|
if (node && !visitedMap.has(node)) {
|
|
435
330
|
const meta = new TemplateMeta(node);
|
|
@@ -447,12 +342,21 @@ export function autoTemplate(node) {
|
|
|
447
342
|
break;
|
|
448
343
|
case TRACK_TYPE.PROPERTY:
|
|
449
344
|
case TRACK_TYPE.ARRAY:
|
|
450
|
-
iterator(property);
|
|
345
|
+
iterator(property);
|
|
451
346
|
const pmeta = visitedMap.get(property);
|
|
452
347
|
meta.addBinds(type, propertyName, pmeta);
|
|
453
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;
|
|
454
357
|
case TRACK_TYPE.CALLEE:
|
|
455
358
|
iterator(rootNode);
|
|
359
|
+
iterator(calleeNode);
|
|
456
360
|
const cmeta = visitedMap.get(calleeNode);
|
|
457
361
|
if (AppPropertyName) {
|
|
458
362
|
meta.addRootBinds(AppPropertyName, visitedMap.get(rootNode));
|
|
@@ -505,6 +409,7 @@ export function autoTemplate(node) {
|
|
|
505
409
|
}
|
|
506
410
|
|
|
507
411
|
iterator(node);
|
|
412
|
+
finalOps.forEach(f => { f(); });
|
|
508
413
|
return autoScript(stack);
|
|
509
414
|
}
|
|
510
415
|
|
|
@@ -527,6 +432,11 @@ export function getRoles(script) {
|
|
|
527
432
|
return exportRoles();
|
|
528
433
|
}
|
|
529
434
|
export function applyTemplate(script, app, rootBindCallback, roleCallback, finalCallback) {
|
|
530
|
-
const { execTemplate } = eval(script);
|
|
435
|
+
const { execTemplate, importModule } = eval(script);
|
|
436
|
+
// 为了兼容 2.11 老模板
|
|
437
|
+
if(importModule) {
|
|
438
|
+
importModule('operators', operatorModule);
|
|
439
|
+
importModule('uniqueName', uniqueNameModule);
|
|
440
|
+
}
|
|
531
441
|
execTemplate(app, getConceptConstructor, getConceptMeta, BaseNode, rootBindCallback, roleCallback, finalCallback);
|
|
532
442
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { BaseNode } from '../../common/BaseNode';
|
|
2
|
+
import { getConceptConstructor, getConceptMeta } from '../../decorators/index';
|
|
3
|
+
import { firstUpperCase } from '../../utils/string';
|
|
4
|
+
|
|
5
|
+
function instanceOfBaseNode(item) {
|
|
6
|
+
return (item instanceof BaseNode);
|
|
7
|
+
}
|
|
8
|
+
const ops = {
|
|
9
|
+
_set(item, propertyName, value, callback) {
|
|
10
|
+
if(instanceOfBaseNode(value)) {
|
|
11
|
+
value.parentNode = item;
|
|
12
|
+
value.parentKey = propertyName;
|
|
13
|
+
}
|
|
14
|
+
if(item[propertyName] !== value) {
|
|
15
|
+
item.update({
|
|
16
|
+
[propertyName]: value,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if(instanceOfBaseNode(value) && callback) {
|
|
20
|
+
callback(item[propertyName]);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
_push(item, propertyName, value) {
|
|
25
|
+
if(!item[propertyName]){
|
|
26
|
+
item[propertyName] = [];
|
|
27
|
+
}
|
|
28
|
+
value.parentNode = item;
|
|
29
|
+
value.parentKey = propertyName;
|
|
30
|
+
item[propertyName].push(value);
|
|
31
|
+
const index = item[propertyName].length;
|
|
32
|
+
value.create({
|
|
33
|
+
index,
|
|
34
|
+
parentNode: item,
|
|
35
|
+
parentKey: propertyName,
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
_create(concept) {
|
|
39
|
+
const _ctor = getConceptConstructor(concept);
|
|
40
|
+
const item = new _ctor();
|
|
41
|
+
const { propertyMap } = getConceptMeta(concept);
|
|
42
|
+
for(const p of propertyMap) {
|
|
43
|
+
const [propertyName] = p;
|
|
44
|
+
const t = item[propertyName];
|
|
45
|
+
if(Array.isArray(t)) {
|
|
46
|
+
ops._set(item, propertyName, []);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return item;
|
|
50
|
+
},
|
|
51
|
+
_addModule(app, name, belongs, data) {
|
|
52
|
+
const ms = app[belongs];
|
|
53
|
+
const exist = ms.find(m => m.name === name);
|
|
54
|
+
if(!exist) {
|
|
55
|
+
app["addModuleIn" + firstUpperCase(belongs)](data);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
_bindRoles(){
|
|
59
|
+
return Array.prototype.map.call(arguments, r => r.name);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default ops;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { unique } from '../../utils/string';
|
|
2
|
+
class uniqueName {
|
|
3
|
+
NamesWeakMap = new Map();
|
|
4
|
+
initAppUniqueNames(app) {
|
|
5
|
+
const NamesWeakMap = this.NamesWeakMap;
|
|
6
|
+
NamesWeakMap.set('DataSource', new Set(app.getDataSourceExistingNames()));
|
|
7
|
+
NamesWeakMap.set('Structure', new Set(app.getStructureExistingNames()));
|
|
8
|
+
NamesWeakMap.set('Enum', new Set(app.getEnumExistingNames()));
|
|
9
|
+
NamesWeakMap.set('Logic', new Set(app.getLogicExistingNames()));
|
|
10
|
+
NamesWeakMap.set('Interface', new Set(app.getInterfaceExistingNames()));
|
|
11
|
+
NamesWeakMap.set('View', new Set(app.getViewExistingNames()));
|
|
12
|
+
NamesWeakMap.set('Process', new Set(app.getProcessExistingNames()));
|
|
13
|
+
NamesWeakMap.set('Role', new Set(app.getRoleExistingNames()));
|
|
14
|
+
}
|
|
15
|
+
getGenUniqNameFunctionName(item, concept) {
|
|
16
|
+
const p = item.parentNode;
|
|
17
|
+
const NamesWeakMap = this.NamesWeakMap;
|
|
18
|
+
if(!p) {
|
|
19
|
+
const nameSet = NamesWeakMap.get(concept);
|
|
20
|
+
const n = unique(item.name, nameSet, 1, true);
|
|
21
|
+
nameSet.add(n);
|
|
22
|
+
return n;
|
|
23
|
+
}
|
|
24
|
+
const f1 = p["get" + concept + "UniqueName"];
|
|
25
|
+
const f2 = p["get" + concept + "ExistingNames"]
|
|
26
|
+
if(f1 && f2) {
|
|
27
|
+
const names = f2.call(p);
|
|
28
|
+
const t = names.filter(n => n === item.name);
|
|
29
|
+
if(t.length > 1) {
|
|
30
|
+
return f1.call(p, item.name);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return item.name;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export default uniqueName;
|