@nasl/types 0.1.6 → 0.1.7-beta.1

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/nasl.core.d.ts CHANGED
@@ -1,23 +1,9 @@
1
1
  declare namespace nasl.core {
2
- export type Any = any;
3
2
  export type Boolean = boolean;
4
3
  export type Integer = number;
5
4
  export type Decimal = number;
6
5
  export type String = string;
7
-
8
- export class Binary {
9
- accept: 'Binary';
10
- }
11
-
12
- export class Date {
13
- accept: 'Date';
14
- }
15
-
16
- export class Time {
17
- accept: 'Time';
18
- }
19
-
20
- export class DateTime {
21
- accept: 'DateTime';
22
- }
6
+ export type Date = string;
7
+ export type Time = string;
8
+ export type DateTime = string;
23
9
  }
package/nasl.ui.ast.d.ts CHANGED
@@ -11,6 +11,9 @@ export type BaseSetter = InputSetter | SwitchSetter | EnumSelectSetter | Capsule
11
11
  */
12
12
  export interface InputSetter {
13
13
  concept: 'InputSetter';
14
+ /**
15
+ * 占位文本
16
+ */
14
17
  placeholder?: string;
15
18
  }
16
19
 
@@ -27,6 +30,9 @@ export interface SwitchSetter {
27
30
  */
28
31
  export interface EnumSelectSetter {
29
32
  concept: 'EnumSelectSetter';
33
+ /**
34
+ * 枚举选项列表
35
+ */
30
36
  options: Array<SetterOption>;
31
37
  }
32
38
 
@@ -35,6 +41,9 @@ export interface EnumSelectSetter {
35
41
  */
36
42
  export interface CapsulesSetter {
37
43
  concept: 'CapsulesSetter';
44
+ /**
45
+ * 枚举选项列表
46
+ */
38
47
  options: Array<SetterOption>;
39
48
  }
40
49
 
@@ -43,10 +52,25 @@ export interface CapsulesSetter {
43
52
  */
44
53
  export interface NumberInputSetter {
45
54
  concept: 'NumberInputSetter';
55
+ /**
56
+ * 按钮位置
57
+ */
46
58
  placement?: string;
59
+ /**
60
+ * 最小值
61
+ */
47
62
  min?: number;
63
+ /**
64
+ * 最大值
65
+ */
48
66
  max?: number;
67
+ /**
68
+ * 精度
69
+ */
49
70
  precision?: number;
71
+ /**
72
+ * 占位文本
73
+ */
50
74
  placeholder?: string;
51
75
  }
52
76
 
@@ -55,6 +79,9 @@ export interface NumberInputSetter {
55
79
  */
56
80
  export interface IconSetter {
57
81
  concept: 'IconSetter';
82
+ /**
83
+ * 图标标题
84
+ */
58
85
  title?: string;
59
86
  }
60
87
 
@@ -79,21 +106,70 @@ export interface PropertySelectSetter {
79
106
  */
80
107
  export interface ViewComponentDeclaration {
81
108
  concept: 'ViewComponentDeclaration';
109
+ /**
110
+ * 页面组件名称
111
+ */
82
112
  name: string;
113
+ /**
114
+ * 页面组件中划线名称
115
+ */
83
116
  kebabName: string;
117
+ /**
118
+ * 页面组件标题
119
+ */
84
120
  title: string;
121
+ /**
122
+ * 所在分组
123
+ */
85
124
  group: string;
125
+ /**
126
+ * 页面组件图标
127
+ */
86
128
  icon: string;
129
+ /**
130
+ * 页面组件描述
131
+ */
87
132
  description?: string;
133
+ /**
134
+ * 关于 TS 的 typeParams
135
+ */
88
136
  tsTypeParams?: string;
137
+ /**
138
+ * 组件属性列表
139
+ */
89
140
  props: Array<PropDeclaration>;
141
+ /**
142
+ * 可访问的组件属性列表
143
+ */
90
144
  readableProps: Array<PropDeclaration>;
145
+ /**
146
+ * 组件事件列表
147
+ */
91
148
  events: Array<EventDeclaration>;
149
+ /**
150
+ * 插槽列表
151
+ */
92
152
  slots: Array<SlotDeclaration>;
153
+ /**
154
+ * 逻辑列表
155
+ */
93
156
  methods: Array<LogicDeclaration>;
157
+ /**
158
+ * 页面组件列表
159
+ */
94
160
  children: Array<ViewComponentDeclaration>;
161
+ /**
162
+ * 页面组件的代码块列表
163
+ */
95
164
  blocks: Array<ViewBlockWithImage>;
165
+ /**
166
+ * 主题变量
167
+ */
96
168
  themeVariables: Array<ThemeVariable>;
169
+ /**
170
+ * 国际化配置列表
171
+ */
172
+ i18nMap?: Map<string, Map<string, string>>;
97
173
  }
98
174
 
99
175
  /**
@@ -101,23 +177,97 @@ export interface ViewComponentDeclaration {
101
177
  */
102
178
  export interface PropDeclaration {
103
179
  concept: 'PropDeclaration';
180
+ /**
181
+ * 组件属性名称
182
+ */
104
183
  name: string;
184
+ /**
185
+ * 组件属性标题
186
+ */
105
187
  title: string;
188
+ /**
189
+ * 组件属性分组
190
+ */
106
191
  group: '基础信息' | '数据属性' | '主要属性' | '交互属性' | '状态属性' | '样式属性' | '工具属性';
192
+ /**
193
+ * 组件属性图标
194
+ */
107
195
  icon?: string;
196
+ /**
197
+ * 组件属性描述
198
+ */
108
199
  description?: string;
200
+ /**
201
+ * 类型
202
+ *
203
+ * 直接写 TS 类型
204
+ */
109
205
  tsType: string;
206
+ /**
207
+ * 是否支持双向绑定
208
+ */
110
209
  sync: boolean;
210
+ /**
211
+ * 是否将任意类型隐式转换成String
212
+ *
213
+ * 仅在属性类型为 string(不包括字符串枚举)的情况下,且 sync 为 falsy 时可配置
214
+ */
215
+ implicitToString?: boolean;
216
+ /**
217
+ * 工具提示链接
218
+ */
111
219
  tooltipLink?: string;
220
+ /**
221
+ * 文档描述
222
+ */
112
223
  docDescription?: string;
224
+ /**
225
+ * 隐藏绑定属性按钮
226
+ */
113
227
  bindHide: boolean;
228
+ /**
229
+ * 绑定属性并打开弹窗
230
+ */
114
231
  bindOpen: boolean;
232
+ /**
233
+ * 所在的 tab 页
234
+ */
115
235
  tabKind: 'property' | 'style';
236
+ /**
237
+ * 属性设置器
238
+ */
116
239
  setter: BaseSetter;
240
+ /**
241
+ * 属性在面板中的布局方式
242
+ *
243
+ * block 表示标题与设置器分行展示;inline 表示同一行展示
244
+ */
245
+ layout: 'block' | 'inline';
246
+ /**
247
+ * 默认值
248
+ */
117
249
  defaultValue?: DefaultValue;
250
+ /**
251
+ * 渲染时的设计值
252
+ */
118
253
  tsDesignerValue?: string;
254
+ /**
255
+ * 是否显隐
256
+ *
257
+ * 用 TS 写表达式,在 IDE 中直接 eval
258
+ */
119
259
  tsIf?: string;
260
+ /**
261
+ * 是否禁用
262
+ *
263
+ * 用 TS 写表达式,在 IDE 中直接 eval
264
+ */
120
265
  tsDisabledIf?: string;
266
+ /**
267
+ * 在属性切换时发生的事件
268
+ *
269
+ * 用 TS 写表达式,在 IDE 中直接 eval
270
+ */
121
271
  tsOnChange?: string;
122
272
  }
123
273
 
@@ -126,9 +276,23 @@ export interface PropDeclaration {
126
276
  */
127
277
  export interface EventDeclaration {
128
278
  concept: 'EventDeclaration';
279
+ /**
280
+ * 组件事件名称
281
+ */
129
282
  name: string;
283
+ /**
284
+ * 组件事件标题
285
+ */
130
286
  title: string;
287
+ /**
288
+ * 组件事件描述
289
+ */
131
290
  description?: string;
291
+ /**
292
+ * 类型
293
+ *
294
+ * 直接写 TS 类型,这里是个函数类型
295
+ */
132
296
  tsType: string;
133
297
  }
134
298
 
@@ -137,12 +301,35 @@ export interface EventDeclaration {
137
301
  */
138
302
  export interface SlotDeclaration {
139
303
  concept: 'SlotDeclaration';
304
+ /**
305
+ * 插槽名称
306
+ */
140
307
  name: string;
308
+ /**
309
+ * 插槽标题
310
+ */
141
311
  title: string;
312
+ /**
313
+ * 插槽描述
314
+ */
142
315
  description?: string;
316
+ /**
317
+ * 类型
318
+ *
319
+ * 直接写 TS 类型
320
+ */
143
321
  tsType: string;
322
+ /**
323
+ * 输入参数列表
324
+ */
144
325
  params: Array<Param>;
326
+ /**
327
+ * 空的占位图
328
+ */
145
329
  emptyBackground?: string;
330
+ /**
331
+ * 插槽代码块
332
+ */
146
333
  snippets: Array<ViewBlockWithImage>;
147
334
  }
148
335
 
@@ -151,11 +338,29 @@ export interface SlotDeclaration {
151
338
  */
152
339
  export interface LogicDeclaration {
153
340
  concept: 'LogicDeclaration';
341
+ /**
342
+ * 逻辑名称
343
+ */
154
344
  name: string;
345
+ /**
346
+ * 逻辑标题
347
+ */
155
348
  title: string;
349
+ /**
350
+ * 逻辑描述
351
+ */
156
352
  description: string;
353
+ /**
354
+ * 类型参数列表
355
+ */
157
356
  typeParams?: Array<TypeParam>;
357
+ /**
358
+ * 输入参数列表
359
+ */
158
360
  params: Array<Param>;
361
+ /**
362
+ * 输出参数列表
363
+ */
159
364
  returns: Array<Return>;
160
365
  }
161
366
 
@@ -172,6 +377,9 @@ export interface NullLiteral {
172
377
  */
173
378
  export interface BooleanLiteral {
174
379
  concept: 'BooleanLiteral';
380
+ /**
381
+ * 字面量的值
382
+ */
175
383
  value: string;
176
384
  }
177
385
 
@@ -180,8 +388,14 @@ export interface BooleanLiteral {
180
388
  */
181
389
  export interface StringLiteral {
182
390
  concept: 'StringLiteral';
391
+ /**
392
+ * 字面量的值
393
+ */
183
394
  value: string;
184
- i18nKey: string;
395
+ /**
396
+ * 国际化键
397
+ */
398
+ i18nKey?: string;
185
399
  }
186
400
 
187
401
  /**
@@ -189,7 +403,13 @@ export interface StringLiteral {
189
403
  */
190
404
  export interface NumericLiteral {
191
405
  concept: 'NumericLiteral';
406
+ /**
407
+ * 字面量的值
408
+ */
192
409
  value: string;
410
+ /**
411
+ * 类型
412
+ */
193
413
  typeAnnotation: TypeAnnotation;
194
414
  }
195
415
 
@@ -198,7 +418,13 @@ export interface NumericLiteral {
198
418
  */
199
419
  export interface NewList {
200
420
  concept: 'NewList';
201
- typeAnnotation: TypeAnnotation;
421
+ /**
422
+ * 类型
423
+ */
424
+ typeAnnotation?: TypeAnnotation;
425
+ /**
426
+ * 成员表达式
427
+ */
202
428
  items: Array<LogicItem>;
203
429
  }
204
430
 
@@ -207,11 +433,33 @@ export interface NewList {
207
433
  */
208
434
  export interface SetterOption {
209
435
  concept: 'SetterOption';
436
+ /**
437
+ * 选项值
438
+ */
210
439
  value: string;
440
+ /**
441
+ * 选项标题
442
+ */
211
443
  title: string;
444
+ /**
445
+ * 选项图标
446
+ */
212
447
  icon?: string;
448
+ /**
449
+ * 选项工具提示
450
+ */
213
451
  tooltip?: string;
452
+ /**
453
+ * 是否显隐
454
+ *
455
+ * 用 TS 写表达式,在 IDE 中直接 eval
456
+ */
214
457
  tsIf?: string;
458
+ /**
459
+ * 是否禁用
460
+ *
461
+ * 用 TS 写表达式,在 IDE 中直接 eval
462
+ */
215
463
  tsDisabledIf?: string;
216
464
  }
217
465
 
@@ -220,10 +468,25 @@ export interface SetterOption {
220
468
  */
221
469
  export interface ViewBlockWithImage {
222
470
  concept: 'ViewBlockWithImage';
471
+ /**
472
+ * 标题
473
+ */
223
474
  title: string;
475
+ /**
476
+ * 代码
477
+ */
224
478
  code: string;
479
+ /**
480
+ * 描述
481
+ */
225
482
  description?: string;
483
+ /**
484
+ * 截图
485
+ */
226
486
  screenshot: string;
487
+ /**
488
+ * 手绘
489
+ */
227
490
  drawing: string;
228
491
  }
229
492
 
@@ -232,8 +495,17 @@ export interface ViewBlockWithImage {
232
495
  */
233
496
  export interface ViewBlock {
234
497
  concept: 'ViewBlock';
498
+ /**
499
+ * 标题
500
+ */
235
501
  title: string;
502
+ /**
503
+ * 代码
504
+ */
236
505
  code: string;
506
+ /**
507
+ * 描述
508
+ */
237
509
  description?: string;
238
510
  }
239
511
 
@@ -242,6 +514,9 @@ export interface ViewBlock {
242
514
  */
243
515
  export interface ThemeVariable {
244
516
  concept: 'ThemeVariable';
517
+ /**
518
+ * 主题变量名称
519
+ */
245
520
  name: string;
246
521
  }
247
522
 
@@ -250,13 +525,19 @@ export interface ThemeVariable {
250
525
  */
251
526
  export interface DefaultValue {
252
527
  concept: 'DefaultValue';
528
+ /**
529
+ * 根表达式
530
+ */
253
531
  expression: LogicItem;
532
+ /**
533
+ * 草稿态
534
+ */
254
535
  playground: Array<LogicItem>;
255
536
  }
256
537
 
257
538
  /**
258
- * 设置器基类
259
- */
539
+ * 设置器基类
540
+ */
260
541
  export type LogicItem = NullLiteral | BooleanLiteral | StringLiteral | NumericLiteral | NewList;
261
542
 
262
543
  /**
@@ -264,9 +545,25 @@ export type LogicItem = NullLiteral | BooleanLiteral | StringLiteral | NumericLi
264
545
  */
265
546
  export interface Param {
266
547
  concept: 'Param';
548
+ /**
549
+ * 输入参数名称
550
+ */
267
551
  name: string;
552
+ /**
553
+ * 输入参数描述
554
+ */
268
555
  description?: string;
269
- typeAnnotation: TypeAnnotation;
556
+ /**
557
+ * 是否为展开参数
558
+ */
559
+ spread?: boolean;
560
+ /**
561
+ * 类型
562
+ */
563
+ typeAnnotation?: TypeAnnotation;
564
+ /**
565
+ * 默认值
566
+ */
270
567
  defaultValue?: DefaultValue;
271
568
  }
272
569
 
@@ -275,13 +572,37 @@ export interface Param {
275
572
  */
276
573
  export interface TypeAnnotation {
277
574
  concept: 'TypeAnnotation';
575
+ /**
576
+ * 类型种类
577
+ */
278
578
  typeKind: 'primitive' | 'reference' | 'generic' | 'typeParam' | 'function' | 'union' | 'anonymousStructure';
579
+ /**
580
+ * 类型命名空间
581
+ */
279
582
  typeNamespace: string;
583
+ /**
584
+ * 类型名称
585
+ */
280
586
  typeName: string;
587
+ /**
588
+ * 类型参数
589
+ */
281
590
  typeArguments?: Array<TypeAnnotation>;
591
+ /**
592
+ * 返回类型
593
+ */
282
594
  returnType?: Array<TypeAnnotation>;
595
+ /**
596
+ * 是否是推断出来的
597
+ */
283
598
  inferred: boolean;
599
+ /**
600
+ * 匿名数据结构属性
601
+ */
284
602
  properties?: Array<StructureProperty>;
603
+ /**
604
+ * 规则对象
605
+ */
285
606
  ruleMap: Map<string, number>;
286
607
  }
287
608
 
@@ -290,12 +611,34 @@ export interface TypeAnnotation {
290
611
  */
291
612
  export interface StructureProperty {
292
613
  concept: 'StructureProperty';
614
+ /**
615
+ * 数据结构属性名称
616
+ */
293
617
  name: string;
294
- label: string;
295
- description: string;
296
- typeAnnotation: TypeAnnotation;
297
- defaultValue: DefaultValue;
298
- jsonName: string;
618
+ /**
619
+ * 数据结构属性标题
620
+ */
621
+ label?: string;
622
+ /**
623
+ * 数据结构属性描述
624
+ */
625
+ description?: string;
626
+ /**
627
+ * 类型
628
+ */
629
+ typeAnnotation?: TypeAnnotation;
630
+ /**
631
+ * 默认值
632
+ *
633
+ * defaultValue结构体
634
+ */
635
+ defaultValue?: DefaultValue;
636
+ /**
637
+ * 数据结构字段 JSON 的序列化别名
638
+ *
639
+ * JSON 字符串别名
640
+ */
641
+ jsonName?: string;
299
642
  }
300
643
 
301
644
  /**
@@ -303,6 +646,9 @@ export interface StructureProperty {
303
646
  */
304
647
  export interface TypeParam {
305
648
  concept: 'TypeParam';
649
+ /**
650
+ * 类型名称
651
+ */
306
652
  name: string;
307
653
  }
308
654
 
@@ -311,9 +657,21 @@ export interface TypeParam {
311
657
  */
312
658
  export interface Return {
313
659
  concept: 'Return';
660
+ /**
661
+ * 输出参数名称
662
+ */
314
663
  name: string;
664
+ /**
665
+ * 输出参数描述
666
+ */
315
667
  description: string;
316
- typeAnnotation: TypeAnnotation;
668
+ /**
669
+ * 类型
670
+ */
671
+ typeAnnotation?: TypeAnnotation;
672
+ /**
673
+ * 默认值
674
+ */
317
675
  defaultValue?: DefaultValue;
318
676
  }
319
677