@lcap/nasl 3.8.3-beta.4 → 3.8.3-beta.5

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.
Files changed (88) hide show
  1. package/out/common/BaseNode.d.ts +9 -4
  2. package/out/common/BaseNode.js +73 -18
  3. package/out/common/BaseNode.js.map +1 -1
  4. package/out/concepts/App__.js +17 -13
  5. package/out/concepts/App__.js.map +1 -1
  6. package/out/concepts/AuthLogicForCallInterface__.js +2 -50
  7. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  8. package/out/concepts/BusinessComponent__.js +2 -42
  9. package/out/concepts/BusinessComponent__.js.map +1 -1
  10. package/out/concepts/BusinessLogic__.js +2 -50
  11. package/out/concepts/BusinessLogic__.js.map +1 -1
  12. package/out/concepts/CallFunction__.d.ts +1 -1
  13. package/out/concepts/CallFunction__.js +1 -1
  14. package/out/concepts/CallLogic__.js +2 -2
  15. package/out/concepts/CallLogic__.js.map +1 -1
  16. package/out/concepts/Identifier__.d.ts +2 -0
  17. package/out/concepts/Identifier__.js +51 -5
  18. package/out/concepts/Identifier__.js.map +1 -1
  19. package/out/concepts/Logic__.js +6 -101
  20. package/out/concepts/Logic__.js.map +1 -1
  21. package/out/concepts/MemberExpression__.d.ts +1 -1
  22. package/out/concepts/MemberExpression__.js +15 -3
  23. package/out/concepts/MemberExpression__.js.map +1 -1
  24. package/out/concepts/OverriddenLogic__.js +2 -50
  25. package/out/concepts/OverriddenLogic__.js.map +1 -1
  26. package/out/concepts/ProcessElementV2__.js +4 -0
  27. package/out/concepts/ProcessElementV2__.js.map +1 -1
  28. package/out/concepts/ProcessElement__.js +4 -0
  29. package/out/concepts/ProcessElement__.js.map +1 -1
  30. package/out/concepts/ProcessV2__.js +4 -0
  31. package/out/concepts/ProcessV2__.js.map +1 -1
  32. package/out/concepts/Process__.js +4 -0
  33. package/out/concepts/Process__.js.map +1 -1
  34. package/out/concepts/SubLogic__.js +5 -50
  35. package/out/concepts/SubLogic__.js.map +1 -1
  36. package/out/concepts/TypeAnnotation__.js +1 -1
  37. package/out/concepts/TypeAnnotation__.js.map +1 -1
  38. package/out/concepts/View__.js +10 -49
  39. package/out/concepts/View__.js.map +1 -1
  40. package/out/generator/genBundleFiles.js +5 -5
  41. package/out/generator/permission.js +21 -5
  42. package/out/generator/permission.js.map +1 -1
  43. package/out/generator/release-body/body.js.map +1 -1
  44. package/out/natural/transformTS2UI.js +5 -5
  45. package/out/natural/transformTS2UI.js.map +1 -1
  46. package/out/natural/transforms/transform2LogicItem.js +4 -4
  47. package/out/natural/transforms/transform2LogicItem.js.map +1 -1
  48. package/out/server/naslServer.js +17 -2
  49. package/out/server/naslServer.js.map +1 -1
  50. package/out/server/semanticData.d.ts +32 -0
  51. package/out/server/semanticData.js +371 -0
  52. package/out/server/semanticData.js.map +1 -0
  53. package/out/templator/block2nasl/viewMergeBlock.js +2 -1
  54. package/out/templator/block2nasl/viewMergeBlock.js.map +1 -1
  55. package/package.json +1 -1
  56. package/src/common/BaseNode.ts +106 -36
  57. package/src/concepts/App__.ts +17 -13
  58. package/src/concepts/AuthLogicForCallInterface__.ts +3 -56
  59. package/src/concepts/BusinessComponent__.ts +6 -51
  60. package/src/concepts/BusinessLogic__.ts +4 -56
  61. package/src/concepts/CallFunction__.ts +1 -1
  62. package/src/concepts/CallLogic__.ts +8 -4
  63. package/src/concepts/Identifier__.ts +57 -6
  64. package/src/concepts/Logic__.ts +9 -111
  65. package/src/concepts/MemberExpression__.ts +21 -7
  66. package/src/concepts/OverriddenLogic__.ts +4 -56
  67. package/src/concepts/ProcessElementV2__.ts +4 -0
  68. package/src/concepts/ProcessElement__.ts +4 -0
  69. package/src/concepts/ProcessV2__.ts +5 -0
  70. package/src/concepts/Process__.ts +4 -0
  71. package/src/concepts/SubLogic__.ts +6 -56
  72. package/src/concepts/TypeAnnotation__.ts +1 -1
  73. package/src/concepts/View__.ts +14 -54
  74. package/src/generator/genBundleFiles.ts +5 -5
  75. package/src/generator/permission.ts +23 -5
  76. package/src/generator/release-body/body.ts +0 -1
  77. package/src/natural/transformTS2UI.ts +5 -5
  78. package/src/natural/transforms/transform2LogicItem.ts +4 -4
  79. package/src/server/naslServer.ts +22 -2
  80. package/src/server/semanticData.ts +447 -0
  81. package/src/templator/block2nasl/viewMergeBlock.ts +2 -1
  82. package/src/translator/utils.ts +1 -1
  83. package/test/concepts/logic/__snapshots__/toEmbeddedTS.spec.ts.snap +182 -0
  84. package/test/concepts/logic/constant.ts +5 -0
  85. package/test/concepts/logic/fixtures/variable-host-call-logic-member-expression.json +267 -0
  86. package/test/concepts/logic/fixtures/variable-host-call-logic-nested-member-expression copy.json +457 -0
  87. package/test/concepts/logic/fixtures/variable-host-call-logic-with-handle-error-member-expression.json +267 -0
  88. package/test/concepts/logic/toEmbeddedTS.spec.ts +15 -0
