@lcap/nasl 2.13.0-beta.1 → 2.13.0-beta.2

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 (112) hide show
  1. package/out/bak/translator.js +1 -6
  2. package/out/bak/translator.js.map +1 -1
  3. package/out/common/BaseNode.js +1 -1
  4. package/out/common/BaseNode.js.map +1 -1
  5. package/out/concepts/BindAttribute__.d.ts +65 -12
  6. package/out/concepts/BindAttribute__.js +72 -7
  7. package/out/concepts/BindAttribute__.js.map +1 -1
  8. package/out/concepts/BindDirective__.d.ts +55 -0
  9. package/out/concepts/BindDirective__.js +69 -0
  10. package/out/concepts/BindDirective__.js.map +1 -1
  11. package/out/concepts/BindEvent__.d.ts +2 -94
  12. package/out/concepts/BindEvent__.js +55 -347
  13. package/out/concepts/BindEvent__.js.map +1 -1
  14. package/out/concepts/CallQueryComponent__.d.ts +102 -26
  15. package/out/concepts/CallQueryComponent__.js +104 -28
  16. package/out/concepts/CallQueryComponent__.js.map +1 -1
  17. package/out/concepts/CompletionProperty__.d.ts +1 -0
  18. package/out/concepts/CompletionProperty__.js +1 -0
  19. package/out/concepts/CompletionProperty__.js.map +1 -1
  20. package/out/concepts/Destination__.d.ts +1 -0
  21. package/out/concepts/Destination__.js +5 -1
  22. package/out/concepts/Destination__.js.map +1 -1
  23. package/out/concepts/Function__.d.ts +1 -2
  24. package/out/concepts/Function__.js +28 -0
  25. package/out/concepts/Function__.js.map +1 -1
  26. package/out/concepts/Logic__.d.ts +1 -7
  27. package/out/concepts/Logic__.js +10 -76
  28. package/out/concepts/Logic__.js.map +1 -1
  29. package/out/concepts/Param__.d.ts +0 -1
  30. package/out/concepts/Param__.js +0 -6
  31. package/out/concepts/Param__.js.map +1 -1
  32. package/out/concepts/ProcessElement__.d.ts +0 -86
  33. package/out/concepts/ProcessElement__.js +0 -130
  34. package/out/concepts/ProcessElement__.js.map +1 -1
  35. package/out/concepts/Process__.d.ts +0 -93
  36. package/out/concepts/Process__.js +0 -141
  37. package/out/concepts/Process__.js.map +1 -1
  38. package/out/concepts/ViewElement__.d.ts +8 -0
  39. package/out/concepts/ViewElement__.js +35 -47
  40. package/out/concepts/ViewElement__.js.map +1 -1
  41. package/out/concepts/View__.d.ts +8 -9
  42. package/out/concepts/View__.js +26 -72
  43. package/out/concepts/View__.js.map +1 -1
  44. package/out/concepts/basics/stdlib/nasl.ui.js +0 -4
  45. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  46. package/out/index.d.ts +1 -1
  47. package/out/index.js +3 -1
  48. package/out/index.js.map +1 -1
  49. package/out/server/createUiTs.d.ts +0 -9
  50. package/out/server/createUiTs.js +1 -28
  51. package/out/server/createUiTs.js.map +1 -1
  52. package/out/server/getMemberIdentifier.d.ts +1 -16
  53. package/out/server/getMemberIdentifier.js +29 -94
  54. package/out/server/getMemberIdentifier.js.map +1 -1
  55. package/out/server/getProcesses.d.ts +3 -3
  56. package/out/server/getProcesses.js +27 -28
  57. package/out/server/getProcesses.js.map +1 -1
  58. package/out/server/index.js +0 -3
  59. package/out/server/index.js.map +1 -1
  60. package/out/server/naslServer.js +7 -19
  61. package/out/server/naslServer.js.map +1 -1
  62. package/out/server/translator.js +5 -13
  63. package/out/server/translator.js.map +1 -1
  64. package/out/service/storage/init.d.ts +8 -0
  65. package/out/service/storage/init.js +5 -7
  66. package/out/service/storage/init.js.map +1 -1
  67. package/out/service/storage/service.d.ts +11 -2
  68. package/out/service/storage/service.js +26 -1
  69. package/out/service/storage/service.js.map +1 -1
  70. package/out/templator/genCurdEditMultipleKeyBlock.js +2 -4
  71. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  72. package/out/templator/genCurdMultipleKeyBlock.d.ts +0 -11
  73. package/out/templator/genCurdMultipleKeyBlock.js +19 -29
  74. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  75. package/out/templator/genEditTableBlock.js +30 -2
  76. package/out/templator/genEditTableBlock.js.map +1 -1
  77. package/out/templator/genGridViewBlock.js +15 -1
  78. package/out/templator/genGridViewBlock.js.map +1 -1
  79. package/out/templator/genTableBlock.js +15 -1
  80. package/out/templator/genTableBlock.js.map +1 -1
  81. package/package.json +1 -1
  82. package/src/bak/translator.js +1 -8
  83. package/src/common/BaseNode.ts +1 -1
  84. package/src/concepts/BindAttribute__.ts +153 -19
  85. package/src/concepts/BindDirective__.ts +139 -0
  86. package/src/concepts/BindEvent__.ts +57 -422
  87. package/src/concepts/CallQueryComponent__.ts +253 -56
  88. package/src/concepts/CompletionProperty__.ts +1 -0
  89. package/src/concepts/Destination__.ts +6 -1
  90. package/src/concepts/Function__.ts +1 -15
  91. package/src/concepts/Logic__.ts +11 -77
  92. package/src/concepts/Param__.ts +0 -6
  93. package/src/concepts/ProcessElement__.ts +1 -227
  94. package/src/concepts/Process__.ts +1 -237
  95. package/src/concepts/ViewElement__.ts +36 -48
  96. package/src/concepts/View__.ts +27 -72
  97. package/src/concepts/basics/stdlib/nasl.ui.ts +0 -4
  98. package/src/index.ts +1 -1
  99. package/src/server/createUiTs.ts +2 -26
  100. package/src/server/getMemberIdentifier.ts +28 -88
  101. package/src/server/getProcesses.ts +30 -31
  102. package/src/server/index.ts +0 -4
  103. package/src/server/naslServer.ts +7 -20
  104. package/src/server/translator.ts +6 -13
  105. package/src/service/storage/init.ts +5 -6
  106. package/src/service/storage/service.ts +28 -1
  107. package/src/templator/genCurdEditMultipleKeyBlock.ts +2 -5
  108. package/src/templator/genCurdMultipleKeyBlock.ts +16 -27
  109. package/src/templator/genEditTableBlock.ts +27 -0
  110. package/src/templator/genGridViewBlock.ts +13 -0
  111. package/src/templator/genTableBlock.ts +13 -0
  112. package/src/server/events.yaml +0 -89
