@lcap/nasl 2.18.0-beta.7 → 2.19.0-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/out/automate/template/myProcess.js +1 -1
- package/out/automate/template/myProcess.js.map +1 -1
- package/out/bak/translator.js +2 -1
- package/out/bak/translator.js.map +1 -1
- package/out/common/Command.d.ts +1 -0
- package/out/common/Command.js +5 -1
- package/out/common/Command.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +1 -0
- package/out/concepts/AnonymousFunction__.js +40 -2
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.d.ts +10 -0
- package/out/concepts/App__.js +132 -0
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Assignee__.js +4 -3
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts +2 -0
- package/out/concepts/BatchAssignment__.js +45 -1
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +8 -1
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/CallFunction__.js +51 -18
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +6 -4
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +87 -15
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +4 -1
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +2 -0
- package/out/concepts/DataSource__.js +55 -1
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +2 -0
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +1 -0
- package/out/concepts/Identifier__.js +18 -7
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +1 -1
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +1 -0
- package/out/concepts/Logic__.js +27 -14
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Match__.js +13 -8
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +345 -0
- package/out/concepts/NewComposite__.js +1067 -0
- package/out/concepts/NewComposite__.js.map +1 -0
- package/out/concepts/NewList__.d.ts +130 -0
- package/out/concepts/NewList__.js +353 -0
- package/out/concepts/NewList__.js.map +1 -0
- package/out/concepts/NewMap__.d.ts +221 -0
- package/out/concepts/NewMap__.js +492 -0
- package/out/concepts/NewMap__.js.map +1 -0
- package/out/concepts/New__.d.ts +19 -0
- package/out/concepts/New__.js +66 -0
- package/out/concepts/New__.js.map +1 -0
- package/out/concepts/Param__.d.ts +2 -0
- package/out/concepts/Param__.js +40 -3
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +31 -10
- 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/ProcessOutcomes__.d.ts +30 -0
- package/out/concepts/{ConstructArgument__.js → ProcessOutcomes__.js} +27 -48
- package/out/concepts/ProcessOutcomes__.js.map +1 -0
- package/out/concepts/Return__.js +2 -1
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SelectMembers__.js +3 -3
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js +12 -2
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +4 -0
- package/out/concepts/TypeAnnotation__.js +66 -12
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/ValidationRule__.js +1 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +2 -1
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.js +12 -0
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +1 -0
- package/out/concepts/View__.js +9 -0
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.js +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.logging.js +5 -0
- package/out/concepts/basics/stdlib/nasl.logging.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +2 -0
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +151 -19
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/index__.d.ts +5 -0
- package/out/concepts/index__.js +5 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/enums/KEYWORDS.js +1 -0
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genMetaData.js +1 -6
- package/out/generator/genMetaData.js.map +1 -1
- package/out/generator/genReleaseBody.d.ts +2 -0
- package/out/generator/genReleaseBody.js +18 -1
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/index.d.ts +1 -0
- package/out/generator/index.js +1 -0
- package/out/generator/index.js.map +1 -1
- package/out/generator/permission.d.ts +9 -0
- package/out/generator/permission.js +235 -0
- package/out/generator/permission.js.map +1 -0
- package/out/index.d.ts +1 -1
- package/out/index.js +2 -1
- package/out/index.js.map +1 -1
- package/out/server/entity2LogicNamespace.js +69 -9
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/extendBaseNode.js +7 -3
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.js +6 -0
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.d.ts +2 -1
- package/out/server/getLogics.js +11 -0
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +1 -1
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/naslServer.d.ts +1 -1
- package/out/server/naslServer.js +161 -22
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.js +8 -0
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.js +53 -8
- package/out/server/translator.js.map +1 -1
- package/out/service/creator/add.configs.js +4 -0
- package/out/service/creator/add.configs.js.map +1 -1
- package/out/service/datasource/api.d.ts +12 -0
- package/out/service/datasource/api.js +14 -0
- package/out/service/datasource/api.js.map +1 -0
- package/out/service/datasource/index.d.ts +2 -0
- package/out/service/datasource/index.js +10 -0
- package/out/service/datasource/index.js.map +1 -0
- package/out/service/storage/init.js +8 -1
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genEditTableBlock.js +4 -5
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +4 -3
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +16 -14
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +5 -5
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +6 -10
- package/out/templator/genTableBlock.js.map +1 -1
- package/package.json +1 -1
- package/sandbox/stdlib/dist/nasl.util.js +0 -0
- package/sandbox/stdlib/nasl.auth.ts +1 -1
- package/sandbox/stdlib/nasl.core.ts +4 -0
- package/sandbox/stdlib/nasl.logging.ts +4 -4
- package/sandbox/stdlib/nasl.util.ts +13 -4
- package/src/automate/template/myProcess.js +1 -1
- package/src/bak/translator.js +4 -1
- package/src/common/Command.ts +4 -0
- package/src/concepts/AnonymousFunction__.ts +48 -2
- package/src/concepts/App__.ts +140 -41
- package/src/concepts/Assignee__.ts +4 -3
- package/src/concepts/BatchAssignment__.ts +45 -1
- package/src/concepts/BindAttribute__.ts +9 -2
- package/src/concepts/CallFunction__.ts +65 -31
- package/src/concepts/CallInterface__.ts +6 -22
- package/src/concepts/CallLogic__.ts +62 -13
- package/src/concepts/CallQueryComponent__.ts +4 -1
- package/src/concepts/DataSource__.ts +56 -1
- package/src/concepts/ForEachStatement__.ts +2 -0
- package/src/concepts/Identifier__.ts +18 -7
- package/src/concepts/LogicItem__.ts +1 -1
- package/src/concepts/Logic__.ts +48 -32
- package/src/concepts/Match__.ts +12 -8
- package/src/concepts/NewComposite__.ts +1356 -0
- package/src/concepts/NewList__.ts +444 -0
- package/src/concepts/NewMap__.ts +678 -0
- package/src/concepts/New__.ts +73 -0
- package/src/concepts/Param__.ts +238 -199
- package/src/concepts/ProcessElement__.ts +32 -10
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/ProcessOutcomes__.ts +90 -0
- package/src/concepts/Return__.ts +4 -1
- package/src/concepts/SelectMembers__.ts +3 -3
- package/src/concepts/StringInterpolation__.ts +21 -11
- package/src/concepts/TypeAnnotation__.ts +71 -50
- package/src/concepts/ValidationRule__.ts +19 -1
- package/src/concepts/Variable__.ts +4 -1
- package/src/concepts/ViewElement__.ts +38 -1
- package/src/concepts/View__.ts +12 -2
- package/src/concepts/basics/stdlib/dist/nasl.util.js +133 -34
- package/src/concepts/basics/stdlib/nasl.auth.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.logging.ts +5 -0
- package/src/concepts/basics/stdlib/nasl.ui.ts +2 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +153 -19
- package/src/concepts/dist/BindAttribute__.js +760 -0
- package/src/concepts/dist/BindEvent__.js +732 -0
- package/src/concepts/dist/CallFunction__.js +21 -7
- package/src/concepts/dist/CallLogic__.js +50 -10
- package/src/concepts/dist/Identifier__.js +311 -0
- package/src/concepts/dist/StringInterpolation__.js +231 -0
- package/src/concepts/dist/TypeAnnotation__.js +834 -0
- package/src/concepts/dist/ViewElement__.js +12 -0
- package/src/concepts/dist/View__.js +1601 -0
- package/src/concepts/index__.ts +5 -0
- package/src/enums/KEYWORDS.ts +1 -0
- package/src/generator/dist/genMetaData.js +1 -5
- package/src/generator/dist/permission.js +392 -0
- package/src/generator/genMetaData.ts +1 -6
- package/src/generator/genReleaseBody.ts +21 -3
- package/src/generator/index.ts +1 -0
- package/src/generator/permission.ts +271 -0
- package/src/index.ts +1 -1
- package/src/server/dist/naslServer.js +385 -269
- package/src/server/entity2LogicNamespace.ts +70 -10
- package/src/server/extendBaseNode.ts +7 -3
- package/src/server/formatTsUtils.ts +6 -0
- package/src/server/getLogics.ts +13 -1
- package/src/server/getMemberIdentifier.ts +1 -1
- package/src/server/naslServer.ts +162 -29
- package/src/server/process2LogicNamespace.ts +8 -0
- package/src/server/translator.ts +52 -9
- package/src/service/creator/add.configs.js +4 -0
- package/src/service/dataSource/api.js +11 -0
- package/src/service/dataSource/index.js +6 -0
- package/src/service/storage/dist/init.js +8 -1
- package/src/service/storage/init.ts +9 -2
- package/src/service/video/VideoTranscribe.js +1 -0
- package/src/templator/dist/genEditTableBlock.js +204 -0
- package/src/templator/dist/genGridViewBlock.js +265 -0
- package/src/templator/dist/genListViewBlock.js +84 -0
- package/src/templator/dist/genTableBlock.js +209 -0
- package/src/templator/dist/utils.js +527 -0
- package/src/templator/genEditTableBlock.ts +8 -16
- package/src/templator/genGetBlock.ts +18 -19
- package/src/templator/genGridViewBlock.ts +18 -18
- package/src/templator/genListViewBlock.ts +8 -11
- package/src/templator/genTableBlock.ts +6 -10
- package/ts-worker/dist/webpack.config.dev.js +1 -3
- package/ts-worker/lib/tsserver.js +8 -1
- package/out/automate/engine/2.14-components.d.ts +0 -1115
- package/out/automate/engine/2.14-components.js +0 -1087
- package/out/automate/engine/2.14-components.js.map +0 -1
- package/out/concepts/ConstructArgument__.d.ts +0 -40
- package/out/concepts/ConstructArgument__.js.map +0 -1
- package/out/concepts/Construct__.d.ts +0 -189
- package/out/concepts/Construct__.js +0 -340
- package/out/concepts/Construct__.js.map +0 -1
- package/out/concepts/MatchExpression__.d.ts +0 -97
- package/out/concepts/MatchExpression__.js +0 -281
- package/out/concepts/MatchExpression__.js.map +0 -1
- package/out/templator/sql-parser/index.d.ts +0 -1
- package/out/templator/sql-parser/index.js +0 -228
- package/out/templator/sql-parser/index.js.map +0 -1
- package/out/templator/sql-parser/parser.js +0 -26664
- package/out/templator/sql-parser/parser.js.map +0 -1
- package/src/concepts/dist/Anchor__.js +0 -179
- package/src/concepts/dist/Assignment__.js +0 -301
- package/src/concepts/dist/CallInterface__.js +0 -533
- package/src/concepts/dist/ForEachStatement__.js +0 -426
- package/src/concepts/dist/MatchCase__.js +0 -587
- package/src/concepts/dist/Match__.js +0 -631
- package/src/concepts/dist/MemberExpression__.js +0 -348
- package/src/concepts/dist/Param__.js +0 -538
- package/src/concepts/dist/Return__.js +0 -494
- package/src/concepts/dist/Variable__.js +0 -537
- package/src/server/dist/formatTsUtils.js +0 -683
package/src/server/translator.ts
CHANGED
|
@@ -47,6 +47,8 @@ import {
|
|
|
47
47
|
AnonymousFunction,
|
|
48
48
|
MatchCase,
|
|
49
49
|
OqlQueryComponent,
|
|
50
|
+
NewMap,
|
|
51
|
+
NewList,
|
|
50
52
|
} from '../concepts';
|
|
51
53
|
import { SourceMapItem } from '../translator';
|
|
52
54
|
import { Diagnostic } from '../manager/diagnostic';
|
|
@@ -234,6 +236,10 @@ const TS_RULES: Array<{
|
|
|
234
236
|
re: /Cannot find name '__(?:IDENTIFIER|LEFT|RIGHT)__'/,
|
|
235
237
|
result: '表达式不能为空。',
|
|
236
238
|
},
|
|
239
|
+
{
|
|
240
|
+
re: /Cannot find name '__(?:FRONTENDVARIABLES)__'/,
|
|
241
|
+
result: '前端全局变量:不可在非页面下使用。',
|
|
242
|
+
},
|
|
237
243
|
{
|
|
238
244
|
re: /Cannot find name '__(?:QueryFieldExpression)__'/,
|
|
239
245
|
result: '数据查询:实体属性不能为空。',
|
|
@@ -369,6 +375,11 @@ const TS_RULES: Array<{
|
|
|
369
375
|
re: /'__destinationEmpty__' is declared but its value is never read./,
|
|
370
376
|
result: '任务未关联页面',
|
|
371
377
|
},
|
|
378
|
+
{
|
|
379
|
+
re: /Variable '(.+?)' implicitly has an 'any' type./,
|
|
380
|
+
result: '$1推断不出类型!请连线或手动设置',
|
|
381
|
+
transforms: [transformType],
|
|
382
|
+
},
|
|
372
383
|
];
|
|
373
384
|
|
|
374
385
|
const POST_RULES: Array<{
|
|
@@ -396,6 +407,14 @@ const POST_RULES: Array<{
|
|
|
396
407
|
re: /Decimal|"Decimal"/g,
|
|
397
408
|
result: '精确小数',
|
|
398
409
|
},
|
|
410
|
+
{
|
|
411
|
+
re: /String|"String"/g,
|
|
412
|
+
result: '字符串',
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
re: /Boolean|"Boolean"/g,
|
|
416
|
+
result: '布尔值',
|
|
417
|
+
},
|
|
399
418
|
{
|
|
400
419
|
re: /never/g,
|
|
401
420
|
result: '未知类型',
|
|
@@ -480,11 +499,13 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
480
499
|
}
|
|
481
500
|
}
|
|
482
501
|
|
|
483
|
-
if (node instanceof ProcessElement && (
|
|
502
|
+
if (node instanceof ProcessElement && (['ExclusiveGateway', 'ParallelGateway', 'InclusiveGateway'].includes(node.type))) {
|
|
484
503
|
const reg = /Expected (.+?) arguments, but got (.+?)./.exec(text);
|
|
485
504
|
let u = '排他网关';
|
|
486
505
|
if (node.type === 'ParallelGateway') {
|
|
487
506
|
u = '并行网关';
|
|
507
|
+
} else if (node.type === 'InclusiveGateway') {
|
|
508
|
+
u = '包容网关';
|
|
488
509
|
}
|
|
489
510
|
if (reg[2] === '0') {
|
|
490
511
|
tsErrorDetail.message = `${u}出口顺序流和入口顺序流个数不能等于0`;
|
|
@@ -500,15 +521,19 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
500
521
|
node = node.getAncestor('CallLogic');
|
|
501
522
|
}
|
|
502
523
|
// 赋值左右侧类型不一致, 把文字换一下
|
|
503
|
-
if (/Argument of type '(.+?)' is not assignable to parameter of type '(.+?)'/.exec(text)
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
if (
|
|
524
|
+
if (/Argument of type '(.+?)' is not assignable to parameter of type '(.+?)'/.exec(text)) {
|
|
525
|
+
if (node.parentNode instanceof Assignment) {
|
|
526
|
+
// OQL 的返回类型报错需要转换翻译,其内部 SQL 语句的参数类型报错不转换翻译
|
|
527
|
+
if (node instanceof OqlQueryComponent) {
|
|
528
|
+
if ((node.getCurrentSource().currentSource.range.start.line + 1) === tsErrorDetail.originalDiagnostic.start.line) {
|
|
529
|
+
tsErrorDetail.message = tsErrorDetail.message.replace('参数类型不一致!传入类型:', '赋值:类型不一致!右边类型:').replace('接收类型:', '左边类型:');
|
|
530
|
+
}
|
|
531
|
+
} else {
|
|
532
|
+
// node = node.getAncestor('CallLogic');
|
|
507
533
|
tsErrorDetail.message = tsErrorDetail.message.replace('参数类型不一致!传入类型:', '赋值:类型不一致!右边类型:').replace('接收类型:', '左边类型:');
|
|
508
534
|
}
|
|
509
|
-
} else {
|
|
510
|
-
|
|
511
|
-
tsErrorDetail.message = tsErrorDetail.message.replace('参数类型不一致!传入类型:', '赋值:类型不一致!右边类型:').replace('接收类型:', '左边类型:');
|
|
535
|
+
} else if (node.parentNode instanceof NewMap && text.includes(`is not assignable to parameter of type 'None'`)) {
|
|
536
|
+
tsErrorDetail.message = tsErrorDetail.message = `'参数类型不一致!', 'map的key类型只能是String | Integer | Boolean | Long | Decimal'的其中一种`;
|
|
512
537
|
}
|
|
513
538
|
}
|
|
514
539
|
if (node instanceof Argument || node instanceof Anchor) {
|
|
@@ -542,7 +567,7 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
542
567
|
if (node instanceof OqlQueryComponent) {
|
|
543
568
|
console.log(minRange, tsErrorDetail);
|
|
544
569
|
}
|
|
545
|
-
|
|
570
|
+
console.log(node, text)
|
|
546
571
|
// 类型报错的,需要放到上一级
|
|
547
572
|
if (/'(.+?)' has no exported member(?: named)? '(.+?)'/.exec(text) || /Property '(.+?)' does not exist on type '(.+?)'./.exec(text)) {
|
|
548
573
|
if (node instanceof TypeAnnotation) {
|
|
@@ -579,6 +604,10 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
579
604
|
tsErrorDetail.message = '调用逻辑:参数不能为空!';
|
|
580
605
|
} else if (node instanceof ProcessOutcome || node instanceof Function || node instanceof MatchCase) {
|
|
581
606
|
tsErrorDetail.message = (node as any).constructor.nodeTitle + ':不能为空!';
|
|
607
|
+
} else if (node instanceof NewMap) {
|
|
608
|
+
tsErrorDetail.message = 'Map推断不出类型!请手动设置!';
|
|
609
|
+
} else if (node instanceof NewList) {
|
|
610
|
+
tsErrorDetail.message = 'List推断不出类型!请手动设置!';
|
|
582
611
|
} else if (node instanceof Argument) {
|
|
583
612
|
let str = tsErrorDetail.message;
|
|
584
613
|
str = (node.parentNode as any).constructor.nodeTitle + ':' + str;
|
|
@@ -610,6 +639,14 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
610
639
|
tsErrorDetail.message = identifierToString(node);
|
|
611
640
|
}
|
|
612
641
|
}
|
|
642
|
+
|
|
643
|
+
if (/'__UpdateNoProperty__' is declared but its value is never read./.exec(text)) {
|
|
644
|
+
tsErrorDetail.message = '局部更新:未选择任何属性';
|
|
645
|
+
const callLogic = node.parentNode.parentNode.parentNode as CallLogic;
|
|
646
|
+
const bodyArgument = callLogic.arguments.find(item => item.keyword === 'body');
|
|
647
|
+
node = bodyArgument.expression;
|
|
648
|
+
}
|
|
649
|
+
|
|
613
650
|
// 左右类型不一致的,把上级信息带上
|
|
614
651
|
if (/^Type '(.+?)' is not assignable to type '(.+?)'\./.exec(text) || /^This condition will always return '(.+?)' since the types '(.+?)' and '(.+?)' have no overlap./.exec(text)) {
|
|
615
652
|
let str = tsErrorDetail.message;
|
|
@@ -621,6 +658,8 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
621
658
|
tsErrorDetail.message = tsErrorDetail.message.replace('左右参数', '返回值')
|
|
622
659
|
.replace('左边类型', '接收类型')
|
|
623
660
|
.replace('右边类型', '传入类型');
|
|
661
|
+
} else if (text === `Type 'void' is not assignable to type 'never'.`) {
|
|
662
|
+
tsErrorDetail.message = `${node.name}推断不出类型!请连线或手动设置`;
|
|
624
663
|
}
|
|
625
664
|
}
|
|
626
665
|
// 参数类型不一致!
|
|
@@ -650,6 +689,10 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
650
689
|
node.isSmpty = true;
|
|
651
690
|
}
|
|
652
691
|
}
|
|
692
|
+
if (/Variable '(.+?)' implicitly has an 'any' type./.exec(text) || /Variable '(.+?)' implicitly has an 'any\[\]' type./.exec(text)) {
|
|
693
|
+
if (node instanceof NewMap || node instanceof NewList || node instanceof Logic)
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
653
696
|
for (const rule of POST_RULES) {
|
|
654
697
|
if (rule.re.test(tsErrorDetail.message))
|
|
655
698
|
tsErrorDetail.message = tsErrorDetail.message.replace(rule.re, rule.result);
|
|
@@ -9,6 +9,10 @@ function httpCode(response, params, requestInfo) {
|
|
|
9
9
|
if ((data.code === undefined) || (data.code + '').startsWith('2')) {
|
|
10
10
|
return response;
|
|
11
11
|
}
|
|
12
|
+
if (data.code === 401339 && data.msg === '租户已过期或禁用') {
|
|
13
|
+
location.href = '/dashboard/exception/tenantExpired';
|
|
14
|
+
return
|
|
15
|
+
}
|
|
12
16
|
if (typeof window !== 'undefined' && new RegExp('^/designer').test(window.location.pathname)) {
|
|
13
17
|
if (data.code === 401) {
|
|
14
18
|
window.location.href = '/login';
|
|
@@ -124,6 +124,13 @@ function getStatement(state, app, diffLogicList) {
|
|
|
124
124
|
break;
|
|
125
125
|
case 'BatchAssignment':
|
|
126
126
|
logicItems = __spreadArrays([(_d = state.left) === null || _d === void 0 ? void 0 : _d.expression], (_e = state.left) === null || _e === void 0 ? void 0 : _e.members, state.rights.map(function (item) { return __spreadArrays([item === null || item === void 0 ? void 0 : item.expression], item === null || item === void 0 ? void 0 : item.members); }).flat(1));
|
|
127
|
+
break;
|
|
128
|
+
case 'MemberExpression':
|
|
129
|
+
logicItems = [state.object, state.property];
|
|
130
|
+
break;
|
|
131
|
+
case 'StringInterpolation':
|
|
132
|
+
logicItems = __spreadArrays(state.expressions);
|
|
133
|
+
break;
|
|
127
134
|
default:
|
|
128
135
|
break;
|
|
129
136
|
}
|
|
@@ -405,7 +412,7 @@ function handleApp(app) {
|
|
|
405
412
|
app._timer = setTimeout(function () {
|
|
406
413
|
console.error('收集超时,请及时排查原因');
|
|
407
414
|
app.emit('refresh');
|
|
408
|
-
},
|
|
415
|
+
}, 2500);
|
|
409
416
|
}
|
|
410
417
|
if (!app._isCollectingCount) {
|
|
411
418
|
app._actionMsg = event === null || event === void 0 ? void 0 : event.actionMsg;
|
|
@@ -77,6 +77,13 @@ function getStatement(state: any, app: any, diffLogicList: string[]) {
|
|
|
77
77
|
break;
|
|
78
78
|
case 'BatchAssignment':
|
|
79
79
|
logicItems = [state.left?.expression, ...state.left?.members, ...state.rights.map((item: SelectMembers) => [item?.expression, ...item?.members]).flat(1)];
|
|
80
|
+
break;
|
|
81
|
+
case 'MemberExpression':
|
|
82
|
+
logicItems = [state.object, state.property];
|
|
83
|
+
break;
|
|
84
|
+
case 'StringInterpolation':
|
|
85
|
+
logicItems = [...state.expressions];
|
|
86
|
+
break;
|
|
80
87
|
default:
|
|
81
88
|
break;
|
|
82
89
|
}
|
|
@@ -85,7 +92,7 @@ function getStatement(state: any, app: any, diffLogicList: string[]) {
|
|
|
85
92
|
}
|
|
86
93
|
|
|
87
94
|
/* 小程序影响的服务端发布 */
|
|
88
|
-
function getMiniAppChange(target: any, obj: any, action:string) {
|
|
95
|
+
function getMiniAppChange(target: any, obj: any, action: string) {
|
|
89
96
|
if (!target.app.miniEnable) {
|
|
90
97
|
return false;
|
|
91
98
|
}
|
|
@@ -335,7 +342,7 @@ export function handleApp(app: any) {
|
|
|
335
342
|
app._timer = setTimeout(() => {
|
|
336
343
|
console.error('收集超时,请及时排查原因');
|
|
337
344
|
app.emit('refresh');
|
|
338
|
-
},
|
|
345
|
+
}, 2500);
|
|
339
346
|
}
|
|
340
347
|
if (!app._isCollectingCount) {
|
|
341
348
|
app._actionMsg = event?.actionMsg;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.genBlurUpdateLogic = exports.genEditTableRemoveLogic = exports.genEditTableLoadLogic = exports.genEditTableTemplate = exports.genEditTableColumnTemplate = void 0;
|
|
4
|
+
var utils = require("../utils");
|
|
5
|
+
var _1 = require(".");
|
|
6
|
+
var utils_1 = require("./utils");
|
|
7
|
+
/**
|
|
8
|
+
* 根据实体属性生成表格列模板
|
|
9
|
+
* @param property 实体属性
|
|
10
|
+
*/
|
|
11
|
+
function genEditTableColumnTemplate(entity, property, nameGroup, selectNameGroupMap) {
|
|
12
|
+
var dataSource = entity.parentNode;
|
|
13
|
+
var lowerEntityName = utils.firstLowerCase(entity.name);
|
|
14
|
+
var valueExpression = "current.item." + lowerEntityName + "." + property.name;
|
|
15
|
+
var title = property.label || property.name;
|
|
16
|
+
var canEditable = function (property) { return !property.readonly; };
|
|
17
|
+
var getText = function (property) {
|
|
18
|
+
var propertyTypeName = property.typeAnnotation.typeName;
|
|
19
|
+
if (propertyTypeName === 'Boolean') {
|
|
20
|
+
return "\n <u-text v-if=\"" + valueExpression + "\" text=\"\u662F\"></u-text>\n <u-text v-if=\"!" + valueExpression + "\" text=\"\u5426\"></u-text>\n ";
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return "<u-text :text=\"" + valueExpression + "\"></u-text>";
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var genEditComponent = function (property) {
|
|
27
|
+
if (property.readonly)
|
|
28
|
+
return '';
|
|
29
|
+
var label = property.label || property.name;
|
|
30
|
+
var formItem = '';
|
|
31
|
+
var propertyTypeName = property.typeAnnotation.typeName;
|
|
32
|
+
if (property.relationEntity && selectNameGroupMap) {
|
|
33
|
+
// 有外键关联
|
|
34
|
+
var relationEntity = dataSource === null || dataSource === void 0 ? void 0 : dataSource.findEntityByName(property.relationEntity);
|
|
35
|
+
if (relationEntity) {
|
|
36
|
+
var relationProperty = relationEntity.properties.find(function (prop) { return prop.name === property.relationProperty; });
|
|
37
|
+
var displayedProperty = _1.getFirstDisplayedProperty(relationEntity);
|
|
38
|
+
if (displayedProperty) {
|
|
39
|
+
var lowerEntityName_1 = utils.firstLowerCase(relationEntity.name);
|
|
40
|
+
// 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
|
|
41
|
+
var key = [property.name, relationEntity.name].join('-');
|
|
42
|
+
var selectNameGroup = selectNameGroupMap.get(key);
|
|
43
|
+
formItem += "\n <u-select clearable placeholder=\"\u8BF7\u9009\u62E9" + label + "\" :data-source=\"" + selectNameGroup.viewLogicLoad + "\"\n :autofocus=\"true\" :opened=\"true\" append-to=\"body\" @blur=\"" + nameGroup.viewLogicBlurUpdate + "\" @select=\"" + nameGroup.viewLogicBlurUpdate + "\"\n text-field=\"" + lowerEntityName_1 + "." + displayedProperty.name + "\" value-field=\"" + lowerEntityName_1 + "." + relationProperty.name + "\" :pageable=\"true\" :remote-paging=\"true\" :value.sync=\"" + valueExpression + "\">\n </u-select>\n ";
|
|
44
|
+
}
|
|
45
|
+
else
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
else if (propertyTypeName === 'Boolean') {
|
|
52
|
+
formItem += "<u-select clearable :value.sync=\"" + valueExpression + "\" placeholder=\"\u8BF7\u8F93\u5165" + label + "\"\n :autofocus=\"true\" :opened=\"true\" append-to=\"body\" @blur=\"" + nameGroup.viewLogicBlurUpdate + "\" @select=\"" + nameGroup.viewLogicBlurUpdate + "\">\n <u-select-item :value=\"true\" text=\"\u662F\">\u662F</u-select-item>\n <u-select-item :value=\"false\" text=\"\u5426\">\u5426</u-select-item>\n </u-select>";
|
|
53
|
+
}
|
|
54
|
+
else if (propertyTypeName === 'Integer' || propertyTypeName === 'Long') {
|
|
55
|
+
formItem = "<u-number-input :value.sync=\"" + valueExpression + "\" placeholder=\"\u8BF7\u8F93\u5165" + label + "\" :autofocus=\"true\" @blur=\"" + nameGroup.viewLogicBlurUpdate + "\"></u-number-input>";
|
|
56
|
+
}
|
|
57
|
+
else if (propertyTypeName === 'Double') {
|
|
58
|
+
formItem = "<u-number-input :value.sync=\"" + valueExpression + "\" :precision=\"0\" :step=\"0\" placeholder=\"\u8BF7\u8F93\u5165" + label + "\" :autofocus=\"true\" @blur=\"" + nameGroup.viewLogicBlurUpdate + "\"></u-number-input>";
|
|
59
|
+
}
|
|
60
|
+
else if (propertyTypeName === 'Decimal') {
|
|
61
|
+
formItem = "<u-number-input :value.sync=\"" + valueExpression + "\" :precision=\"0\" :step=\"0\" placeholder=\"\u8BF7\u8F93\u5165" + label + "\" :autofocus=\"true\" @blur=\"" + nameGroup.viewLogicBlurUpdate + "\"></u-number-input>";
|
|
62
|
+
}
|
|
63
|
+
else if (propertyTypeName === 'Text') {
|
|
64
|
+
formItem = "<u-validator placement=\"bottom\" display=\"appear\" @blur-valid=\"" + nameGroup.viewLogicBlurUpdate + "\" style=\"width:100%\">\n <u-textarea :value.sync=\"" + valueExpression + "\" placeholder=\"\u8BF7\u8F93\u5165" + label + "\" :autofocus=\"true\" size=\"full\"></u-textarea>\n </u-validator>";
|
|
65
|
+
}
|
|
66
|
+
else if (propertyTypeName === 'Date') {
|
|
67
|
+
formItem = "<u-date-picker clearable :date.sync=\"" + valueExpression + "\" placeholder=\"\u8BF7\u8F93\u5165" + label + "\" append-to=\"body\" :autofocus=\"true\" :opened=\"true\" @blur=\"" + nameGroup.viewLogicBlurUpdate + "\"></u-date-picker>";
|
|
68
|
+
}
|
|
69
|
+
else if (propertyTypeName === 'Time') {
|
|
70
|
+
formItem = "<u-time-picker :time.sync=\"" + valueExpression + "\" placeholder=\"\u8BF7\u8F93\u5165" + label + "\" append-to=\"body\" :autofocus=\"true\" @blur=\"" + nameGroup.viewLogicBlurUpdate + "\"></u-time-picker>";
|
|
71
|
+
}
|
|
72
|
+
else if (propertyTypeName === 'DateTime') {
|
|
73
|
+
formItem = "<u-date-time-picker clearable :date.sync=\"" + valueExpression + "\" placeholder=\"\u8BF7\u8F93\u5165" + label + "\" append-to=\"body\" :autofocus=\"true\" :opened=\"true\" @blur=\"" + nameGroup.viewLogicBlurUpdate + "\"></u-date-time-picker>";
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
formItem = "<u-validator placement=\"bottom\" display=\"appear\" @blur-valid=\"" + nameGroup.viewLogicBlurUpdate + "\" style=\"width:100%\" append-to=\"body\">\n <u-input :value.sync=\"" + valueExpression + "\" placeholder=\"\u8BF7\u8F93\u5165" + label + "\" :autofocus=\"true\" size=\"full\"></u-input>\n </u-validator>";
|
|
77
|
+
}
|
|
78
|
+
return "<template #editcell=\"current\">\n <u-linear-layout gap=\"small\">\n " + formItem + "\n </u-linear-layout>\n </template>";
|
|
79
|
+
};
|
|
80
|
+
return "<u-table-view-column field=\"" + utils.firstLowerCase(entity.name) + "." + property.name + "\" " + (canEditable(property) ? 'type="editable"' : '') + ">\n <template #title><u-text text=\"" + title + "\"></u-text></template>\n <template #cell=\"current\">\n <u-linear-layout gap=\"small\">\n " + getText(property) + "\n </u-linear-layout>\n </template>\n " + genEditComponent(property) + "\n</u-table-view-column>";
|
|
81
|
+
}
|
|
82
|
+
exports.genEditTableColumnTemplate = genEditTableColumnTemplate;
|
|
83
|
+
/**
|
|
84
|
+
* 生成表格模板
|
|
85
|
+
* @param entity 实体
|
|
86
|
+
* @param nameGroup 命名组
|
|
87
|
+
*/
|
|
88
|
+
function genEditTableTemplate(entity, nameGroup, selectNameGroupMap) {
|
|
89
|
+
var properties = entity.properties.filter(_1.filterProperty('inTable'));
|
|
90
|
+
return "<u-table-view ref=\"" + nameGroup.viewElementMainView + "\" :data-source=\"" + nameGroup.viewLogicLoad + "\" data-schema=\"" + nameGroup.structure + "\"\n value-field=\"" + nameGroup.viewVariableEntity + ".id\"\n :pageable=\"true\" :remote-paging=\"true\" :show-sizer=\"true\" :default-column-width=\"300\" editable>\n <u-table-view-column type=\"index\" width=\"60\"><template #title><u-text text=\"\u5E8F\u53F7\"></u-text></template></u-table-view-column>\n\n " + properties.map(function (property) { return genEditTableColumnTemplate(entity, property, nameGroup, selectNameGroupMap) + '\n'; }).join('') + "\n\n <u-table-view-column>\n <template #title><u-text text=\"\u64CD\u4F5C\"></u-text></template>\n <template #cell=\"current\">\n <u-linear-layout gap=\"small\">\n <u-link @click=\"" + nameGroup.viewLogicRemove + "\">\u5220\u9664</u-link>\n </u-linear-layout>\n </template>\n </u-table-view-column>\n</u-table-view>\n";
|
|
91
|
+
}
|
|
92
|
+
exports.genEditTableTemplate = genEditTableTemplate;
|
|
93
|
+
/**
|
|
94
|
+
* 生成表格 load 逻辑
|
|
95
|
+
* @param entity 实体
|
|
96
|
+
*/
|
|
97
|
+
function genEditTableLoadLogic(entity, nameGroup, newLogic, supportFilter) {
|
|
98
|
+
var moduleNode = entity.app;
|
|
99
|
+
var moduleNamespace = moduleNode === null || moduleNode === void 0 ? void 0 : moduleNode.getNamespace();
|
|
100
|
+
var params = [
|
|
101
|
+
_1.genLogicParam("" + newLogic.params[0].name, 'params.page'),
|
|
102
|
+
_1.genLogicParam("" + newLogic.params[1].name, 'params.size'),
|
|
103
|
+
_1.genLogicParam("" + newLogic.params[2].name, 'params.sort'),
|
|
104
|
+
_1.genLogicParam("" + newLogic.params[3].name, 'params.order'),
|
|
105
|
+
];
|
|
106
|
+
if (supportFilter)
|
|
107
|
+
params.push(_1.genLogicParam("" + newLogic.params[4].name, nameGroup.viewVariableFilter));
|
|
108
|
+
return utils_1.NaslNode.Logic({
|
|
109
|
+
name: nameGroup.viewLogicLoad,
|
|
110
|
+
params: [
|
|
111
|
+
utils_1.NaslNode.Param({
|
|
112
|
+
name: 'params',
|
|
113
|
+
typeAnnotation: utils_1.NaslUITypeAnnotation.DataSourceParams
|
|
114
|
+
}),
|
|
115
|
+
],
|
|
116
|
+
returns: [
|
|
117
|
+
utils_1.NaslNode.Return({
|
|
118
|
+
name: 'result',
|
|
119
|
+
typeAnnotation: null
|
|
120
|
+
}),
|
|
121
|
+
],
|
|
122
|
+
variables: [],
|
|
123
|
+
body: [
|
|
124
|
+
utils_1.NaslLogicItem.Start,
|
|
125
|
+
utils_1.NaslLogicItem.Assignment({
|
|
126
|
+
left: utils_1.NaslLogicItem.Identifier({
|
|
127
|
+
name: 'result'
|
|
128
|
+
}),
|
|
129
|
+
right: utils_1.NaslLogicItem.CallLogic({
|
|
130
|
+
calleeNamespace: moduleNamespace + ".logics",
|
|
131
|
+
calleeName: newLogic.name,
|
|
132
|
+
arguments: params
|
|
133
|
+
})
|
|
134
|
+
}),
|
|
135
|
+
utils_1.NaslLogicItem.End,
|
|
136
|
+
]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
exports.genEditTableLoadLogic = genEditTableLoadLogic;
|
|
140
|
+
/**
|
|
141
|
+
* 生成表格 remove 逻辑
|
|
142
|
+
* @param entity 实体
|
|
143
|
+
*/
|
|
144
|
+
function genEditTableRemoveLogic(entity, nameGroup) {
|
|
145
|
+
var _a;
|
|
146
|
+
var lowerEntityName = utils.firstLowerCase(entity.name);
|
|
147
|
+
var ns = entity.ns;
|
|
148
|
+
var deleteLogic = (_a = ns === null || ns === void 0 ? void 0 : ns.logics) === null || _a === void 0 ? void 0 : _a.find(function (logic) { return logic.name === "delete"; });
|
|
149
|
+
var idPropertys = entity.properties.filter(function (property) { return property.primaryKey || property.name === 'id'; });
|
|
150
|
+
return utils_1.NaslNode.Logic({
|
|
151
|
+
name: nameGroup.viewLogicRemove,
|
|
152
|
+
params: [],
|
|
153
|
+
returns: [],
|
|
154
|
+
variables: [],
|
|
155
|
+
body: [
|
|
156
|
+
utils_1.NaslLogicItem.Start,
|
|
157
|
+
utils_1.NaslLogicItem.CallLogic({
|
|
158
|
+
calleeNamespace: deleteLogic.getNamespace(),
|
|
159
|
+
calleeName: deleteLogic.name,
|
|
160
|
+
arguments: idPropertys.map(function (idProperty) {
|
|
161
|
+
var paramFromLogic = _1.getParamFromLogic(deleteLogic, idProperty.name);
|
|
162
|
+
// 如果旧逻辑,但是新导入表中,id的name 不是id 的话,就直接使用名称叫id的
|
|
163
|
+
if (!paramFromLogic) {
|
|
164
|
+
paramFromLogic = _1.getParamFromLogic(deleteLogic, 'id');
|
|
165
|
+
}
|
|
166
|
+
return _1.genLogicParam(paramFromLogic.name, "current.item." + lowerEntityName + "." + paramFromLogic.name);
|
|
167
|
+
})
|
|
168
|
+
}),
|
|
169
|
+
_1.genCallComponentLogic(nameGroup.viewElementMainView, 'reload'),
|
|
170
|
+
utils_1.NaslLogicItem.End,
|
|
171
|
+
]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
exports.genEditTableRemoveLogic = genEditTableRemoveLogic;
|
|
175
|
+
function genBlurUpdateLogic(entity, nameGroup) {
|
|
176
|
+
var _a;
|
|
177
|
+
var lowerEntityName = utils.firstLowerCase(entity.name);
|
|
178
|
+
var ns = entity.ns;
|
|
179
|
+
var updateLogic = (_a = ns === null || ns === void 0 ? void 0 : ns.logics) === null || _a === void 0 ? void 0 : _a.find(function (logic) { return logic.name === "update"; });
|
|
180
|
+
return utils_1.NaslNode.Logic({
|
|
181
|
+
name: nameGroup.viewLogicBlurUpdate,
|
|
182
|
+
params: [],
|
|
183
|
+
returns: [],
|
|
184
|
+
body: [
|
|
185
|
+
utils_1.NaslLogicItem.Start,
|
|
186
|
+
utils_1.NaslLogicItem.Assignment({
|
|
187
|
+
left: _1.genMemberExpression("current.item.editing", ['', '', nameGroup.structure + ".editing"]),
|
|
188
|
+
right: utils_1.NaslLogicItem.StringLiteral({
|
|
189
|
+
value: ''
|
|
190
|
+
})
|
|
191
|
+
}),
|
|
192
|
+
utils_1.NaslLogicItem.CallLogic({
|
|
193
|
+
calleeNamespace: updateLogic.getNamespace(),
|
|
194
|
+
calleeName: updateLogic.name,
|
|
195
|
+
arguments: [
|
|
196
|
+
_1.genLogicParam("" + updateLogic.params[0].name, "current.item." + lowerEntityName),
|
|
197
|
+
]
|
|
198
|
+
}),
|
|
199
|
+
utils_1.NaslLogicItem.End,
|
|
200
|
+
],
|
|
201
|
+
playground: []
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
exports.genBlurUpdateLogic = genBlurUpdateLogic;
|