@@ -0,0 +1,182 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`logic:toEmbeddedTS variable-host-call-logic-member-expression 1`] = `
4
+ "export function logic3() {
5
+ // @ts-ignore
6
+ let result = (() => {
7
+ const __$1 = app.logics.logic2();
8
+ return __$1.a;
9
+ })();
10
+
11
+ nasl.core.assign(result, app.logics.logic2().a);
12
+ return result;
13
+ /* -----以下是 returns 的默认值草稿------ */
14
+ }
15
+ "
16
+ `;
17
+
18
+ exports[`logic:toEmbeddedTS variable-host-call-logic-nested-member-expression copy 1`] = `
19
+ "export function logic3() {
20
+ // @ts-ignore
21
+ let result = (() => {
22
+ const __$1 = app.logics.logic4(
23
+ (() => {
24
+ const __$1 = app.logics.logic2();
25
+ return __$1.b;
26
+ })()
27
+ );
28
+ return __$1.a;
29
+ })();
30
+
31
+ nasl.core.assign(result, app.logics.logic4(app.logics.logic2().b).a);
32
+ return result;
33
+ /* -----以下是 returns 的默认值草稿------ */
34
+ }
35
+ "
36
+ `;
37
+
38
+ exports[`logic:toEmbeddedTS variable-host-call-logic-with-handle-error-member-expression 1`] = `
39
+ "export function logic3() {
40
+ // @ts-ignore
41
+ let result = (() => {
42
+ const __$1 = (() => {
43
+ const __wrapper = nasl.util.autoHandleError(app.logics.logic2);
44
+ return __wrapper();
45
+ })();
46
+ return __$1.a;
47
+ })();
48
+
49
+ nasl.core.assign(
50
+ result,
51
+ (() => {
52
+ const __wrapper = nasl.util.autoHandleError(app.logics.logic2);
53
+ return __wrapper();
54
+ })().a
55
+ );
56
+ return result;
57
+ /* -----以下是 returns 的默认值草稿------ */
58
+ }
59
+ "
60
+ `;
61
+
62
+ exports[`logic:toEmbeddedTS variable-host-call-query-conponent 1`] = `
63
+ "export function logic2(): {
64
+ list: nasl.collection.List<{
65
+ entity1: app.dataSources.defaultDS.entities.Entity1;
66
+ __name: \\"AStructure_62305639\\";
67
+ }>;
68
+ total: nasl.core.Long;
69
+ __name: \\"AStructure_7d582107\\";
70
+ } {
71
+ let result: {
72
+ list: nasl.collection.List<{
73
+ entity1: app.dataSources.defaultDS.entities.Entity1;
74
+ __name: \\"AStructure_62305639\\";
75
+ }>;
76
+ total: nasl.core.Long;
77
+ __name: \\"AStructure_7d582107\\";
78
+ };
79
+
80
+ nasl.core.assign(
81
+ result,
82
+ nasl.util.paginateLimit(
83
+ (function (): nasl.collection.List<{
84
+ entity1: app.dataSources.defaultDS.entities.Entity1;
85
+ __name: \\"AStructure_62305639\\";
86
+ }> {
87
+ nasl.langUtil
88
+ .FROM(
89
+ new nasl.langUtil.Collection<
90
+ [app.dataSources.defaultDS.entities.Entity1]
91
+ >()
92
+ )
93
+ .SELECT(() => new app.dataSources.defaultDS.entities.Entity1())
94
+ .ORDER_BY(() => [
95
+ new app.dataSources.defaultDS.entities.Entity1().createdTime,
96
+ new nasl.core.String(\\"StringLiteral\\"),
97
+ ]);
98
+ return;
99
+ })(),
100
+ new nasl.core.Long(10),
101
+ new nasl.core.Long(10)
102
+ )
103
+ );
104
+ return result;
105
+ /* -----以下是 returns 的默认值草稿------ */
106
+ }
107
+ "
108
+ `;
109
+
110
+ exports[`logic:toEmbeddedTS variable-host-call-query-conponent-wrapper 1`] = `
111
+ "export function logic2(): {
112
+ list: nasl.collection.List<{
113
+ entity1: app.dataSources.defaultDS.entities.Entity1;
114
+ __name: \\"AStructure_62305639\\";
115
+ }>;
116
+ total: nasl.core.Long;
117
+ __name: \\"AStructure_7d582107\\";
118
+ } {
119
+ let result: {
120
+ list: nasl.collection.List<{
121
+ entity1: app.dataSources.defaultDS.entities.Entity1;
122
+ __name: \\"AStructure_62305639\\";
123
+ }>;
124
+ total: nasl.core.Long;
125
+ __name: \\"AStructure_7d582107\\";
126
+ };
127
+
128
+ nasl.core.assign(
129
+ result,
130
+ nasl.util.paginateLimit(
131
+ (function (): nasl.collection.List<{
132
+ entity1: app.dataSources.defaultDS.entities.Entity1;
133
+ __name: \\"AStructure_62305639\\";
134
+ }> {
135
+ nasl.langUtil
136
+ .FROM(
137
+ new nasl.langUtil.Collection<
138
+ [app.dataSources.defaultDS.entities.Entity1]
139
+ >()
140
+ )
141
+ .SELECT(() => new app.dataSources.defaultDS.entities.Entity1())
142
+ .ORDER_BY(() => [
143
+ new app.dataSources.defaultDS.entities.Entity1().createdTime,
144
+ new nasl.core.String(\\"StringLiteral\\"),
145
+ ]);
146
+ return;
147
+ })(),
148
+ new nasl.core.Long(10),
149
+ new nasl.core.Long(10)
150
+ )
151
+ );
152
+ return result;
153
+ /* -----以下是 returns 的默认值草稿------ */
154
+ }
155
+ "
156
+ `;
157
+
158
+ exports[`logic:toEmbeddedTS with-annotation 1`] = `
159
+ "export function logic1(param1: nasl.core.String): nasl.core.String {
160
+ let result: nasl.core.String;
161
+
162
+ nasl.core.assign(result, param1);
163
+ return result;
164
+ /* -----以下是 returns 的默认值草稿------ */
165
+ /* -----以下是 params 的默认值草稿------ */
166
+ }
167
+ "
168
+ `;
169
+
170
+ exports[`logic:toEmbeddedTS with-annotation-with-default 1`] = `
171
+ "export function logic1(
172
+ param1: nasl.core.String = new nasl.core.String(\\"StringLiteral\\")
173
+ ): nasl.core.String {
174
+ let result: nasl.core.String;
175
+
176
+ nasl.core.assign(result, param1);
177
+ return result;
178
+ /* -----以下是 returns 的默认值草稿------ */
179
+ /* -----以下是 params 的默认值草稿------ */
180
+ }
181
+ "
182
+ `;
@@ -0,0 +1,5 @@
1
+ import { basename } from 'path';
2
+ import { getCases } from '../utils';
3
+
4
+ export const ConceptName = basename(__dirname);
5
+ export const cases = getCases(ConceptName);
@@ -0,0 +1,267 @@
1
+ {
2
+ "concept": "App",
3
+ "id": "ab35095a-d99f-4667-b509-299b5517d0b9",
4
+ "ideVersion": "3.9",
5
+ "name": "dsadasds321312",
6
+ "title": "苏方舟测试(勿删)",
7
+ "icon": "",
8
+ "desc": "",
9
+ "dnsAddr": "http://dsadasds321312.csforkf.lcap.codewave-test.163yun.com",
10
+ "hasUserCenter": true,
11
+ "hasAuth": true,
12
+ "dataSources": [],
13
+ "structures": [],
14
+ "enums": [],
15
+ "logics": [
16
+ {
17
+ "__$Selected": true,
18
+ "concept": "Logic",
19
+ "name": "logic3",
20
+ "title": null,
21
+ "description": null,
22
+ "triggerType": null,
23
+ "cron": null,
24
+ "overridable": null,
25
+ "transactional": {
26
+ "concept": "Transactional",
27
+ "enabled": false,
28
+ "propagation": null,
29
+ "isolation": null
30
+ },
31
+ "typeParams": [],
32
+ "params": [],
33
+ "returns": [
34
+ {
35
+ "concept": "Return",
36
+ "name": "result",
37
+ "description": null,
38
+ "typeAnnotation": null,
39
+ "defaultValue": null
40
+ }
41
+ ],
42
+ "variables": [],
43
+ "body": [
44
+ {
45
+ "concept": "Start",
46
+ "label": "开始",
47
+ "folded": false
48
+ },
49
+ {
50
+ "concept": "Assignment",
51
+ "left": {
52
+ "concept": "Identifier",
53
+ "name": "result",
54
+ "folded": false
55
+ },
56
+ "right": {
57
+ "concept": "MemberExpression",
58
+ "object": {
59
+ "concept": "CallLogic",
60
+ "uuid": "a2cf38a95b7249edabaea73f6fde2502",
61
+ "calleeNamespace": "app.logics",
62
+ "calleeName": "logic2",
63
+ "handleError": false,
64
+ "typeArguments": [],
65
+ "arguments": [],
66
+ "folded": false
67
+ },
68
+ "property": {
69
+ "concept": "Identifier",
70
+ "name": "a",
71
+ "folded": false
72
+ },
73
+ "folded": false
74
+ },
75
+ "folded": false,
76
+ "changedTime": 1717421422155
77
+ },
78
+ {
79
+ "concept": "End",
80
+ "label": "结束",
81
+ "folded": false
82
+ }
83
+ ],
84
+ "playground": [],
85
+ "applyAnnotations": null,
86
+ "composedBy": null
87
+ },
88
+ {
89
+ "concept": "Logic",
90
+ "name": "logic2",
91
+ "title": null,
92
+ "description": null,
93
+ "triggerType": null,
94
+ "cron": null,
95
+ "overridable": null,
96
+ "transactional": {
97
+ "concept": "Transactional",
98
+ "enabled": false,
99
+ "propagation": null,
100
+ "isolation": null
101
+ },
102
+ "typeParams": [],
103
+ "params": [],
104
+ "returns": [
105
+ {
106
+ "concept": "Return",
107
+ "name": "result",
108
+ "description": null,
109
+ "typeAnnotation": null,
110
+ "defaultValue": null
111
+ }
112
+ ],
113
+ "variables": [],
114
+ "body": [
115
+ {
116
+ "concept": "Start",
117
+ "label": "开始",
118
+ "folded": false
119
+ },
120
+ {
121
+ "concept": "Assignment",
122
+ "left": {
123
+ "concept": "Identifier",
124
+ "name": "result",
125
+ "folded": false
126
+ },
127
+ "right": {
128
+ "concept": "NewComposite",
129
+ "properties": [
130
+ {
131
+ "concept": "Identifier",
132
+ "name": "a",
133
+ "folded": false
134
+ },
135
+ {
136
+ "concept": "Identifier",
137
+ "name": "b",
138
+ "folded": false
139
+ }
140
+ ],
141
+ "rights": [
142
+ {
143
+ "concept": "SelectMembers",
144
+ "hideMembers": false,
145
+ "expression": {
146
+ "concept": "NumericLiteral",
147
+ "value": "123",
148
+ "folded": false,
149
+ "typeAnnotation": {
150
+ "concept": "TypeAnnotation",
151
+ "typeKind": "primitive",
152
+ "typeNamespace": "nasl.core",
153
+ "typeName": "Long"
154
+ }
155
+ },
156
+ "members": []
157
+ },
158
+ {
159
+ "concept": "SelectMembers",
160
+ "hideMembers": false,
161
+ "expression": {
162
+ "concept": "StringLiteral",
163
+ "value": "012",
164
+ "folded": false,
165
+ "offsetX": 107,
166
+ "offsetY": 267
167
+ },
168
+ "members": []
169
+ }
170
+ ],
171
+ "assignmentLines": [
172
+ {
173
+ "concept": "AssignmentLine",
174
+ "leftIndex": [
175
+ 0,
176
+ 0
177
+ ],
178
+ "rightIndex": [
179
+ 0
180
+ ]
181
+ },
182
+ {
183
+ "concept": "AssignmentLine",
184
+ "leftIndex": [
185
+ 0,
186
+ 1
187
+ ],
188
+ "rightIndex": [
189
+ 1
190
+ ]
191
+ }
192
+ ],
193
+ "hideProperties": false,
194
+ "hideDefaults": false,
195
+ "autoConnection": true,
196
+ "folded": false,
197
+ "offsetX": -43.23828125,
198
+ "offsetY": 495.1640625,
199
+ "typeAnnotation": {
200
+ "concept": "TypeAnnotation",
201
+ "typeKind": "anonymousStructure",
202
+ "properties": [
203
+ {
204
+ "concept": "StructureProperty",
205
+ "name": "a",
206
+ "typeAnnotation": null
207
+ },
208
+ {
209
+ "concept": "StructureProperty",
210
+ "name": "b",
211
+ "typeAnnotation": null
212
+ }
213
+ ]
214
+ }
215
+ },
216
+ "folded": false,
217
+ "changedTime": 1717385790487
218
+ },
219
+ {
220
+ "concept": "End",
221
+ "label": "结束",
222
+ "folded": false
223
+ }
224
+ ],
225
+ "playground": [],
226
+ "applyAnnotations": null,
227
+ "composedBy": null
228
+ }
229
+ ],
230
+ "overriddenLogics": [],
231
+ "interfaces": [],
232
+ "frontendTypes": [],
233
+ "backend": {
234
+ "concept": "Backend",
235
+ "name": "",
236
+ "variables": []
237
+ },
238
+ "processes": [],
239
+ "processV2s": [],
240
+ "roles": [],
241
+ "configuration": {
242
+ "concept": "Configuration",
243
+ "groups": []
244
+ },
245
+ "connectorDependencies": [],
246
+ "interfaceDependencies": [],
247
+ "dependencies": [],
248
+ "integration": {
249
+ "concept": "Integration",
250
+ "microApp": {},
251
+ "connectors": []
252
+ },
253
+ "authLogics": [],
254
+ "authLogicsForCallInterface": [],
255
+ "connections": [],
256
+ "triggerLaunchers": [],
257
+ "metadataTypes": [],
258
+ "preferenceMap": {
259
+ "namingConvention.tableName": "snake_case",
260
+ "namingConvention.columnName": "snake_case",
261
+ "javaLogicEnabled": "false",
262
+ "onDemandInterfaceGeneration": "true",
263
+ "serverValidationRules": "auto",
264
+ "metadataTypeEnable": false
265
+ },
266
+ "changedTime": 1717494049956
267
+ }