@lcap/nasl 1.0.0-alpha.13 → 1.0.0-alpha.14
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 +1 -1
- package/out/automate/engine/index.js.map +1 -1
- package/out/common/BaseNode.d.ts +4 -4
- package/out/common/BaseNode.js +45 -41
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +17 -0
- package/out/concepts/App__.js +54 -12
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +2 -2
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +8 -6
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +21 -21
- package/out/concepts/BindAttribute__.js +4 -3
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +3 -3
- package/out/concepts/BindDirective__.js +22 -2
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +9 -8
- package/out/concepts/BindEvent__.js +17 -7
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.js +10 -5
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +11 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +1 -0
- package/out/concepts/CallLogic__.js +17 -7
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +0 -1
- package/out/concepts/CallQueryComponent__.js +5 -8
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +6 -2
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Destination__.js +10 -7
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +3 -0
- package/out/concepts/EntityProperty__.js +38 -0
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +34 -31
- package/out/concepts/Entity__.js +29 -12
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.js +1 -1
- 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 +8 -12
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.js +4 -4
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +13 -7
- 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/InterfaceParam__.d.ts +2 -0
- package/out/concepts/InterfaceParam__.js +10 -0
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js +3 -3
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +1 -0
- package/out/concepts/LogicItem__.js +14 -0
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +1 -0
- package/out/concepts/Logic__.js +16 -11
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Module__.js +8 -8
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.js +12 -12
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/Param__.d.ts +1 -0
- package/out/concepts/Param__.js +3 -0
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +2 -2
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +5 -5
- 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 +4 -4
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +2 -2
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +1 -0
- package/out/concepts/Return__.js +6 -3
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -1
- package/out/concepts/StringLiteral__.js +2 -2
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +3 -6
- package/out/concepts/StructureProperty__.js +38 -32
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +3 -3
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +3 -3
- 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/TypeAnnotation__.js +10 -2
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +1 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +1 -0
- package/out/concepts/ValidationRule__.js +27 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +1 -0
- package/out/concepts/Variable__.js +6 -3
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js +5 -5
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +63 -60
- package/out/concepts/ViewElement__.js +123 -88
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +4 -0
- package/out/concepts/View__.js +26 -10
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +3 -1
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.auth.js +39 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js +70 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser.js +6 -35
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js +25 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.util.js +0 -29
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/enums/KEYWORDS.js +1 -0
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.js +98 -72
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/server/createUiTs.d.ts +1 -0
- package/out/server/createUiTs.js +15 -1
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/getLogics.js +27 -45
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +3 -3
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +1 -1
- package/out/server/getProcesses.js +2 -2
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/naslServer.d.ts +1 -3
- package/out/server/naslServer.js +73 -57
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.d.ts +0 -3
- package/out/server/translator.js +16 -7
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +21 -12
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +3 -3
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +6 -10
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +2 -2
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genQueryComponent.d.ts +2 -0
- package/out/templator/genQueryComponent.js +1 -0
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genUpdateBlock.js +5 -5
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +3 -1
- package/out/templator/utils.js +2 -1
- package/out/templator/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/automate/engine/index.js +1 -1
- package/src/common/BaseNode.ts +46 -42
- package/src/concepts/App__.ts +54 -12
- package/src/concepts/Argument__.ts +3 -2
- package/src/concepts/BinaryExpression__.ts +8 -6
- package/src/concepts/BindAttribute__.ts +26 -32
- package/src/concepts/BindDirective__.ts +24 -9
- package/src/concepts/BindEvent__.ts +25 -29
- package/src/concepts/CallFunction__.ts +11 -6
- package/src/concepts/CallInterface__.ts +11 -1
- package/src/concepts/CallLogic__.ts +21 -40
- package/src/concepts/CallQueryComponent__.ts +6 -10
- package/src/concepts/Comment__.ts +6 -2
- package/src/concepts/ConfigGroup__.ts +1 -1
- package/src/concepts/ConfigProperty__.ts +1 -1
- package/src/concepts/Configuration__.ts +1 -1
- package/src/concepts/Destination__.ts +9 -7
- package/src/concepts/EntityProperty__.ts +36 -0
- package/src/concepts/Entity__.ts +63 -50
- package/src/concepts/Enum__.ts +1 -1
- package/src/concepts/Event__.ts +1 -1
- package/src/concepts/ForEachStatement__.ts +8 -13
- package/src/concepts/Function__.ts +4 -4
- package/src/concepts/Identifier__.ts +15 -18
- package/src/concepts/IfStatement__.ts +2 -2
- package/src/concepts/InterfaceParam__.ts +11 -0
- package/src/concepts/Interface__.ts +3 -3
- package/src/concepts/LogicItem__.ts +15 -0
- package/src/concepts/Logic__.ts +34 -50
- package/src/concepts/Module__.ts +8 -8
- package/src/concepts/Namespace__.ts +12 -12
- package/src/concepts/Param__.ts +3 -0
- package/src/concepts/ProcessComponent__.ts +2 -2
- package/src/concepts/ProcessElement__.ts +5 -5
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +4 -4
- package/src/concepts/QueryFromExpression__.ts +1 -1
- package/src/concepts/QueryJoinExpression__.ts +2 -2
- package/src/concepts/QuerySelectExpression__.ts +1 -1
- package/src/concepts/Return__.ts +6 -3
- package/src/concepts/StringLiteral__.ts +2 -2
- package/src/concepts/StructureProperty__.ts +36 -29
- package/src/concepts/Structure__.ts +3 -3
- package/src/concepts/SwitchCase__.ts +3 -3
- package/src/concepts/SwitchStatement__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +8 -2
- package/src/concepts/UnaryExpression__.ts +1 -1
- package/src/concepts/ValidationRule__.ts +24 -1
- package/src/concepts/Variable__.ts +6 -3
- package/src/concepts/ViewComponent__.ts +5 -5
- package/src/concepts/ViewElement__.ts +183 -147
- package/src/concepts/View__.ts +30 -32
- package/src/concepts/WhileStatement__.ts +1 -1
- package/src/concepts/basics/stdlib/index.ts +3 -1
- package/src/concepts/basics/stdlib/nasl.auth.ts +35 -0
- package/src/concepts/basics/stdlib/nasl.browser.ts +7 -41
- package/src/concepts/basics/stdlib/nasl.configuration.ts +21 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +0 -29
- package/src/enums/KEYWORDS.ts +1 -0
- package/src/generator/genBundleFiles.ts +102 -74
- package/src/server/createUiTs.ts +18 -3
- package/src/server/getLogics.ts +29 -47
- package/src/server/getMemberIdentifier.ts +3 -3
- package/src/server/getProcesses.ts +2 -2
- package/src/server/naslServer.ts +84 -62
- package/src/server/translator.ts +18 -6
- package/src/service/storage/init.ts +20 -13
- package/src/templator/genCreateBlock.ts +3 -3
- package/src/templator/genCurdEditMultipleKeyBlock.ts +22 -23
- package/src/templator/genCurdMultipleKeyBlock.ts +2 -2
- package/src/templator/genGetBlock.ts +1 -1
- package/src/templator/genQueryComponent.ts +1 -0
- package/src/templator/genUpdateBlock.ts +5 -6
- package/src/templator/utils.ts +2 -1
|
@@ -2,6 +2,8 @@ import { TranslatorState, shiftState, withSourceMap } from '../translator';
|
|
|
2
2
|
import Logic from './Logic__';
|
|
3
3
|
import Param from './Param__';
|
|
4
4
|
import { ElementToVueOptions } from './ViewElement__';
|
|
5
|
+
import { getNaslNodeByNodeCallee } from '../automate/engine/utils';
|
|
6
|
+
|
|
5
7
|
//================================================================================
|
|
6
8
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
7
9
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -64,8 +66,6 @@ export class CallLogic extends LogicItem {
|
|
|
64
66
|
@property('Argument')
|
|
65
67
|
arguments: Array<Argument> = [];
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
|
|
69
69
|
/**
|
|
70
70
|
* @param source 需要合并的部分参数
|
|
71
71
|
*/
|
|
@@ -79,13 +79,6 @@ export class CallLogic extends LogicItem {
|
|
|
79
79
|
return super.from(source, parentNode, parentKey) as CallLogic;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
82
|
/**
|
|
90
83
|
* 插入类型标注
|
|
91
84
|
* @internal
|
|
@@ -105,7 +98,7 @@ export class CallLogic extends LogicItem {
|
|
|
105
98
|
const relationOptions = { parentNode: this, parentKey: 'typeArguments' };
|
|
106
99
|
let typeAnnotation: TypeAnnotation;
|
|
107
100
|
if (options instanceof TypeAnnotation) {
|
|
108
|
-
options.
|
|
101
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
109
102
|
typeAnnotation = options;
|
|
110
103
|
Object.assign(typeAnnotation, relationOptions);
|
|
111
104
|
} else {
|
|
@@ -118,8 +111,6 @@ export class CallLogic extends LogicItem {
|
|
|
118
111
|
return typeAnnotation;
|
|
119
112
|
}
|
|
120
113
|
|
|
121
|
-
|
|
122
|
-
|
|
123
114
|
/**
|
|
124
115
|
* 插入类型标注
|
|
125
116
|
* @param typeAnnotationOptions 类型标注参数
|
|
@@ -142,8 +133,6 @@ export class CallLogic extends LogicItem {
|
|
|
142
133
|
return node;
|
|
143
134
|
}
|
|
144
135
|
|
|
145
|
-
|
|
146
|
-
|
|
147
136
|
/**
|
|
148
137
|
* 添加类型标注
|
|
149
138
|
* @internal
|
|
@@ -163,8 +152,6 @@ export class CallLogic extends LogicItem {
|
|
|
163
152
|
return this._insertTypeAnnotationAt(options as any, index);
|
|
164
153
|
}
|
|
165
154
|
|
|
166
|
-
|
|
167
|
-
|
|
168
155
|
/**
|
|
169
156
|
* 添加类型标注
|
|
170
157
|
* @param typeAnnotationOptions 类型标注参数
|
|
@@ -188,11 +175,6 @@ export class CallLogic extends LogicItem {
|
|
|
188
175
|
return node;
|
|
189
176
|
}
|
|
190
177
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
178
|
/**
|
|
197
179
|
* 插入实际参数
|
|
198
180
|
* @internal
|
|
@@ -212,7 +194,7 @@ export class CallLogic extends LogicItem {
|
|
|
212
194
|
const relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
213
195
|
let argument: Argument;
|
|
214
196
|
if (options instanceof Argument) {
|
|
215
|
-
options.
|
|
197
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
216
198
|
argument = options;
|
|
217
199
|
Object.assign(argument, relationOptions);
|
|
218
200
|
} else {
|
|
@@ -225,8 +207,6 @@ export class CallLogic extends LogicItem {
|
|
|
225
207
|
return argument;
|
|
226
208
|
}
|
|
227
209
|
|
|
228
|
-
|
|
229
|
-
|
|
230
210
|
/**
|
|
231
211
|
* 插入实际参数
|
|
232
212
|
* @param argumentOptions 实际参数参数
|
|
@@ -249,8 +229,6 @@ export class CallLogic extends LogicItem {
|
|
|
249
229
|
return node;
|
|
250
230
|
}
|
|
251
231
|
|
|
252
|
-
|
|
253
|
-
|
|
254
232
|
/**
|
|
255
233
|
* 添加实际参数
|
|
256
234
|
* @internal
|
|
@@ -270,8 +248,6 @@ export class CallLogic extends LogicItem {
|
|
|
270
248
|
return this._insertArgumentAt(options as any, index);
|
|
271
249
|
}
|
|
272
250
|
|
|
273
|
-
|
|
274
|
-
|
|
275
251
|
/**
|
|
276
252
|
* 添加实际参数
|
|
277
253
|
* @param argumentOptions 实际参数参数
|
|
@@ -295,9 +271,6 @@ export class CallLogic extends LogicItem {
|
|
|
295
271
|
return node;
|
|
296
272
|
}
|
|
297
273
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
274
|
/**
|
|
302
275
|
* 删除类型标注
|
|
303
276
|
* @param typeAnnotation 已有的类型标注实例
|
|
@@ -305,7 +278,7 @@ export class CallLogic extends LogicItem {
|
|
|
305
278
|
removeTypeAnnotation(typeAnnotation: TypeAnnotation): void;
|
|
306
279
|
|
|
307
280
|
removeTypeAnnotation(options: TypeAnnotation) {
|
|
308
|
-
|
|
281
|
+
const typeAnnotation: TypeAnnotation = options;
|
|
309
282
|
return typeAnnotation.delete();
|
|
310
283
|
}
|
|
311
284
|
|
|
@@ -332,8 +305,6 @@ export class CallLogic extends LogicItem {
|
|
|
332
305
|
return params;
|
|
333
306
|
}
|
|
334
307
|
|
|
335
|
-
|
|
336
|
-
|
|
337
308
|
/**
|
|
338
309
|
* 删除实际参数
|
|
339
310
|
* @param argument 已有的实际参数实例
|
|
@@ -341,7 +312,7 @@ export class CallLogic extends LogicItem {
|
|
|
341
312
|
removeArgument(argument: Argument): void;
|
|
342
313
|
|
|
343
314
|
removeArgument(options: Argument) {
|
|
344
|
-
|
|
315
|
+
const argument: Argument = options;
|
|
345
316
|
return argument.delete();
|
|
346
317
|
}
|
|
347
318
|
|
|
@@ -382,6 +353,11 @@ export class CallLogic extends LogicItem {
|
|
|
382
353
|
}
|
|
383
354
|
return '';
|
|
384
355
|
}
|
|
356
|
+
|
|
357
|
+
// 用于logic回填
|
|
358
|
+
get calleewholeKey(): string {
|
|
359
|
+
return this.calleeNamespace + '.' + this.calleeName;
|
|
360
|
+
}
|
|
385
361
|
get calleeKey(): string {
|
|
386
362
|
const tsCalleeNamespace = this.tsCalleeNamespace;
|
|
387
363
|
const calleeName = this.calleeName;
|
|
@@ -399,7 +375,7 @@ export class CallLogic extends LogicItem {
|
|
|
399
375
|
/**
|
|
400
376
|
* 设置argment 触发别的地方的更新
|
|
401
377
|
*/
|
|
402
|
-
setArgumentName({ argument }: { argument: Argument[]}) {
|
|
378
|
+
setArgumentName({ argument }: { argument: Argument[] }) {
|
|
403
379
|
// argument.setKeyword(newKeyword);
|
|
404
380
|
// this.arguments = argument;
|
|
405
381
|
}
|
|
@@ -521,7 +497,7 @@ export class CallLogic extends LogicItem {
|
|
|
521
497
|
|
|
522
498
|
toVue(options?: ElementToVueOptions): string {
|
|
523
499
|
let code = '';
|
|
524
|
-
if (this.calleeNamespace === 'nasl.browser') {
|
|
500
|
+
if (this.calleeNamespace === 'nasl.browser' || this.calleeNamespace === 'nasl.auth' || this.calleeNamespace === 'nasl.configuration') {
|
|
525
501
|
code += '$global.';
|
|
526
502
|
}
|
|
527
503
|
code += this.calleeName;
|
|
@@ -660,7 +636,7 @@ export class CallLogic extends LogicItem {
|
|
|
660
636
|
code += `JSON.parse`;
|
|
661
637
|
break;
|
|
662
638
|
}
|
|
663
|
-
} else if (calleeNamespace === 'nasl.browser') {
|
|
639
|
+
} else if (calleeNamespace === 'nasl.browser' || calleeNamespace === 'nasl.auth' || calleeNamespace === 'nasl.configuration') {
|
|
664
640
|
code += `this.$global.${this.calleeName}`;
|
|
665
641
|
} else {
|
|
666
642
|
code += `this.${this.calleeName}`;
|
|
@@ -681,6 +657,12 @@ export class CallLogic extends LogicItem {
|
|
|
681
657
|
@withSourceMap()
|
|
682
658
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
683
659
|
let code = this.calleeKey;
|
|
660
|
+
if (Array.isArray(this.typeArguments) && this.typeArguments.length) {
|
|
661
|
+
// 如果有内容
|
|
662
|
+
const typeAnnotation = this.typeArguments[0];
|
|
663
|
+
code += `<`;
|
|
664
|
+
code += `${typeAnnotation.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }))}>`;
|
|
665
|
+
}
|
|
684
666
|
code += '(';
|
|
685
667
|
this.arguments.forEach((arg, index) => {
|
|
686
668
|
const tsCalleeNamespace = this.tsCalleeNamespace;
|
|
@@ -694,7 +676,6 @@ export class CallLogic extends LogicItem {
|
|
|
694
676
|
code += ', ';
|
|
695
677
|
});
|
|
696
678
|
code += ');\n';
|
|
697
|
-
|
|
698
679
|
return code;
|
|
699
680
|
}
|
|
700
681
|
|
|
@@ -704,7 +685,7 @@ export class CallLogic extends LogicItem {
|
|
|
704
685
|
//================================================================================
|
|
705
686
|
}
|
|
706
687
|
|
|
707
|
-
classMap
|
|
688
|
+
classMap.CallLogic = CallLogic;
|
|
708
689
|
export default CallLogic;
|
|
709
690
|
//================================================================================
|
|
710
691
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -241,7 +241,7 @@ export class CallQueryComponent extends LogicItem {
|
|
|
241
241
|
name: options,
|
|
242
242
|
}, this, 'groupBy');
|
|
243
243
|
} else if (options instanceof QueryGroupByExpression) {
|
|
244
|
-
options.
|
|
244
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
245
245
|
queryGroupByExpression = options;
|
|
246
246
|
Object.assign(queryGroupByExpression, relationOptions);
|
|
247
247
|
} else {
|
|
@@ -359,7 +359,7 @@ export class CallQueryComponent extends LogicItem {
|
|
|
359
359
|
const relationOptions = { parentNode: this, parentKey: 'orderBy' };
|
|
360
360
|
let queryOrderByExpression: QueryOrderByExpression;
|
|
361
361
|
if (options instanceof QueryOrderByExpression) {
|
|
362
|
-
options.
|
|
362
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
363
363
|
queryOrderByExpression = options;
|
|
364
364
|
Object.assign(queryOrderByExpression, relationOptions);
|
|
365
365
|
} else {
|
|
@@ -901,13 +901,14 @@ export class CallQueryComponent extends LogicItem {
|
|
|
901
901
|
return Structure.from({
|
|
902
902
|
concept: 'Structure',
|
|
903
903
|
name: structureName,
|
|
904
|
+
origin: 'CallQueryComponent',
|
|
904
905
|
properties: [...genPropertyListOfFrom(this.from), ...genPropertyListOfAggregate(this)],
|
|
905
906
|
});
|
|
906
907
|
}
|
|
907
908
|
|
|
908
909
|
saveStructure() {
|
|
909
910
|
const source = this.genStructure();
|
|
910
|
-
console.log(source);
|
|
911
|
+
// console.log(source);
|
|
911
912
|
if (this.typeAnnotation) {
|
|
912
913
|
const structure = this.app.structures.find((item) => item.name === this.typeAnnotation.typeName);
|
|
913
914
|
if (structure) {
|
|
@@ -938,11 +939,6 @@ export class CallQueryComponent extends LogicItem {
|
|
|
938
939
|
} catch {}
|
|
939
940
|
}
|
|
940
941
|
|
|
941
|
-
delete() {
|
|
942
|
-
this.removeStructure();
|
|
943
|
-
super.delete();
|
|
944
|
-
}
|
|
945
|
-
|
|
946
942
|
getEntityNames(node: QueryFromExpression | QueryJoinExpression, set = new Set()) {
|
|
947
943
|
if (node?.entityName)
|
|
948
944
|
set.add(node.entityName);
|
|
@@ -1008,11 +1004,11 @@ export class CallQueryComponent extends LogicItem {
|
|
|
1008
1004
|
}));
|
|
1009
1005
|
if (!children || children.length === 0)
|
|
1010
1006
|
return;
|
|
1011
|
-
|
|
1007
|
+
|
|
1012
1008
|
children.forEach((item) => {
|
|
1013
1009
|
item.icon = 'variable';
|
|
1014
1010
|
});
|
|
1015
|
-
return { name: '聚合属性别名', icon:
|
|
1011
|
+
return { name: '聚合属性别名', icon: 'category', children };
|
|
1016
1012
|
}
|
|
1017
1013
|
|
|
1018
1014
|
//================================================================================
|
|
@@ -67,7 +67,7 @@ export class Comment extends LogicItem {
|
|
|
67
67
|
//================================================================================
|
|
68
68
|
|
|
69
69
|
toJS(state?: TranslatorState): string {
|
|
70
|
-
return
|
|
70
|
+
return `/* ${this.value} */`;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
public static getDefaultOptions() {
|
|
@@ -79,7 +79,11 @@ export class Comment extends LogicItem {
|
|
|
79
79
|
@withSourceMap()
|
|
80
80
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
81
81
|
let code = '';
|
|
82
|
-
code += `\n${indent(state.tabSize)}
|
|
82
|
+
code += `\n${indent(state.tabSize)}
|
|
83
|
+
/**
|
|
84
|
+
* 注释不用翻译
|
|
85
|
+
*/
|
|
86
|
+
\n`;
|
|
83
87
|
return code;
|
|
84
88
|
}
|
|
85
89
|
//================================================================================
|
|
@@ -123,7 +123,7 @@ export class ConfigGroup extends BaseNode {
|
|
|
123
123
|
name: options,
|
|
124
124
|
}, this, 'properties');
|
|
125
125
|
} else if (options instanceof ConfigProperty) {
|
|
126
|
-
options.
|
|
126
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
127
127
|
configProperty = options;
|
|
128
128
|
Object.assign(configProperty, relationOptions);
|
|
129
129
|
} else {
|
|
@@ -129,7 +129,7 @@ export class ConfigProperty extends BaseNode {
|
|
|
129
129
|
name: options,
|
|
130
130
|
}, this, 'values');
|
|
131
131
|
} else if (options instanceof ConfigPropertyValue) {
|
|
132
|
-
options.
|
|
132
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
133
133
|
configPropertyValue = options;
|
|
134
134
|
Object.assign(configPropertyValue, relationOptions);
|
|
135
135
|
} else {
|
|
@@ -107,7 +107,7 @@ export class Configuration extends BaseNode {
|
|
|
107
107
|
name: options,
|
|
108
108
|
}, this, 'groups');
|
|
109
109
|
} else if (options instanceof ConfigGroup) {
|
|
110
|
-
options.
|
|
110
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
111
111
|
configGroup = options;
|
|
112
112
|
Object.assign(configGroup, relationOptions);
|
|
113
113
|
} else {
|
|
@@ -115,7 +115,7 @@ export class Destination extends LogicItem {
|
|
|
115
115
|
const relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
116
116
|
let argument: Argument;
|
|
117
117
|
if (options instanceof Argument) {
|
|
118
|
-
options.
|
|
118
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
119
119
|
argument = options;
|
|
120
120
|
Object.assign(argument, relationOptions);
|
|
121
121
|
} else {
|
|
@@ -359,13 +359,13 @@ export class Destination extends LogicItem {
|
|
|
359
359
|
code += prependCode;
|
|
360
360
|
code += '\n';
|
|
361
361
|
if (this.tsCalleeNamespace && this.viewName) {
|
|
362
|
-
code += `${this.tsCalleeNamespace}.${this.viewName}.$destination(`;
|
|
362
|
+
code += `${this.tsCalleeNamespace}.${this.viewName}.$destination({`;
|
|
363
363
|
if (Array.isArray(this.arguments)) {
|
|
364
364
|
this.arguments.forEach((argument: Argument) => {
|
|
365
|
-
code += argument.toEmbeddedTS(shiftState(state, code)) + ', ';
|
|
365
|
+
code += argument.toEmbeddedTS(shiftState(state, code), false, true) + ', ';
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
|
-
code += `);\n`;
|
|
368
|
+
code += `});\n`;
|
|
369
369
|
}
|
|
370
370
|
code += indent(state.tabSize + 1) + `}\n`;
|
|
371
371
|
return code;
|
|
@@ -379,13 +379,13 @@ export class Destination extends LogicItem {
|
|
|
379
379
|
code = `${utils.firstLowerCase(this.concept)}: () => {\n`;
|
|
380
380
|
code += indent(state.tabSize + 2);
|
|
381
381
|
if (this.tsCalleeNamespace && this.tsName) {
|
|
382
|
-
code += `${this.tsCalleeNamespace}.${this.tsName}.$destination(`;
|
|
382
|
+
code += `${this.tsCalleeNamespace}.${this.tsName}.$destination({`;
|
|
383
383
|
if (Array.isArray(this.arguments)) {
|
|
384
384
|
this.arguments.forEach((argument: Argument) => {
|
|
385
|
-
code += argument.toEmbeddedTS(shiftState(state, code)) + ', ';
|
|
385
|
+
code += argument.toEmbeddedTS(shiftState(state, code), false, true) + ', ';
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
|
-
code += `);\n`;
|
|
388
|
+
code += `});\n`;
|
|
389
389
|
}
|
|
390
390
|
code += indent(state.tabSize + 1) + `},\n`;
|
|
391
391
|
return code;
|
|
@@ -398,6 +398,8 @@ export class Destination extends LogicItem {
|
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
400
|
code += `);\n`;
|
|
401
|
+
} else {
|
|
402
|
+
code += '__IDENTIFIER__';
|
|
401
403
|
}
|
|
402
404
|
return code;
|
|
403
405
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { dataTypesMap } from './basics/types';
|
|
2
2
|
import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
|
|
3
|
+
import { getNodeByNodeCallee, getNaslNodeByNodeCallee } from '../automate/engine/utils';
|
|
3
4
|
type changeType = 'up' | 'down';
|
|
4
5
|
//================================================================================
|
|
5
6
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
@@ -331,6 +332,41 @@ export class EntityProperty extends BaseNode {
|
|
|
331
332
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
332
333
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
333
334
|
//================================================================================
|
|
335
|
+
|
|
336
|
+
get hasChildren() {
|
|
337
|
+
const { typeKind } = this.typeAnnotation;
|
|
338
|
+
if (typeKind === 'reference' || typeKind === 'generic') {
|
|
339
|
+
return [{}];
|
|
340
|
+
}
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
get isTreeLeaf() {
|
|
344
|
+
return !this.hasChildren;
|
|
345
|
+
}
|
|
346
|
+
getSelectRef() {
|
|
347
|
+
const { typeName, typeKind, typeNamespace } = this.typeAnnotation;
|
|
348
|
+
let completionChildren;
|
|
349
|
+
if (typeKind === 'reference') {
|
|
350
|
+
if (typeNamespace === 'nasl.ui') {
|
|
351
|
+
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
352
|
+
const properties = node.properties || [];
|
|
353
|
+
completionChildren = properties;
|
|
354
|
+
} else {
|
|
355
|
+
const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
|
|
356
|
+
const properties = node.properties || [];
|
|
357
|
+
completionChildren = properties;
|
|
358
|
+
}
|
|
359
|
+
} else if (typeKind === 'generic') {
|
|
360
|
+
if (typeNamespace === 'nasl.collection') {
|
|
361
|
+
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
362
|
+
const properties = node.properties || [];
|
|
363
|
+
completionChildren = properties;
|
|
364
|
+
}
|
|
365
|
+
} else {
|
|
366
|
+
completionChildren = undefined;
|
|
367
|
+
}
|
|
368
|
+
return completionChildren;
|
|
369
|
+
}
|
|
334
370
|
/**
|
|
335
371
|
* 设置是否必填
|
|
336
372
|
*/
|
package/src/concepts/Entity__.ts
CHANGED
|
@@ -110,15 +110,15 @@ export class Entity extends BaseNode {
|
|
|
110
110
|
/**
|
|
111
111
|
* 设置实体名称
|
|
112
112
|
*/
|
|
113
|
-
setName(name: string) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
113
|
+
// setName(name: string) {
|
|
114
|
+
// const object = {
|
|
115
|
+
// name,
|
|
116
|
+
// };
|
|
117
|
+
// this.update({
|
|
118
|
+
// ...object,
|
|
119
|
+
// field: 'name',
|
|
120
|
+
// });
|
|
121
|
+
// }
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* 设置实体描述
|
|
@@ -132,7 +132,7 @@ export class Entity extends BaseNode {
|
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
getPropertyExistingNames(excludedList: Array<EntityProperty> = []) {
|
|
136
136
|
const excludedSet = new Set(excludedList);
|
|
137
137
|
return (this.properties || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
138
138
|
}
|
|
@@ -141,24 +141,24 @@ export class Entity extends BaseNode {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
* 插入实体字段
|
|
145
|
+
* @internal
|
|
146
|
+
* @param name 实体字段名称,如果不填会自动生成一个唯一名称
|
|
147
|
+
*/
|
|
148
148
|
_insertPropertyAt(name: string, index: number): EntityProperty;
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
* 插入实体字段
|
|
152
|
+
* @internal
|
|
153
|
+
* @param propertyOptions 实体字段参数
|
|
154
|
+
*/
|
|
155
155
|
_insertPropertyAt(propertyOptions: Partial<EntityProperty>, index: number): EntityProperty;
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
* 插入实体字段
|
|
159
|
+
* @internal
|
|
160
|
+
* @param property 已有的实体字段实例
|
|
161
|
+
*/
|
|
162
162
|
_insertPropertyAt(property: EntityProperty, index: number): EntityProperty;
|
|
163
163
|
|
|
164
164
|
_insertPropertyAt(options: string | Partial<EntityProperty> | EntityProperty, index: number) {
|
|
@@ -176,7 +176,7 @@ export class Entity extends BaseNode {
|
|
|
176
176
|
name: options,
|
|
177
177
|
}, this, 'properties');
|
|
178
178
|
} else if (options instanceof EntityProperty) {
|
|
179
|
-
options.
|
|
179
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
180
180
|
property = options;
|
|
181
181
|
Object.assign(property, relationOptions);
|
|
182
182
|
} else {
|
|
@@ -273,7 +273,6 @@ export class Entity extends BaseNode {
|
|
|
273
273
|
return node;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
|
|
277
276
|
getEntityIndexExistingNames(excludedList: Array<EntityIndex> = []) {
|
|
278
277
|
const excludedSet = new Set(excludedList);
|
|
279
278
|
return (this.indexes || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -283,24 +282,24 @@ export class Entity extends BaseNode {
|
|
|
283
282
|
}
|
|
284
283
|
|
|
285
284
|
/**
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
285
|
+
* 插入实体索引
|
|
286
|
+
* @internal
|
|
287
|
+
* @param name 实体索引名称,如果不填会自动生成一个唯一名称
|
|
288
|
+
*/
|
|
290
289
|
_insertEntityIndexAt(name: string, index: number): EntityIndex;
|
|
291
290
|
|
|
292
291
|
/**
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
292
|
+
* 插入实体索引
|
|
293
|
+
* @internal
|
|
294
|
+
* @param entityIndexOptions 实体索引参数
|
|
295
|
+
*/
|
|
297
296
|
_insertEntityIndexAt(entityIndexOptions: Partial<EntityIndex>, index: number): EntityIndex;
|
|
298
297
|
|
|
299
298
|
/**
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
299
|
+
* 插入实体索引
|
|
300
|
+
* @internal
|
|
301
|
+
* @param entityIndex 已有的实体索引实例
|
|
302
|
+
*/
|
|
304
303
|
_insertEntityIndexAt(entityIndex: EntityIndex, index: number): EntityIndex;
|
|
305
304
|
|
|
306
305
|
_insertEntityIndexAt(options: string | Partial<EntityIndex> | EntityIndex, index: number) {
|
|
@@ -318,7 +317,7 @@ export class Entity extends BaseNode {
|
|
|
318
317
|
name: options,
|
|
319
318
|
}, this, 'indexes');
|
|
320
319
|
} else if (options instanceof EntityIndex) {
|
|
321
|
-
options.
|
|
320
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
322
321
|
entityIndex = options;
|
|
323
322
|
Object.assign(entityIndex, relationOptions);
|
|
324
323
|
} else {
|
|
@@ -415,13 +414,10 @@ export class Entity extends BaseNode {
|
|
|
415
414
|
return node;
|
|
416
415
|
}
|
|
417
416
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
417
|
/**
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
418
|
+
* 删除实体字段
|
|
419
|
+
* @param name 实体字段名称
|
|
420
|
+
*/
|
|
425
421
|
removeProperty(name: string): void;
|
|
426
422
|
|
|
427
423
|
/**
|
|
@@ -466,12 +462,10 @@ export class Entity extends BaseNode {
|
|
|
466
462
|
return params;
|
|
467
463
|
}
|
|
468
464
|
|
|
469
|
-
|
|
470
|
-
|
|
471
465
|
/**
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
466
|
+
* 删除实体索引
|
|
467
|
+
* @param name 实体索引名称
|
|
468
|
+
*/
|
|
475
469
|
removeEntityIndex(name: string): void;
|
|
476
470
|
|
|
477
471
|
/**
|
|
@@ -520,6 +514,22 @@ export class Entity extends BaseNode {
|
|
|
520
514
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
521
515
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
522
516
|
//================================================================================
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* 设置实体表名并修改表名
|
|
520
|
+
*/
|
|
521
|
+
setName(name: string) {
|
|
522
|
+
const object: { name: string; tableName?: string } = {
|
|
523
|
+
name,
|
|
524
|
+
};
|
|
525
|
+
if (this.name === this.tableName && (this.origin === 'ide' || this.origin === 'sql')) {
|
|
526
|
+
object.tableName = name;
|
|
527
|
+
}
|
|
528
|
+
this.update({
|
|
529
|
+
...object,
|
|
530
|
+
field: 'name',
|
|
531
|
+
});
|
|
532
|
+
}
|
|
523
533
|
/**
|
|
524
534
|
* 设置实体表名
|
|
525
535
|
*/
|
|
@@ -681,10 +691,13 @@ export class Entity extends BaseNode {
|
|
|
681
691
|
}
|
|
682
692
|
|
|
683
693
|
get ns() {
|
|
684
|
-
const ns = entity2LogicNamespace(this);
|
|
694
|
+
const ns: Namespace = entity2LogicNamespace(this);
|
|
685
695
|
ns.path = this.getNamespace() + '.' + ns.name;
|
|
686
696
|
return ns;
|
|
687
697
|
}
|
|
698
|
+
// @excludedInJSON()
|
|
699
|
+
// nslogic: Namespace;
|
|
700
|
+
|
|
688
701
|
get logics() {
|
|
689
702
|
const ns = this.ns;
|
|
690
703
|
return ns.logics;
|
|
@@ -715,7 +728,7 @@ export class Entity extends BaseNode {
|
|
|
715
728
|
//================================================================================
|
|
716
729
|
}
|
|
717
730
|
|
|
718
|
-
classMap
|
|
731
|
+
classMap.Entity = Entity;
|
|
719
732
|
export default Entity;
|
|
720
733
|
//================================================================================
|
|
721
734
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
package/src/concepts/Enum__.ts
CHANGED
|
@@ -148,7 +148,7 @@ export class Enum extends BaseNode {
|
|
|
148
148
|
const relationOptions = { parentNode: this, parentKey: 'enumItems' };
|
|
149
149
|
let enumItem: EnumItem;
|
|
150
150
|
if (options instanceof EnumItem) {
|
|
151
|
-
options.
|
|
151
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
152
152
|
enumItem = options;
|
|
153
153
|
Object.assign(enumItem, relationOptions);
|
|
154
154
|
} else {
|
package/src/concepts/Event__.ts
CHANGED
|
@@ -150,7 +150,7 @@ export class Event extends BaseNode {
|
|
|
150
150
|
name: options,
|
|
151
151
|
}, this, 'params');
|
|
152
152
|
} else if (options instanceof Param) {
|
|
153
|
-
options.
|
|
153
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
154
154
|
param = options;
|
|
155
155
|
Object.assign(param, relationOptions);
|
|
156
156
|
} else {
|