@lcap/nasl 3.8.3-beta.6 → 3.8.3-beta.8
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/common/BaseNode.js +1 -1
- package/out/common/BaseNode.js.map +1 -1
- package/out/decorators/index.js +3 -1
- package/out/decorators/index.js.map +1 -1
- package/out/natural/transformTS2UI.js +1 -1
- package/out/natural/transformTS2UI.js.map +1 -1
- package/out/server/naslServer.js +66 -68
- package/out/server/naslServer.js.map +1 -1
- package/out/utils/time-slicing/controller.js +6 -1
- package/out/utils/time-slicing/controller.js.map +1 -1
- package/out/utils/time-slicing/utils.d.ts +2 -0
- package/out/utils/time-slicing/utils.js +4 -1
- package/out/utils/time-slicing/utils.js.map +1 -1
- package/package.json +1 -1
- package/sandbox-natural/stdlib/nasl.ui.d.ts +2 -2
- package/src/common/BaseNode.ts +1 -1
- package/src/decorators/index.ts +4 -1
- package/src/natural/transformTS2UI.ts +1 -1
- package/src/server/naslServer.ts +67 -70
- package/src/utils/time-slicing/controller.ts +7 -1
- package/src/utils/time-slicing/utils.ts +5 -0
|
@@ -223,7 +223,12 @@ class TimeSlicingController {
|
|
|
223
223
|
}
|
|
224
224
|
else {
|
|
225
225
|
this.setFrameEnd();
|
|
226
|
-
|
|
226
|
+
if (utils_1.isSupportRequestIdleCallback) {
|
|
227
|
+
requestIdleCallback(runFrame);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
Promise.resolve().then(runGroup);
|
|
231
|
+
}
|
|
227
232
|
}
|
|
228
233
|
};
|
|
229
234
|
/** 运行任务组 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/utils/time-slicing/controller.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,+CAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/utils/time-slicing/controller.ts"],"names":[],"mappings":";;;A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I,EAAE;4BACf,MAAM,CAAC,KAAK;iCACT,IAAI,CAAC,OAAO,CAAC;iCACb,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;yBAC3C;wBACD,UAAU;6BACL;4BACH,SAAS,GAAG,IAAI,CAAC;4BACjB,IAAI,CAAC,aAAa,EAAE,CAAC;4BACrB,MAAM,CAAC,KAAK;iCACT,IAAI,CAAC,YAAY,CAAC;iCAClB,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;yBAC3C;wBAED,MAAM;qBACP;oBACD,OAAO;yBACF,IAAI,MAAM,CAAC,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC,KAAK,EAAE;wBAC7C,MAAM;qBACP;iBACF;gBAED,WAAW;gBACX,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;YACvB,CAAC,CAAC;YAEF,8CAA8C;YAC9C,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC3B,UAAU;YAEV,OAAO;YACP,QAAQ,EAAE,CAAC;QACb,CAAC,CAAQ,CAAC;IACZ,CAAC;CACF;AAlVD,sDAkVC"}
|
|
@@ -36,6 +36,8 @@ export interface AsyncData {
|
|
|
36
36
|
/** 异步标签 */
|
|
37
37
|
mark: ReturnType<typeof getAsyncMark>;
|
|
38
38
|
}
|
|
39
|
+
/** 是否可用全局接口 */
|
|
40
|
+
export declare const isSupportRequestIdleCallback: boolean;
|
|
39
41
|
export declare function getId(): number;
|
|
40
42
|
/** 延迟 */
|
|
41
43
|
export declare function delay(time?: number): Promise<void>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.returnOrigin = exports.isGenerator = exports.getFrameMark = exports.getGroupMark = exports.getAsyncMark = exports.delay = exports.getId = void 0;
|
|
3
|
+
exports.returnOrigin = exports.isGenerator = exports.getFrameMark = exports.getGroupMark = exports.getAsyncMark = exports.delay = exports.getId = exports.isSupportRequestIdleCallback = void 0;
|
|
4
|
+
const env_1 = require("../env");
|
|
4
5
|
/** 编号 */
|
|
5
6
|
let id = 0;
|
|
7
|
+
/** 是否可用全局接口 */
|
|
8
|
+
exports.isSupportRequestIdleCallback = env_1.isBrowser && 'requestIdleCallback' in window;
|
|
6
9
|
function getId() {
|
|
7
10
|
return id++;
|
|
8
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/time-slicing/utils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/time-slicing/utils.ts"],"names":[],"mappings":";;;AAAA,gCAAmC;AA4CnC,SAAS;AACT,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX,eAAe;AACF,QAAA,4BAA4B,GAAG,eAAS,IAAI,qBAAqB,IAAI,MAAM,CAAC;AAEzF,SAAgB,KAAK;IACnB,OAAO,EAAE,EAAE,CAAC;AACd,CAAC;AAFD,sBAEC;AAED,SAAS;AACT,SAAgB,KAAK,CAAC,OAAe,EAAE;IACrC,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;AACnE,CAAC;AAFD,sBAEC;AAED,SAAgB,YAAY,CAAC,EAAU;IACrC,OAAO;QACL,UAAU,EAAE,cAAc,EAAE,EAAE;QAC9B,QAAQ,EAAE,YAAY,EAAE,EAAE;QAC1B,YAAY,EAAE,gBAAgB,EAAE,EAAE;KACnC,CAAC;AACJ,CAAC;AAND,oCAMC;AAED,SAAgB,YAAY,CAAC,EAAU;IACrC,OAAO;QACL,UAAU,EAAE,cAAc,EAAE,EAAE;QAC9B,QAAQ,EAAE,YAAY,EAAE,EAAE;QAC1B,YAAY,EAAE,gBAAgB,EAAE,EAAE;KACnC,CAAC;AACJ,CAAC;AAND,oCAMC;AAED,SAAgB,YAAY,CAAC,EAAU;IACrC,OAAO;QACL,UAAU,EAAE,cAAc,EAAE,EAAE;QAC9B,QAAQ,EAAE,YAAY,EAAE,EAAE;QAC1B,YAAY,EAAE,gBAAgB,EAAE,EAAE;KACnC,CAAC;AACJ,CAAC;AAND,oCAMC;AAED,SAAgB,WAAW,CAAC,KAAc;IACxC,OAAO,KAAK,IAAI,OAAQ,KAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAU,CAAC;AACxE,CAAC;AAFD,kCAEC;AAOD,QAAe,CAAC,CAAC,YAAY,CAAI,UAAc;IAC7C,OAAO,UAAU,CAAC;AACpB,CAAC;AAFD,oCAEC"}
|
package/package.json
CHANGED
|
@@ -59,9 +59,9 @@ declare namespace nasl.auth {
|
|
|
59
59
|
export function hasAuth(authPath: String): Boolean;
|
|
60
60
|
// 退出当前登录状态
|
|
61
61
|
export function logout(): void;
|
|
62
|
-
// 对字符串 实现aes解密,返回解密后的字符串
|
|
63
|
-
export function encryptByAES(authPath: String): String;
|
|
64
62
|
// 对字符串 实现aes加密,返回加密后的字符串
|
|
63
|
+
export function encryptByAES(authPath: String): String;
|
|
64
|
+
// 对字符串 实现aes解密,返回解密后的字符串
|
|
65
65
|
export function decryptByAES(authPath: String): String;
|
|
66
66
|
// 获取用户信息
|
|
67
67
|
export const userInfo: {
|
package/src/common/BaseNode.ts
CHANGED
|
@@ -292,7 +292,7 @@ export class BaseNode extends EventEmitter {
|
|
|
292
292
|
const arr = property.objectRef.split(' | ');
|
|
293
293
|
for (let i = 0; i < arr.length; i++) {
|
|
294
294
|
objectRefCtor = getConceptConstructor(arr[i]);
|
|
295
|
-
if (sourceItem instanceof objectRefCtor) {
|
|
295
|
+
if (objectRefCtor && sourceItem instanceof objectRefCtor) {
|
|
296
296
|
sourceItem.parentNode = this;
|
|
297
297
|
sourceItem.parentKey = key;
|
|
298
298
|
break;
|
package/src/decorators/index.ts
CHANGED
|
@@ -61,7 +61,10 @@ export function getConceptMeta(concept: string): ConceptMeta {
|
|
|
61
61
|
*/
|
|
62
62
|
export function getConceptConstructor<T extends keyof ConceptTypeofClassMap>(concept: T): ConceptTypeofClassMap[T] {
|
|
63
63
|
const conceptMeta = getConceptMeta(concept);
|
|
64
|
-
|
|
64
|
+
|
|
65
|
+
if ((conceptMeta?.constructor as any)?.from) {
|
|
66
|
+
return conceptMeta?.constructor as any;
|
|
67
|
+
}
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
/**
|
|
@@ -1001,7 +1001,7 @@ function transformNode2Logic(node: babelTypes.FunctionDeclaration, name: string,
|
|
|
1001
1001
|
let logicItem = transformNode2Expression(item, 'logic');
|
|
1002
1002
|
if (logicItem) {
|
|
1003
1003
|
if ((logicItem as any).concept === 'Variable') {
|
|
1004
|
-
if (!curLogic.variables.find((_: any) => _.name === logicItem.name)) curLogic.addVariable(logicItem);
|
|
1004
|
+
if (!curLogic.variables.find((_: any) => _.name === logicItem.name)) curLogic.addVariable({ ...logicItem, defaultValue: undefined });
|
|
1005
1005
|
logicItem = new naslTypes.Assignment({
|
|
1006
1006
|
left: new naslTypes.Identifier({ name: logicItem?.name }),
|
|
1007
1007
|
right: (logicItem as any).defaultValue?.expression || '',
|
package/src/server/naslServer.ts
CHANGED
|
@@ -1127,14 +1127,14 @@ class NaslServer {
|
|
|
1127
1127
|
|
|
1128
1128
|
this.logger.time('处理诊断数据');
|
|
1129
1129
|
|
|
1130
|
-
yield* utils.wrapForEachToGenerator(records, function* resolveRecord(record) {
|
|
1130
|
+
yield* utils.wrapForEachToGenerator(records, function* resolveRecord(record : DiagnosticRecord) {
|
|
1131
1131
|
if (!record || !record.node) {
|
|
1132
1132
|
return;
|
|
1133
1133
|
}
|
|
1134
1134
|
|
|
1135
1135
|
let { node } = record;
|
|
1136
1136
|
// @ts-ignore
|
|
1137
|
-
|
|
1137
|
+
let nodeRaw = node.__v_raw || node; // 暂时先这样提速
|
|
1138
1138
|
|
|
1139
1139
|
// 先获取原来的节点先清除一下之前有异常的节点,下面重新赋值
|
|
1140
1140
|
const oldRecord = self.diagnosticManager.getRecord?.(record.id);
|
|
@@ -1163,13 +1163,13 @@ class NaslServer {
|
|
|
1163
1163
|
|
|
1164
1164
|
// 语义诊断
|
|
1165
1165
|
if (isChangeInterface) {
|
|
1166
|
-
yield* self.existStructureFix(record.semanticDiagnostics,
|
|
1166
|
+
yield* self.existStructureFix(record.semanticDiagnostics, node as FileNode, self);
|
|
1167
1167
|
}
|
|
1168
1168
|
|
|
1169
1169
|
// 单独处理 oql 语义错误提示
|
|
1170
|
-
if (
|
|
1170
|
+
if (nodeRaw instanceof Logic) {
|
|
1171
1171
|
yield* utils.wrapForEachToGenerator(record?.syntaxDiagnostics, function *test(item) {
|
|
1172
|
-
const minRange = yield* self._findMinRangeWithGenerator(item as unknown as tsProtocol.DiagnosticWithFileName,
|
|
1172
|
+
const minRange = yield* self._findMinRangeWithGenerator(item as unknown as tsProtocol.DiagnosticWithFileName, node as FileNode);
|
|
1173
1173
|
if (minRange?.node instanceof OqlQueryComponent) {
|
|
1174
1174
|
if (item.text === 'Invalid character.') {
|
|
1175
1175
|
record.semanticDiagnostics.push(item);
|
|
@@ -1188,7 +1188,7 @@ class NaslServer {
|
|
|
1188
1188
|
utils.wrapMapToGenerator(record.semanticDiagnostics, function* (diag) {
|
|
1189
1189
|
return yield* self._resolveDiagnosticWithGenerator(
|
|
1190
1190
|
diag as unknown as tsProtocol.DiagnosticWithFileName,
|
|
1191
|
-
|
|
1191
|
+
node as FileNode,
|
|
1192
1192
|
record
|
|
1193
1193
|
);
|
|
1194
1194
|
})
|
|
@@ -1283,20 +1283,20 @@ class NaslServer {
|
|
|
1283
1283
|
`'__UpdateNoProperty__' is declared but its value is never read.`,
|
|
1284
1284
|
].includes(diag.text)
|
|
1285
1285
|
) {
|
|
1286
|
-
return yield* self._resolveDiagnosticWithGenerator(diag as unknown as tsProtocol.DiagnosticWithFileName,
|
|
1286
|
+
return yield* self._resolveDiagnosticWithGenerator(diag as unknown as tsProtocol.DiagnosticWithFileName, node as FileNode, record);
|
|
1287
1287
|
} if (diag.text.includes(` is declared but its value is never read.`)) {
|
|
1288
1288
|
// 局部变量和输入变量未使用的警告
|
|
1289
|
-
const fromModule =
|
|
1290
|
-
const fromConnector =
|
|
1291
|
-
if ((asserts.isStrictView(
|
|
1289
|
+
const fromModule = nodeRaw.parentNode.concept === 'Module';
|
|
1290
|
+
const fromConnector = nodeRaw.parentNode.concept === 'Connector';
|
|
1291
|
+
if ((asserts.isStrictView(nodeRaw) || asserts.isStrictLogic(record.node)) && !(fromModule || fromConnector)) {
|
|
1292
1292
|
/**
|
|
1293
1293
|
* javalogic不用提示
|
|
1294
1294
|
*/
|
|
1295
|
-
if (asserts.isStrictLogic(
|
|
1295
|
+
if (asserts.isStrictLogic(nodeRaw) && self._isJavalogic(nodeRaw)) {
|
|
1296
1296
|
return null;
|
|
1297
1297
|
}
|
|
1298
|
-
asserts.assertFileNode(
|
|
1299
|
-
const minRange = yield* self._findMinRangeWithGenerator(diag as unknown as tsProtocol.DiagnosticWithFileName,
|
|
1298
|
+
asserts.assertFileNode(nodeRaw);
|
|
1299
|
+
const minRange = yield* self._findMinRangeWithGenerator(diag as unknown as tsProtocol.DiagnosticWithFileName, node as FileNode);
|
|
1300
1300
|
if (minRange) {
|
|
1301
1301
|
/**
|
|
1302
1302
|
* 如果节点是入参类型
|
|
@@ -1829,16 +1829,16 @@ class NaslServer {
|
|
|
1829
1829
|
private *_attachDiagnosticsWithGenerator(fileNode: BaseNode) {
|
|
1830
1830
|
// 每次诊断前先清空这个Set
|
|
1831
1831
|
// @ts-ignore
|
|
1832
|
-
|
|
1832
|
+
let fileNodeRaw = fileNode.__v_raw || fileNode; // 暂时先这样提速
|
|
1833
1833
|
this.logicSetWithComponentLogic = new Set<string>();
|
|
1834
1834
|
|
|
1835
1835
|
const self = this;
|
|
1836
1836
|
const diagnostics: Diagnostic[] = [];
|
|
1837
1837
|
|
|
1838
|
-
if (
|
|
1839
|
-
yield* utils.wrapIteratorToGenerator(
|
|
1838
|
+
if (fileNodeRaw instanceof View || fileNodeRaw instanceof BusinessComponent) {
|
|
1839
|
+
yield* utils.wrapIteratorToGenerator(fileNodeRaw.sourceMap.entries(), function* attachView([node, value]) {
|
|
1840
1840
|
const likeComponent = node.getAncestor('View') || node.getAncestor('BusinessComponent');
|
|
1841
|
-
if (node instanceof ViewElement && likeComponent ===
|
|
1841
|
+
if (node instanceof ViewElement && likeComponent === fileNodeRaw) {
|
|
1842
1842
|
if (node.tag) {
|
|
1843
1843
|
yield* utils.wrapForEachToGenerator(node.bindAttrs, (bindAttr) => {
|
|
1844
1844
|
if ((bindAttr.model || bindAttr.sync) && bindAttr.expression) {
|
|
@@ -1879,14 +1879,14 @@ class NaslServer {
|
|
|
1879
1879
|
}
|
|
1880
1880
|
});
|
|
1881
1881
|
}
|
|
1882
|
-
} else if ((node instanceof Variable || node instanceof Return) && likeComponent ===
|
|
1882
|
+
} else if ((node instanceof Variable || node instanceof Return) && likeComponent === fileNodeRaw) {
|
|
1883
1883
|
if (!node.typeAnnotation && !node.__TypeAnnotation) {
|
|
1884
1884
|
const nodeTypeName = node.concept === 'Return' ? '输出参数' : '局部变量';
|
|
1885
1885
|
let msg;
|
|
1886
|
-
yield*
|
|
1886
|
+
yield* fileNodeRaw.traverseChildrenGenerator((nodeIn : types.SyntaxNode) => {
|
|
1887
1887
|
if (nodeIn && (nodeIn instanceof BatchAssignment || (nodeIn instanceof Assignment && nodeIn.left?.name))) {
|
|
1888
1888
|
// 子页面内部逻辑过滤
|
|
1889
|
-
if ((nodeIn.view || nodeIn.getAncestor('BusinessComponent')) !==
|
|
1889
|
+
if ((nodeIn.view || nodeIn.getAncestor('BusinessComponent')) !== fileNodeRaw) return;
|
|
1890
1890
|
// 当局部变量、输出参数属于页面内逻辑时,需过滤同页面下不同逻辑下的同名变量
|
|
1891
1891
|
if (node.logic && node.logic !== nodeIn.logic) return;
|
|
1892
1892
|
// 跟变量无关的赋值过滤
|
|
@@ -1942,7 +1942,7 @@ class NaslServer {
|
|
|
1942
1942
|
node.tsErrorDetail = diagnostic;
|
|
1943
1943
|
diagnostics.push(diagnostic);
|
|
1944
1944
|
}
|
|
1945
|
-
const fileSourceCode = self.getNodeCode(
|
|
1945
|
+
const fileSourceCode = self.getNodeCode(fileNodeRaw, value);
|
|
1946
1946
|
if (fileSourceCode.includes('|') && fileSourceCode.includes('.metadataTypes.')) {
|
|
1947
1947
|
const typeAnnotation = node.typeAnnotation.toJSON()
|
|
1948
1948
|
yield* self._treeMetadataType2CoreType(typeAnnotation, (node.rootNode as App))
|
|
@@ -2011,13 +2011,13 @@ class NaslServer {
|
|
|
2011
2011
|
}
|
|
2012
2012
|
});
|
|
2013
2013
|
}
|
|
2014
|
-
else if (
|
|
2015
|
-
const dataSourceGroup = (
|
|
2014
|
+
else if (fileNodeRaw instanceof DataSource) {
|
|
2015
|
+
const dataSourceGroup = (fileNodeRaw.rootNode as App).configuration?.getGroup('dataSource');
|
|
2016
2016
|
if (dataSourceGroup) {
|
|
2017
|
-
const property = dataSourceGroup.getProperty(
|
|
2017
|
+
const property = dataSourceGroup.getProperty(fileNodeRaw.name);
|
|
2018
2018
|
if (property && property.values) {
|
|
2019
2019
|
yield* utils.wrapForEachToGenerator(property.values, (propertyValue) => {
|
|
2020
|
-
if (!propertyValue.value &&
|
|
2020
|
+
if (!propertyValue.value && fileNodeRaw.name !== 'defaultDS') {
|
|
2021
2021
|
// prod 环境数据源未配置数据信息 时,不再给出其他提示
|
|
2022
2022
|
// https://projectmanage.netease-official.lcap.163yun.com/dashboard/FeatureDetail?id=2782461488301056
|
|
2023
2023
|
if (propertyValue.env === 'online') return;
|
|
@@ -2036,7 +2036,7 @@ class NaslServer {
|
|
|
2036
2036
|
};
|
|
2037
2037
|
diagnostics.push(diagnostic);
|
|
2038
2038
|
} else if (propertyValue.value) {
|
|
2039
|
-
const dataSource: any =
|
|
2039
|
+
const dataSource: any = fileNodeRaw;
|
|
2040
2040
|
// 数据源有连接错误
|
|
2041
2041
|
let envText;
|
|
2042
2042
|
if (propertyValue.env === 'dev') {
|
|
@@ -2075,18 +2075,18 @@ class NaslServer {
|
|
|
2075
2075
|
}
|
|
2076
2076
|
|
|
2077
2077
|
// 检查实体重名
|
|
2078
|
-
const duplidateEntities = this._getDuplicateNames(
|
|
2078
|
+
const duplidateEntities = this._getDuplicateNames(fileNodeRaw, (dataSource: DataSource) => dataSource.entities, (entity: Entity) => entity.name);
|
|
2079
2079
|
if(duplidateEntities.length) {
|
|
2080
2080
|
diagnostics.push({
|
|
2081
2081
|
node: fileNode,
|
|
2082
2082
|
severity: 'error',
|
|
2083
|
-
message: `数据源${
|
|
2083
|
+
message: `数据源${fileNodeRaw.name}存在重名实体:${duplidateEntities.join(', ')}`,
|
|
2084
2084
|
});
|
|
2085
2085
|
}
|
|
2086
2086
|
}
|
|
2087
2087
|
// 加上对实体属性存储类型的校验规则
|
|
2088
|
-
else if (
|
|
2089
|
-
const entity =
|
|
2088
|
+
else if (fileNodeRaw instanceof Entity) {
|
|
2089
|
+
const entity = fileNodeRaw;
|
|
2090
2090
|
const dbType = entity.dataSource.dataSourceSqlType;
|
|
2091
2091
|
const { origin, properties } = entity || {};
|
|
2092
2092
|
if (dbType && !['excel', 'table'].includes(origin) && Array.isArray(properties) && properties.length) {
|
|
@@ -2339,12 +2339,12 @@ class NaslServer {
|
|
|
2339
2339
|
});
|
|
2340
2340
|
}
|
|
2341
2341
|
}
|
|
2342
|
-
else if (
|
|
2343
|
-
const { isRefedByTrigger, fRefNames } = yield this.isRefedByTriggerAndReturnFirstRef(
|
|
2344
|
-
if (
|
|
2342
|
+
else if (fileNodeRaw instanceof Logic || fileNodeRaw instanceof OverriddenLogic) {
|
|
2343
|
+
const { isRefedByTrigger, fRefNames } = yield this.isRefedByTriggerAndReturnFirstRef(fileNodeRaw);
|
|
2344
|
+
if (fileNodeRaw instanceof Logic && fileNodeRaw?.exportInterface && fileNodeRaw.calleewholeKey.startsWith('app.logics')) {
|
|
2345
2345
|
let isSame = true;
|
|
2346
|
-
const itf = (
|
|
2347
|
-
const { params: logicParams, returns: logicReturns } =
|
|
2346
|
+
const itf = (fileNodeRaw.exportInterface as Interface);
|
|
2347
|
+
const { params: logicParams, returns: logicReturns } = fileNodeRaw;
|
|
2348
2348
|
const { params: itfParams, returns: itfReturns } = itf;
|
|
2349
2349
|
if (logicParams?.length !== itfParams?.length || logicReturns?.length !== itfReturns?.length) {
|
|
2350
2350
|
isSame = false;
|
|
@@ -2387,31 +2387,31 @@ class NaslServer {
|
|
|
2387
2387
|
}
|
|
2388
2388
|
}
|
|
2389
2389
|
|
|
2390
|
-
if (
|
|
2391
|
-
const duplicateLogics = this._getDuplicateNames(
|
|
2392
|
-
if(duplicateLogics.includes(
|
|
2390
|
+
if (fileNodeRaw instanceof Logic && fileNodeRaw.calleewholeKey.startsWith('app.logics')) {
|
|
2391
|
+
const duplicateLogics = this._getDuplicateNames(fileNodeRaw.rootNode as App, (app: App) => app.logics, (logic: Logic) => logic.name);
|
|
2392
|
+
if(duplicateLogics.includes(fileNodeRaw.name)) {
|
|
2393
2393
|
const diagnostic = {
|
|
2394
2394
|
node: fileNode,
|
|
2395
2395
|
severity: 'error',
|
|
2396
|
-
message: `存在重名服务端逻辑${
|
|
2396
|
+
message: `存在重名服务端逻辑${fileNodeRaw.name}`,
|
|
2397
2397
|
};
|
|
2398
2398
|
diagnostics.push(diagnostic);
|
|
2399
2399
|
}
|
|
2400
2400
|
}
|
|
2401
2401
|
|
|
2402
2402
|
if (isRefedByTrigger) {
|
|
2403
|
-
const { isTriggerRule, errorFRefNames } = this.isTriggerRule(
|
|
2403
|
+
const { isTriggerRule, errorFRefNames } = this.isTriggerRule(fileNodeRaw as Logic, fRefNames);
|
|
2404
2404
|
if (!isTriggerRule) {
|
|
2405
2405
|
const diagnostic = {
|
|
2406
2406
|
node: fileNode,
|
|
2407
2407
|
severity: 'error',
|
|
2408
|
-
message: `${
|
|
2408
|
+
message: `${fileNodeRaw.name} 已被消息订阅配置 ${errorFRefNames.join(',')} 引用,但出入参数类型不匹配,或数量不一致`,
|
|
2409
2409
|
};
|
|
2410
2410
|
diagnostics.push(diagnostic);
|
|
2411
2411
|
}
|
|
2412
2412
|
}
|
|
2413
2413
|
|
|
2414
|
-
yield* utils.wrapIteratorToGenerator(
|
|
2414
|
+
yield* utils.wrapIteratorToGenerator(fileNodeRaw.sourceMap.entries(), function* wrapIterator([node, value]) {
|
|
2415
2415
|
if (node instanceof OqlQueryComponent) {
|
|
2416
2416
|
// 自动推导情况
|
|
2417
2417
|
const typeAnnotation = yield* type2TypeAnnotation((node as any).__nodeType);
|
|
@@ -2474,7 +2474,7 @@ class NaslServer {
|
|
|
2474
2474
|
} else {
|
|
2475
2475
|
node.__aStructureError = null;
|
|
2476
2476
|
}
|
|
2477
|
-
const fileSourceCode = self.getNodeCode(
|
|
2477
|
+
const fileSourceCode = self.getNodeCode(fileNodeRaw, value);
|
|
2478
2478
|
if (fileSourceCode.includes('|') && fileSourceCode.includes('.metadataTypes.')) {
|
|
2479
2479
|
const typeAnnotation = node.typeAnnotation.toJSON()
|
|
2480
2480
|
yield* self._treeMetadataType2CoreType(typeAnnotation, (node.rootNode as App))
|
|
@@ -2490,7 +2490,7 @@ class NaslServer {
|
|
|
2490
2490
|
}
|
|
2491
2491
|
}
|
|
2492
2492
|
else if (node instanceof Param) {
|
|
2493
|
-
const fileSourceCode = self.getNodeCode(
|
|
2493
|
+
const fileSourceCode = self.getNodeCode(fileNodeRaw, value);
|
|
2494
2494
|
if (fileSourceCode.includes('|') && fileSourceCode.includes('.metadataTypes.')) {
|
|
2495
2495
|
const typeAnnotation = node.typeAnnotation.toJSON()
|
|
2496
2496
|
yield* self._treeMetadataType2CoreType(typeAnnotation, (node.rootNode as App))
|
|
@@ -2508,12 +2508,12 @@ class NaslServer {
|
|
|
2508
2508
|
self.checkNodeError(node, diagnostics);
|
|
2509
2509
|
});
|
|
2510
2510
|
}
|
|
2511
|
-
else if (
|
|
2512
|
-
yield* utils.wrapIteratorToGenerator(
|
|
2511
|
+
else if (fileNodeRaw instanceof Process) {
|
|
2512
|
+
yield* utils.wrapIteratorToGenerator(fileNodeRaw.sourceMap.entries(), ([node, value]) => {
|
|
2513
2513
|
this.checkNodeError(node, diagnostics);
|
|
2514
2514
|
});
|
|
2515
|
-
} else if (
|
|
2516
|
-
yield* utils.wrapIteratorToGenerator(
|
|
2515
|
+
} else if (fileNodeRaw instanceof ProcessV2) {
|
|
2516
|
+
yield* utils.wrapIteratorToGenerator(fileNodeRaw.sourceMap.entries(), function* wrapIterator([node, value]) {
|
|
2517
2517
|
if (node instanceof Return || node instanceof Variable) {
|
|
2518
2518
|
const nodeTypeName = node.concept === 'Return' ? '输出参数' : '局部变量';
|
|
2519
2519
|
if (!node.typeAnnotation && !node.__TypeAnnotation) {
|
|
@@ -2553,13 +2553,13 @@ class NaslServer {
|
|
|
2553
2553
|
}
|
|
2554
2554
|
}
|
|
2555
2555
|
});
|
|
2556
|
-
} else if (
|
|
2557
|
-
const connectorPropertyNames = NaslServer.getPropertyNames(
|
|
2558
|
-
const connectionPropertyNames = NaslServer.getPropertyNames(
|
|
2556
|
+
} else if (fileNodeRaw instanceof Connection) {
|
|
2557
|
+
const connectorPropertyNames = NaslServer.getPropertyNames(fileNodeRaw);
|
|
2558
|
+
const connectionPropertyNames = NaslServer.getPropertyNames(fileNodeRaw?.connector);
|
|
2559
2559
|
const diagnostic = {
|
|
2560
2560
|
node: fileNode,
|
|
2561
2561
|
severity: 'error',
|
|
2562
|
-
message: `连接器 ${
|
|
2562
|
+
message: `连接器 ${fileNodeRaw.name} 参数配置有更新`,
|
|
2563
2563
|
// 保留原来的内容方便查询一些问题
|
|
2564
2564
|
originalDiagnostic: {
|
|
2565
2565
|
fileName: '',
|
|
@@ -2584,12 +2584,12 @@ class NaslServer {
|
|
|
2584
2584
|
diagnostics.push(diagnostic);
|
|
2585
2585
|
} else if (!isSameConfig) {
|
|
2586
2586
|
diagnostics.push(diagnostic);
|
|
2587
|
-
} else if (hasEmptyConfig(
|
|
2587
|
+
} else if (hasEmptyConfig(fileNodeRaw)) {
|
|
2588
2588
|
diagnostics.push(diagnostic);
|
|
2589
2589
|
}
|
|
2590
2590
|
|
|
2591
|
-
} else if (
|
|
2592
|
-
|
|
2591
|
+
} else if (fileNodeRaw instanceof MetadataType) {
|
|
2592
|
+
fileNodeRaw?.sourceMap.forEach((value, node) => {
|
|
2593
2593
|
const rulesMap: any = {};
|
|
2594
2594
|
const { rules, typeAnnotation } = node as MetadataType;
|
|
2595
2595
|
if (Array.isArray(rules)) {
|
|
@@ -2633,20 +2633,20 @@ class NaslServer {
|
|
|
2633
2633
|
}
|
|
2634
2634
|
|
|
2635
2635
|
// TODO need reset when process support hoc & spread param & type annotation
|
|
2636
|
-
const isInProcess =
|
|
2637
|
-
|
|
2638
|
-
!!
|
|
2639
|
-
!!
|
|
2636
|
+
const isInProcess = fileNodeRaw instanceof Process ||
|
|
2637
|
+
fileNodeRaw instanceof ProcessV2 ||
|
|
2638
|
+
!!fileNodeRaw?.getAncestor('Process') ||
|
|
2639
|
+
!!fileNodeRaw?.getAncestor('ProcessV2');
|
|
2640
2640
|
if (isInProcess) {
|
|
2641
2641
|
// 查找计算过 subLogic 的节点。(目前只有 Logic、ProcessElement、ProcessElementV2)
|
|
2642
|
-
let targetNode: Process | ProcessV2 =
|
|
2642
|
+
let targetNode: Process | ProcessV2 = fileNodeRaw as | Process | ProcessV2;
|
|
2643
2643
|
if (
|
|
2644
|
-
isProcess(
|
|
2645
|
-
isProcessV2(
|
|
2644
|
+
isProcess(fileNodeRaw) ||
|
|
2645
|
+
isProcessV2(fileNodeRaw)
|
|
2646
2646
|
) {
|
|
2647
|
-
targetNode =
|
|
2647
|
+
targetNode = fileNodeRaw;
|
|
2648
2648
|
} else {
|
|
2649
|
-
targetNode =
|
|
2649
|
+
targetNode = fileNodeRaw.getAncestor('Process') as Process || fileNodeRaw.getAncestor('ProcessV2') as ProcessV2;
|
|
2650
2650
|
}
|
|
2651
2651
|
if (targetNode?.subLogics?.length) {
|
|
2652
2652
|
const diagnostic = {
|
|
@@ -3213,14 +3213,12 @@ class NaslServer {
|
|
|
3213
3213
|
): Generator<void, MinRange> {
|
|
3214
3214
|
let minRange: MinRange;
|
|
3215
3215
|
// @ts-ignore
|
|
3216
|
-
|
|
3217
|
-
const { sourceMap } =
|
|
3216
|
+
let fileNodeRaw = fileNode.__v_raw || fileNode; // 暂时先这样提速
|
|
3217
|
+
const { sourceMap } = fileNodeRaw;
|
|
3218
3218
|
// 是否找到了行内准确的,是的话,就不走多行的
|
|
3219
3219
|
let haveLineNode = false;
|
|
3220
3220
|
|
|
3221
3221
|
for (let [node, item] of sourceMap.entries()) {
|
|
3222
|
-
// @ts-ignore
|
|
3223
|
-
node = node.__v_raw || node; // 暂时先这样提速
|
|
3224
3222
|
/**
|
|
3225
3223
|
* 当前内容的开始行 <= 诊断开始的行 &&
|
|
3226
3224
|
* 当前内容的结束行 >= 诊断结束的行
|
|
@@ -3274,12 +3272,11 @@ class NaslServer {
|
|
|
3274
3272
|
}
|
|
3275
3273
|
}
|
|
3276
3274
|
}
|
|
3277
|
-
|
|
3278
3275
|
yield;
|
|
3279
3276
|
}
|
|
3280
3277
|
|
|
3281
3278
|
if (!minRange) {
|
|
3282
|
-
if (
|
|
3279
|
+
if (fileNodeRaw instanceof View || fileNodeRaw instanceof BusinessComponent) {
|
|
3283
3280
|
return { node: fileNode, item: sourceMap.get(fileNode) } as MinRange;
|
|
3284
3281
|
}
|
|
3285
3282
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
FrameData,
|
|
9
9
|
AsyncData,
|
|
10
10
|
getId,
|
|
11
|
+
isSupportRequestIdleCallback,
|
|
11
12
|
} from './utils';
|
|
12
13
|
import {
|
|
13
14
|
LowResourceRatio,
|
|
@@ -274,7 +275,12 @@ export class TimeSlicingController {
|
|
|
274
275
|
}
|
|
275
276
|
else {
|
|
276
277
|
this.setFrameEnd();
|
|
277
|
-
|
|
278
|
+
if (isSupportRequestIdleCallback) {
|
|
279
|
+
requestIdleCallback(runFrame);
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
Promise.resolve().then(runGroup);
|
|
283
|
+
}
|
|
278
284
|
}
|
|
279
285
|
};
|
|
280
286
|
/** 运行任务组 */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isBrowser } from '../env';
|
|
2
|
+
|
|
1
3
|
export interface TaskDataInDebug {
|
|
2
4
|
count: number;
|
|
3
5
|
time: number;
|
|
@@ -43,6 +45,9 @@ export interface AsyncData {
|
|
|
43
45
|
/** 编号 */
|
|
44
46
|
let id = 0;
|
|
45
47
|
|
|
48
|
+
/** 是否可用全局接口 */
|
|
49
|
+
export const isSupportRequestIdleCallback = isBrowser && 'requestIdleCallback' in window;
|
|
50
|
+
|
|
46
51
|
export function getId() {
|
|
47
52
|
return id++;
|
|
48
53
|
}
|