@lcap/nasl 1.0.0-alpha.13 → 1.0.0-alpha.16
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/index.d.ts +1 -1
- package/out/automate/engine/index.js +73 -25
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/utils.js +7 -6
- package/out/automate/engine/utils.js.map +1 -1
- package/out/common/BaseNode.d.ts +5 -4
- package/out/common/BaseNode.js +48 -41
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +18 -1
- package/out/concepts/App__.js +64 -24
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +2 -2
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.d.ts +190 -0
- package/out/concepts/Assignee__.js +264 -0
- package/out/concepts/Assignee__.js.map +1 -0
- package/out/concepts/BinaryExpression__.js +6 -6
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +19 -0
- package/out/concepts/BindAttribute__.js +36 -2
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +21 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +1 -0
- package/out/concepts/BindEvent__.js +38 -14
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.js +20 -7
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +11 -8
- package/out/concepts/CallInterface__.js +160 -23
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +1 -0
- package/out/concepts/CallLogic__.js +17 -7
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +5 -1
- package/out/concepts/CallQueryComponent__.js +15 -11
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +6 -2
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +11 -0
- package/out/concepts/Destination__.js +59 -19
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +10 -2
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +7 -0
- package/out/concepts/EntityProperty__.js +60 -3
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +4 -1
- package/out/concepts/Entity__.js +29 -12
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +4 -0
- package/out/concepts/Enum__.js +9 -6
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +8 -12
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.js +5 -5
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +26 -24
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +2 -0
- package/out/concepts/InterfaceParam__.js +41 -21
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +3 -0
- package/out/concepts/Interface__.js +105 -9
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +2 -1
- package/out/concepts/LogicItem__.js +14 -0
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +3 -0
- package/out/concepts/Logic__.js +57 -16
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +13 -6
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +6 -0
- package/out/concepts/Module__.js +18 -8
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +4 -0
- package/out/concepts/Namespace__.js +23 -12
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/Param__.d.ts +2 -1
- package/out/concepts/Param__.js +35 -22
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +2 -2
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +20 -18
- 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/Process__.d.ts +6 -1
- package/out/concepts/Process__.js +18 -14
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js +1 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +2 -2
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +1 -0
- package/out/concepts/Return__.js +38 -25
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js +1 -1
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -1
- package/out/concepts/StringLiteral__.js +2 -2
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +5 -4
- package/out/concepts/StructureProperty__.js +54 -31
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +1 -0
- package/out/concepts/Structure__.js +18 -5
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +3 -3
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +1 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +3 -5
- package/out/concepts/TypeAnnotation__.js +36 -14
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +4 -2
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +1 -0
- package/out/concepts/ValidationRule__.js +27 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +1 -0
- package/out/concepts/Variable__.js +38 -25
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js +5 -5
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +7 -1
- package/out/concepts/ViewElement__.js +154 -117
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +4 -0
- package/out/concepts/View__.js +38 -25
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +3 -1
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.auth.js +30 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js +70 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser.js +6 -35
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js +25 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.util.js +49 -41
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.validation.js +26 -20
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
- package/out/concepts/basics/types/coreTypeList.js +11 -11
- package/out/concepts/basics/types/coreTypeList.js.map +1 -1
- package/out/concepts/index__.d.ts +1 -0
- package/out/concepts/index__.js +1 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/enums/KEYWORDS.js +1 -1
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +1 -0
- package/out/generator/genBundleFiles.js +122 -93
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/manager/diagnostic.d.ts +1 -1
- package/out/server/createUiTs.d.ts +1 -0
- package/out/server/createUiTs.js +19 -2
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/entity2LogicNamespace.js +24 -9
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/getExtensionModules.js +2 -0
- package/out/server/getExtensionModules.js.map +1 -1
- package/out/server/getLogics.js +40 -56
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +4 -0
- package/out/server/getMemberIdentifier.js +90 -48
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +2 -2
- package/out/server/getProcesses.js +34 -11
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/index.js +4 -0
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +11 -30
- package/out/server/naslServer.js +410 -199
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.d.ts +10 -0
- package/out/server/process2LogicNamespace.js +16 -0
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.d.ts +22 -3
- package/out/server/translator.js +336 -130
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +29 -15
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +5 -5
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +9 -13
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +7 -7
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +2 -2
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +4 -2
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.d.ts +1 -1
- package/out/templator/genGridViewBlock.js +3 -3
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.d.ts +2 -0
- package/out/templator/genQueryComponent.js +1 -0
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genTableBlock.d.ts +1 -1
- package/out/templator/genTableBlock.js +3 -3
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +7 -7
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +3 -1
- package/out/templator/utils.js +2 -1
- package/out/templator/utils.js.map +1 -1
- package/out/utils/index.d.ts +6 -0
- package/out/utils/index.js +20 -1
- package/out/utils/index.js.map +1 -1
- package/package.json +2 -1
- package/src/automate/engine/index.js +73 -25
- package/src/automate/engine/utils.js +7 -6
- package/src/common/BaseNode.ts +51 -42
- package/src/concepts/App__.ts +104 -26
- package/src/concepts/Argument__.ts +3 -2
- package/src/concepts/Assignee__.ts +437 -0
- package/src/concepts/BinaryExpression__.ts +7 -6
- package/src/concepts/BindAttribute__.ts +51 -2
- package/src/concepts/BindDirective__.ts +20 -1
- package/src/concepts/BindEvent__.ts +39 -16
- package/src/concepts/CallFunction__.ts +21 -8
- package/src/concepts/CallInterface__.ts +161 -42
- package/src/concepts/CallLogic__.ts +21 -9
- package/src/concepts/CallQueryComponent__.ts +15 -13
- package/src/concepts/Comment__.ts +6 -2
- package/src/concepts/ConfigGroup__.ts +1 -1
- package/src/concepts/ConfigProperty__.ts +1 -1
- package/src/concepts/Configuration__.ts +1 -1
- package/src/concepts/Destination__.ts +57 -19
- package/src/concepts/End__.ts +9 -11
- package/src/concepts/EntityProperty__.ts +56 -3
- package/src/concepts/Entity__.ts +33 -20
- package/src/concepts/Enum__.ts +8 -7
- package/src/concepts/Event__.ts +1 -1
- package/src/concepts/ForEachStatement__.ts +8 -13
- package/src/concepts/Function__.ts +5 -5
- package/src/concepts/Identifier__.ts +31 -26
- package/src/concepts/IfStatement__.ts +2 -2
- package/src/concepts/InterfaceParam__.ts +39 -20
- package/src/concepts/Interface__.ts +103 -9
- package/src/concepts/LogicItem__.ts +16 -1
- package/src/concepts/Logic__.ts +60 -18
- package/src/concepts/MemberExpression__.ts +18 -6
- package/src/concepts/Module__.ts +19 -8
- package/src/concepts/Namespace__.ts +24 -12
- package/src/concepts/Param__.ts +34 -23
- package/src/concepts/ProcessComponent__.ts +2 -2
- package/src/concepts/ProcessElement__.ts +51 -50
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +32 -28
- package/src/concepts/QueryAggregateExpression__.ts +1 -1
- package/src/concepts/QueryFromExpression__.ts +1 -1
- package/src/concepts/QueryJoinExpression__.ts +2 -2
- package/src/concepts/QuerySelectExpression__.ts +1 -1
- package/src/concepts/Return__.ts +35 -25
- package/src/concepts/SqlQueryComponent__.ts +1 -1
- package/src/concepts/StringLiteral__.ts +2 -2
- package/src/concepts/StructureProperty__.ts +49 -29
- package/src/concepts/Structure__.ts +17 -5
- package/src/concepts/SwitchCase__.ts +3 -3
- package/src/concepts/SwitchStatement__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +34 -12
- package/src/concepts/UnaryExpression__.ts +4 -2
- package/src/concepts/ValidationRule__.ts +24 -1
- package/src/concepts/Variable__.ts +35 -24
- package/src/concepts/ViewComponent__.ts +5 -5
- package/src/concepts/ViewElement__.ts +168 -113
- package/src/concepts/View__.ts +44 -25
- package/src/concepts/WhileStatement__.ts +1 -1
- package/src/concepts/basics/stdlib/index.ts +3 -1
- package/src/concepts/basics/stdlib/nasl.auth.ts +26 -0
- package/src/concepts/basics/stdlib/nasl.browser.ts +7 -41
- package/src/concepts/basics/stdlib/nasl.configuration.ts +21 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +49 -41
- package/src/concepts/basics/stdlib/nasl.validation.ts +17 -11
- package/src/concepts/basics/types/coreTypeList.ts +11 -11
- package/src/concepts/index__.ts +1 -0
- package/src/enums/KEYWORDS.ts +1 -1
- package/src/generator/genBundleFiles.ts +131 -112
- package/src/manager/diagnostic.ts +1 -1
- package/src/server/createUiTs.ts +22 -4
- package/src/server/entity2LogicNamespace.ts +25 -9
- package/src/server/getExtensionModules.ts +2 -0
- package/src/server/getLogics.ts +42 -58
- package/src/server/getMemberIdentifier.ts +88 -46
- package/src/server/getProcesses.ts +32 -9
- package/src/server/index.ts +12 -1
- package/src/server/naslServer.ts +422 -215
- package/src/server/process2LogicNamespace.ts +17 -1
- package/src/server/translator.ts +392 -134
- package/src/service/storage/init.ts +27 -16
- package/src/templator/genCreateBlock.ts +5 -5
- package/src/templator/genCurdEditMultipleKeyBlock.ts +25 -26
- package/src/templator/genCurdMultipleKeyBlock.ts +7 -7
- package/src/templator/genEditTableBlock.ts +2 -2
- package/src/templator/genGetBlock.ts +5 -7
- package/src/templator/genGridViewBlock.ts +4 -7
- package/src/templator/genQueryComponent.ts +1 -0
- package/src/templator/genTableBlock.ts +4 -7
- package/src/templator/genUpdateBlock.ts +7 -8
- package/src/templator/utils.ts +2 -1
- package/src/utils/index.ts +19 -0
package/src/concepts/Return__.ts
CHANGED
|
@@ -7,7 +7,6 @@ import Structure from './Structure__';
|
|
|
7
7
|
import StructureProperty from './StructureProperty__';
|
|
8
8
|
import { getNodeByNodeCallee, getNaslNodeByNodeCallee } from '../automate/engine/utils';
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
//================================================================================
|
|
12
11
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
13
12
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -240,9 +239,9 @@ export class Return extends BaseNode {
|
|
|
240
239
|
code += ': ';
|
|
241
240
|
code += this.typeAnnotation.toEmbeddedTS(shiftState(state, code));
|
|
242
241
|
}
|
|
243
|
-
if (this.defaultValue) {
|
|
244
|
-
|
|
245
|
-
}
|
|
242
|
+
// if (this.defaultValue) {
|
|
243
|
+
// code += ` = ${this.defaultValue}`;
|
|
244
|
+
// }
|
|
246
245
|
return code;
|
|
247
246
|
}
|
|
248
247
|
|
|
@@ -279,7 +278,7 @@ export class Return extends BaseNode {
|
|
|
279
278
|
if (!typeAnnotation)
|
|
280
279
|
throw new Error('找不到类型:' + typeAnnotation);
|
|
281
280
|
} else {
|
|
282
|
-
typeAnnotation._delete();
|
|
281
|
+
typeAnnotation._delete?.();
|
|
283
282
|
const relationOptions = { parentId: this.id, parentConcept: this.concept, parentNode: this };
|
|
284
283
|
Object.assign(typeAnnotation, relationOptions);
|
|
285
284
|
}
|
|
@@ -317,35 +316,46 @@ export class Return extends BaseNode {
|
|
|
317
316
|
return !!this.module;
|
|
318
317
|
}
|
|
319
318
|
get hasChildren() {
|
|
320
|
-
const { typeKind } = this.typeAnnotation;
|
|
319
|
+
const { typeKind, typeNamespace } = this.typeAnnotation;
|
|
321
320
|
if (typeKind === 'reference' || typeKind === 'generic') {
|
|
321
|
+
if (typeNamespace.endsWith('.enums'))
|
|
322
|
+
return null;
|
|
322
323
|
return [{}];
|
|
323
324
|
}
|
|
324
325
|
return null;
|
|
325
326
|
}
|
|
327
|
+
get isTreeLeaf() {
|
|
328
|
+
return !this.hasChildren;
|
|
329
|
+
}
|
|
326
330
|
getSelectRef() {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
if (
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
331
|
+
try {
|
|
332
|
+
const { typeName, typeKind, typeNamespace } = this.typeAnnotation;
|
|
333
|
+
let completionChildren;
|
|
334
|
+
if (typeKind === 'reference') {
|
|
335
|
+
if (typeNamespace === 'nasl.ui') {
|
|
336
|
+
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
337
|
+
const properties = node.properties || [];
|
|
338
|
+
completionChildren = properties;
|
|
339
|
+
} else if (typeNamespace.endsWith('.enums')) {
|
|
340
|
+
completionChildren = undefined;
|
|
341
|
+
} else {
|
|
342
|
+
const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
|
|
343
|
+
const properties = node.properties || [];
|
|
344
|
+
completionChildren = properties;
|
|
345
|
+
}
|
|
346
|
+
} else if (typeKind === 'generic') {
|
|
347
|
+
if (typeNamespace === 'nasl.collection') {
|
|
348
|
+
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
349
|
+
const properties = node.properties || [];
|
|
350
|
+
completionChildren = properties;
|
|
351
|
+
}
|
|
334
352
|
} else {
|
|
335
|
-
|
|
336
|
-
const properties = node.properties || [];
|
|
337
|
-
completionChildren = properties;
|
|
353
|
+
completionChildren = undefined;
|
|
338
354
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
const properties = node.properties || [];
|
|
343
|
-
completionChildren = properties;
|
|
344
|
-
}
|
|
345
|
-
} else {
|
|
346
|
-
completionChildren = undefined;
|
|
355
|
+
return completionChildren;
|
|
356
|
+
} catch (err) {
|
|
357
|
+
console.log(err);
|
|
347
358
|
}
|
|
348
|
-
return completionChildren;
|
|
349
359
|
}
|
|
350
360
|
//================================================================================
|
|
351
361
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
@@ -129,7 +129,7 @@ export class SqlQueryComponent extends LogicItem {
|
|
|
129
129
|
@withSourceMap()
|
|
130
130
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
131
131
|
let code = `(function(): nasl.collection.List<`
|
|
132
|
-
code +=`${this.typeAnnotation ? this.typeAnnotation.toEmbeddedTS(shiftState(state, code)): '
|
|
132
|
+
code +=`${this.typeAnnotation ? this.typeAnnotation.toEmbeddedTS(shiftState(state, code)): '__IDENTIFIER__'}> {\n`;
|
|
133
133
|
code += '\n';
|
|
134
134
|
code += indent(state.tabSize + 1) + 'return;\n';
|
|
135
135
|
code += indent(state.tabSize) + '})();\n';
|
|
@@ -101,7 +101,7 @@ export class StringLiteral extends LogicItem {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
@withSourceMap()
|
|
104
|
-
toEmbeddedTS(state?: TranslatorState): string {
|
|
104
|
+
toEmbeddedTS(state?: TranslatorState, isRequired?: boolean): string {
|
|
105
105
|
let code = '';
|
|
106
106
|
if (this.value) {
|
|
107
107
|
if (!this.value.includes("'"))
|
|
@@ -113,7 +113,7 @@ export class StringLiteral extends LogicItem {
|
|
|
113
113
|
else
|
|
114
114
|
code += `'${this.value.replace(/'/g, "\\'")}'`;
|
|
115
115
|
} else {
|
|
116
|
-
code += `''`;
|
|
116
|
+
code += isRequired ? '__IDENTIFIER__' : `''`;
|
|
117
117
|
}
|
|
118
118
|
return code;
|
|
119
119
|
}
|
|
@@ -227,10 +227,55 @@ export class StructureProperty extends BaseNode {
|
|
|
227
227
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
228
228
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
229
229
|
//================================================================================
|
|
230
|
+
|
|
231
|
+
get hasChildren() {
|
|
232
|
+
const { typeKind, typeNamespace } = this.typeAnnotation;
|
|
233
|
+
if (typeKind === 'reference' || typeKind === 'generic') {
|
|
234
|
+
if (typeNamespace.endsWith('.enums'))
|
|
235
|
+
return null;
|
|
236
|
+
return [{}];
|
|
237
|
+
}
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
get isTreeLeaf() {
|
|
241
|
+
return !this.hasChildren;
|
|
242
|
+
}
|
|
230
243
|
/**
|
|
231
|
-
*
|
|
244
|
+
* 是否展开
|
|
232
245
|
*/
|
|
233
|
-
|
|
246
|
+
@property()
|
|
247
|
+
isLeaf: boolean = true;
|
|
248
|
+
|
|
249
|
+
getSelectRef() {
|
|
250
|
+
try {
|
|
251
|
+
const { typeName, typeKind, typeNamespace } = this.typeAnnotation;
|
|
252
|
+
let completionChildren;
|
|
253
|
+
if (typeKind === 'reference') {
|
|
254
|
+
if (typeNamespace === 'nasl.ui') {
|
|
255
|
+
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
256
|
+
const properties = node.properties || [];
|
|
257
|
+
completionChildren = properties;
|
|
258
|
+
} else if (typeNamespace.endsWith('.enums')) {
|
|
259
|
+
completionChildren = undefined;
|
|
260
|
+
} else {
|
|
261
|
+
const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
|
|
262
|
+
const properties = node.properties || [];
|
|
263
|
+
completionChildren = properties;
|
|
264
|
+
}
|
|
265
|
+
} else if (typeKind === 'generic') {
|
|
266
|
+
if (typeNamespace === 'nasl.collection') {
|
|
267
|
+
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
268
|
+
const properties = node.properties || [];
|
|
269
|
+
completionChildren = properties;
|
|
270
|
+
}
|
|
271
|
+
} else {
|
|
272
|
+
completionChildren = undefined;
|
|
273
|
+
}
|
|
274
|
+
return completionChildren;
|
|
275
|
+
} catch (err) {
|
|
276
|
+
console.log(err);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
234
279
|
|
|
235
280
|
@withSourceMap()
|
|
236
281
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
@@ -262,7 +307,7 @@ export class StructureProperty extends BaseNode {
|
|
|
262
307
|
// eslint-disable-next-line prefer-rest-params
|
|
263
308
|
throw new Error('找不到类型:' + arguments[0]);
|
|
264
309
|
} else {
|
|
265
|
-
typeAnnotation._delete();
|
|
310
|
+
typeAnnotation._delete?.();
|
|
266
311
|
const relationOptions = { parentId: this.id, parentConcept: this.concept, parentNode: this };
|
|
267
312
|
Object.assign(typeAnnotation, relationOptions);
|
|
268
313
|
}
|
|
@@ -291,32 +336,7 @@ export class StructureProperty extends BaseNode {
|
|
|
291
336
|
* 是否可编辑
|
|
292
337
|
* */
|
|
293
338
|
get readonly() {
|
|
294
|
-
return !!this.module;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
getSelectRef() {
|
|
298
|
-
const { typeName, typeKind, typeNamespace } = this.typeAnnotation;
|
|
299
|
-
let completionChildren;
|
|
300
|
-
if (typeKind === 'reference') {
|
|
301
|
-
if (typeNamespace === 'nasl.ui') {
|
|
302
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
303
|
-
const properties = node.properties || [];
|
|
304
|
-
completionChildren = properties;
|
|
305
|
-
} else {
|
|
306
|
-
const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
|
|
307
|
-
const properties = node.properties || [];
|
|
308
|
-
completionChildren = properties;
|
|
309
|
-
}
|
|
310
|
-
} else if (typeKind === 'generic') {
|
|
311
|
-
if (typeNamespace === 'nasl.collection') {
|
|
312
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
313
|
-
const properties = node.properties || [];
|
|
314
|
-
completionChildren = properties;
|
|
315
|
-
}
|
|
316
|
-
} else {
|
|
317
|
-
completionChildren = undefined;
|
|
318
|
-
}
|
|
319
|
-
return completionChildren;
|
|
339
|
+
return !!this.module || (this.parentNode as Structure).origin === 'CallQueryComponent';
|
|
320
340
|
}
|
|
321
341
|
|
|
322
342
|
//================================================================================
|
|
@@ -169,7 +169,7 @@ export class Structure extends BaseNode {
|
|
|
169
169
|
name: options,
|
|
170
170
|
}, this, 'typeParams');
|
|
171
171
|
} else if (options instanceof TypeParam) {
|
|
172
|
-
options.
|
|
172
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
173
173
|
typeParam = options;
|
|
174
174
|
Object.assign(typeParam, relationOptions);
|
|
175
175
|
} else {
|
|
@@ -311,7 +311,7 @@ export class Structure extends BaseNode {
|
|
|
311
311
|
name: options,
|
|
312
312
|
}, this, 'properties');
|
|
313
313
|
} else if (options instanceof StructureProperty) {
|
|
314
|
-
options.
|
|
314
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
315
315
|
property = options;
|
|
316
316
|
Object.assign(property, relationOptions);
|
|
317
317
|
} else {
|
|
@@ -518,7 +518,7 @@ export class Structure extends BaseNode {
|
|
|
518
518
|
* 是否可编辑
|
|
519
519
|
* */
|
|
520
520
|
get readonly() {
|
|
521
|
-
return !!this.module;
|
|
521
|
+
return !!this.module || this.origin === 'CallQueryComponent';
|
|
522
522
|
}
|
|
523
523
|
/* 删除空数据模块 */
|
|
524
524
|
deleteLogincAndModule() {
|
|
@@ -532,7 +532,7 @@ export class Structure extends BaseNode {
|
|
|
532
532
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
533
533
|
let code = `export class ${this.tsName} {\n`;
|
|
534
534
|
code += indent(state.tabSize + 1);
|
|
535
|
-
code += `__name: '${this.
|
|
535
|
+
code += `__name: '${this.getTsNamespace()}.${this.tsName}';\n`;
|
|
536
536
|
this.properties.forEach((property) => {
|
|
537
537
|
code += indent(state.tabSize + 1);
|
|
538
538
|
code += property.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }));
|
|
@@ -550,6 +550,18 @@ export class Structure extends BaseNode {
|
|
|
550
550
|
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
+
getTsNamespace() {
|
|
554
|
+
if (this.parentNode.concept === 'App') {
|
|
555
|
+
return `${(this.parentNode as Namespace).getNamespace()}.structures`;
|
|
556
|
+
} else {
|
|
557
|
+
if (this.parentNode && (this.parentNode as Namespace).getTsNamespace) {
|
|
558
|
+
return `${(this.parentNode as Namespace).getTsNamespace()}.structures`;
|
|
559
|
+
} else {
|
|
560
|
+
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
553
565
|
/**
|
|
554
566
|
* 生成宿主语言的文件路径
|
|
555
567
|
* @param name 一般不用传,用于 rename
|
|
@@ -560,7 +572,7 @@ export class Structure extends BaseNode {
|
|
|
560
572
|
}
|
|
561
573
|
|
|
562
574
|
toEmbeddedTSFile() {
|
|
563
|
-
let code = `namespace ${this.
|
|
575
|
+
let code = `namespace ${this.getTsNamespace()} {\n`;
|
|
564
576
|
|
|
565
577
|
const state = createCompilerState(code, { tabSize: 1 });
|
|
566
578
|
try {
|
|
@@ -89,7 +89,7 @@ export class SwitchCase extends LogicItem {
|
|
|
89
89
|
const relationOptions = { parentNode: this, parentKey: 'consequent' };
|
|
90
90
|
let logicItem: LogicItem;
|
|
91
91
|
if (options instanceof LogicItem) {
|
|
92
|
-
options.
|
|
92
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
93
93
|
logicItem = options;
|
|
94
94
|
Object.assign(logicItem, relationOptions);
|
|
95
95
|
} else {
|
|
@@ -249,7 +249,7 @@ export class SwitchCase extends LogicItem {
|
|
|
249
249
|
tabSize: 0,
|
|
250
250
|
})) : '';
|
|
251
251
|
|
|
252
|
-
code += ')
|
|
252
|
+
code += ') {\n';
|
|
253
253
|
|
|
254
254
|
if (Array.isArray(this.consequent)) {
|
|
255
255
|
this.consequent.forEach((logicItem) => {
|
|
@@ -277,7 +277,7 @@ export class SwitchCase extends LogicItem {
|
|
|
277
277
|
|
|
278
278
|
@withSourceMap()
|
|
279
279
|
toEmbeddedTS(state?: TranslatorState, isLast?: boolean): string {
|
|
280
|
-
let code = '';
|
|
280
|
+
let code = '\n';
|
|
281
281
|
if (!isLast) {
|
|
282
282
|
code += 'if (nasl.core.ensureBoolean(';
|
|
283
283
|
code += this.test ? this.test.toEmbeddedTS(shiftState(state, code, {
|
|
@@ -72,7 +72,7 @@ export class SwitchStatement extends LogicItem {
|
|
|
72
72
|
const relationOptions = { parentNode: this, parentKey: 'cases' };
|
|
73
73
|
let switchCase: SwitchCase;
|
|
74
74
|
if (options instanceof SwitchCase) {
|
|
75
|
-
options.
|
|
75
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
76
76
|
switchCase = options;
|
|
77
77
|
Object.assign(switchCase, relationOptions);
|
|
78
78
|
} else {
|
|
@@ -14,6 +14,20 @@ export enum PRIMITIVE_TYPE {
|
|
|
14
14
|
Email = 'Email'
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
export const PRIMITIVE_TITLE: Record<string, string> = {
|
|
18
|
+
Boolean: '布尔值',
|
|
19
|
+
Integer: '整数',
|
|
20
|
+
Long: '长整数',
|
|
21
|
+
Double: '小数',
|
|
22
|
+
String: '字符串',
|
|
23
|
+
Text: '长文本',
|
|
24
|
+
Binary: '二进制流',
|
|
25
|
+
Date: '日期',
|
|
26
|
+
Time: '时间',
|
|
27
|
+
DateTime: '日期时间',
|
|
28
|
+
Email: '电子邮箱',
|
|
29
|
+
};
|
|
30
|
+
|
|
17
31
|
//================================================================================
|
|
18
32
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
19
33
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -62,13 +76,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
62
76
|
@property('TypeAnnotation')
|
|
63
77
|
typeArguments?: Array<TypeAnnotation> = null;
|
|
64
78
|
|
|
65
|
-
/**
|
|
66
|
-
* 显示文本
|
|
67
|
-
*/
|
|
68
|
-
@excludedInJSON()
|
|
69
|
-
@property()
|
|
70
|
-
text?: string = undefined;
|
|
71
|
-
|
|
72
79
|
/**
|
|
73
80
|
* 是否是推断出来的
|
|
74
81
|
*/
|
|
@@ -116,7 +123,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
116
123
|
const relationOptions = { parentNode: this, parentKey: 'typeArguments' };
|
|
117
124
|
let typeAnnotation: TypeAnnotation;
|
|
118
125
|
if (options instanceof TypeAnnotation) {
|
|
119
|
-
options.
|
|
126
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
120
127
|
typeAnnotation = options;
|
|
121
128
|
Object.assign(typeAnnotation, relationOptions);
|
|
122
129
|
} else {
|
|
@@ -252,13 +259,18 @@ export class TypeAnnotation extends BaseNode {
|
|
|
252
259
|
}
|
|
253
260
|
|
|
254
261
|
/**
|
|
255
|
-
*
|
|
262
|
+
* 用于展示的 type 标题
|
|
256
263
|
*/
|
|
257
264
|
get typeTitle(): string {
|
|
258
|
-
if (this.typeKind === 'primitive'
|
|
265
|
+
if (this.typeKind === 'primitive') {
|
|
266
|
+
return `${this.typeName} ${PRIMITIVE_TITLE[this.typeName]}`;
|
|
267
|
+
} else if (this.typeKind === 'reference') {
|
|
259
268
|
return `${this.typeName}`;
|
|
260
269
|
} else if (this.typeKind === 'generic') {
|
|
261
|
-
|
|
270
|
+
if (this.typeArguments && this.typeArguments.length)
|
|
271
|
+
return `${this.typeName}<${(this.typeArguments || []).map((arg) => arg.typeName || 'T')}>`;
|
|
272
|
+
else
|
|
273
|
+
return this.typeName;
|
|
262
274
|
} else {
|
|
263
275
|
return this.typeName;
|
|
264
276
|
}
|
|
@@ -319,6 +331,10 @@ export class TypeAnnotation extends BaseNode {
|
|
|
319
331
|
return '';
|
|
320
332
|
}
|
|
321
333
|
|
|
334
|
+
toJS(state?: TranslatorState): string {
|
|
335
|
+
return JSON.stringify(this);
|
|
336
|
+
}
|
|
337
|
+
|
|
322
338
|
@withSourceMap()
|
|
323
339
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
324
340
|
if (this.typeKind === 'primitive' || this.typeKind === 'reference') {
|
|
@@ -330,7 +346,13 @@ export class TypeAnnotation extends BaseNode {
|
|
|
330
346
|
let code = `${this.tsCalleeNamespace}.${this.typeName}<`;
|
|
331
347
|
return (code += `${(this.typeArguments || []).map((arg) => arg.toEmbeddedTS(shiftState(state, code, { inline: true })))}>`);
|
|
332
348
|
} else {
|
|
333
|
-
|
|
349
|
+
if (this.tsCalleeNamespace && this.typeName) {
|
|
350
|
+
return `${this.tsCalleeNamespace}.${this.typeName}`;
|
|
351
|
+
} else if (this.typeName) {
|
|
352
|
+
return this.typeName;
|
|
353
|
+
} else {
|
|
354
|
+
return '__IDENTIFIER__';
|
|
355
|
+
}
|
|
334
356
|
}
|
|
335
357
|
}
|
|
336
358
|
|
|
@@ -137,7 +137,7 @@ export class UnaryExpression extends LogicItem {
|
|
|
137
137
|
if (this.operator === 'isNull') {
|
|
138
138
|
return this.argument.toUI(state);
|
|
139
139
|
} else {
|
|
140
|
-
return '!' + this.argument.toUI(state);
|
|
140
|
+
return '!(' + this.argument.toUI(state) + ')';
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -162,7 +162,9 @@ export class UnaryExpression extends LogicItem {
|
|
|
162
162
|
|
|
163
163
|
let code = '';
|
|
164
164
|
if (this.argument) {
|
|
165
|
-
code += `${this.operator}(
|
|
165
|
+
code += `${this.operator}(`;
|
|
166
|
+
code += `${this.argument.toEmbeddedTS(shiftState(state, code))}`;
|
|
167
|
+
code += `)`;
|
|
166
168
|
} else {
|
|
167
169
|
code += `${this.operator}(__IDENTIFIER__)`;
|
|
168
170
|
}
|
|
@@ -92,7 +92,7 @@ export class ValidationRule extends LogicItem {
|
|
|
92
92
|
const relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
93
93
|
let argument: Argument;
|
|
94
94
|
if (options instanceof Argument) {
|
|
95
|
-
options.
|
|
95
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
96
96
|
argument = options;
|
|
97
97
|
Object.assign(argument, relationOptions);
|
|
98
98
|
} else {
|
|
@@ -258,6 +258,29 @@ export class ValidationRule extends LogicItem {
|
|
|
258
258
|
return code;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
+
@withSourceMap()
|
|
262
|
+
toEmbeddedTS(state?: TranslatorState): string {
|
|
263
|
+
let code = '';
|
|
264
|
+
if (this.calleeName) {
|
|
265
|
+
if (this.arguments.length) {
|
|
266
|
+
code += this.calleeKey;
|
|
267
|
+
code += '(';
|
|
268
|
+
this.arguments.forEach((arg, index) => {
|
|
269
|
+
code += arg.toEmbeddedTS(shiftState(state, code), false, false);
|
|
270
|
+
if (index !== this.arguments.length - 1)
|
|
271
|
+
code += ', ';
|
|
272
|
+
});
|
|
273
|
+
code += ')';
|
|
274
|
+
} else {
|
|
275
|
+
// 没有入参数的不需要校验
|
|
276
|
+
return 'null';
|
|
277
|
+
}
|
|
278
|
+
} else {
|
|
279
|
+
code += '__IDENTIFIER__';
|
|
280
|
+
}
|
|
281
|
+
return code;
|
|
282
|
+
}
|
|
283
|
+
|
|
261
284
|
get calleeKey(): string {
|
|
262
285
|
return `${this.calleeNamespace}.${this.calleeName}`;
|
|
263
286
|
}
|
|
@@ -240,9 +240,9 @@ export class Variable extends BaseNode {
|
|
|
240
240
|
code += ': ';
|
|
241
241
|
code += this.typeAnnotation.toEmbeddedTS(shiftState(state, code));
|
|
242
242
|
}
|
|
243
|
-
if (this.defaultValue) {
|
|
244
|
-
|
|
245
|
-
}
|
|
243
|
+
// if (this.defaultValue) {
|
|
244
|
+
// code += ` = ${this.defaultValue}`;
|
|
245
|
+
// }
|
|
246
246
|
return code;
|
|
247
247
|
}
|
|
248
248
|
|
|
@@ -275,7 +275,7 @@ export class Variable extends BaseNode {
|
|
|
275
275
|
if (!typeAnnotation)
|
|
276
276
|
throw new Error('找不到类型:' + arguments[0]);
|
|
277
277
|
} else {
|
|
278
|
-
typeAnnotation._delete();
|
|
278
|
+
typeAnnotation._delete?.();
|
|
279
279
|
const relationOptions = { parentId: this.id, parentConcept: this.concept, parentNode: this };
|
|
280
280
|
Object.assign(typeAnnotation, relationOptions);
|
|
281
281
|
}
|
|
@@ -313,35 +313,46 @@ export class Variable extends BaseNode {
|
|
|
313
313
|
return !!this.module;
|
|
314
314
|
}
|
|
315
315
|
get hasChildren() {
|
|
316
|
-
const { typeKind } = this.typeAnnotation;
|
|
316
|
+
const { typeKind, typeNamespace } = this.typeAnnotation;
|
|
317
317
|
if (typeKind === 'reference' || typeKind === 'generic') {
|
|
318
|
+
if (typeNamespace.endsWith('.enums'))
|
|
319
|
+
return null;
|
|
318
320
|
return [{}];
|
|
319
321
|
}
|
|
320
322
|
return null;
|
|
321
323
|
}
|
|
324
|
+
get isTreeLeaf() {
|
|
325
|
+
return !this.hasChildren;
|
|
326
|
+
}
|
|
322
327
|
getSelectRef() {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
if (
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
328
|
+
try {
|
|
329
|
+
const { typeName, typeKind, typeNamespace } = this.typeAnnotation;
|
|
330
|
+
let completionChildren;
|
|
331
|
+
if (typeKind === 'reference') {
|
|
332
|
+
if (typeNamespace === 'nasl.ui') {
|
|
333
|
+
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
334
|
+
const properties = node.properties || [];
|
|
335
|
+
completionChildren = properties;
|
|
336
|
+
} else if (typeNamespace.endsWith('.enums')) {
|
|
337
|
+
completionChildren = undefined;
|
|
338
|
+
} else {
|
|
339
|
+
const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
|
|
340
|
+
const properties = node.properties || [];
|
|
341
|
+
completionChildren = properties;
|
|
342
|
+
}
|
|
343
|
+
} else if (typeKind === 'generic') {
|
|
344
|
+
if (typeNamespace === 'nasl.collection') {
|
|
345
|
+
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
346
|
+
const properties = node.properties || [];
|
|
347
|
+
completionChildren = properties;
|
|
348
|
+
}
|
|
330
349
|
} else {
|
|
331
|
-
|
|
332
|
-
const properties = node.properties || [];
|
|
333
|
-
completionChildren = properties;
|
|
350
|
+
completionChildren = undefined;
|
|
334
351
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
const properties = node.properties || [];
|
|
339
|
-
completionChildren = properties;
|
|
340
|
-
}
|
|
341
|
-
} else {
|
|
342
|
-
completionChildren = undefined;
|
|
352
|
+
return completionChildren;
|
|
353
|
+
} catch (err) {
|
|
354
|
+
console.log(err);
|
|
343
355
|
}
|
|
344
|
-
return completionChildren;
|
|
345
356
|
}
|
|
346
357
|
//================================================================================
|
|
347
358
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
@@ -164,7 +164,7 @@ export class ViewComponent extends BaseNode {
|
|
|
164
164
|
name: options,
|
|
165
165
|
}, this, 'attrs');
|
|
166
166
|
} else if (options instanceof Attribute) {
|
|
167
|
-
options.
|
|
167
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
168
168
|
attribute = options;
|
|
169
169
|
Object.assign(attribute, relationOptions);
|
|
170
170
|
} else {
|
|
@@ -306,7 +306,7 @@ export class ViewComponent extends BaseNode {
|
|
|
306
306
|
name: options,
|
|
307
307
|
}, this, 'events');
|
|
308
308
|
} else if (options instanceof Event) {
|
|
309
|
-
options.
|
|
309
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
310
310
|
event = options;
|
|
311
311
|
Object.assign(event, relationOptions);
|
|
312
312
|
} else {
|
|
@@ -448,7 +448,7 @@ export class ViewComponent extends BaseNode {
|
|
|
448
448
|
name: options,
|
|
449
449
|
}, this, 'slots');
|
|
450
450
|
} else if (options instanceof Slot) {
|
|
451
|
-
options.
|
|
451
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
452
452
|
slot = options;
|
|
453
453
|
Object.assign(slot, relationOptions);
|
|
454
454
|
} else {
|
|
@@ -590,7 +590,7 @@ export class ViewComponent extends BaseNode {
|
|
|
590
590
|
name: options,
|
|
591
591
|
}, this, 'methods');
|
|
592
592
|
} else if (options instanceof Logic) {
|
|
593
|
-
options.
|
|
593
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
594
594
|
logic = options;
|
|
595
595
|
Object.assign(logic, relationOptions);
|
|
596
596
|
} else {
|
|
@@ -732,7 +732,7 @@ export class ViewComponent extends BaseNode {
|
|
|
732
732
|
name: options,
|
|
733
733
|
}, this, 'children');
|
|
734
734
|
} else if (options instanceof ViewComponent) {
|
|
735
|
-
options.
|
|
735
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
736
736
|
viewComponent = options;
|
|
737
737
|
Object.assign(viewComponent, relationOptions);
|
|
738
738
|
} else {
|