@lcap/nasl 2.21.0-beta.2 → 2.21.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/automate/engine/operators.d.ts +2 -2
- package/out/automate/engine/operators.js +14 -5
- package/out/automate/engine/operators.js.map +1 -1
- package/out/common/BaseNode.d.ts +6 -0
- package/out/common/BaseNode.js +45 -8
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/Abort__.d.ts +1 -1
- package/out/concepts/Abort__.js +3 -3
- package/out/concepts/Abort__.js.map +1 -1
- package/out/concepts/App__.d.ts +0 -2
- package/out/concepts/App__.js +0 -42
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +18 -0
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindEvent__.js +21 -22
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +16 -16
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +0 -1
- package/out/concepts/DataSource__.js +0 -3
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +0 -23
- package/out/concepts/EntityProperty__.js +0 -121
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +0 -3
- package/out/concepts/InterfaceParam__.js +0 -64
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +0 -3
- package/out/concepts/Interface__.js +4 -8
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +1 -1
- package/out/concepts/Logic__.js +22 -42
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js +1 -1
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +1 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +0 -12
- package/out/concepts/Module__.js +0 -7
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/NewMap__.js +5 -1
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js +9 -3
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.d.ts +0 -1
- package/out/concepts/OqlQueryComponent__.js +0 -46
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.d.ts +0 -3
- package/out/concepts/Param__.js +1 -67
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.d.ts +0 -3
- package/out/concepts/Return__.js +1 -67
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +0 -1
- package/out/concepts/SqlQueryComponent__.js +0 -46
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +0 -3
- package/out/concepts/StructureProperty__.js +0 -65
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +1 -3
- package/out/concepts/TypeAnnotation__.js +12 -31
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +0 -3
- package/out/concepts/Variable__.js +1 -67
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.d.ts +7 -0
- package/out/concepts/ViewComponent__.js +7 -0
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.js +1 -1
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.collection.js +2 -2
- package/out/concepts/basics/stdlib/nasl.collection.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.core.js +3 -3
- package/out/concepts/basics/stdlib/nasl.core.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.interface.js +1 -1
- package/out/concepts/basics/stdlib/nasl.interface.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.process.js +6 -6
- package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +43 -43
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +19 -46
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.validation.js +13 -13
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
- package/out/concepts/basics/types/coreTypeList.js +5 -1
- package/out/concepts/basics/types/coreTypeList.js.map +1 -1
- package/out/concepts/index__.d.ts +0 -1
- package/out/concepts/index__.js +0 -1
- package/out/concepts/index__.js.map +1 -1
- package/out/generator/genReleaseBody.js +0 -3
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/sentry/index.d.ts +28 -0
- package/out/sentry/index.js +104 -0
- package/out/sentry/index.js.map +1 -0
- package/out/server/entity2LogicNamespace.js +1 -1
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/extendBaseNode.js +65 -0
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.js +5 -5
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.js +9 -7
- package/out/server/getLogics.js.map +1 -1
- package/out/server/naslServer.d.ts +2 -2
- package/out/server/naslServer.js +120 -51
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +3 -2
- package/out/server/translator.js.map +1 -1
- package/out/service/creator/errHandles.js +5 -0
- package/out/service/creator/errHandles.js.map +1 -1
- package/out/service/storage/init.js +6 -8
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genQueryComponent.js +2 -2
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genSelectBlock.js +9 -1
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/utils.d.ts +32 -0
- package/out/templator/utils.js +7 -7
- package/out/templator/utils.js.map +1 -1
- package/package.json +2 -2
- package/sandbox/stdlib/nasl.auth.ts +3 -1
- package/sandbox/stdlib/nasl.browser.ts +1 -1
- package/sandbox/stdlib/nasl.collection.ts +9 -9
- package/sandbox/stdlib/nasl.core.ts +100 -38
- package/sandbox/stdlib/nasl.interface.ts +1 -1
- package/sandbox/stdlib/nasl.langUtil.ts +4 -4
- package/sandbox/stdlib/nasl.oql.ts +156 -156
- package/sandbox/stdlib/nasl.process.ts +6 -6
- package/sandbox/stdlib/nasl.ui.ts +42 -42
- package/sandbox/stdlib/nasl.util.ts +45 -44
- package/sandbox/stdlib/nasl.validation.ts +8 -8
- package/src/automate/engine/operators.js +13 -5
- package/src/automate/upgrader/2.20.js +1 -0
- package/src/common/BaseNode.ts +32 -1
- package/src/concepts/Abort__.ts +4 -3
- package/src/concepts/App__.ts +2 -38
- package/src/concepts/BindAttribute__.ts +17 -1
- package/src/concepts/BindEvent__.ts +21 -21
- package/src/concepts/CallFunction__.ts +0 -1
- package/src/concepts/CallQueryComponent__.ts +16 -74
- package/src/concepts/ConfigPropertyValue__.ts +0 -4
- package/src/concepts/DataSource__.ts +0 -4
- package/src/concepts/EntityProperty__.ts +0 -129
- package/src/concepts/InterfaceParam__.ts +0 -55
- package/src/concepts/Interface__.ts +4 -4
- package/src/concepts/Logic__.ts +31 -47
- package/src/concepts/MatchCase__.ts +1 -1
- package/src/concepts/MemberExpression__.ts +1 -1
- package/src/concepts/Module__.ts +0 -6
- package/src/concepts/NewMap__.ts +5 -1
- package/src/concepts/NumericLiteral__.ts +9 -4
- package/src/concepts/OqlQueryComponent__.ts +0 -40
- package/src/concepts/Param__.ts +3 -59
- package/src/concepts/Rect__.ts +0 -8
- package/src/concepts/Return__.ts +1 -58
- package/src/concepts/SqlQueryComponent__.ts +0 -40
- package/src/concepts/StructureProperty__.ts +0 -57
- package/src/concepts/TypeAnnotation__.ts +12 -72
- package/src/concepts/Variable__.ts +1 -58
- package/src/concepts/ViewComponent__.ts +6 -0
- package/src/concepts/ViewElement__.ts +7 -7
- package/src/concepts/basics/stdlib/nasl.collection.ts +2 -2
- package/src/concepts/basics/stdlib/nasl.core.ts +3 -3
- package/src/concepts/basics/stdlib/nasl.interface.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.process.ts +6 -6
- package/src/concepts/basics/stdlib/nasl.ui.ts +43 -43
- package/src/concepts/basics/stdlib/nasl.util.ts +19 -46
- package/src/concepts/basics/stdlib/nasl.validation.ts +13 -13
- package/src/concepts/basics/types/coreTypeList.ts +5 -1
- package/src/concepts/index__.ts +0 -1
- package/src/generator/genReleaseBody.ts +0 -2
- package/src/sentry/index.ts +134 -0
- package/src/server/entity2LogicNamespace.ts +1 -1
- package/src/server/extendBaseNode.ts +61 -1
- package/src/server/formatTsUtils.ts +5 -5
- package/src/server/getLogics.ts +8 -7
- package/src/server/naslServer.ts +120 -53
- package/src/server/translator.ts +3 -2
- package/src/service/creator/errHandles.js +6 -0
- package/src/service/storage/init.ts +6 -8
- package/src/templator/genQueryComponent.ts +5 -5
- package/src/templator/genSelectBlock.ts +9 -1
- package/src/templator/utils.ts +7 -7
- package/ts-worker/lib/Messager.js +0 -3
- package/ts-worker/src/index.js +0 -1
- package/src/concepts/DatabaseTypeAnnotation__.ts +0 -88
|
@@ -24,10 +24,10 @@ export enum PRIMITIVE_TYPE {
|
|
|
24
24
|
export const PRIMITIVE_TITLE: Record<string, string> = {
|
|
25
25
|
Boolean: '布尔值',
|
|
26
26
|
Integer: '整数',
|
|
27
|
-
Long: '
|
|
27
|
+
Long: '长整数',
|
|
28
28
|
Double: '小数',
|
|
29
|
-
Decimal: '
|
|
30
|
-
String: '
|
|
29
|
+
Decimal: '精确小数',
|
|
30
|
+
String: '字符串',
|
|
31
31
|
Text: '长文本',
|
|
32
32
|
Binary: '二进制流',
|
|
33
33
|
Date: '日期',
|
|
@@ -37,22 +37,6 @@ export const PRIMITIVE_TITLE: Record<string, string> = {
|
|
|
37
37
|
Union: '联合类型',
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
export const PRIMITIVE_DESC: Record<string, string> = {
|
|
41
|
-
Boolean: '包含真(true)、假(false)两个值',
|
|
42
|
-
Long: '可表示最大长度约 19 个数字的正负整数',
|
|
43
|
-
Decimal: '可表示 31 个有效数字以内的小数',
|
|
44
|
-
String: '表示汉语、英语、数字等文本内容',
|
|
45
|
-
Date: '通常用于仅日期处理和数据存储',
|
|
46
|
-
Time: '通常用于仅时间处理和数据存储',
|
|
47
|
-
DateTime: '通常用于日期和时间的处理和数据存储',
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const GENERIC_DESC: Record<string, string> = {
|
|
51
|
-
List: 'T类型的数据构成的列表',
|
|
52
|
-
Map: '从K类型到V类型的映射',
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
|
|
56
40
|
/**
|
|
57
41
|
* 判断是否是联合类型
|
|
58
42
|
* @param typeAnnotation
|
|
@@ -93,7 +77,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
93
77
|
* 类型种类
|
|
94
78
|
*/
|
|
95
79
|
@property()
|
|
96
|
-
typeKind: 'primitive' | 'reference' | 'generic' | 'typeParam' | '
|
|
80
|
+
typeKind: 'primitive' | 'reference' | 'generic' | 'typeParam' | 'function' | 'union' | 'anonymousStructure' = undefined;
|
|
97
81
|
|
|
98
82
|
/**
|
|
99
83
|
* 类型命名空间
|
|
@@ -137,8 +121,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
137
121
|
@property()
|
|
138
122
|
ruleMap: Object = undefined;
|
|
139
123
|
|
|
140
|
-
|
|
141
|
-
|
|
142
124
|
/**
|
|
143
125
|
* @param source 需要合并的部分参数
|
|
144
126
|
*/
|
|
@@ -178,10 +160,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
178
160
|
});
|
|
179
161
|
}
|
|
180
162
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
163
|
/**
|
|
186
164
|
* 插入类型标注
|
|
187
165
|
* @internal
|
|
@@ -214,8 +192,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
214
192
|
return typeAnnotation;
|
|
215
193
|
}
|
|
216
194
|
|
|
217
|
-
|
|
218
|
-
|
|
219
195
|
/**
|
|
220
196
|
* 插入类型标注
|
|
221
197
|
* @param typeAnnotationOptions 类型标注参数
|
|
@@ -238,8 +214,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
238
214
|
return node;
|
|
239
215
|
}
|
|
240
216
|
|
|
241
|
-
|
|
242
|
-
|
|
243
217
|
/**
|
|
244
218
|
* 添加类型标注
|
|
245
219
|
* @internal
|
|
@@ -259,8 +233,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
259
233
|
return this._insertTypeAnnotationInTypeArgumentsAt(options as any, index);
|
|
260
234
|
}
|
|
261
235
|
|
|
262
|
-
|
|
263
|
-
|
|
264
236
|
/**
|
|
265
237
|
* 添加类型标注
|
|
266
238
|
* @param typeAnnotationOptions 类型标注参数
|
|
@@ -284,8 +256,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
284
256
|
return node;
|
|
285
257
|
}
|
|
286
258
|
|
|
287
|
-
|
|
288
|
-
|
|
289
259
|
/**
|
|
290
260
|
* 插入类型标注
|
|
291
261
|
* @internal
|
|
@@ -318,8 +288,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
318
288
|
return typeAnnotation;
|
|
319
289
|
}
|
|
320
290
|
|
|
321
|
-
|
|
322
|
-
|
|
323
291
|
/**
|
|
324
292
|
* 插入类型标注
|
|
325
293
|
* @param typeAnnotationOptions 类型标注参数
|
|
@@ -342,8 +310,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
342
310
|
return node;
|
|
343
311
|
}
|
|
344
312
|
|
|
345
|
-
|
|
346
|
-
|
|
347
313
|
/**
|
|
348
314
|
* 添加类型标注
|
|
349
315
|
* @internal
|
|
@@ -363,8 +329,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
363
329
|
return this._insertTypeAnnotationInReturnTypeAt(options as any, index);
|
|
364
330
|
}
|
|
365
331
|
|
|
366
|
-
|
|
367
|
-
|
|
368
332
|
/**
|
|
369
333
|
* 添加类型标注
|
|
370
334
|
* @param typeAnnotationOptions 类型标注参数
|
|
@@ -388,11 +352,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
388
352
|
return node;
|
|
389
353
|
}
|
|
390
354
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
355
|
/**
|
|
397
356
|
* 插入数据结构属性
|
|
398
357
|
* @internal
|
|
@@ -425,8 +384,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
425
384
|
return structureProperty;
|
|
426
385
|
}
|
|
427
386
|
|
|
428
|
-
|
|
429
|
-
|
|
430
387
|
/**
|
|
431
388
|
* 插入数据结构属性
|
|
432
389
|
* @param structurePropertyOptions 数据结构属性参数
|
|
@@ -449,8 +406,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
449
406
|
return node;
|
|
450
407
|
}
|
|
451
408
|
|
|
452
|
-
|
|
453
|
-
|
|
454
409
|
/**
|
|
455
410
|
* 添加数据结构属性
|
|
456
411
|
* @internal
|
|
@@ -470,8 +425,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
470
425
|
return this._insertStructurePropertyAt(options as any, index);
|
|
471
426
|
}
|
|
472
427
|
|
|
473
|
-
|
|
474
|
-
|
|
475
428
|
/**
|
|
476
429
|
* 添加数据结构属性
|
|
477
430
|
* @param structurePropertyOptions 数据结构属性参数
|
|
@@ -495,9 +448,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
495
448
|
return node;
|
|
496
449
|
}
|
|
497
450
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
451
|
/**
|
|
502
452
|
* 删除类型标注
|
|
503
453
|
* @param typeAnnotation 已有的类型标注实例
|
|
@@ -505,12 +455,10 @@ export class TypeAnnotation extends BaseNode {
|
|
|
505
455
|
removeTypeAnnotationInTypeArguments(typeAnnotation: TypeAnnotation): void;
|
|
506
456
|
|
|
507
457
|
removeTypeAnnotationInTypeArguments(options: TypeAnnotation) {
|
|
508
|
-
|
|
458
|
+
const typeAnnotation: TypeAnnotation = options;
|
|
509
459
|
return typeAnnotation.delete();
|
|
510
460
|
}
|
|
511
461
|
|
|
512
|
-
|
|
513
|
-
|
|
514
462
|
/**
|
|
515
463
|
* 删除类型标注
|
|
516
464
|
* @param typeAnnotation 已有的类型标注实例
|
|
@@ -518,7 +466,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
518
466
|
removeTypeAnnotationInReturnType(typeAnnotation: TypeAnnotation): void;
|
|
519
467
|
|
|
520
468
|
removeTypeAnnotationInReturnType(options: TypeAnnotation) {
|
|
521
|
-
|
|
469
|
+
const typeAnnotation: TypeAnnotation = options;
|
|
522
470
|
return typeAnnotation.delete();
|
|
523
471
|
}
|
|
524
472
|
|
|
@@ -545,8 +493,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
545
493
|
return params;
|
|
546
494
|
}
|
|
547
495
|
|
|
548
|
-
|
|
549
|
-
|
|
550
496
|
/**
|
|
551
497
|
* 删除数据结构属性
|
|
552
498
|
* @param structureProperty 已有的数据结构属性实例
|
|
@@ -554,7 +500,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
554
500
|
removeStructureProperty(structureProperty: StructureProperty): void;
|
|
555
501
|
|
|
556
502
|
removeStructureProperty(options: StructureProperty) {
|
|
557
|
-
|
|
503
|
+
const structureProperty: StructureProperty = options;
|
|
558
504
|
return structureProperty.delete();
|
|
559
505
|
}
|
|
560
506
|
|
|
@@ -659,9 +605,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
659
605
|
*/
|
|
660
606
|
get headTitle(): string {
|
|
661
607
|
if (this.typeKind === 'primitive') {
|
|
662
|
-
if (this.typeName === 'Long') {
|
|
663
|
-
return `Integer ${PRIMITIVE_TITLE[this.typeName] || ''}`;
|
|
664
|
-
}
|
|
665
608
|
return `${this.typeName} ${PRIMITIVE_TITLE[this.typeName] || ''}`;
|
|
666
609
|
} else if (this.typeKind === 'reference') {
|
|
667
610
|
const typeNamespace = this?.typeNamespace;
|
|
@@ -696,9 +639,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
696
639
|
*/
|
|
697
640
|
get typeTitle(): string {
|
|
698
641
|
if (this.typeKind === 'primitive') {
|
|
699
|
-
if (this.typeName === 'Long') {
|
|
700
|
-
return `Integer ${PRIMITIVE_TITLE[this.typeName] || ''}`;
|
|
701
|
-
}
|
|
702
642
|
return `${this.typeName} ${PRIMITIVE_TITLE[this.typeName] || ''}`;
|
|
703
643
|
} else if (this.typeKind === 'reference') {
|
|
704
644
|
return this.typeName;
|
|
@@ -951,7 +891,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
951
891
|
const DateTimeReg = /^\d{1,4}(\/|-)\d{1,2}(\/|-)\d{1,2}\s(\d{1,2})(:\d{1,2})?:(\d{1,2})$/;
|
|
952
892
|
const BooleanReg = /(false|true|\u662f|\u5426)/i;
|
|
953
893
|
if (EmailReg.test(code)) {
|
|
954
|
-
return this.createPrimitive('
|
|
894
|
+
return this.createPrimitive('Email');
|
|
955
895
|
} else if (TimeReg.test(code)) {
|
|
956
896
|
return this.createPrimitive('Time');
|
|
957
897
|
} else if (BooleanReg.test(code)) {
|
|
@@ -962,19 +902,19 @@ export class TypeAnnotation extends BaseNode {
|
|
|
962
902
|
return this.createPrimitive('DateTime');
|
|
963
903
|
} else if (!isNaN(Number(code))) {
|
|
964
904
|
if (code.indexOf('.') !== -1) {
|
|
965
|
-
return this.createPrimitive('
|
|
905
|
+
return this.createPrimitive('Double');
|
|
966
906
|
// return this.createPrimitive('Decimal');
|
|
967
907
|
}
|
|
968
908
|
if (code.length > 8) {
|
|
969
909
|
return this.createPrimitive('Long');
|
|
970
910
|
}
|
|
971
|
-
return this.createPrimitive('
|
|
911
|
+
return this.createPrimitive('Integer');
|
|
972
912
|
} else if (code.length > 255) {
|
|
973
|
-
return this.createPrimitive('
|
|
913
|
+
return this.createPrimitive('Text');
|
|
974
914
|
}
|
|
975
915
|
return this.createPrimitive('String');
|
|
976
916
|
} else {
|
|
977
|
-
return this.createPrimitive('
|
|
917
|
+
return this.createPrimitive('Integer');
|
|
978
918
|
}
|
|
979
919
|
}
|
|
980
920
|
// 增加插入泛型子类型
|
|
@@ -386,7 +386,7 @@ export class Variable extends BaseNode {
|
|
|
386
386
|
|
|
387
387
|
// 处理下拉属性
|
|
388
388
|
try {
|
|
389
|
-
this.completionChildren = this.getSelectRef(typeAnnotation);
|
|
389
|
+
this.completionChildren = this.getSelectRef(typeAnnotation, true);
|
|
390
390
|
} catch (err) {
|
|
391
391
|
this.completionChildren = [];
|
|
392
392
|
console.log(err);
|
|
@@ -417,63 +417,6 @@ export class Variable extends BaseNode {
|
|
|
417
417
|
get readonly() {
|
|
418
418
|
return !!this.module;
|
|
419
419
|
}
|
|
420
|
-
get hasChildren() {
|
|
421
|
-
if (!this.typeAnnotation)
|
|
422
|
-
return null;
|
|
423
|
-
const { typeKind, typeName, typeNamespace } = this.typeAnnotation;
|
|
424
|
-
if (typeKind === 'reference' || typeKind === 'generic') {
|
|
425
|
-
if (typeNamespace.endsWith('.enums'))
|
|
426
|
-
return null;
|
|
427
|
-
return [{}];
|
|
428
|
-
} else if (typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) {
|
|
429
|
-
return [{}];
|
|
430
|
-
}
|
|
431
|
-
return null;
|
|
432
|
-
}
|
|
433
|
-
get isTreeLeaf() {
|
|
434
|
-
return !this.hasChildren;
|
|
435
|
-
}
|
|
436
|
-
getSelectRef(newTypeAnnotation: TypeAnnotation) {
|
|
437
|
-
try {
|
|
438
|
-
const { typeName, typeKind, typeNamespace } = newTypeAnnotation || this.typeAnnotation;
|
|
439
|
-
let completionChildren;
|
|
440
|
-
if (typeKind === 'reference') {
|
|
441
|
-
if (typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.process' || typeNamespace === 'nasl.auth') {
|
|
442
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
443
|
-
const properties = (node as Structure)?.properties || [];
|
|
444
|
-
completionChildren = properties;
|
|
445
|
-
} else if (typeNamespace.endsWith('.enums')) {
|
|
446
|
-
completionChildren = [];
|
|
447
|
-
} else {
|
|
448
|
-
const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
|
|
449
|
-
const properties = node?.properties || [];
|
|
450
|
-
completionChildren = properties;
|
|
451
|
-
}
|
|
452
|
-
} else if (typeKind === 'generic') {
|
|
453
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
454
|
-
const properties = ((node as Structure)?.properties && [...(node as Structure)?.properties]) || [];
|
|
455
|
-
for (let i = 0; i < properties.length; i++) {
|
|
456
|
-
const item = properties[i];
|
|
457
|
-
if (item?.typeAnnotation?.typeKind === 'typeParam') {
|
|
458
|
-
const newItem = StructureProperty.from(item.toJSON());
|
|
459
|
-
newItem.typeAnnotation = this?.typeAnnotation?.typeArguments[0];
|
|
460
|
-
newItem.parentNode = this;
|
|
461
|
-
properties[i] = newItem;
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
completionChildren = properties;
|
|
465
|
-
} else if (typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) {
|
|
466
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
467
|
-
const properties = ((node as Structure)?.properties && [...(node as Structure)?.properties]) || [];
|
|
468
|
-
completionChildren = properties;
|
|
469
|
-
} else {
|
|
470
|
-
completionChildren = [];
|
|
471
|
-
}
|
|
472
|
-
return completionChildren;
|
|
473
|
-
} catch (err) {
|
|
474
|
-
console.log(err);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
420
|
//================================================================================
|
|
478
421
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
479
422
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -1431,7 +1431,7 @@ export class ViewElement extends BaseNode {
|
|
|
1431
1431
|
if (tag === 'u-input') {
|
|
1432
1432
|
code += '<nasl.core.String>';
|
|
1433
1433
|
} else if (tag === 'u-input-number') {
|
|
1434
|
-
code += '<nasl.core.
|
|
1434
|
+
code += '<nasl.core.Integer>';
|
|
1435
1435
|
} else {
|
|
1436
1436
|
code += '<any>';
|
|
1437
1437
|
}
|
|
@@ -1640,7 +1640,7 @@ export class ViewElement extends BaseNode {
|
|
|
1640
1640
|
const oldName = element.name;
|
|
1641
1641
|
element.deepRenameElements(this);
|
|
1642
1642
|
if (element.tag === 'u-modal' || element.tag === 'u-drawer') {
|
|
1643
|
-
const cancelNode = traverse(({ node }: { node: any
|
|
1643
|
+
const cancelNode = traverse(({ node }: { node: any}) => {
|
|
1644
1644
|
if (node?.bindAttrs?.find((bindAttr: any) => bindAttr.value === '取消'))
|
|
1645
1645
|
return node;
|
|
1646
1646
|
}, { node: element });
|
|
@@ -1801,7 +1801,7 @@ export class ViewElement extends BaseNode {
|
|
|
1801
1801
|
}
|
|
1802
1802
|
attr = new BindAttribute(source);
|
|
1803
1803
|
} catch (e) {
|
|
1804
|
-
const expression = <any>this._parseExpression(oldAttr.value);
|
|
1804
|
+
const expression = <any> this._parseExpression(oldAttr.value);
|
|
1805
1805
|
attr = new BindAttribute({
|
|
1806
1806
|
type: 'dynamic',
|
|
1807
1807
|
name: oldAttr.name,
|
|
@@ -1858,7 +1858,7 @@ export class ViewElement extends BaseNode {
|
|
|
1858
1858
|
if (directive.name === 'model') {
|
|
1859
1859
|
const valueAttr = astNode.attrs && astNode.attrs.find((attr) => attr.name === 'value');
|
|
1860
1860
|
if (!valueAttr) {
|
|
1861
|
-
const expression = <any>this._parseExpression(directive.value);
|
|
1861
|
+
const expression = <any> this._parseExpression(directive.value);
|
|
1862
1862
|
element.addBindAttribute(new BindAttribute({
|
|
1863
1863
|
type: 'dynamic',
|
|
1864
1864
|
name: 'value',
|
|
@@ -1868,7 +1868,7 @@ export class ViewElement extends BaseNode {
|
|
|
1868
1868
|
}));
|
|
1869
1869
|
}
|
|
1870
1870
|
} else {
|
|
1871
|
-
const expression = <any>this._parseExpression(directive.value);
|
|
1871
|
+
const expression = <any> this._parseExpression(directive.value);
|
|
1872
1872
|
element.addBindDirective(new BindDirective({
|
|
1873
1873
|
type: expression ? 'string' : 'dynamic',
|
|
1874
1874
|
name: directive.name,
|
|
@@ -1887,7 +1887,7 @@ export class ViewElement extends BaseNode {
|
|
|
1887
1887
|
name: 'if',
|
|
1888
1888
|
rawName: 'v-if',
|
|
1889
1889
|
value: '',
|
|
1890
|
-
expression: <any>this._parseExpression(astNode.if),
|
|
1890
|
+
expression: <any> this._parseExpression(astNode.if),
|
|
1891
1891
|
}));
|
|
1892
1892
|
}
|
|
1893
1893
|
} else if (astNode.type === 2) {
|
|
@@ -1898,7 +1898,7 @@ export class ViewElement extends BaseNode {
|
|
|
1898
1898
|
name: view.getViewElementUniqueName(`${baseName}1`),
|
|
1899
1899
|
});
|
|
1900
1900
|
const value = astNode.text?.match(/{{(.*?)}}/)[1].trim();
|
|
1901
|
-
const expression = <any>this._parseExpression(value);
|
|
1901
|
+
const expression = <any> this._parseExpression(value);
|
|
1902
1902
|
element.addBindAttribute(new BindAttribute({
|
|
1903
1903
|
type: 'dynamic',
|
|
1904
1904
|
name: 'text',
|
|
@@ -16,7 +16,7 @@ export const collectionStructures = [
|
|
|
16
16
|
properties: [
|
|
17
17
|
new StructureProperty({
|
|
18
18
|
name: 'length',
|
|
19
|
-
typeAnnotation: TypeAnnotation.createPrimitive('
|
|
19
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
|
|
20
20
|
}),
|
|
21
21
|
],
|
|
22
22
|
}),
|
|
@@ -33,7 +33,7 @@ export const collectionStructures = [
|
|
|
33
33
|
properties: [
|
|
34
34
|
new StructureProperty({
|
|
35
35
|
name: 'length',
|
|
36
|
-
typeAnnotation: TypeAnnotation.createPrimitive('
|
|
36
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
|
|
37
37
|
}),
|
|
38
38
|
],
|
|
39
39
|
}),
|
|
@@ -9,7 +9,7 @@ export const coreStructures = [
|
|
|
9
9
|
properties: [
|
|
10
10
|
new StructureProperty({
|
|
11
11
|
name: 'length',
|
|
12
|
-
typeAnnotation: TypeAnnotation.createPrimitive('
|
|
12
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
|
|
13
13
|
}),
|
|
14
14
|
],
|
|
15
15
|
}),
|
|
@@ -18,7 +18,7 @@ export const coreStructures = [
|
|
|
18
18
|
properties: [
|
|
19
19
|
new StructureProperty({
|
|
20
20
|
name: 'length',
|
|
21
|
-
typeAnnotation: TypeAnnotation.createPrimitive('
|
|
21
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
|
|
22
22
|
}),
|
|
23
23
|
],
|
|
24
24
|
}),
|
|
@@ -27,7 +27,7 @@ export const coreStructures = [
|
|
|
27
27
|
properties: [
|
|
28
28
|
new StructureProperty({
|
|
29
29
|
name: 'length',
|
|
30
|
-
typeAnnotation: TypeAnnotation.createPrimitive('
|
|
30
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
|
|
31
31
|
}),
|
|
32
32
|
],
|
|
33
33
|
}),
|
|
@@ -25,7 +25,7 @@ export const interfaceStructures = [
|
|
|
25
25
|
}),
|
|
26
26
|
new StructureProperty({
|
|
27
27
|
name: 'Code',
|
|
28
|
-
typeAnnotation: TypeAnnotation.createPrimitive('
|
|
28
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
|
|
29
29
|
}),
|
|
30
30
|
new StructureProperty({
|
|
31
31
|
name: 'Message',
|
|
@@ -96,11 +96,11 @@ const logics = [
|
|
|
96
96
|
}),
|
|
97
97
|
new Param({
|
|
98
98
|
name: 'page',
|
|
99
|
-
typeAnnotation: TypeAnnotation.createPrimitive('
|
|
99
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
|
|
100
100
|
}),
|
|
101
101
|
new Param({
|
|
102
102
|
name: 'size',
|
|
103
|
-
typeAnnotation: TypeAnnotation.createPrimitive('
|
|
103
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
|
|
104
104
|
}),
|
|
105
105
|
new Param({
|
|
106
106
|
name: 'sort',
|
|
@@ -123,7 +123,7 @@ const logics = [
|
|
|
123
123
|
}),
|
|
124
124
|
new StructureProperty({
|
|
125
125
|
name: 'total',
|
|
126
|
-
typeAnnotation: TypeAnnotation.createPrimitive('
|
|
126
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
|
|
127
127
|
}),
|
|
128
128
|
]),
|
|
129
129
|
}),
|
|
@@ -235,11 +235,11 @@ const logics = [
|
|
|
235
235
|
}),
|
|
236
236
|
new Param({
|
|
237
237
|
name: 'page',
|
|
238
|
-
typeAnnotation: TypeAnnotation.createPrimitive('
|
|
238
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
|
|
239
239
|
}),
|
|
240
240
|
new Param({
|
|
241
241
|
name: 'size',
|
|
242
|
-
typeAnnotation: TypeAnnotation.createPrimitive('
|
|
242
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
|
|
243
243
|
}),
|
|
244
244
|
new Param({
|
|
245
245
|
name: 'sort',
|
|
@@ -262,7 +262,7 @@ const logics = [
|
|
|
262
262
|
}),
|
|
263
263
|
new StructureProperty({
|
|
264
264
|
name: 'total',
|
|
265
|
-
typeAnnotation: TypeAnnotation.createPrimitive('
|
|
265
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
|
|
266
266
|
}),
|
|
267
267
|
]),
|
|
268
268
|
}),
|