@@ -59,6 +59,12 @@ export class CallQueryComponent extends LogicItem {
59
59
  @property('LogicItem')
60
60
  where: LogicItem = undefined;
61
61
 
62
+ /**
63
+ * where 草稿态
64
+ */
65
+ @property('LogicItem')
66
+ wherePlayground: Array<LogicItem> = [];
67
+
62
68
  /**
63
69
  * groupBy
64
70
  */
@@ -71,6 +77,12 @@ export class CallQueryComponent extends LogicItem {
71
77
  @property('LogicItem')
72
78
  having: LogicItem = undefined;
73
79
 
80
+ /**
81
+ * having 草稿态
82
+ */
83
+ @property('LogicItem')
84
+ havingPlayground: Array<LogicItem> = [];
85
+
74
86
  /**
75
87
  * orderBy
76
88
  */
@@ -204,20 +216,113 @@ export class CallQueryComponent extends LogicItem {
204
216
  });
205
217
  }
206
218
 
207
- getQueryGroupByExpressionExistingNames(excludedList: Array<QueryGroupByExpression> = []) {
208
- const excludedSet = new Set(excludedList);
209
- return (this.groupBy || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
210
- }
211
- getQueryGroupByExpressionUniqueName(name = 'queryGroupByExpression1') {
212
- return utils.unique(name, this.getQueryGroupByExpressionExistingNames(), undefined, false);
213
- }
219
+
220
+
221
+
214
222
 
215
223
  /**
216
- * 插入查询分组
224
+ * 插入逻辑项
225
+ * @internal
226
+ * @param logicItemOptions 逻辑项参数
227
+ */
228
+ _insertItemInWherePlaygroundAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
229
+
230
+ /**
231
+ * 插入逻辑项
217
232
  * @internal
218
- * @param name 查询分组名称,如果不填会自动生成一个唯一名称
233
+ * @param logicItem 已有的逻辑项实例
219
234
  */
220
- _insertQueryGroupByExpressionInGroupByAt(name: string, index: number): QueryGroupByExpression;
235
+ _insertItemInWherePlaygroundAt(logicItem: LogicItem, index: number): LogicItem;
236
+
237
+ _insertItemInWherePlaygroundAt(options: Partial<LogicItem> | LogicItem, index: number) {
238
+ const logicItemOptions: any = {};
239
+ const relationOptions = { parentNode: this, parentKey: 'wherePlayground' };
240
+ let logicItem: LogicItem;
241
+ if (options instanceof LogicItem) {
242
+ options.ensureDelete(); // 同一实例不支持多处存在
243
+ logicItem = options;
244
+ Object.assign(logicItem, relationOptions);
245
+ } else {
246
+ logicItem = LogicItem.from({
247
+ ...logicItemOptions,
248
+ ...options,
249
+ }, this, 'wherePlayground');
250
+ }
251
+ this.wherePlayground.splice(index, 0, logicItem);
252
+ return logicItem;
253
+ }
254
+
255
+
256
+
257
+ /**
258
+ * 插入逻辑项
259
+ * @param logicItemOptions 逻辑项参数
260
+ */
261
+ insertItemInWherePlaygroundAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
262
+
263
+ /**
264
+ * 插入逻辑项
265
+ * @param logicItem 已有的逻辑项实例
266
+ */
267
+ insertItemInWherePlaygroundAt(logicItem: LogicItem, index: number): LogicItem;
268
+
269
+ insertItemInWherePlaygroundAt(options: Partial<LogicItem> | LogicItem, index: number) {
270
+ const node = this._insertItemInWherePlaygroundAt(options as any, index);
271
+ node.create({
272
+ index,
273
+ parentNode: this,
274
+ parentKey: 'wherePlayground',
275
+ });
276
+ return node;
277
+ }
278
+
279
+
280
+
281
+ /**
282
+ * 添加逻辑项
283
+ * @internal
284
+ * @param logicItemOptions 逻辑项参数
285
+ */
286
+ _addItemInWherePlayground(logicItemOptions: Partial<LogicItem>): LogicItem;
287
+
288
+ /**
289
+ * 添加逻辑项
290
+ * @internal
291
+ * @param logicItem 已有的逻辑项实例
292
+ */
293
+ _addItemInWherePlayground(logicItem: LogicItem): LogicItem;
294
+
295
+ _addItemInWherePlayground(options?: Partial<LogicItem> | LogicItem) {
296
+ const index = this.wherePlayground.length;
297
+ return this._insertItemInWherePlaygroundAt(options as any, index);
298
+ }
299
+
300
+
301
+
302
+ /**
303
+ * 添加逻辑项
304
+ * @param logicItemOptions 逻辑项参数
305
+ */
306
+ addItemInWherePlayground(logicItemOptions: Partial<LogicItem>): LogicItem;
307
+
308
+ /**
309
+ * 添加逻辑项
310
+ * @param logicItem 已有的逻辑项实例
311
+ */
312
+ addItemInWherePlayground(logicItem: LogicItem): LogicItem;
313
+
314
+ addItemInWherePlayground(options?: Partial<LogicItem> | LogicItem) {
315
+ const node = this._addItemInWherePlayground(options as any);
316
+ const index = this.wherePlayground.indexOf(node);
317
+ node.create({
318
+ index,
319
+ parentNode: this,
320
+ parentKey: 'wherePlayground',
321
+ });
322
+ return node;
323
+ }
324
+
325
+
221
326
 
222
327
  /**
223
328
  * 插入查询分组
@@ -233,21 +338,11 @@ export class CallQueryComponent extends LogicItem {
233
338
  */
234
339
  _insertQueryGroupByExpressionInGroupByAt(queryGroupByExpression: QueryGroupByExpression, index: number): QueryGroupByExpression;
235
340
 
236
- _insertQueryGroupByExpressionInGroupByAt(options: string | Partial<QueryGroupByExpression> | QueryGroupByExpression, index: number) {
341
+ _insertQueryGroupByExpressionInGroupByAt(options: Partial<QueryGroupByExpression> | QueryGroupByExpression, index: number) {
237
342
  const queryGroupByExpressionOptions: any = {};
238
343
  const relationOptions = { parentNode: this, parentKey: 'groupBy' };
239
344
  let queryGroupByExpression: QueryGroupByExpression;
240
- if (!options) {
241
- queryGroupByExpression = QueryGroupByExpression.from({
242
- ...queryGroupByExpressionOptions,
243
- name: this.getQueryGroupByExpressionUniqueName(),
244
- }, this, 'groupBy');
245
- } else if (typeof options === 'string') {
246
- queryGroupByExpression = QueryGroupByExpression.from({
247
- ...queryGroupByExpressionOptions,
248
- name: options,
249
- }, this, 'groupBy');
250
- } else if (options instanceof QueryGroupByExpression) {
345
+ if (options instanceof QueryGroupByExpression) {
251
346
  options.ensureDelete(); // 同一实例不支持多处存在
252
347
  queryGroupByExpression = options;
253
348
  Object.assign(queryGroupByExpression, relationOptions);
@@ -261,11 +356,7 @@ export class CallQueryComponent extends LogicItem {
261
356
  return queryGroupByExpression;
262
357
  }
263
358
 
264
- /**
265
- * 插入查询分组
266
- * @param name 查询分组名称,如果不填会自动生成一个唯一名称
267
- */
268
- insertQueryGroupByExpressionInGroupByAt(name: string, index: number): QueryGroupByExpression;
359
+
269
360
 
270
361
  /**
271
362
  * 插入查询分组
@@ -279,7 +370,7 @@ export class CallQueryComponent extends LogicItem {
279
370
  */
280
371
  insertQueryGroupByExpressionInGroupByAt(queryGroupByExpression: QueryGroupByExpression, index: number): QueryGroupByExpression;
281
372
 
282
- insertQueryGroupByExpressionInGroupByAt(options: string | Partial<QueryGroupByExpression> | QueryGroupByExpression, index: number) {
373
+ insertQueryGroupByExpressionInGroupByAt(options: Partial<QueryGroupByExpression> | QueryGroupByExpression, index: number) {
283
374
  const node = this._insertQueryGroupByExpressionInGroupByAt(options as any, index);
284
375
  node.create({
285
376
  index,
@@ -289,12 +380,7 @@ export class CallQueryComponent extends LogicItem {
289
380
  return node;
290
381
  }
291
382
 
292
- /**
293
- * 添加查询分组
294
- * @internal
295
- * @param name 查询分组名称,如果不填会自动生成一个唯一名称
296
- */
297
- _addQueryGroupByExpressionInGroupBy(name?: string): QueryGroupByExpression;
383
+
298
384
 
299
385
  /**
300
386
  * 添加查询分组
@@ -310,17 +396,12 @@ export class CallQueryComponent extends LogicItem {
310
396
  */
311
397
  _addQueryGroupByExpressionInGroupBy(queryGroupByExpression: QueryGroupByExpression): QueryGroupByExpression;
312
398
 
313
- _addQueryGroupByExpressionInGroupBy(options?: string | Partial<QueryGroupByExpression> | QueryGroupByExpression) {
399
+ _addQueryGroupByExpressionInGroupBy(options?: Partial<QueryGroupByExpression> | QueryGroupByExpression) {
314
400
  const index = this.groupBy.length;
315
401
  return this._insertQueryGroupByExpressionInGroupByAt(options as any, index);
316
402
  }
317
403
 
318
- /**
319
- * 添加查询分组
320
- * @internal
321
- * @param name 查询分组名称,如果不填会自动生成一个唯一名称
322
- */
323
- addQueryGroupByExpressionInGroupBy(name?: string): QueryGroupByExpression;
404
+
324
405
 
325
406
  /**
326
407
  * 添加查询分组
@@ -334,7 +415,7 @@ export class CallQueryComponent extends LogicItem {
334
415
  */
335
416
  addQueryGroupByExpressionInGroupBy(queryGroupByExpression: QueryGroupByExpression): QueryGroupByExpression;
336
417
 
337
- addQueryGroupByExpressionInGroupBy(options?: string | Partial<QueryGroupByExpression> | QueryGroupByExpression) {
418
+ addQueryGroupByExpressionInGroupBy(options?: Partial<QueryGroupByExpression> | QueryGroupByExpression) {
338
419
  const node = this._addQueryGroupByExpressionInGroupBy(options as any);
339
420
  const index = this.groupBy.indexOf(node);
340
421
  node.create({
@@ -347,6 +428,110 @@ export class CallQueryComponent extends LogicItem {
347
428
 
348
429
 
349
430
 
431
+ /**
432
+ * 插入逻辑项
433
+ * @internal
434
+ * @param logicItemOptions 逻辑项参数
435
+ */
436
+ _insertItemInHavingPlaygroundAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
437
+
438
+ /**
439
+ * 插入逻辑项
440
+ * @internal
441
+ * @param logicItem 已有的逻辑项实例
442
+ */
443
+ _insertItemInHavingPlaygroundAt(logicItem: LogicItem, index: number): LogicItem;
444
+
445
+ _insertItemInHavingPlaygroundAt(options: Partial<LogicItem> | LogicItem, index: number) {
446
+ const logicItemOptions: any = {};
447
+ const relationOptions = { parentNode: this, parentKey: 'havingPlayground' };
448
+ let logicItem: LogicItem;
449
+ if (options instanceof LogicItem) {
450
+ options.ensureDelete(); // 同一实例不支持多处存在
451
+ logicItem = options;
452
+ Object.assign(logicItem, relationOptions);
453
+ } else {
454
+ logicItem = LogicItem.from({
455
+ ...logicItemOptions,
456
+ ...options,
457
+ }, this, 'havingPlayground');
458
+ }
459
+ this.havingPlayground.splice(index, 0, logicItem);
460
+ return logicItem;
461
+ }
462
+
463
+
464
+
465
+ /**
466
+ * 插入逻辑项
467
+ * @param logicItemOptions 逻辑项参数
468
+ */
469
+ insertItemInHavingPlaygroundAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
470
+
471
+ /**
472
+ * 插入逻辑项
473
+ * @param logicItem 已有的逻辑项实例
474
+ */
475
+ insertItemInHavingPlaygroundAt(logicItem: LogicItem, index: number): LogicItem;
476
+
477
+ insertItemInHavingPlaygroundAt(options: Partial<LogicItem> | LogicItem, index: number) {
478
+ const node = this._insertItemInHavingPlaygroundAt(options as any, index);
479
+ node.create({
480
+ index,
481
+ parentNode: this,
482
+ parentKey: 'havingPlayground',
483
+ });
484
+ return node;
485
+ }
486
+
487
+
488
+
489
+ /**
490
+ * 添加逻辑项
491
+ * @internal
492
+ * @param logicItemOptions 逻辑项参数
493
+ */
494
+ _addItemInHavingPlayground(logicItemOptions: Partial<LogicItem>): LogicItem;
495
+
496
+ /**
497
+ * 添加逻辑项
498
+ * @internal
499
+ * @param logicItem 已有的逻辑项实例
500
+ */
501
+ _addItemInHavingPlayground(logicItem: LogicItem): LogicItem;
502
+
503
+ _addItemInHavingPlayground(options?: Partial<LogicItem> | LogicItem) {
504
+ const index = this.havingPlayground.length;
505
+ return this._insertItemInHavingPlaygroundAt(options as any, index);
506
+ }
507
+
508
+
509
+
510
+ /**
511
+ * 添加逻辑项
512
+ * @param logicItemOptions 逻辑项参数
513
+ */
514
+ addItemInHavingPlayground(logicItemOptions: Partial<LogicItem>): LogicItem;
515
+
516
+ /**
517
+ * 添加逻辑项
518
+ * @param logicItem 已有的逻辑项实例
519
+ */
520
+ addItemInHavingPlayground(logicItem: LogicItem): LogicItem;
521
+
522
+ addItemInHavingPlayground(options?: Partial<LogicItem> | LogicItem) {
523
+ const node = this._addItemInHavingPlayground(options as any);
524
+ const index = this.havingPlayground.indexOf(node);
525
+ node.create({
526
+ index,
527
+ parentNode: this,
528
+ parentKey: 'havingPlayground',
529
+ });
530
+ return node;
531
+ }
532
+
533
+
534
+
350
535
  /**
351
536
  * 插入查询排序子句
352
537
  * @internal
@@ -584,10 +769,17 @@ export class CallQueryComponent extends LogicItem {
584
769
 
585
770
 
586
771
  /**
587
- * 删除查询分组
588
- * @param name 查询分组名称
589
- */
590
- removeQueryGroupByExpressionInGroupBy(name: string): void;
772
+ * 删除逻辑项
773
+ * @param logicItem 已有的逻辑项实例
774
+ */
775
+ removeItemInWherePlayground(logicItem: LogicItem): void;
776
+
777
+ removeItemInWherePlayground(options: LogicItem) {
778
+ let logicItem: LogicItem = options;
779
+ return logicItem.delete();
780
+ }
781
+
782
+
591
783
 
592
784
  /**
593
785
  * 删除查询分组
@@ -595,16 +787,8 @@ export class CallQueryComponent extends LogicItem {
595
787
  */
596
788
  removeQueryGroupByExpressionInGroupBy(queryGroupByExpression: QueryGroupByExpression): void;
597
789
 
598
- removeQueryGroupByExpressionInGroupBy(options: string | QueryGroupByExpression) {
599
- let queryGroupByExpression: QueryGroupByExpression;
600
- if (typeof options === 'string') {
601
- queryGroupByExpression = this.groupBy.find((item) => item.name === options);
602
- if (!queryGroupByExpression) {
603
- throw new Error('找不到查询分组 ' + options);
604
- }
605
- } else {
606
- queryGroupByExpression = options;
607
- }
790
+ removeQueryGroupByExpressionInGroupBy(options: QueryGroupByExpression) {
791
+ let queryGroupByExpression: QueryGroupByExpression = options;
608
792
  return queryGroupByExpression.delete();
609
793
  }
610
794
 
@@ -637,6 +821,19 @@ export class CallQueryComponent extends LogicItem {
637
821
 
638
822
 
639
823
 
824
+ /**
825
+ * 删除逻辑项
826
+ * @param logicItem 已有的逻辑项实例
827
+ */
828
+ removeItemInHavingPlayground(logicItem: LogicItem): void;
829
+
830
+ removeItemInHavingPlayground(options: LogicItem) {
831
+ let logicItem: LogicItem = options;
832
+ return logicItem.delete();
833
+ }
834
+
835
+
836
+
640
837
  /**
641
838
  * 删除查询排序子句
642
839
  * @param queryOrderByExpression 已有的查询排序子句实例
@@ -239,6 +239,7 @@ export class CompletionProperty extends BaseNode {
239
239
 
240
240
  isProcess: boolean = false;
241
241
 
242
+ noFurther: boolean = false;
242
243
  //================================================================================
243
244
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
244
245
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -1,4 +1,5 @@
1
1
  import View from './View__';
2
+ import { getNodeByNodeCallee } from '../automate/engine/utils';
2
3
  import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState, embeddedTSEmitter } from '../translator';
3
4
  import { ElementToVueOptions } from './ViewElement__';
4
5
  import { BindAttribute } from '..';
@@ -431,7 +432,7 @@ export class Destination extends LogicItem {
431
432
  let code = '';
432
433
 
433
434
  if (this.parentNode instanceof BindAttribute) {
434
- code = `${utils.firstLowerCase(this.concept)}: () => {\n`;
435
+ code = `() => {\n`;
435
436
  code += indent((state?.tabSize || 0) + 2);
436
437
  if (this.tsCalleeNamespace && this.tsName) {
437
438
  code += `${this.tsCalleeNamespace}.${this.tsName}.$destination({`;
@@ -475,6 +476,10 @@ export class Destination extends LogicItem {
475
476
  code += `${indent((state?.tabSize || 0) + 1)}}\n`;
476
477
  return code;
477
478
  }
479
+
480
+ get viewNode() {
481
+ return getNodeByNodeCallee(this.app, this.viewNamespace + '.' + this.viewName);
482
+ }
478
483
  //================================================================================
479
484
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
480
485
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -150,7 +150,7 @@ export class Function extends BaseNode {
150
150
  });
151
151
  }
152
152
 
153
- getTypeParamExistingNames(excludedList: Array<TypeParam> = []) {
153
+ getTypeParamExistingNames(excludedList: Array<TypeParam> = []) {
154
154
  const excludedSet = new Set(excludedList);
155
155
  return (this.typeParams || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
156
156
  }
@@ -291,7 +291,6 @@ export class Function extends BaseNode {
291
291
  return node;
292
292
  }
293
293
 
294
-
295
294
  getParamUniqueName(name = 'param1') {
296
295
  return utils.unique(name, this.getVarExistingNames(), undefined, false);
297
296
  }
@@ -429,7 +428,6 @@ export class Function extends BaseNode {
429
428
  return node;
430
429
  }
431
430
 
432
-
433
431
  getReturnUniqueName(name = 'result') {
434
432
  return utils.unique(name, this.getVarExistingNames(), undefined, false);
435
433
  }
@@ -567,7 +565,6 @@ export class Function extends BaseNode {
567
565
  return node;
568
566
  }
569
567
 
570
-
571
568
  getVariableUniqueName(name = 'variable1') {
572
569
  return utils.unique(name, this.getVarExistingNames(), undefined, false);
573
570
  }
@@ -705,9 +702,6 @@ export class Function extends BaseNode {
705
702
  return node;
706
703
  }
707
704
 
708
-
709
-
710
-
711
705
  /**
712
706
  * 删除类型参数
713
707
  * @param name 类型参数名称
@@ -756,8 +750,6 @@ export class Function extends BaseNode {
756
750
  return params;
757
751
  }
758
752
 
759
-
760
-
761
753
  /**
762
754
  * 删除输入参数
763
755
  * @param name 输入参数名称
@@ -806,8 +798,6 @@ export class Function extends BaseNode {
806
798
  return params;
807
799
  }
808
800
 
809
-
810
-
811
801
  /**
812
802
  * 删除输出参数
813
803
  * @param name 输出参数名称
@@ -856,8 +846,6 @@ export class Function extends BaseNode {
856
846
  return params;
857
847
  }
858
848
 
859
-
860
-
861
849
  /**
862
850
  * 删除局部变量
863
851
  * @param name 局部变量名称
@@ -906,8 +894,6 @@ export class Function extends BaseNode {
906
894
  return params;
907
895
  }
908
896
 
909
-
910
-
911
897
  /**
912
898
  * 删除逻辑项
913
899
  * @param name 逻辑项名称
@@ -2,7 +2,6 @@ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState
2
2
  import Namespace from './Namespace__';
3
3
  import CallQueryComponent from './CallQueryComponent__';
4
4
  import ForEachStatement from './ForEachStatement__';
5
- import BindEvent from './BindEvent__';
6
5
  //================================================================================
7
6
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
8
7
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -1379,7 +1378,16 @@ export class Logic extends BaseNode {
1379
1378
  return varList.filter((item) => !excludedSet.has(item)).map((item) => item?.name);
1380
1379
  }
1381
1380
 
1382
- toJSContent(code: string, state?: TranslatorState): string {
1381
+ toJS(state?: TranslatorState): string {
1382
+ let code = `methods['${this.name}'] = async function (`;
1383
+ if (Array.isArray(this.params)) {
1384
+ this.params.forEach((param, index) => {
1385
+ code += param.name;
1386
+ if (index !== this.params.length - 1)
1387
+ code += ', ';
1388
+ });
1389
+ }
1390
+ code += `) {\n`;
1383
1391
  // params
1384
1392
  if (Array.isArray(this.params)) {
1385
1393
  this.params.forEach((param) => {
@@ -1412,27 +1420,8 @@ export class Logic extends BaseNode {
1412
1420
  });
1413
1421
  }
1414
1422
 
1415
- return code;
1416
- }
1417
- toJS(state?: TranslatorState, type?: string): string {
1418
- let code = '';
1419
- if (type === 'IIFE') {
1420
- code += `(async () => {\n`;
1421
- code = this.toJSContent(code, state);
1422
- code += indent((state?.tabSize || 0)) + '})();\n';
1423
- return code;
1424
- }
1425
- code += `methods['${this.name}'] = async function (`;
1426
- if (Array.isArray(this.params)) {
1427
- this.params.forEach((param, index) => {
1428
- code += param.name;
1429
- if (index !== this.params.length - 1)
1430
- code += ', ';
1431
- });
1432
- }
1433
- code += `) {\n`;
1434
- code = this.toJSContent(code, state);
1435
1423
  code += indent((state?.tabSize || 0)) + '}\n';
1424
+
1436
1425
  return code;
1437
1426
  }
1438
1427
 
@@ -1543,9 +1532,6 @@ export class Logic extends BaseNode {
1543
1532
  if (!this.body.length && this.returns.length) {
1544
1533
  code += indent((state?.tabSize || 0) + 1) + `return ${this.returns[0].name};\n`;
1545
1534
  } else {
1546
- if (this.body.length <= 2 && !(this.parentNode instanceof Namespace)) {
1547
- code += 'const $LogicEmpty: any = null;';
1548
- }
1549
1535
  this.body.forEach((item) => {
1550
1536
  code += item.toEmbeddedTS && item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
1551
1537
  code += '\n';
@@ -1577,8 +1563,6 @@ export class Logic extends BaseNode {
1577
1563
  code += `function ${this.name}(`;
1578
1564
  } else if (prefix === 'inObject') {
1579
1565
  code += `${this.name}(`;
1580
- } else if (prefix === 'arrowFunction') {
1581
- code += `(`;
1582
1566
  }
1583
1567
  this.params.forEach((param, index) => {
1584
1568
  code += param.toEmbeddedTS(shiftState(state, code, { inline: true }));
@@ -1590,9 +1574,6 @@ export class Logic extends BaseNode {
1590
1574
  code += ': ';
1591
1575
  code += this.returns[0].typeAnnotation.toEmbeddedTS(shiftState(state, code, { inline: true }));
1592
1576
  }
1593
- if (prefix === 'arrowFunction') {
1594
- code += ` => `;
1595
- }
1596
1577
  code += '{\n';
1597
1578
 
1598
1579
  this.variables.forEach((variable) => {
@@ -1610,10 +1591,6 @@ export class Logic extends BaseNode {
1610
1591
  if (!this.body.length && this.returns.length) {
1611
1592
  code += indent((state?.tabSize || 0) + 1) + `return ${this.returns[0].name};\n`;
1612
1593
  } else {
1613
- // 如果长度小于2 并且不是虚拟节点就 加 报错,
1614
- if (this.body.length <= 2 && !(this.parentNode instanceof Namespace) && !(this.parentNode instanceof ProcessElement)) {
1615
- code += 'const $LogicEmpty: any = null;';
1616
- }
1617
1594
  this.body.forEach((item) => {
1618
1595
  code += item.toEmbeddedTS && item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
1619
1596
  code += '\n';
@@ -1756,49 +1733,6 @@ export class Logic extends BaseNode {
1756
1733
  this.app?.emit('collect:end');
1757
1734
  }
1758
1735
 
1759
- // 是不是内部有错误
1760
- haveError: boolean = false;
1761
-
1762
- // 是否body为空
1763
- isSmpty: boolean = false;
1764
-
1765
- get pathName() {
1766
- if (this.view) {
1767
- return this.getEventLogicName('chinese');
1768
- }
1769
- const nameMap = {
1770
- OnProcessStart: '流程开始时',
1771
- OnTasksCreate: '任务创建时',
1772
- OnTasksOpen: '任务打开时',
1773
- OnTasksClose: '任务关闭时',
1774
- OnCreate: '用户任务创建时',
1775
- OnOpen: '用户任务打开时',
1776
- OnClose: '用户任务关闭时',
1777
- };
1778
- const pathName = [this.name];
1779
- let parentNode = this.parentNode;
1780
- while (parentNode && parentNode.concept !== 'Process') {
1781
- const name = (nameMap as any)[parentNode.name] || parentNode.name;
1782
- pathName.unshift(name);
1783
- parentNode = parentNode.parentNode;
1784
- }
1785
- return pathName.join('-');
1786
- }
1787
- // 获取bindEvent下的logic的名称
1788
- getEventLogicName(type?: string) {
1789
- if (this.parentNode instanceof BindEvent) {
1790
- if (type === 'chinese') {
1791
- const bindEvent = this.parentNode;
1792
- const bindChineseName = bindEvent.getPageViewEventChineseName();
1793
- return `${bindChineseName}-${this.name}`;
1794
- }
1795
- }
1796
- return this.name;
1797
- }
1798
-
1799
- // 虚拟输入参数列表
1800
- virtualParams: Array<Param> = [];
1801
-
1802
1736
  //================================================================================
1803
1737
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
1804
1738
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -388,12 +388,6 @@ export class Param extends BaseNode {
388
388
  console.log(err);
389
389
  }
390
390
  }
391
-
392
- setnNewTypeAnnotation(oldTypeAnnotation: TypeAnnotation) {
393
- const json = oldTypeAnnotation.toJSON();
394
- const typeAnnotation = TypeAnnotation.from(json);
395
- this.typeAnnotation = typeAnnotation;
396
- }
397
391
  //================================================================================
398
392
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
399
393
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