@lcap/nasl 3.5.0-beta.4 → 3.6.0-alpha.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.
- package/out/breakpoint/shared/utils.js +1 -19
- package/out/breakpoint/shared/utils.js.map +1 -1
- package/out/breakpoint/store/core.js +1 -1
- package/out/breakpoint/store/core.js.map +1 -1
- package/out/common/BaseNode.d.ts +9 -0
- package/out/common/BaseNode.js +15 -0
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/Command.js +1 -0
- package/out/common/Command.js.map +1 -1
- package/out/common/EventEmitter.d.ts +1 -1
- package/out/common/EventEmitter.js +0 -4
- package/out/common/EventEmitter.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +6 -1
- package/out/concepts/AnonymousFunction__.js +34 -16
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.d.ts +29 -0
- package/out/concepts/App__.js +120 -21
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindEvent__.js +2 -2
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BusinessComponent__.d.ts +1 -1
- package/out/concepts/BusinessComponent__.js +107 -87
- package/out/concepts/BusinessComponent__.js.map +1 -1
- package/out/concepts/CallEvent__.d.ts +4 -0
- package/out/concepts/CallEvent__.js +18 -1
- package/out/concepts/CallEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.d.ts +0 -1
- package/out/concepts/CallFunction__.js +0 -8
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/Destination__.js +3 -3
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +1 -1
- package/out/concepts/Entity__.js +2 -0
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Logic__.js +15 -8
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Match__.d.ts +1 -1
- package/out/concepts/ValidationRule__.js +2 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +1 -0
- package/out/concepts/ViewElement__.js +20 -3
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +19 -18
- package/out/concepts/View__.js.map +1 -1
- package/out/server/extendBaseNode.js +18 -0
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/getProcesses.js +3 -3
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/naslServer.js +16 -12
- package/out/server/naslServer.js.map +1 -1
- package/out/service/storage/init.js +24 -1
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.d.ts +27 -0
- package/out/templator/genCurdMultipleKeyBlock.js +673 -1
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +2 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genTableBlock.d.ts +2 -0
- package/out/templator/genTableBlock.js +114 -1
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +2 -1
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/translator/utils.js +30 -1
- package/out/translator/utils.js.map +1 -1
- package/out/utils/index.d.ts +17 -0
- package/out/utils/index.js +184 -1
- package/out/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/breakpoint/shared/utils.ts +2 -24
- package/src/breakpoint/store/core.ts +1 -1
- package/src/common/BaseNode.ts +19 -0
- package/src/common/Command.ts +1 -0
- package/src/common/EventEmitter.ts +1 -6
- package/src/concepts/AnonymousFunction__.ts +36 -18
- package/src/concepts/App__.ts +132 -21
- package/src/concepts/BindAttribute__.ts +0 -1
- package/src/concepts/BindEvent__.ts +2 -2
- package/src/concepts/BusinessComponent__.ts +122 -98
- package/src/concepts/CallEvent__.ts +19 -2
- package/src/concepts/CallFunction__.ts +0 -11
- package/src/concepts/Destination__.ts +3 -3
- package/src/concepts/Entity__.ts +3 -1
- package/src/concepts/Logic__.ts +15 -9
- package/src/concepts/ValidationRule__.ts +6 -1
- package/src/concepts/ViewElement__.ts +26 -3
- package/src/concepts/View__.ts +19 -18
- package/src/server/extendBaseNode.ts +21 -0
- package/src/server/getProcesses.ts +3 -3
- package/src/server/naslServer.ts +17 -11
- package/src/service/storage/init.ts +31 -1
- package/src/templator/genCurdMultipleKeyBlock.ts +781 -57
- package/src/templator/genGetBlock.ts +2 -1
- package/src/templator/genTableBlock.ts +127 -2
- package/src/templator/genUpdateBlock.ts +2 -1
- package/src/translator/utils.ts +32 -1
- package/src/utils/index.ts +211 -1
- package/ts-worker/src/index.js +1 -0
package/src/server/naslServer.ts
CHANGED
|
@@ -89,6 +89,7 @@ import {
|
|
|
89
89
|
types,
|
|
90
90
|
asserts,
|
|
91
91
|
BusinessComponent,
|
|
92
|
+
CallEvent,
|
|
92
93
|
} from '../concepts';
|
|
93
94
|
|
|
94
95
|
import * as utils from '../utils';
|
|
@@ -1603,9 +1604,10 @@ class NaslServer {
|
|
|
1603
1604
|
const self = this;
|
|
1604
1605
|
const diagnostics: Diagnostic[] = [];
|
|
1605
1606
|
|
|
1606
|
-
if (fileNode instanceof View) {
|
|
1607
|
+
if (fileNode instanceof View || fileNode instanceof BusinessComponent) {
|
|
1607
1608
|
yield* utils.wrapIteratorToGenerator(fileNode.sourceMap.entries(), function* attachView([node, value]) {
|
|
1608
|
-
|
|
1609
|
+
const likeComponent = node.getAncestor('View') || node.getAncestor('BusinessComponent');
|
|
1610
|
+
if (node instanceof ViewElement && likeComponent === fileNode) {
|
|
1609
1611
|
if (node.tag) {
|
|
1610
1612
|
yield* utils.wrapForEachToGenerator(node.bindAttrs, (bindAttr) => {
|
|
1611
1613
|
if ((bindAttr.model || bindAttr.sync) && bindAttr.expression) {
|
|
@@ -1646,14 +1648,14 @@ class NaslServer {
|
|
|
1646
1648
|
}
|
|
1647
1649
|
});
|
|
1648
1650
|
}
|
|
1649
|
-
} else if ((node instanceof Variable || node instanceof Return) &&
|
|
1651
|
+
} else if ((node instanceof Variable || node instanceof Return) && likeComponent === fileNode) {
|
|
1650
1652
|
if (!node.typeAnnotation && !node.__TypeAnnotation) {
|
|
1651
1653
|
const nodeTypeName = node.concept === 'Return' ? '输出参数' : '局部变量';
|
|
1652
1654
|
let msg;
|
|
1653
1655
|
yield* fileNode.traverseChildrenGenerator((nodeIn) => {
|
|
1654
1656
|
if (nodeIn && (nodeIn instanceof BatchAssignment || (nodeIn instanceof Assignment && nodeIn.left?.name))) {
|
|
1655
1657
|
// 子页面内部逻辑过滤
|
|
1656
|
-
if (nodeIn.view !== fileNode) return;
|
|
1658
|
+
if ((nodeIn.view || nodeIn.getAncestor('BusinessComponent')) !== fileNode) return;
|
|
1657
1659
|
// 当局部变量、输出参数属于页面内逻辑时,需过滤同页面下不同逻辑下的同名变量
|
|
1658
1660
|
if (node.logic && node.logic !== nodeIn.logic) return;
|
|
1659
1661
|
// 跟变量无关的赋值过滤
|
|
@@ -2730,7 +2732,7 @@ class NaslServer {
|
|
|
2730
2732
|
}
|
|
2731
2733
|
|
|
2732
2734
|
if (!minRange) {
|
|
2733
|
-
if (fileNode instanceof View) {
|
|
2735
|
+
if (fileNode instanceof View || fileNode instanceof BusinessComponent) {
|
|
2734
2736
|
return { node: fileNode, item: sourceMap.get(fileNode) } as MinRange;
|
|
2735
2737
|
}
|
|
2736
2738
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -3131,6 +3133,9 @@ class NaslServer {
|
|
|
3131
3133
|
);
|
|
3132
3134
|
const results = await Promise.all(promises);
|
|
3133
3135
|
results.forEach((constRefs) => {
|
|
3136
|
+
if(constRefs.symbolDisplayString.includes('(parameter)')) {
|
|
3137
|
+
return;
|
|
3138
|
+
}
|
|
3134
3139
|
refsList = [...refsList, ...constRefs.refs];
|
|
3135
3140
|
});
|
|
3136
3141
|
}
|
|
@@ -3181,6 +3186,9 @@ class NaslServer {
|
|
|
3181
3186
|
minRange.setTypeMethods = 'setCalleeNamespace';
|
|
3182
3187
|
minRange.newValue = `elements.${ newValue }.logics`;
|
|
3183
3188
|
}
|
|
3189
|
+
if (minRange.node instanceof CallEvent) {
|
|
3190
|
+
minRange.setTypeMethods = 'setCalleeName';
|
|
3191
|
+
}
|
|
3184
3192
|
// 如果节点是实体修改引发calllogic修改
|
|
3185
3193
|
if (
|
|
3186
3194
|
minRange.node instanceof CallLogic &&
|
|
@@ -3551,17 +3559,15 @@ class NaslServer {
|
|
|
3551
3559
|
if (node instanceof Param && minRange.node instanceof Interface) {
|
|
3552
3560
|
return null;
|
|
3553
3561
|
}
|
|
3554
|
-
//
|
|
3555
|
-
if (minRange.node instanceof View) {
|
|
3556
|
-
if (node instanceof View) {
|
|
3562
|
+
// 如果是被影响的是页面/业务组件
|
|
3563
|
+
if (minRange.node instanceof View || minRange.node instanceof BusinessComponent) {
|
|
3564
|
+
if (node instanceof View || node instanceof BusinessComponent) {
|
|
3557
3565
|
// 如果是子页面修改
|
|
3558
3566
|
// 父页面引起子页面改名,就可以不改了,自动同步
|
|
3567
|
+
// 页面中的业务组件,业务组件中的业务组件等都需要忽略
|
|
3559
3568
|
if (minRange.node !== node) {
|
|
3560
3569
|
return null;
|
|
3561
3570
|
}
|
|
3562
|
-
} else if (node instanceof BusinessComponent) {
|
|
3563
|
-
minRange.setTypeMethods = 'setTag';
|
|
3564
|
-
minRange.newValue = `bs-${newValue}`;
|
|
3565
3571
|
} else if (!(node instanceof Role)) {
|
|
3566
3572
|
/**
|
|
3567
3573
|
* 无论是逻辑还是实体中的key,修改都不应该触发
|
|
@@ -385,6 +385,29 @@ const handleAIPoint = (app: any, actionItem: any) => {
|
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
+
const isBreakpointEvent = (event: any) => {
|
|
389
|
+
const originEvent = event?.originEvent;
|
|
390
|
+
const object = originEvent?.object || {};
|
|
391
|
+
const oldObject = originEvent?.oldObject || {};
|
|
392
|
+
|
|
393
|
+
if (typeof object !== 'object') {
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (typeof oldObject !== 'object') {
|
|
398
|
+
return false;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
const source = { ...object, ...oldObject };
|
|
402
|
+
const keys = Object.keys(source);
|
|
403
|
+
|
|
404
|
+
if (keys.length !== 1) {
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
return keys[0] === 'breakpoint';
|
|
409
|
+
};
|
|
410
|
+
|
|
388
411
|
/**
|
|
389
412
|
* 执行更新
|
|
390
413
|
*/
|
|
@@ -457,8 +480,11 @@ async function doAction(app: any, actionItem: any) {
|
|
|
457
480
|
const emitTarget = event?.originEvent?.target as types.SyntaxNode;
|
|
458
481
|
const _path: string = event.originEvent.path;
|
|
459
482
|
const _root = _path.split('.')?.[1] || '';
|
|
483
|
+
const breakabled = isBreakpointEvent(event);
|
|
460
484
|
if (['backend', 'overriddenLogics', 'dataSources', 'processes', 'roles', 'logics', 'enums', 'structures', 'interfaces', 'interfaceDependencies', 'configuration', 'dependencies', 'authLogics', 'authLogicsForCallInterface', 'triggerLaunchers', 'connections'].some((item) => _root.startsWith(item))) {
|
|
461
|
-
|
|
485
|
+
if (!breakabled) {
|
|
486
|
+
hasBackEnd = true;
|
|
487
|
+
}
|
|
462
488
|
}
|
|
463
489
|
if (emitTarget) {
|
|
464
490
|
if (emitTarget.concept === 'App') {
|
|
@@ -626,6 +652,7 @@ async function doAction(app: any, actionItem: any) {
|
|
|
626
652
|
const uuid = uuidv4().replace(/-/g, '');
|
|
627
653
|
const instructList = [{
|
|
628
654
|
uuid,
|
|
655
|
+
realAction: action,
|
|
629
656
|
actions: actionList,
|
|
630
657
|
riskList: allRiskList
|
|
631
658
|
}];
|
|
@@ -1015,6 +1042,9 @@ export function handleApp(app: ProxyApp) {
|
|
|
1015
1042
|
});
|
|
1016
1043
|
}, 2500);
|
|
1017
1044
|
}
|
|
1045
|
+
|
|
1046
|
+
if (event?.action === 'move') proxyApp._action = event.action;
|
|
1047
|
+
|
|
1018
1048
|
if (!proxyApp._isCollectingCount) {
|
|
1019
1049
|
proxyApp._actionMsg = event?.actionMsg;
|
|
1020
1050
|
proxyApp._action = event?.action;
|