@lcap/nasl 2.21.0-beta.2 → 2.21.0-beta.3
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/engine/operators.d.ts +2 -2
- package/out/automate/engine/operators.js +14 -5
- package/out/automate/engine/operators.js.map +1 -1
- package/out/common/BaseNode.d.ts +6 -0
- package/out/common/BaseNode.js +45 -8
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/Abort__.d.ts +1 -1
- package/out/concepts/Abort__.js +3 -3
- package/out/concepts/Abort__.js.map +1 -1
- package/out/concepts/App__.d.ts +0 -2
- package/out/concepts/App__.js +0 -42
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +18 -0
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindEvent__.js +21 -22
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +16 -16
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +0 -1
- package/out/concepts/DataSource__.js +0 -3
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +0 -23
- package/out/concepts/EntityProperty__.js +0 -121
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +0 -3
- package/out/concepts/InterfaceParam__.js +0 -64
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +0 -3
- package/out/concepts/Interface__.js +4 -8
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +1 -1
- package/out/concepts/Logic__.js +22 -42
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js +1 -1
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +1 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +0 -12
- package/out/concepts/Module__.js +0 -7
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/NewMap__.js +5 -1
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js +9 -3
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.d.ts +0 -1
- package/out/concepts/OqlQueryComponent__.js +0 -46
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.d.ts +0 -3
- package/out/concepts/Param__.js +1 -67
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.d.ts +0 -3
- package/out/concepts/Return__.js +1 -67
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +0 -1
- package/out/concepts/SqlQueryComponent__.js +0 -46
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +0 -3
- package/out/concepts/StructureProperty__.js +0 -65
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +1 -3
- package/out/concepts/TypeAnnotation__.js +12 -31
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +0 -3
- package/out/concepts/Variable__.js +1 -67
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.d.ts +7 -0
- package/out/concepts/ViewComponent__.js +7 -0
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.js +1 -1
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.collection.js +2 -2
- package/out/concepts/basics/stdlib/nasl.collection.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.core.js +3 -3
- package/out/concepts/basics/stdlib/nasl.core.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.interface.js +1 -1
- package/out/concepts/basics/stdlib/nasl.interface.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.process.js +6 -6
- package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +43 -43
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +19 -46
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.validation.js +13 -13
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
- package/out/concepts/basics/types/coreTypeList.js +5 -1
- package/out/concepts/basics/types/coreTypeList.js.map +1 -1
- package/out/concepts/index__.d.ts +0 -1
- package/out/concepts/index__.js +0 -1
- package/out/concepts/index__.js.map +1 -1
- package/out/generator/genReleaseBody.js +0 -3
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/sentry/index.d.ts +28 -0
- package/out/sentry/index.js +104 -0
- package/out/sentry/index.js.map +1 -0
- package/out/server/entity2LogicNamespace.js +1 -1
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/extendBaseNode.js +65 -0
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.js +5 -5
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.js +9 -7
- package/out/server/getLogics.js.map +1 -1
- package/out/server/naslServer.d.ts +2 -2
- package/out/server/naslServer.js +120 -51
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +3 -2
- package/out/server/translator.js.map +1 -1
- package/out/service/creator/errHandles.js +5 -0
- package/out/service/creator/errHandles.js.map +1 -1
- package/out/service/storage/init.js +6 -8
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genQueryComponent.js +2 -2
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genSelectBlock.js +9 -1
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/utils.d.ts +32 -0
- package/out/templator/utils.js +7 -7
- package/out/templator/utils.js.map +1 -1
- package/package.json +2 -2
- package/sandbox/stdlib/nasl.auth.ts +3 -1
- package/sandbox/stdlib/nasl.browser.ts +1 -1
- package/sandbox/stdlib/nasl.collection.ts +9 -9
- package/sandbox/stdlib/nasl.core.ts +100 -38
- package/sandbox/stdlib/nasl.interface.ts +1 -1
- package/sandbox/stdlib/nasl.langUtil.ts +4 -4
- package/sandbox/stdlib/nasl.oql.ts +156 -156
- package/sandbox/stdlib/nasl.process.ts +6 -6
- package/sandbox/stdlib/nasl.ui.ts +42 -42
- package/sandbox/stdlib/nasl.util.ts +45 -44
- package/sandbox/stdlib/nasl.validation.ts +8 -8
- package/src/automate/engine/operators.js +13 -5
- package/src/automate/upgrader/2.20.js +1 -0
- package/src/common/BaseNode.ts +32 -1
- package/src/concepts/Abort__.ts +4 -3
- package/src/concepts/App__.ts +2 -38
- package/src/concepts/BindAttribute__.ts +17 -1
- package/src/concepts/BindEvent__.ts +21 -21
- package/src/concepts/CallFunction__.ts +0 -1
- package/src/concepts/CallQueryComponent__.ts +16 -74
- package/src/concepts/ConfigPropertyValue__.ts +0 -4
- package/src/concepts/DataSource__.ts +0 -4
- package/src/concepts/EntityProperty__.ts +0 -129
- package/src/concepts/InterfaceParam__.ts +0 -55
- package/src/concepts/Interface__.ts +4 -4
- package/src/concepts/Logic__.ts +31 -47
- package/src/concepts/MatchCase__.ts +1 -1
- package/src/concepts/MemberExpression__.ts +1 -1
- package/src/concepts/Module__.ts +0 -6
- package/src/concepts/NewMap__.ts +5 -1
- package/src/concepts/NumericLiteral__.ts +9 -4
- package/src/concepts/OqlQueryComponent__.ts +0 -40
- package/src/concepts/Param__.ts +3 -59
- package/src/concepts/Rect__.ts +0 -8
- package/src/concepts/Return__.ts +1 -58
- package/src/concepts/SqlQueryComponent__.ts +0 -40
- package/src/concepts/StructureProperty__.ts +0 -57
- package/src/concepts/TypeAnnotation__.ts +12 -72
- package/src/concepts/Variable__.ts +1 -58
- package/src/concepts/ViewComponent__.ts +6 -0
- package/src/concepts/ViewElement__.ts +7 -7
- package/src/concepts/basics/stdlib/nasl.collection.ts +2 -2
- package/src/concepts/basics/stdlib/nasl.core.ts +3 -3
- package/src/concepts/basics/stdlib/nasl.interface.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.process.ts +6 -6
- package/src/concepts/basics/stdlib/nasl.ui.ts +43 -43
- package/src/concepts/basics/stdlib/nasl.util.ts +19 -46
- package/src/concepts/basics/stdlib/nasl.validation.ts +13 -13
- package/src/concepts/basics/types/coreTypeList.ts +5 -1
- package/src/concepts/index__.ts +0 -1
- package/src/generator/genReleaseBody.ts +0 -2
- package/src/sentry/index.ts +134 -0
- package/src/server/entity2LogicNamespace.ts +1 -1
- package/src/server/extendBaseNode.ts +61 -1
- package/src/server/formatTsUtils.ts +5 -5
- package/src/server/getLogics.ts +8 -7
- package/src/server/naslServer.ts +120 -53
- package/src/server/translator.ts +3 -2
- package/src/service/creator/errHandles.js +6 -0
- package/src/service/storage/init.ts +6 -8
- package/src/templator/genQueryComponent.ts +5 -5
- package/src/templator/genSelectBlock.ts +9 -1
- package/src/templator/utils.ts +7 -7
- package/ts-worker/lib/Messager.js +0 -3
- package/ts-worker/src/index.js +0 -1
- package/src/concepts/DatabaseTypeAnnotation__.ts +0 -88
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
export const CONSTRUCTOR_HOOK = 'constructor';
|
|
2
|
+
export const BEFORE_HOOK = 'before';
|
|
3
|
+
export const AFTER_HOOK = 'after';
|
|
4
|
+
|
|
5
|
+
export const NASL_NODE = 'nasl-node';
|
|
6
|
+
export const TS_WORKER_MESSAGER = 'ts-worker-messager';
|
|
7
|
+
|
|
8
|
+
type ClassType = { new(...args: any[]): any };
|
|
9
|
+
|
|
10
|
+
type Source = {
|
|
11
|
+
instance: any;
|
|
12
|
+
hook: string;
|
|
13
|
+
name: string;
|
|
14
|
+
params: any[];
|
|
15
|
+
result?: any;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type Listener = (source: Source) => void;
|
|
19
|
+
|
|
20
|
+
type Monitor = (key: string) => <T extends ClassType>(SourceClass: T) => T;
|
|
21
|
+
|
|
22
|
+
const previousStore: { [key:string]: Source } = {};
|
|
23
|
+
const listenersStore: { [key:string]: Listener[] } = {};
|
|
24
|
+
|
|
25
|
+
const isPromise = (obj: any) => obj && typeof obj.then === 'function';
|
|
26
|
+
|
|
27
|
+
export const getPrevious = (key: string) => previousStore[key];
|
|
28
|
+
|
|
29
|
+
export const removeListener = (key: string) => (listener: Listener) => {
|
|
30
|
+
listenersStore[key] = listenersStore[key] || [];
|
|
31
|
+
listenersStore[key] = listenersStore[key].filter((item) => item !== listener);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const addListener = (key: string) => (listener: Listener, capture = false) => {
|
|
35
|
+
listenersStore[key] = listenersStore[key] || [];
|
|
36
|
+
|
|
37
|
+
if (capture) {
|
|
38
|
+
listenersStore[key] = [listener, ...listenersStore[key]];
|
|
39
|
+
} else {
|
|
40
|
+
listenersStore[key] = listenersStore[key].concat(listener);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return () => removeListener(key)(listener);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const fireListeners = (key: string) => (source: Source) => {
|
|
47
|
+
listenersStore[key] = listenersStore[key] || [];
|
|
48
|
+
listenersStore[key].forEach((listener) => listener(source));
|
|
49
|
+
|
|
50
|
+
return source;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const sentryMonitor: Monitor = (key) => (SourceClass) => {
|
|
54
|
+
if (!key) {
|
|
55
|
+
return SourceClass;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
class TargetClass extends SourceClass {
|
|
59
|
+
constructor(...params: any[]) {
|
|
60
|
+
super(...params); // tslint-disable
|
|
61
|
+
|
|
62
|
+
fireListeners(key)({
|
|
63
|
+
hook: CONSTRUCTOR_HOOK,
|
|
64
|
+
name: 'constructor',
|
|
65
|
+
instance: this,
|
|
66
|
+
result: this,
|
|
67
|
+
params,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const properties = Object.getOwnPropertyNames(SourceClass.prototype);
|
|
73
|
+
const names = properties.filter((property) => {
|
|
74
|
+
if (property === 'constructor') {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return typeof SourceClass.prototype[property] === 'function';
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
names.forEach((name) => {
|
|
82
|
+
const { [name]: callback } = SourceClass.prototype;
|
|
83
|
+
|
|
84
|
+
TargetClass.prototype[name] = function (...params: any[]) {
|
|
85
|
+
const current = previousStore[key];
|
|
86
|
+
|
|
87
|
+
previousStore[key] = fireListeners(key)({
|
|
88
|
+
hook: BEFORE_HOOK,
|
|
89
|
+
instance: this,
|
|
90
|
+
name,
|
|
91
|
+
params,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const result = callback.apply(this, params);
|
|
95
|
+
|
|
96
|
+
if (isPromise(result)) {
|
|
97
|
+
return result.then((data: any) => {
|
|
98
|
+
fireListeners(key)({
|
|
99
|
+
hook: AFTER_HOOK,
|
|
100
|
+
instance: this,
|
|
101
|
+
result: data,
|
|
102
|
+
params,
|
|
103
|
+
name,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
previousStore[key] = current;
|
|
107
|
+
return data;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
fireListeners(key)({
|
|
112
|
+
hook: AFTER_HOOK,
|
|
113
|
+
instance: this,
|
|
114
|
+
name,
|
|
115
|
+
params,
|
|
116
|
+
result,
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
previousStore[key] = current;
|
|
120
|
+
return result;
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
return TargetClass;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const getPreviousFromNaslNode = () => getPrevious(NASL_NODE);
|
|
128
|
+
export const getPreviousFromTSWorkerMessager = () => getPrevious(TS_WORKER_MESSAGER);
|
|
129
|
+
|
|
130
|
+
export const addListenerToNaslNode = addListener(NASL_NODE);
|
|
131
|
+
export const addListenerToTSWorkerMessager = addListener(TS_WORKER_MESSAGER);
|
|
132
|
+
|
|
133
|
+
export const sentryMonitorNaslNode = sentryMonitor(NASL_NODE);
|
|
134
|
+
export const sentryMonitorTSWorkerMessager = sentryMonitor(TS_WORKER_MESSAGER);
|
|
@@ -212,7 +212,7 @@ export function entity2LogicNamespace(entity: Entity) {
|
|
|
212
212
|
returns: [
|
|
213
213
|
new Return({
|
|
214
214
|
name: 'result',
|
|
215
|
-
typeAnnotation: TypeAnnotation.createPrimitive('
|
|
215
|
+
typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
|
|
216
216
|
}),
|
|
217
217
|
],
|
|
218
218
|
body: [],
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FileNode, NaslServer } from './naslServer';
|
|
2
2
|
import * as tsProtocol from 'typescript/lib/protocol';
|
|
3
3
|
import { MinRange } from './translator';
|
|
4
|
-
import { BaseNode, CallLogic, Destination, EnumItem, Interface, Logic, Param, Process, Role, Structure, View, ViewElement, Frontend } from '../concepts';
|
|
4
|
+
import { BaseNode, CallLogic, Destination, EnumItem, Interface, Logic, Param, Process, Role, Structure, View, ViewElement, Frontend, TypeAnnotation, StructureProperty, App } from '../concepts';
|
|
5
5
|
import { EventPayload, invokeCommand, registerCommand } from '../common';
|
|
6
|
+
import { getNodeByNodeCallee, getNaslNodeByNodeCallee } from '../automate/engine/utils';
|
|
6
7
|
|
|
7
8
|
interface SetNameNode extends BaseNode {
|
|
8
9
|
setName(name: string): any;
|
|
@@ -399,3 +400,62 @@ BaseNode.prototype.getCurrentTypeAnnotation = async function getCurrentTypeAnnot
|
|
|
399
400
|
console.log(err);
|
|
400
401
|
}
|
|
401
402
|
};
|
|
403
|
+
|
|
404
|
+
function newNode(node: BaseNode, parentNode: TypeAnnotation, needNewStructure: boolean) {
|
|
405
|
+
if (needNewStructure && node?.toJSON) {
|
|
406
|
+
return (BaseNode.from(node.toJSON(), parentNode, '') as Structure);
|
|
407
|
+
}
|
|
408
|
+
return (node as Structure);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* 获取下一级变量
|
|
412
|
+
*/
|
|
413
|
+
|
|
414
|
+
BaseNode.prototype.getSelectRef = function getSelectRef(newTypeAnnotation: TypeAnnotation, needNewStructure = false) {
|
|
415
|
+
try {
|
|
416
|
+
const typeAnnotation = newTypeAnnotation || (this as any).typeAnnotation || this.__TypeAnnotation;
|
|
417
|
+
const { typeName, typeKind, typeNamespace, typeArguments } = typeAnnotation;
|
|
418
|
+
let completionChildren: any;
|
|
419
|
+
if (typeKind === 'reference') {
|
|
420
|
+
if (typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.process' || typeNamespace === 'nasl.auth') {
|
|
421
|
+
const node = newNode(getNaslNodeByNodeCallee(typeNamespace, typeName), typeAnnotation, needNewStructure);
|
|
422
|
+
const properties = (node as Structure)?.properties || [];
|
|
423
|
+
completionChildren = properties;
|
|
424
|
+
} else if (typeNamespace.endsWith('.enums')) {
|
|
425
|
+
completionChildren = [];
|
|
426
|
+
} else {
|
|
427
|
+
let app: App;
|
|
428
|
+
if (this.concept === 'App') {
|
|
429
|
+
app = (this as App);
|
|
430
|
+
} else {
|
|
431
|
+
app = this.rootNode || typeAnnotation.app;
|
|
432
|
+
}
|
|
433
|
+
const node = newNode(getNodeByNodeCallee(app, typeNamespace + '.' + typeName), typeAnnotation, needNewStructure);
|
|
434
|
+
const properties = node?.properties || [];
|
|
435
|
+
completionChildren = properties;
|
|
436
|
+
}
|
|
437
|
+
} else if (typeKind === 'generic') {
|
|
438
|
+
const node = newNode(getNaslNodeByNodeCallee(typeNamespace, typeName), typeAnnotation, needNewStructure);
|
|
439
|
+
const properties = (node?.properties && [...node?.properties]) || [];
|
|
440
|
+
for (let i = 0; i < properties.length; i++) {
|
|
441
|
+
const item = properties[i];
|
|
442
|
+
if (item?.typeAnnotation?.typeKind === 'typeParam') {
|
|
443
|
+
const newItem = StructureProperty.from(item.toJSON());
|
|
444
|
+
newItem.typeAnnotation = typeArguments[0];
|
|
445
|
+
newItem.parentNode = this;
|
|
446
|
+
properties[i] = newItem;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
completionChildren = properties;
|
|
450
|
+
} else if (typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) {
|
|
451
|
+
const node = newNode(getNaslNodeByNodeCallee(typeNamespace, typeName), typeAnnotation, needNewStructure);
|
|
452
|
+
const properties = (node?.properties && [...node?.properties]) || [];
|
|
453
|
+
completionChildren = properties;
|
|
454
|
+
} else {
|
|
455
|
+
completionChildren;
|
|
456
|
+
}
|
|
457
|
+
return completionChildren;
|
|
458
|
+
} catch (err) {
|
|
459
|
+
console.log(err);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
@@ -24,7 +24,7 @@ interface variableItem {
|
|
|
24
24
|
*/
|
|
25
25
|
function formatTs2TypeString(displayParts: Array<{ text: string; kind: string }>) {
|
|
26
26
|
let str = '';
|
|
27
|
-
displayParts
|
|
27
|
+
displayParts?.forEach((item) => {
|
|
28
28
|
str += item.text;
|
|
29
29
|
});
|
|
30
30
|
return str;
|
|
@@ -122,7 +122,7 @@ export function displayString2TypeAnnotation(typeStr: string, parentPrefix?: str
|
|
|
122
122
|
if (type === 'Promise<void>')
|
|
123
123
|
return null;
|
|
124
124
|
// 把后面结尾里带()的比如
|
|
125
|
-
// 'function nasl.core.add(left: nasl.core.
|
|
125
|
+
// 'function nasl.core.add(left: nasl.core.Integer, right: nasl.core.Integer): nasl.core.Integer (+12 overloads)'
|
|
126
126
|
if (type.includes('(') && type.includes(')')) {
|
|
127
127
|
type = type.replace(/\([^\)]*\)/g, '');
|
|
128
128
|
}
|
|
@@ -389,7 +389,7 @@ function getAStructureScopeType(type: string, parent: any, node: BaseNode) {
|
|
|
389
389
|
entity1: app.dataSources.defaultDS.entities.Entity1;
|
|
390
390
|
lCAPRolePerMapping: app.dataSources.defaultDS.entities.LCAPRolePerMapping;
|
|
391
391
|
}>;
|
|
392
|
-
total: nasl.core.
|
|
392
|
+
total: nasl.core.Integer;
|
|
393
393
|
}`
|
|
394
394
|
*/
|
|
395
395
|
function getAStructureObjectStringType(type: string, parent: any, node: BaseNode) {
|
|
@@ -481,7 +481,7 @@ export function formatVariableData(data: unknown | variableItem[], node: BaseNod
|
|
|
481
481
|
// 当前的类型如 app.entitys.entity1 nasl.core.String
|
|
482
482
|
let typeKey: string;
|
|
483
483
|
if (item.completionDetail) {
|
|
484
|
-
if (item.completionDetail
|
|
484
|
+
if (item.completionDetail?.hasOwnProperty('nodeType')) {
|
|
485
485
|
const typeAnnotation = type2TypeAnnotation(item.completionDetail.nodeType);
|
|
486
486
|
typeKey = typeAnnotation?.typeKey;
|
|
487
487
|
} else {
|
|
@@ -505,7 +505,7 @@ export function formatVariableData(data: unknown | variableItem[], node: BaseNod
|
|
|
505
505
|
}
|
|
506
506
|
typeKey = getPlatformType(currentType);
|
|
507
507
|
}
|
|
508
|
-
} else if (item instanceof StructureProperty) {
|
|
508
|
+
} else if (item instanceof StructureProperty || item instanceof EntityProperty) {
|
|
509
509
|
typeKey = item?.typeAnnotation?.typeKey;
|
|
510
510
|
}
|
|
511
511
|
// 如果没有父节点就是Identifier
|
package/src/server/getLogics.ts
CHANGED
|
@@ -206,13 +206,6 @@ export async function getLogics(node: CallLogic | BindEvent| Identifier | Logic,
|
|
|
206
206
|
logics: stdlibNamespace.findChild('configuration').logics,
|
|
207
207
|
expanded: false,
|
|
208
208
|
}),
|
|
209
|
-
new Namespace({
|
|
210
|
-
name: 'category',
|
|
211
|
-
path: `io`,
|
|
212
|
-
title: '文件处理',
|
|
213
|
-
logics: stdlibNamespace.findChild('io').logics,
|
|
214
|
-
expanded: false,
|
|
215
|
-
}),
|
|
216
209
|
],
|
|
217
210
|
expanded: false,
|
|
218
211
|
});
|
|
@@ -224,6 +217,14 @@ export async function getLogics(node: CallLogic | BindEvent| Identifier | Logic,
|
|
|
224
217
|
logics: stdlibNamespace.findChild('browser').logics.filter((item) => ['navigateToUserInfo', 'getWeChatHeadImg', 'getWeChatNickName', 'getWeChatOpenid'].includes(item.name)),
|
|
225
218
|
expanded: false,
|
|
226
219
|
}));
|
|
220
|
+
} else if (node?.frontend?.type === 'pc') {
|
|
221
|
+
systemTree.children.push(new Namespace({
|
|
222
|
+
name: 'category',
|
|
223
|
+
path: `io`,
|
|
224
|
+
title: '文件处理',
|
|
225
|
+
logics: stdlibNamespace.findChild('io').logics,
|
|
226
|
+
expanded: false,
|
|
227
|
+
}));
|
|
227
228
|
}
|
|
228
229
|
|
|
229
230
|
app.dependencies.forEach((item) => {
|
package/src/server/naslServer.ts
CHANGED
|
@@ -5,7 +5,8 @@ import { Worker } from 'worker_threads';
|
|
|
5
5
|
/// #endif
|
|
6
6
|
|
|
7
7
|
import { config } from '../config';
|
|
8
|
-
import
|
|
8
|
+
import { sentryMonitorTSWorkerMessager } from '../sentry';
|
|
9
|
+
import OriginalMessager from '../common/Messager';
|
|
9
10
|
import * as tsProtocol from 'typescript/lib/protocol';
|
|
10
11
|
import { formatEnums } from '../server/getMemberIdentifier';
|
|
11
12
|
|
|
@@ -96,6 +97,8 @@ const EmbeddedTSFileOffsetMap: { [name: string]: number } = {
|
|
|
96
97
|
ConfigProperty: 12,
|
|
97
98
|
};
|
|
98
99
|
|
|
100
|
+
const Messager = sentryMonitorTSWorkerMessager(OriginalMessager);
|
|
101
|
+
|
|
99
102
|
export interface FileNode extends BaseNode {
|
|
100
103
|
getEmbeddedFilePath(name?: string): string;
|
|
101
104
|
toEmbeddedTSFile(): {
|
|
@@ -157,7 +160,7 @@ export function getDisplayString2Type(displayString: string) {
|
|
|
157
160
|
}
|
|
158
161
|
|
|
159
162
|
export class NaslServer {
|
|
160
|
-
messager:
|
|
163
|
+
messager: OriginalMessager = undefined;
|
|
161
164
|
|
|
162
165
|
worker: Worker = undefined;
|
|
163
166
|
|
|
@@ -900,25 +903,6 @@ export class NaslServer {
|
|
|
900
903
|
});
|
|
901
904
|
}
|
|
902
905
|
record.semanticDiagnostics = record.semanticDiagnostics
|
|
903
|
-
/**
|
|
904
|
-
* reduce 为去除重复的 'Duplicate identifier xxxx' 报错
|
|
905
|
-
* 原属于 TS@4.x 的 bug,在 TS@5.0-dev 后修复,详见:https://github.com/microsoft/TypeScript/issues/51437
|
|
906
|
-
* 触发场景:
|
|
907
|
-
* OQL查询中写入SQL语句:'select * from Entity1 ee, Entity1 ee, Entity1 ee, Entity1 ee'
|
|
908
|
-
* 翻译出的TS代码中,ee 被成功检查为重复变量,但 ee 报错的数量超过 ee 实际的出现数量,需对同一 token 的报错进行去重
|
|
909
|
-
*/
|
|
910
|
-
.reduce((res, item: any) => {
|
|
911
|
-
const hit = item.text.startsWith('Duplicate identifier') && res.some((r: any) => (r.text === item.text
|
|
912
|
-
&& r.start.line === item.start.line
|
|
913
|
-
&& r.start.offset === item.start.offset
|
|
914
|
-
&& r.end.line === item.end.line
|
|
915
|
-
&& r.end.offset === item.end.offset));
|
|
916
|
-
|
|
917
|
-
if (!hit) {
|
|
918
|
-
res.push(item);
|
|
919
|
-
}
|
|
920
|
-
return res;
|
|
921
|
-
}, [])
|
|
922
906
|
.map((diag) => this._resolveDiagnostic(diag as unknown as tsProtocol.DiagnosticWithFileName, node as FileNode, record))
|
|
923
907
|
.filter((diag) => !!diag);
|
|
924
908
|
record.semanticDiagnostics.push(...this._attachDiagnostics(node));
|
|
@@ -931,7 +915,7 @@ export class NaslServer {
|
|
|
931
915
|
let currentNode = diagnostic.node;
|
|
932
916
|
|
|
933
917
|
// 数据源警告类型降级
|
|
934
|
-
if (currentNode.concept === 'DataSource') {
|
|
918
|
+
if (currentNode.concept === 'DataSource' && diagnostic.originalDiagnostic?.text === 'DataSource connection error') {
|
|
935
919
|
diagnostic.severity = 'warning';
|
|
936
920
|
record.suggestionDiagnostics.push(diagnostic);
|
|
937
921
|
return null;
|
|
@@ -1388,23 +1372,36 @@ export class NaslServer {
|
|
|
1388
1372
|
if ((bindAttr.model || bindAttr.sync) && bindAttr.expression) {
|
|
1389
1373
|
const bindExpression = bindAttr.expression;
|
|
1390
1374
|
let diagnostic;
|
|
1391
|
-
if (bindExpression.concept
|
|
1392
|
-
|
|
1393
|
-
node: bindAttr,
|
|
1394
|
-
severity: 'error',
|
|
1395
|
-
message: '页面元素双向绑定:只允许绑定可赋值的变量和属性。',
|
|
1396
|
-
};
|
|
1397
|
-
} else {
|
|
1375
|
+
if (bindExpression.concept === 'MemberExpression') {
|
|
1376
|
+
let current = (bindExpression as MemberExpression);
|
|
1398
1377
|
if ((bindExpression as MemberExpression).isEnum()) {
|
|
1399
1378
|
diagnostic = {
|
|
1400
|
-
node:
|
|
1379
|
+
node: bindExpression,
|
|
1401
1380
|
severity: 'error',
|
|
1402
1381
|
message: '页面元素双向绑定:只允许绑定可赋值的变量和属性。',
|
|
1403
1382
|
};
|
|
1383
|
+
} else {
|
|
1384
|
+
while (current.object) {
|
|
1385
|
+
if (current.object.concept !== 'MemberExpression' && current.object.concept !== 'Identifier') {
|
|
1386
|
+
diagnostic = {
|
|
1387
|
+
node: bindExpression,
|
|
1388
|
+
severity: 'error',
|
|
1389
|
+
message: '页面元素双向绑定:只允许绑定可赋值的变量和属性。',
|
|
1390
|
+
};
|
|
1391
|
+
break;
|
|
1392
|
+
}
|
|
1393
|
+
current = (current.object as MemberExpression);
|
|
1394
|
+
}
|
|
1404
1395
|
}
|
|
1396
|
+
} else if (bindExpression.concept !== 'Identifier') {
|
|
1397
|
+
diagnostic = {
|
|
1398
|
+
node: bindExpression,
|
|
1399
|
+
severity: 'error',
|
|
1400
|
+
message: '页面元素双向绑定:只允许绑定可赋值的变量和属性。',
|
|
1401
|
+
};
|
|
1405
1402
|
}
|
|
1406
1403
|
if (diagnostic) {
|
|
1407
|
-
|
|
1404
|
+
bindExpression.tsErrorDetail = diagnostic;
|
|
1408
1405
|
diagnostics.push(diagnostic);
|
|
1409
1406
|
}
|
|
1410
1407
|
}
|
|
@@ -1684,22 +1681,29 @@ export class NaslServer {
|
|
|
1684
1681
|
}
|
|
1685
1682
|
});
|
|
1686
1683
|
}
|
|
1684
|
+
Object.keys(typeMap).forEach((item) => {
|
|
1685
|
+
if (typeMap[item].length > 1) {
|
|
1686
|
+
typeMap[item].forEach((nodeItem: any) => {
|
|
1687
|
+
const diagnostic = {
|
|
1688
|
+
node: nodeItem,
|
|
1689
|
+
severity: 'error',
|
|
1690
|
+
message: '匹配:重复添加类型',
|
|
1691
|
+
titleTip: '重复添加此项',
|
|
1692
|
+
};
|
|
1693
|
+
nodeItem.tsErrorDetail = diagnostic;
|
|
1694
|
+
diagnostics.push(diagnostic);
|
|
1695
|
+
});
|
|
1696
|
+
}
|
|
1697
|
+
});
|
|
1698
|
+
} else if (node.expression) {
|
|
1699
|
+
const diagnostic = {
|
|
1700
|
+
node: node.expression,
|
|
1701
|
+
severity: 'error',
|
|
1702
|
+
message: '类型不匹配,传入类型:void',
|
|
1703
|
+
};
|
|
1704
|
+
node.expression.tsErrorDetail = diagnostic;
|
|
1705
|
+
diagnostics.push(diagnostic);
|
|
1687
1706
|
}
|
|
1688
|
-
|
|
1689
|
-
Object.keys(typeMap).forEach((item) => {
|
|
1690
|
-
if (typeMap[item].length > 1) {
|
|
1691
|
-
typeMap[item].forEach((nodeItem: any) => {
|
|
1692
|
-
const diagnostic = {
|
|
1693
|
-
node: nodeItem,
|
|
1694
|
-
severity: 'error',
|
|
1695
|
-
message: '匹配:重复添加类型',
|
|
1696
|
-
titleTip: '重复添加此项',
|
|
1697
|
-
};
|
|
1698
|
-
nodeItem.tsErrorDetail = diagnostic;
|
|
1699
|
-
diagnostics.push(diagnostic);
|
|
1700
|
-
});
|
|
1701
|
-
}
|
|
1702
|
-
});
|
|
1703
1707
|
}
|
|
1704
1708
|
if (node instanceof MatchCase && (node.getAncestor('Match') as Match)?.isExpression && node.body.length === 0) {
|
|
1705
1709
|
// 如果不是其他就标红
|
|
@@ -1831,8 +1835,10 @@ export class NaslServer {
|
|
|
1831
1835
|
if (!(node.right.tsErrorDetail) && leftType.sortedTypeKey !== rightType.sortedTypeKey) {
|
|
1832
1836
|
const excludeList = [
|
|
1833
1837
|
'nasl.collection.List<nasl.core.String>',
|
|
1838
|
+
'nasl.collection.List<nasl.core.Text>',
|
|
1834
1839
|
'nasl.collection.List<nasl.core.Email>',
|
|
1835
1840
|
'nasl.collection.Map<nasl.core.String, nasl.core.String>',
|
|
1841
|
+
'nasl.collection.Map<nasl.core.String, nasl.core.Text>',
|
|
1836
1842
|
'nasl.collection.Map<nasl.core.String, nasl.core.Email>',
|
|
1837
1843
|
];
|
|
1838
1844
|
const excludeList2 = [
|
|
@@ -2173,6 +2179,31 @@ export class NaslServer {
|
|
|
2173
2179
|
});
|
|
2174
2180
|
}
|
|
2175
2181
|
}
|
|
2182
|
+
if ((node instanceof Param || node instanceof Return) && node.parentNode instanceof Process) {
|
|
2183
|
+
const { currentSource } = this.getCurrentSource(node.parentNode);
|
|
2184
|
+
if (currentSource) {
|
|
2185
|
+
const code = currentSource.code;
|
|
2186
|
+
const prefix = '__ProcessIdentification__';
|
|
2187
|
+
const positions = [];
|
|
2188
|
+
let pos = code.indexOf(prefix);
|
|
2189
|
+
while (pos !== -1) {
|
|
2190
|
+
pos = code.indexOf(node.name, pos + prefix.length);
|
|
2191
|
+
positions.push(pos);
|
|
2192
|
+
pos = code.indexOf(prefix, pos + prefix.length);
|
|
2193
|
+
}
|
|
2194
|
+
positions.shift();
|
|
2195
|
+
// 拿到标识下定义的参数名字
|
|
2196
|
+
const promises = positions.map((item) => this.references({
|
|
2197
|
+
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
2198
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
2199
|
+
offset: lsp2tspNumber(currentSource.range.start.character + item),
|
|
2200
|
+
}));
|
|
2201
|
+
const results = await Promise.all(promises);
|
|
2202
|
+
results.forEach((constRefs) => {
|
|
2203
|
+
refsList = [...refsList, ...constRefs.refs];
|
|
2204
|
+
});
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2176
2207
|
if (node instanceof ProcessElement) {
|
|
2177
2208
|
if (currentSource) {
|
|
2178
2209
|
const code = currentSource.code;
|
|
@@ -2196,6 +2227,34 @@ export class NaslServer {
|
|
|
2196
2227
|
});
|
|
2197
2228
|
}
|
|
2198
2229
|
}
|
|
2230
|
+
if (node instanceof Return && node.parentNode instanceof ProcessElement) {
|
|
2231
|
+
const { currentSource } = this.getCurrentSource(node.parentNode);
|
|
2232
|
+
if (currentSource) {
|
|
2233
|
+
const code = currentSource.code;
|
|
2234
|
+
const prefix = '__ProcessIdentification__';
|
|
2235
|
+
const positions = [];
|
|
2236
|
+
let pos = code.indexOf(prefix);
|
|
2237
|
+
// 需要再次定位到processelement对象上,避免process上存在同名参数
|
|
2238
|
+
pos = code.indexOf(node.parentNode.name, pos + prefix.length);
|
|
2239
|
+
while (pos !== -1) {
|
|
2240
|
+
pos = code.indexOf(node.name, pos + prefix.length);
|
|
2241
|
+
positions.push(pos);
|
|
2242
|
+
pos = code.indexOf(prefix, pos + prefix.length);
|
|
2243
|
+
// 需要再次定位到processelement对象上,避免process上存在同名参数
|
|
2244
|
+
pos = code.indexOf(node.parentNode.name, pos + node.parentNode.name.length);
|
|
2245
|
+
}
|
|
2246
|
+
// 拿到标识下定义的参数名字
|
|
2247
|
+
const promises = positions.map((item) => this.references({
|
|
2248
|
+
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
2249
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
2250
|
+
offset: lsp2tspNumber(currentSource.range.start.character + item),
|
|
2251
|
+
}));
|
|
2252
|
+
const results = await Promise.all(promises);
|
|
2253
|
+
results.forEach((constRefs) => {
|
|
2254
|
+
refsList = [...refsList, ...constRefs.refs];
|
|
2255
|
+
});
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2199
2258
|
// console.log(refsList, 'refsList');
|
|
2200
2259
|
return refsList;
|
|
2201
2260
|
}
|
|
@@ -3007,7 +3066,7 @@ export class NaslServer {
|
|
|
3007
3066
|
if (node instanceof Param) {
|
|
3008
3067
|
// index在nasl foreach上有脏数据
|
|
3009
3068
|
if (node.parentKey === 'index' && node.parentNode instanceof ForEachStatement) {
|
|
3010
|
-
return TypeAnnotation.createPrimitive('
|
|
3069
|
+
return TypeAnnotation.createPrimitive('Integer');
|
|
3011
3070
|
}
|
|
3012
3071
|
}
|
|
3013
3072
|
|
|
@@ -3070,6 +3129,11 @@ export class NaslServer {
|
|
|
3070
3129
|
types.set(node, (node as Variable).typeAnnotation);
|
|
3071
3130
|
return;
|
|
3072
3131
|
}
|
|
3132
|
+
// 如果 入参不是虚拟节点的,就不去请求类型
|
|
3133
|
+
// 只有虚拟节点的入参,才没有类型
|
|
3134
|
+
if (node.concept === 'Param' && node.parentKey !== 'virtualParams') {
|
|
3135
|
+
return;
|
|
3136
|
+
}
|
|
3073
3137
|
if (![
|
|
3074
3138
|
'Identifier',
|
|
3075
3139
|
'UnaryExpression',
|
|
@@ -3087,8 +3151,10 @@ export class NaslServer {
|
|
|
3087
3151
|
'OqlQueryComponent',
|
|
3088
3152
|
'QueryFieldExpression',
|
|
3089
3153
|
'QueryGroupByExpression',
|
|
3154
|
+
'Param',
|
|
3090
3155
|
].includes(node.concept))
|
|
3091
3156
|
return;
|
|
3157
|
+
|
|
3092
3158
|
// 要去ls那边获取的
|
|
3093
3159
|
newQuickInfoNodes.push(itemDetail);
|
|
3094
3160
|
const fileDetail = {
|
|
@@ -3096,6 +3162,7 @@ export class NaslServer {
|
|
|
3096
3162
|
line: lsp2tspNumber(item.range.start.line),
|
|
3097
3163
|
offset: lsp2tspNumber(item.range.start.character),
|
|
3098
3164
|
};
|
|
3165
|
+
// 位置计算偏移
|
|
3099
3166
|
if (node.concept === 'BinaryExpression'
|
|
3100
3167
|
|| node.concept === 'CallLogic'
|
|
3101
3168
|
|| node.concept === 'CallFunction'
|
|
@@ -3164,8 +3231,8 @@ export class NaslServer {
|
|
|
3164
3231
|
// console.log('原始:', displayString);
|
|
3165
3232
|
// console.log('方案2:', item?.[0]?.nodeType);
|
|
3166
3233
|
const nodeTypeAnnotation = type2TypeAnnotation(item?.[0]?.nodeType);
|
|
3167
|
-
console.log(newQuickInfoNodes[index].node, nodeTypeAnnotation, nodeTypeAnnotation?.typeKey);
|
|
3168
|
-
types.set(newQuickInfoNodes[index].node, nodeTypeAnnotation);
|
|
3234
|
+
// console.log(newQuickInfoNodes[index].node, nodeTypeAnnotation, nodeTypeAnnotation?.typeKey);
|
|
3235
|
+
types.set(newQuickInfoNodes[index].node, (Object.freeze(nodeTypeAnnotation) as TypeAnnotation));
|
|
3169
3236
|
(newQuickInfoNodes[index].node as any).__nodeType = Object.freeze(item?.[0]?.nodeType);
|
|
3170
3237
|
|
|
3171
3238
|
// console.log('方案1:', displayString1);
|
|
@@ -3211,9 +3278,9 @@ export class NaslServer {
|
|
|
3211
3278
|
}
|
|
3212
3279
|
}
|
|
3213
3280
|
if (value instanceof TypeAnnotation) {
|
|
3214
|
-
node.__TypeAnnotation =
|
|
3281
|
+
node.__TypeAnnotation = value;
|
|
3215
3282
|
} else if (value.typeAnnotation) {
|
|
3216
|
-
node.__TypeAnnotation =
|
|
3283
|
+
node.__TypeAnnotation = value.typeAnnotation;
|
|
3217
3284
|
}
|
|
3218
3285
|
} else {
|
|
3219
3286
|
// 清空原来已经赋值上去的类型,可能原来有现在没有了
|
|
@@ -3388,7 +3455,7 @@ export class NaslServer {
|
|
|
3388
3455
|
concept: 'TypeAnnotation',
|
|
3389
3456
|
typeKind: 'primitive',
|
|
3390
3457
|
typeNamespace: 'nasl.core',
|
|
3391
|
-
typeName: '
|
|
3458
|
+
typeName: 'Integer',
|
|
3392
3459
|
typeArguments: null,
|
|
3393
3460
|
inferred: null,
|
|
3394
3461
|
},
|
|
@@ -3402,7 +3469,7 @@ export class NaslServer {
|
|
|
3402
3469
|
// index在nasl foreach上有脏数据
|
|
3403
3470
|
if (node.parentKey === 'index' && node.parentNode instanceof ForEachStatement) {
|
|
3404
3471
|
const jsonNode = jsoner.queryNodeByPath(json, node.getNodePath(false));
|
|
3405
|
-
jsonNode.typeAnnotation = TypeAnnotation.createPrimitive('
|
|
3472
|
+
jsonNode.typeAnnotation = TypeAnnotation.createPrimitive('Integer').toJSON();
|
|
3406
3473
|
}
|
|
3407
3474
|
}
|
|
3408
3475
|
if (node instanceof Match) {
|
package/src/server/translator.ts
CHANGED
|
@@ -68,7 +68,7 @@ function transformType(tsType: string): string {
|
|
|
68
68
|
else if (tsType === 'Double')
|
|
69
69
|
return '小数';
|
|
70
70
|
else if (tsType === 'Decimal')
|
|
71
|
-
return '
|
|
71
|
+
return '精确小数';
|
|
72
72
|
else if (tsType === 'Long')
|
|
73
73
|
return '长整数';
|
|
74
74
|
else if (tsType === 'DateTime')
|
|
@@ -550,7 +550,8 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
550
550
|
}
|
|
551
551
|
} else if (node.parentNode instanceof NewMap) {
|
|
552
552
|
if (text.includes(`is not assignable to parameter of type 'None'`)) {
|
|
553
|
-
|
|
553
|
+
const cap = /Argument of type '(.+?)' is not assignable to parameter of type '(.+?)'/.exec(text);
|
|
554
|
+
tsErrorDetail.message = tsErrorDetail.message = `参数类型不一致!传入类型:${transformType(cap[1])},接收类型:字符串 或 整数 或 布尔值 或 长整数 或 精确小数`;
|
|
554
555
|
} else if (text.includes(`parameter of type 'never'`)) {
|
|
555
556
|
tsErrorDetail.message = '自动推导不出类型!newMap中有未知类型';
|
|
556
557
|
}
|
|
@@ -32,6 +32,12 @@ export default {
|
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
// 检测到当前应用已在新 tab 页打开
|
|
36
|
+
if(err.code === 500502) {
|
|
37
|
+
eventBus.emit('multiTabOpened');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
35
41
|
if (versionStatus[err.code])
|
|
36
42
|
eventBus.emit('updateVersionStatus', {
|
|
37
43
|
status: versionStatus[err.code],
|
|
@@ -414,12 +414,10 @@ class TaskQueue {
|
|
|
414
414
|
}));
|
|
415
415
|
await storageService.saveFrontendNasl({
|
|
416
416
|
body: {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
errorInfo: options.errorInfo,
|
|
422
|
-
},
|
|
417
|
+
nasl: app.toJSON(),
|
|
418
|
+
failedQueue,
|
|
419
|
+
queue,
|
|
420
|
+
errorInfo: options.errorInfo,
|
|
423
421
|
},
|
|
424
422
|
}).catch((err: any) => {
|
|
425
423
|
console.log('备份 nasl 失败:', err);
|
|
@@ -553,7 +551,7 @@ export function handleApp(app: any) {
|
|
|
553
551
|
app._action = '';
|
|
554
552
|
app._noTimer = undefined;
|
|
555
553
|
if (Array.isArray(collectingList) && collectingList.length) {
|
|
556
|
-
app.naslServer
|
|
554
|
+
app.naslServer.embeddedTSEmitter.emit('change', {
|
|
557
555
|
value: collectingList,
|
|
558
556
|
});
|
|
559
557
|
await doAction(app, {
|
|
@@ -574,7 +572,7 @@ export function handleApp(app: any) {
|
|
|
574
572
|
app.on('storage', (event: any) => {
|
|
575
573
|
// 是否正在收集
|
|
576
574
|
if (app._isCollectingCount === 0) {
|
|
577
|
-
app.naslServer
|
|
575
|
+
app.naslServer.embeddedTSEmitter.emit('change', {
|
|
578
576
|
value: [event],
|
|
579
577
|
});
|
|
580
578
|
let actionMsg = '';
|