@lcap/nasl 3.3.3-beta.2 → 3.3.3-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/automate/template/myProcess.d.ts +1 -1
- package/out/automate/template/myProcess.js +3 -2
- package/out/automate/template/myProcess.js.map +1 -1
- package/out/common/BaseNode.d.ts +26 -16
- package/out/common/BaseNode.js +35 -11
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/Anchor__.js +2 -1
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.js +6 -3
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/Argument__.js +4 -3
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignment__.js +3 -2
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.js +2 -1
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/AuthLogicForCallInterface__.js +3 -2
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
- package/out/concepts/BackendVariable__.js +4 -3
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js +7 -5
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +7 -7
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +9 -14
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +2 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.js +5 -3
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.js +2 -1
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/CallAuthInterface__.js +5 -2
- package/out/concepts/CallAuthInterface__.js.map +1 -1
- package/out/concepts/CallFunction__.js +6 -2
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +14 -9
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +10 -5
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +8 -15
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js +2 -1
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +3 -2
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +3 -2
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +3 -2
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Connection__.js +3 -2
- package/out/concepts/Connection__.js.map +1 -1
- package/out/concepts/Connector__.js +15 -10
- package/out/concepts/Connector__.js.map +1 -1
- package/out/concepts/Constant__.js +2 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataSource__.js +3 -2
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.js +2 -1
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/EntityProperty__.js +6 -3
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.js +6 -4
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.js +2 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +3 -2
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.js +2 -1
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +4 -2
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Frontend__.js +14 -9
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.js +11 -6
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +3 -0
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -1
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js +2 -1
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js +6 -3
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js +5 -5
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/Logic__.js +25 -19
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js +6 -4
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.js +2 -1
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +2 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/MetadataType__.d.ts +1 -1
- package/out/concepts/MetadataType__.js +8 -6
- package/out/concepts/MetadataType__.js.map +1 -1
- package/out/concepts/MsgTriggerEvent__.js +3 -2
- package/out/concepts/MsgTriggerEvent__.js.map +1 -1
- package/out/concepts/MsgTriggerLauncher__.js +3 -2
- package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
- package/out/concepts/Namespace__.js +33 -22
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.js +38 -18
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.js +5 -3
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.js +5 -3
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js +2 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js +4 -3
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.js +13 -7
- package/out/concepts/OverriddenLogic__.js.map +1 -1
- package/out/concepts/Param__.js +4 -3
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +6 -4
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +22 -14
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.d.ts +1 -2
- package/out/concepts/ProcessOutcome__.js +16 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.d.ts +1 -2
- package/out/concepts/ProcessOutcomes__.js +16 -1
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.js +15 -10
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js +2 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +2 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.js +2 -1
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +3 -2
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js +2 -1
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js +2 -1
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +3 -2
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.js +4 -3
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SelectMembers__.js +3 -2
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Slot__.js +2 -1
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js +2 -1
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js +5 -2
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +2 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +6 -4
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +2 -1
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +2 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TriggerEvent__.js +3 -2
- package/out/concepts/TriggerEvent__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +9 -4
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +2 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.js +2 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +4 -3
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.js +26 -5
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +9 -4
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +2 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/types__.d.ts +2 -3
- package/out/decorators/index.d.ts +3 -3
- package/out/generator/genBundleFiles.js +4 -4
- package/out/generator/genMetaData.js +4 -4
- package/out/generator/genMetaData.js.map +1 -1
- package/out/generator/genReleaseBody.js +7 -5
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/icestark.d.ts +1 -1
- package/out/generator/icestark.js +4 -2
- package/out/generator/icestark.js.map +1 -1
- package/out/generator/qiankun.d.ts +1 -1
- package/out/generator/qiankun.js +3 -1
- package/out/generator/qiankun.js.map +1 -1
- package/out/server/formatTsUtils.d.ts +3 -3
- package/out/server/getMemberIdentifier.d.ts +4 -4
- package/out/server/getMemberIdentifier.js +2 -2
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/naslServer.js +2 -2
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +11 -0
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/jsoner.js +20 -1
- package/out/service/storage/jsoner.js.map +1 -1
- package/out/translator/utils.d.ts +1 -0
- package/out/translator/utils.js +16 -2
- package/out/translator/utils.js.map +1 -1
- package/package.json +1 -1
- package/sandbox/stdlib/nasl.oql.ts +6 -1
- package/sandbox/stdlib/nasl.util.ts +142 -142
- package/src/automate/template/myProcess.js +3 -2
- package/src/common/BaseNode.ts +64 -33
- package/src/concepts/Anchor__.ts +2 -1
- package/src/concepts/AnonymousFunction__.ts +6 -3
- package/src/concepts/Argument__.ts +7 -6
- package/src/concepts/Assignment__.ts +17 -17
- package/src/concepts/Attribute__.ts +2 -1
- package/src/concepts/AuthLogicForCallInterface__.ts +3 -2
- package/src/concepts/BackendVariable__.ts +7 -6
- package/src/concepts/BatchAssignment__.ts +7 -5
- package/src/concepts/BinaryExpression__.ts +10 -12
- package/src/concepts/BindAttribute__.ts +18 -15
- package/src/concepts/BindDirective__.ts +15 -14
- package/src/concepts/BindEvent__.ts +5 -3
- package/src/concepts/BindStyle__.ts +2 -1
- package/src/concepts/CallAuthInterface__.ts +5 -2
- package/src/concepts/CallFunction__.ts +17 -5
- package/src/concepts/CallInterface__.ts +18 -13
- package/src/concepts/CallLogic__.ts +22 -9
- package/src/concepts/CallQueryComponent__.ts +8 -14
- package/src/concepts/CompletionProperty__.ts +2 -1
- package/src/concepts/ConfigGroup__.ts +3 -2
- package/src/concepts/ConfigProperty__.ts +3 -2
- package/src/concepts/Configuration__.ts +3 -2
- package/src/concepts/Connection__.ts +3 -2
- package/src/concepts/Connector__.ts +15 -10
- package/src/concepts/Constant__.ts +2 -1
- package/src/concepts/DataSource__.ts +3 -2
- package/src/concepts/Destination__.ts +2 -1
- package/src/concepts/EntityProperty__.ts +7 -3
- package/src/concepts/Entity__.ts +6 -4
- package/src/concepts/Enum__.ts +2 -1
- package/src/concepts/Event__.ts +3 -2
- package/src/concepts/ExternalDestination__.ts +2 -1
- package/src/concepts/ForEachStatement__.ts +4 -2
- package/src/concepts/Frontend__.ts +14 -9
- package/src/concepts/Function__.ts +11 -6
- package/src/concepts/Identifier__.ts +7 -4
- package/src/concepts/IfStatement__.ts +2 -1
- package/src/concepts/InterfaceParam__.ts +2 -1
- package/src/concepts/Interface__.ts +6 -3
- package/src/concepts/JSBlock__.ts +24 -25
- package/src/concepts/Logic__.ts +26 -20
- package/src/concepts/MatchCase__.ts +6 -4
- package/src/concepts/Match__.ts +2 -1
- package/src/concepts/MemberExpression__.ts +2 -1
- package/src/concepts/MetadataType__.ts +18 -17
- package/src/concepts/MsgTriggerEvent__.ts +3 -2
- package/src/concepts/MsgTriggerLauncher__.ts +3 -2
- package/src/concepts/Namespace__.ts +33 -22
- package/src/concepts/NewComposite__.ts +37 -18
- package/src/concepts/NewList__.ts +13 -11
- package/src/concepts/NewMap__.ts +11 -9
- package/src/concepts/NumericLiteral__.ts +2 -1
- package/src/concepts/OqlQueryComponent__.ts +9 -8
- package/src/concepts/OverriddenLogic__.ts +13 -7
- package/src/concepts/Param__.ts +15 -14
- package/src/concepts/ProcessComponent__.ts +6 -4
- package/src/concepts/ProcessElement__.ts +22 -14
- package/src/concepts/ProcessOutcome__.ts +17 -2
- package/src/concepts/ProcessOutcomes__.ts +17 -2
- package/src/concepts/Process__.ts +15 -10
- package/src/concepts/QueryAggregateExpression__.ts +2 -1
- package/src/concepts/QueryFromExpression__.ts +2 -1
- package/src/concepts/QueryGroupByExpression__.ts +2 -1
- package/src/concepts/QueryJoinExpression__.ts +3 -2
- package/src/concepts/QueryLimitExpression__.ts +2 -1
- package/src/concepts/QueryOrderByExpression__.ts +2 -1
- package/src/concepts/QuerySelectExpression__.ts +3 -2
- package/src/concepts/Return__.ts +7 -6
- package/src/concepts/SelectMembers__.ts +3 -2
- package/src/concepts/Slot__.ts +2 -1
- package/src/concepts/SqlQueryComponent__.ts +2 -1
- package/src/concepts/StringInterpolation__.ts +13 -3
- package/src/concepts/StructureProperty__.ts +2 -1
- package/src/concepts/Structure__.ts +6 -4
- package/src/concepts/SwitchCase__.ts +2 -1
- package/src/concepts/SwitchStatement__.ts +2 -1
- package/src/concepts/TriggerEvent__.ts +3 -2
- package/src/concepts/TypeAnnotation__.ts +35 -28
- package/src/concepts/UnaryExpression__.ts +2 -1
- package/src/concepts/ValidationRule__.ts +2 -1
- package/src/concepts/Variable__.ts +7 -6
- package/src/concepts/ViewElement__.ts +27 -8
- package/src/concepts/View__.ts +12 -7
- package/src/concepts/WhileStatement__.ts +2 -1
- package/src/concepts/types__.ts +2 -4
- package/src/decorators/index.ts +4 -4
- package/src/generator/genBundleFiles.ts +4 -4
- package/src/generator/genMetaData.ts +4 -4
- package/src/generator/genReleaseBody.ts +8 -4
- package/src/generator/icestark.ts +4 -2
- package/src/generator/qiankun.ts +3 -1
- package/src/server/formatTsUtils.ts +8 -8
- package/src/server/getMemberIdentifier.ts +6 -6
- package/src/server/naslServer.ts +4 -4
- package/src/server/translator.ts +10 -1
- package/src/service/storage/init.ts +2 -2
- package/src/service/storage/jsoner.ts +24 -3
- package/src/translator/utils.ts +15 -1
|
@@ -312,7 +312,8 @@ export class BindDirective extends BaseNode {
|
|
|
312
312
|
// @ts-ignore
|
|
313
313
|
const n = logicItem.__v_raw || logicItem;
|
|
314
314
|
if (Array.isArray((t as any)[parentKey])) {
|
|
315
|
-
|
|
315
|
+
// @ts-ignore
|
|
316
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
316
317
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
317
318
|
params.index = index;
|
|
318
319
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -532,18 +533,18 @@ export class BindDirective extends BaseNode {
|
|
|
532
533
|
let str = '';
|
|
533
534
|
// eslint-disable-next-line no-nested-ternary
|
|
534
535
|
let value = this.value;
|
|
535
|
-
if(this.type === 'string') {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
536
|
+
if (this.type === 'string') {
|
|
537
|
+
value = value.replace(/['"`\\]/g, (m) => {
|
|
538
|
+
let escape = '\\\\';
|
|
539
|
+
escape = '\\\\';
|
|
540
|
+
/// #if process.env.BUILD_TARGET === 'node'
|
|
541
|
+
escape = '\\';
|
|
542
|
+
/// #endif
|
|
543
|
+
if (m === '\\') {
|
|
544
|
+
return `${escape}${escape}`;
|
|
545
|
+
}
|
|
546
|
+
return `${escape}${m}`;
|
|
547
|
+
});
|
|
547
548
|
}
|
|
548
549
|
value = (this.type ?? 'string') !== 'string' ? this.value : value ? `\`${value}\`` : '';
|
|
549
550
|
// 需要用标识符替换
|
|
@@ -558,7 +559,7 @@ export class BindDirective extends BaseNode {
|
|
|
558
559
|
}
|
|
559
560
|
}
|
|
560
561
|
if (value !== undefined && value !== null && typeof value === 'string') {
|
|
561
|
-
|
|
562
|
+
value = value?.replace(/"/g, "'");
|
|
562
563
|
}
|
|
563
564
|
if (this.name === 'auth' && !!this.value) {
|
|
564
565
|
const regex = /(.\w+\[name=\w+\])/g;
|
|
@@ -169,7 +169,7 @@ export class BindEvent extends BaseNode {
|
|
|
169
169
|
|
|
170
170
|
getLogicExistingNames(excludedList: Array<Logic> = []) {
|
|
171
171
|
const excludedSet = new Set(excludedList);
|
|
172
|
-
return ((this.logics as Logic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item
|
|
172
|
+
return ((this.logics as Logic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
|
|
173
173
|
}
|
|
174
174
|
getLogicUniqueName(name = 'logic1') {
|
|
175
175
|
return utils.unique(name, this.getLogicExistingNames(), undefined, true);
|
|
@@ -461,7 +461,8 @@ export class BindEvent extends BaseNode {
|
|
|
461
461
|
// @ts-ignore
|
|
462
462
|
const n = logic.__v_raw || logic;
|
|
463
463
|
if (Array.isArray((t as any)[parentKey])) {
|
|
464
|
-
|
|
464
|
+
// @ts-ignore
|
|
465
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
465
466
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
466
467
|
params.index = index;
|
|
467
468
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -499,7 +500,8 @@ export class BindEvent extends BaseNode {
|
|
|
499
500
|
// @ts-ignore
|
|
500
501
|
const n = logicItem.__v_raw || logicItem;
|
|
501
502
|
if (Array.isArray((t as any)[parentKey])) {
|
|
502
|
-
|
|
503
|
+
// @ts-ignore
|
|
504
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
503
505
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
504
506
|
params.index = index;
|
|
505
507
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -277,7 +277,8 @@ export class BindStyle extends BaseNode {
|
|
|
277
277
|
// @ts-ignore
|
|
278
278
|
const n = logicItem.__v_raw || logicItem;
|
|
279
279
|
if (Array.isArray((t as any)[parentKey])) {
|
|
280
|
-
|
|
280
|
+
// @ts-ignore
|
|
281
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
281
282
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
282
283
|
params.index = index;
|
|
283
284
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -55,7 +55,9 @@ export class CallAuthInterface extends CallInterface {
|
|
|
55
55
|
|
|
56
56
|
getArgumentExistingNames(excludedList: Array<Argument> = []) {
|
|
57
57
|
const excludedSet = new Set(excludedList);
|
|
58
|
-
return ((this.authArguments as Argument[]) || [])
|
|
58
|
+
return ((this.authArguments as Argument[]) || [])
|
|
59
|
+
.filter((item) => !excludedSet.has(item))
|
|
60
|
+
.map((item) => item?.name);
|
|
59
61
|
}
|
|
60
62
|
getArgumentUniqueName(name = 'argument1') {
|
|
61
63
|
return utils.unique(name, this.getArgumentExistingNames(), undefined, false);
|
|
@@ -247,7 +249,8 @@ export class CallAuthInterface extends CallInterface {
|
|
|
247
249
|
// @ts-ignore
|
|
248
250
|
const n = logicItem.__v_raw || logicItem;
|
|
249
251
|
if (Array.isArray((t as any)[parentKey])) {
|
|
250
|
-
|
|
252
|
+
// @ts-ignore
|
|
253
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
251
254
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
252
255
|
params.index = index;
|
|
253
256
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
TranslatorState,
|
|
3
|
+
shiftState,
|
|
4
|
+
withSourceMap,
|
|
5
|
+
indent,
|
|
6
|
+
createCompilerState,
|
|
7
|
+
transfromMetadataType,
|
|
8
|
+
transfromUnionTypeAnnotation,
|
|
9
|
+
} from '../translator';
|
|
2
10
|
import Function from './Function__';
|
|
3
11
|
import { ElementToVueOptions } from './ViewElement__';
|
|
4
12
|
import Identifier from './Identifier__';
|
|
@@ -317,7 +325,8 @@ export class CallFunction extends LogicItem {
|
|
|
317
325
|
// @ts-ignore
|
|
318
326
|
const n = typeAnnotation.__v_raw || typeAnnotation;
|
|
319
327
|
if (Array.isArray((t as any)[parentKey])) {
|
|
320
|
-
|
|
328
|
+
// @ts-ignore
|
|
329
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
321
330
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
322
331
|
params.index = index;
|
|
323
332
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -355,7 +364,8 @@ export class CallFunction extends LogicItem {
|
|
|
355
364
|
// @ts-ignore
|
|
356
365
|
const n = logicItem.__v_raw || logicItem;
|
|
357
366
|
if (Array.isArray((t as any)[parentKey])) {
|
|
358
|
-
|
|
367
|
+
// @ts-ignore
|
|
368
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
359
369
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
360
370
|
params.index = index;
|
|
361
371
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -395,7 +405,8 @@ export class CallFunction extends LogicItem {
|
|
|
395
405
|
this.arguments?.forEach((arg: any, index) => {
|
|
396
406
|
let argStr = arg?.toVue(options);
|
|
397
407
|
const argTypeAnnotation = arg.typeAnnotation || arg.__TypeAnnotation;
|
|
398
|
-
|
|
408
|
+
transfromUnionTypeAnnotation(argTypeAnnotation, this.app);
|
|
409
|
+
const { sortedTypeKey } = transfromMetadataType(argTypeAnnotation, this.app);
|
|
399
410
|
if (needToString) {
|
|
400
411
|
argStr = `$utils['ToString']('${sortedTypeKey}', ${argStr})`;
|
|
401
412
|
} else if (['HasValue'].includes(this.calleeName)) {
|
|
@@ -473,7 +484,8 @@ export class CallFunction extends LogicItem {
|
|
|
473
484
|
this.arguments.forEach((arg: any, index) => {
|
|
474
485
|
let argStr = arg?.toJS(shiftState(state, code));
|
|
475
486
|
const argTypeAnnotation = arg.typeAnnotation || arg.__TypeAnnotation;
|
|
476
|
-
|
|
487
|
+
transfromUnionTypeAnnotation(argTypeAnnotation, this.app);
|
|
488
|
+
const { sortedTypeKey } = transfromMetadataType(argTypeAnnotation, this.app);
|
|
477
489
|
if (needToString) {
|
|
478
490
|
argStr = `this.$utils['ToString']('${sortedTypeKey}', ${argStr})`;
|
|
479
491
|
} else if (['HasValue'].includes(this.calleeName)) {
|
|
@@ -212,7 +212,8 @@ export class CallInterface extends LogicItem {
|
|
|
212
212
|
// @ts-ignore
|
|
213
213
|
const n = logicItem.__v_raw || logicItem;
|
|
214
214
|
if (Array.isArray((t as any)[parentKey])) {
|
|
215
|
-
|
|
215
|
+
// @ts-ignore
|
|
216
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
216
217
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
217
218
|
params.index = index;
|
|
218
219
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -622,25 +623,29 @@ export class CallInterface extends LogicItem {
|
|
|
622
623
|
setCallee(_interface: Interface) {
|
|
623
624
|
const calleeNamespace = _interface.getNamespace();
|
|
624
625
|
const calleeName = _interface.name;
|
|
625
|
-
|
|
626
|
+
// 保留之前的参数
|
|
627
|
+
const params = _interface.params.reduce((res, param) => {
|
|
626
628
|
const oldArgument = this.arguments.find((node) => node.keyword === param.name);
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
629
|
+
if (oldArgument && oldArgument.expression) {
|
|
630
|
+
res.push(Argument.from(
|
|
631
|
+
{
|
|
632
|
+
keyword: param.name,
|
|
633
|
+
expression: oldArgument.expression,
|
|
634
|
+
},
|
|
635
|
+
this,
|
|
636
|
+
'arguments',
|
|
637
|
+
));
|
|
638
|
+
}
|
|
639
|
+
return res
|
|
640
|
+
}, []);
|
|
636
641
|
const oldArguments = this.arguments.reduce((res, argumentNode) => {
|
|
637
642
|
const targetParam = _interface.params.find((item) => item.name === argumentNode.keyword);
|
|
638
|
-
if (!targetParam) {
|
|
643
|
+
if (!targetParam && argumentNode && argumentNode.expression) {
|
|
639
644
|
res.push(
|
|
640
645
|
Argument.from(
|
|
641
646
|
{
|
|
642
647
|
keyword: argumentNode.keyword,
|
|
643
|
-
expression: argumentNode
|
|
648
|
+
expression: argumentNode.expression,
|
|
644
649
|
},
|
|
645
650
|
this,
|
|
646
651
|
'arguments',
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import * as JSON5 from 'json5';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
TranslatorState,
|
|
4
|
+
shiftState,
|
|
5
|
+
withSourceMap,
|
|
6
|
+
createCompilerState,
|
|
7
|
+
transfromUnionTypeAnnotation,
|
|
8
|
+
} from '../translator';
|
|
3
9
|
import Logic from './Logic__';
|
|
4
10
|
import type Param from './Param__';
|
|
5
11
|
import View from './View__';
|
|
@@ -376,7 +382,8 @@ export class CallLogic extends LogicItem {
|
|
|
376
382
|
// @ts-ignore
|
|
377
383
|
const n = typeAnnotation.__v_raw || typeAnnotation;
|
|
378
384
|
if (Array.isArray((t as any)[parentKey])) {
|
|
379
|
-
|
|
385
|
+
// @ts-ignore
|
|
386
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
380
387
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
381
388
|
params.index = index;
|
|
382
389
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -414,7 +421,8 @@ export class CallLogic extends LogicItem {
|
|
|
414
421
|
// @ts-ignore
|
|
415
422
|
const n = logicItem.__v_raw || logicItem;
|
|
416
423
|
if (Array.isArray((t as any)[parentKey])) {
|
|
417
|
-
|
|
424
|
+
// @ts-ignore
|
|
425
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
418
426
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
419
427
|
params.index = index;
|
|
420
428
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -466,7 +474,8 @@ export class CallLogic extends LogicItem {
|
|
|
466
474
|
// @ts-ignore
|
|
467
475
|
const n = bindAttribute.__v_raw || bindAttribute;
|
|
468
476
|
if (Array.isArray((t as any)[parentKey])) {
|
|
469
|
-
|
|
477
|
+
// @ts-ignore
|
|
478
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
470
479
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
471
480
|
params.index = index;
|
|
472
481
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -828,7 +837,7 @@ export class CallLogic extends LogicItem {
|
|
|
828
837
|
|
|
829
838
|
const keywordProcessIndex = findConceptKeyWordIndexFromNamespace(calleeNamespace, 'processes');
|
|
830
839
|
const isProcessLogic = keywordProcessIndex !== -1;
|
|
831
|
-
const isFrontendLibrary = calleeNamespace
|
|
840
|
+
const isFrontendLibrary = calleeNamespace?.startsWith('extensions') && calleeNamespace?.indexOf('frontends');
|
|
832
841
|
// calleeNamespace不存在,一定是页面逻辑
|
|
833
842
|
if (calleeNamespace) {
|
|
834
843
|
const namespaceArr = calleeNamespace.split('.');
|
|
@@ -847,8 +856,9 @@ export class CallLogic extends LogicItem {
|
|
|
847
856
|
const args = logic?.params || [];
|
|
848
857
|
const keywordEntitiesIndex = findConceptKeyWordIndexFromNamespace(this.calleeNamespace, 'entities');
|
|
849
858
|
|
|
850
|
-
code += `this.$logics['${
|
|
851
|
-
}
|
|
859
|
+
code += `this.$logics['${
|
|
860
|
+
this.calleeNamespace ? `${this.calleeNamespace}.${this.calleeName}` : this.calleeName
|
|
861
|
+
}']`;
|
|
852
862
|
code += `({
|
|
853
863
|
config: {
|
|
854
864
|
download: false,
|
|
@@ -1050,9 +1060,12 @@ export class CallLogic extends LogicItem {
|
|
|
1050
1060
|
if (needToString) {
|
|
1051
1061
|
const arg = this.arguments[0];
|
|
1052
1062
|
const argTypeAnnotation = (arg as any).typeAnnotation || arg.__TypeAnnotation;
|
|
1063
|
+
transfromUnionTypeAnnotation(argTypeAnnotation, this.app);
|
|
1053
1064
|
let sortedTypeKey = argTypeAnnotation?.sortedTypeKey;
|
|
1054
1065
|
if (argTypeAnnotation?.typeNamespace?.endsWith('.metadataTypes')) {
|
|
1055
|
-
const referenceNode =
|
|
1066
|
+
const referenceNode =
|
|
1067
|
+
this.app.findNodeByCompleteName(argTypeAnnotation.typeNamespace + '.' + argTypeAnnotation.typeName) ||
|
|
1068
|
+
{};
|
|
1056
1069
|
const typeAn = referenceNode.typeAnnotation || {};
|
|
1057
1070
|
sortedTypeKey = `${typeAn.typeNamespace}.${typeAn.typeName}`;
|
|
1058
1071
|
}
|
|
@@ -1448,7 +1461,7 @@ export class CallLogic extends LogicItem {
|
|
|
1448
1461
|
state: Array.isArray(t) ? 2 : 1,
|
|
1449
1462
|
};
|
|
1450
1463
|
});
|
|
1451
|
-
} catch (err) {
|
|
1464
|
+
} catch (err) {}
|
|
1452
1465
|
}
|
|
1453
1466
|
return node;
|
|
1454
1467
|
}
|
|
@@ -712,7 +712,8 @@ export class CallQueryComponent extends LogicItem {
|
|
|
712
712
|
// @ts-ignore
|
|
713
713
|
const n = typeAnnotation.__v_raw || typeAnnotation;
|
|
714
714
|
if (Array.isArray((t as any)[parentKey])) {
|
|
715
|
-
|
|
715
|
+
// @ts-ignore
|
|
716
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
716
717
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
717
718
|
params.index = index;
|
|
718
719
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -908,7 +909,8 @@ export class CallQueryComponent extends LogicItem {
|
|
|
908
909
|
// @ts-ignore
|
|
909
910
|
const n = logicItem.__v_raw || logicItem;
|
|
910
911
|
if (Array.isArray((t as any)[parentKey])) {
|
|
911
|
-
|
|
912
|
+
// @ts-ignore
|
|
913
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
912
914
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
913
915
|
params.index = index;
|
|
914
916
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -1214,20 +1216,12 @@ export class CallQueryComponent extends LogicItem {
|
|
|
1214
1216
|
if (['COUNT', 'COUNTD'].includes(item.aggregateName)) {
|
|
1215
1217
|
typeName = 'Long';
|
|
1216
1218
|
} else if (['AVG'].includes(item.aggregateName)) {
|
|
1217
|
-
|
|
1218
|
-
const entity = entities.find((item: Entity) => item.name === entityAsName);
|
|
1219
|
-
const property = entity?.properties.find((item: any) => item.name === propertyName);
|
|
1220
|
-
const propertyTypeName = property?.typeAnnotation?.typeName;
|
|
1221
|
-
if (propertyTypeName === 'Decimal') {
|
|
1222
|
-
typeName = 'Decimal';
|
|
1223
|
-
} else {
|
|
1224
|
-
typeName = 'Decimal';
|
|
1225
|
-
}
|
|
1219
|
+
typeName = 'Decimal';
|
|
1226
1220
|
} else {
|
|
1227
1221
|
const { entityAsName, propertyName } = item.aggregateParam;
|
|
1228
|
-
const entity = entities.find((
|
|
1229
|
-
const
|
|
1230
|
-
typeName =
|
|
1222
|
+
const entity = entities.find((e: Entity) => e.name === entityAsName);
|
|
1223
|
+
const prop = entity?.properties.find((p) => p.name === propertyName);
|
|
1224
|
+
typeName = prop?.typeAnnotation?.typeName;
|
|
1231
1225
|
}
|
|
1232
1226
|
return {
|
|
1233
1227
|
concept: 'StructureProperty',
|
|
@@ -215,7 +215,8 @@ export class CompletionProperty extends BaseNode {
|
|
|
215
215
|
// @ts-ignore
|
|
216
216
|
const n = typeAnnotation.__v_raw || typeAnnotation;
|
|
217
217
|
if (Array.isArray((t as any)[parentKey])) {
|
|
218
|
-
|
|
218
|
+
// @ts-ignore
|
|
219
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
219
220
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
220
221
|
params.index = index;
|
|
221
222
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -91,7 +91,7 @@ export class ConfigGroup extends BaseNode {
|
|
|
91
91
|
const excludedSet = new Set(excludedList);
|
|
92
92
|
return ((this.properties as ConfigProperty[]) || [])
|
|
93
93
|
.filter((item) => !excludedSet.has(item))
|
|
94
|
-
.map((item) => item
|
|
94
|
+
.map((item) => item?.name);
|
|
95
95
|
}
|
|
96
96
|
getConfigPropertyUniqueName(name = 'configProperty1') {
|
|
97
97
|
return utils.unique(name, this.getConfigPropertyExistingNames(), undefined, false);
|
|
@@ -283,7 +283,8 @@ export class ConfigGroup extends BaseNode {
|
|
|
283
283
|
// @ts-ignore
|
|
284
284
|
const n = configProperty.__v_raw || configProperty;
|
|
285
285
|
if (Array.isArray((t as any)[parentKey])) {
|
|
286
|
-
|
|
286
|
+
// @ts-ignore
|
|
287
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
287
288
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
288
289
|
params.index = index;
|
|
289
290
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -115,7 +115,7 @@ export class ConfigProperty extends BaseNode {
|
|
|
115
115
|
const excludedSet = new Set(excludedList);
|
|
116
116
|
return ((this.values as ConfigPropertyValue[]) || [])
|
|
117
117
|
.filter((item) => !excludedSet.has(item))
|
|
118
|
-
.map((item) => item
|
|
118
|
+
.map((item) => item?.name);
|
|
119
119
|
}
|
|
120
120
|
getConfigPropertyValueUniqueName(name = 'configPropertyValue1') {
|
|
121
121
|
return utils.unique(name, this.getConfigPropertyValueExistingNames(), undefined, false);
|
|
@@ -313,7 +313,8 @@ export class ConfigProperty extends BaseNode {
|
|
|
313
313
|
// @ts-ignore
|
|
314
314
|
const n = configPropertyValue.__v_raw || configPropertyValue;
|
|
315
315
|
if (Array.isArray((t as any)[parentKey])) {
|
|
316
|
-
|
|
316
|
+
// @ts-ignore
|
|
317
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
317
318
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
318
319
|
params.index = index;
|
|
319
320
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -69,7 +69,7 @@ export class Configuration extends BaseNode {
|
|
|
69
69
|
|
|
70
70
|
getConfigGroupExistingNames(excludedList: Array<ConfigGroup> = []) {
|
|
71
71
|
const excludedSet = new Set(excludedList);
|
|
72
|
-
return ((this.groups as ConfigGroup[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item
|
|
72
|
+
return ((this.groups as ConfigGroup[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
|
|
73
73
|
}
|
|
74
74
|
getConfigGroupUniqueName(name = 'configGroup1') {
|
|
75
75
|
return utils.unique(name, this.getConfigGroupExistingNames(), undefined, false);
|
|
@@ -261,7 +261,8 @@ export class Configuration extends BaseNode {
|
|
|
261
261
|
// @ts-ignore
|
|
262
262
|
const n = configGroup.__v_raw || configGroup;
|
|
263
263
|
if (Array.isArray((t as any)[parentKey])) {
|
|
264
|
-
|
|
264
|
+
// @ts-ignore
|
|
265
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
265
266
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
266
267
|
params.index = index;
|
|
267
268
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -150,7 +150,7 @@ export class Connection extends BaseNode {
|
|
|
150
150
|
const excludedSet = new Set(excludedList);
|
|
151
151
|
return ((this.properties as ConfigProperty[]) || [])
|
|
152
152
|
.filter((item) => !excludedSet.has(item))
|
|
153
|
-
.map((item) => item
|
|
153
|
+
.map((item) => item?.name);
|
|
154
154
|
}
|
|
155
155
|
getConfigPropertyUniqueName(name = 'configProperty1') {
|
|
156
156
|
return utils.unique(name, this.getConfigPropertyExistingNames(), undefined, false);
|
|
@@ -342,7 +342,8 @@ export class Connection extends BaseNode {
|
|
|
342
342
|
// @ts-ignore
|
|
343
343
|
const n = configProperty.__v_raw || configProperty;
|
|
344
344
|
if (Array.isArray((t as any)[parentKey])) {
|
|
345
|
-
|
|
345
|
+
// @ts-ignore
|
|
346
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
346
347
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
347
348
|
params.index = index;
|
|
348
349
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -294,7 +294,7 @@ export class Connector extends Module {
|
|
|
294
294
|
|
|
295
295
|
getParamExistingNames(excludedList: Array<Param> = []) {
|
|
296
296
|
const excludedSet = new Set(excludedList);
|
|
297
|
-
return ((this.properties as Param[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item
|
|
297
|
+
return ((this.properties as Param[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
|
|
298
298
|
}
|
|
299
299
|
getParamUniqueName(name = 'param1') {
|
|
300
300
|
return utils.unique(name, this.getParamExistingNames(), undefined, false);
|
|
@@ -447,7 +447,7 @@ export class Connector extends Module {
|
|
|
447
447
|
|
|
448
448
|
getLogicExistingNames(excludedList: Array<Logic> = []) {
|
|
449
449
|
const excludedSet = new Set(excludedList);
|
|
450
|
-
return ((this.logics as Logic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item
|
|
450
|
+
return ((this.logics as Logic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
|
|
451
451
|
}
|
|
452
452
|
getLogicUniqueName(name = 'logic1') {
|
|
453
453
|
return utils.unique(name, this.getLogicExistingNames(), undefined, false);
|
|
@@ -602,7 +602,7 @@ export class Connector extends Module {
|
|
|
602
602
|
const excludedSet = new Set(excludedList);
|
|
603
603
|
return ((this.triggers as ConnectorTrigger[]) || [])
|
|
604
604
|
.filter((item) => !excludedSet.has(item))
|
|
605
|
-
.map((item) => item
|
|
605
|
+
.map((item) => item?.name);
|
|
606
606
|
}
|
|
607
607
|
getConnectorTriggerUniqueName(name = 'connectorTrigger1') {
|
|
608
608
|
return utils.unique(name, this.getConnectorTriggerExistingNames(), undefined, false);
|
|
@@ -755,7 +755,7 @@ export class Connector extends Module {
|
|
|
755
755
|
|
|
756
756
|
getStructureExistingNames(excludedList: Array<Structure> = []) {
|
|
757
757
|
const excludedSet = new Set(excludedList);
|
|
758
|
-
return ((this.structures as Structure[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item
|
|
758
|
+
return ((this.structures as Structure[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
|
|
759
759
|
}
|
|
760
760
|
getStructureUniqueName(name = 'structure1') {
|
|
761
761
|
return utils.unique(name, this.getStructureExistingNames(), undefined, false);
|
|
@@ -908,7 +908,7 @@ export class Connector extends Module {
|
|
|
908
908
|
|
|
909
909
|
getNamespaceExistingNames(excludedList: Array<Namespace> = []) {
|
|
910
910
|
const excludedSet = new Set(excludedList);
|
|
911
|
-
return ((this.namespaces as Namespace[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item
|
|
911
|
+
return ((this.namespaces as Namespace[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
|
|
912
912
|
}
|
|
913
913
|
getNamespaceUniqueName(name = 'namespace1') {
|
|
914
914
|
return utils.unique(name, this.getNamespaceExistingNames(), undefined, false);
|
|
@@ -1100,7 +1100,8 @@ export class Connector extends Module {
|
|
|
1100
1100
|
// @ts-ignore
|
|
1101
1101
|
const n = param.__v_raw || param;
|
|
1102
1102
|
if (Array.isArray((t as any)[parentKey])) {
|
|
1103
|
-
|
|
1103
|
+
// @ts-ignore
|
|
1104
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
1104
1105
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
1105
1106
|
params.index = index;
|
|
1106
1107
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -1202,7 +1203,8 @@ export class Connector extends Module {
|
|
|
1202
1203
|
// @ts-ignore
|
|
1203
1204
|
const n = logic.__v_raw || logic;
|
|
1204
1205
|
if (Array.isArray((t as any)[parentKey])) {
|
|
1205
|
-
|
|
1206
|
+
// @ts-ignore
|
|
1207
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
1206
1208
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
1207
1209
|
params.index = index;
|
|
1208
1210
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -1254,7 +1256,8 @@ export class Connector extends Module {
|
|
|
1254
1256
|
// @ts-ignore
|
|
1255
1257
|
const n = connectorTrigger.__v_raw || connectorTrigger;
|
|
1256
1258
|
if (Array.isArray((t as any)[parentKey])) {
|
|
1257
|
-
|
|
1259
|
+
// @ts-ignore
|
|
1260
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
1258
1261
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
1259
1262
|
params.index = index;
|
|
1260
1263
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -1306,7 +1309,8 @@ export class Connector extends Module {
|
|
|
1306
1309
|
// @ts-ignore
|
|
1307
1310
|
const n = structure.__v_raw || structure;
|
|
1308
1311
|
if (Array.isArray((t as any)[parentKey])) {
|
|
1309
|
-
|
|
1312
|
+
// @ts-ignore
|
|
1313
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
1310
1314
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
1311
1315
|
params.index = index;
|
|
1312
1316
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -1358,7 +1362,8 @@ export class Connector extends Module {
|
|
|
1358
1362
|
// @ts-ignore
|
|
1359
1363
|
const n = namespace.__v_raw || namespace;
|
|
1360
1364
|
if (Array.isArray((t as any)[parentKey])) {
|
|
1361
|
-
|
|
1365
|
+
// @ts-ignore
|
|
1366
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
1362
1367
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
1363
1368
|
params.index = index;
|
|
1364
1369
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -216,7 +216,8 @@ export class Constant extends BaseNode {
|
|
|
216
216
|
// @ts-ignore
|
|
217
217
|
const n = typeAnnotation.__v_raw || typeAnnotation;
|
|
218
218
|
if (Array.isArray((t as any)[parentKey])) {
|
|
219
|
-
|
|
219
|
+
// @ts-ignore
|
|
220
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
220
221
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
221
222
|
params.index = index;
|
|
222
223
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -110,7 +110,7 @@ export class DataSource extends BaseNode {
|
|
|
110
110
|
|
|
111
111
|
getEntityExistingNames(excludedList: Array<Entity> = []) {
|
|
112
112
|
const excludedSet = new Set(excludedList);
|
|
113
|
-
return ((this.entities as Entity[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item
|
|
113
|
+
return ((this.entities as Entity[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
|
|
114
114
|
}
|
|
115
115
|
getEntityUniqueName(name = 'Entity1') {
|
|
116
116
|
return utils.unique(name, this.getEntityExistingNames(), undefined, true);
|
|
@@ -302,7 +302,8 @@ export class DataSource extends BaseNode {
|
|
|
302
302
|
// @ts-ignore
|
|
303
303
|
const n = entity.__v_raw || entity;
|
|
304
304
|
if (Array.isArray((t as any)[parentKey])) {
|
|
305
|
-
|
|
305
|
+
// @ts-ignore
|
|
306
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
306
307
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
307
308
|
params.index = index;
|
|
308
309
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -290,7 +290,8 @@ export class Destination extends LogicItem {
|
|
|
290
290
|
// @ts-ignore
|
|
291
291
|
const n = logicItem.__v_raw || logicItem;
|
|
292
292
|
if (Array.isArray((t as any)[parentKey])) {
|
|
293
|
-
|
|
293
|
+
// @ts-ignore
|
|
294
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
294
295
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
295
296
|
params.index = index;
|
|
296
297
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -342,7 +342,8 @@ export class EntityProperty extends BaseNode {
|
|
|
342
342
|
// @ts-ignore
|
|
343
343
|
const n = typeAnnotation.__v_raw || typeAnnotation;
|
|
344
344
|
if (Array.isArray((t as any)[parentKey])) {
|
|
345
|
-
|
|
345
|
+
// @ts-ignore
|
|
346
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
346
347
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
347
348
|
params.index = index;
|
|
348
349
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -394,7 +395,8 @@ export class EntityProperty extends BaseNode {
|
|
|
394
395
|
// @ts-ignore
|
|
395
396
|
const n = databaseTypeAnnotation.__v_raw || databaseTypeAnnotation;
|
|
396
397
|
if (Array.isArray((t as any)[parentKey])) {
|
|
397
|
-
|
|
398
|
+
// @ts-ignore
|
|
399
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
398
400
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
399
401
|
params.index = index;
|
|
400
402
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -767,7 +769,9 @@ export class EntityProperty extends BaseNode {
|
|
|
767
769
|
let databaseTypeInfo;
|
|
768
770
|
const items = this.typeAnnotation;
|
|
769
771
|
if (items?.typeNamespace?.endsWith('.metadataTypes')) {
|
|
770
|
-
const referenceNode =
|
|
772
|
+
const referenceNode =
|
|
773
|
+
(this.getAncestor('App') as App).findNodeByCompleteName(items.typeNamespace + '.' + items.typeName)
|
|
774
|
+
?.typeAnnotation || {};
|
|
771
775
|
typeKind = referenceNode.typeKind;
|
|
772
776
|
typeName = referenceNode.typeName;
|
|
773
777
|
typeNamespace = referenceNode.typeNamespace;
|
package/src/concepts/Entity__.ts
CHANGED
|
@@ -139,7 +139,7 @@ export class Entity extends BaseNode {
|
|
|
139
139
|
const excludedSet = new Set(excludedList);
|
|
140
140
|
return ((this.properties as EntityProperty[]) || [])
|
|
141
141
|
.filter((item) => !excludedSet.has(item))
|
|
142
|
-
.map((item) => item
|
|
142
|
+
.map((item) => item?.name);
|
|
143
143
|
}
|
|
144
144
|
getPropertyUniqueName(name = 'property1') {
|
|
145
145
|
return utils.unique(name, this.getPropertyExistingNames(), undefined, false);
|
|
@@ -292,7 +292,7 @@ export class Entity extends BaseNode {
|
|
|
292
292
|
|
|
293
293
|
getEntityIndexExistingNames(excludedList: Array<EntityIndex> = []) {
|
|
294
294
|
const excludedSet = new Set(excludedList);
|
|
295
|
-
return ((this.indexes as EntityIndex[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item
|
|
295
|
+
return ((this.indexes as EntityIndex[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
|
|
296
296
|
}
|
|
297
297
|
getEntityIndexUniqueName(name = 'entityIndex1') {
|
|
298
298
|
return utils.unique(name, this.getEntityIndexExistingNames(), undefined, false);
|
|
@@ -484,7 +484,8 @@ export class Entity extends BaseNode {
|
|
|
484
484
|
// @ts-ignore
|
|
485
485
|
const n = property.__v_raw || property;
|
|
486
486
|
if (Array.isArray((t as any)[parentKey])) {
|
|
487
|
-
|
|
487
|
+
// @ts-ignore
|
|
488
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
488
489
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
489
490
|
params.index = index;
|
|
490
491
|
} else if ((t as any)[parentKey] === n) {
|
|
@@ -536,7 +537,8 @@ export class Entity extends BaseNode {
|
|
|
536
537
|
// @ts-ignore
|
|
537
538
|
const n = entityIndex.__v_raw || entityIndex;
|
|
538
539
|
if (Array.isArray((t as any)[parentKey])) {
|
|
539
|
-
|
|
540
|
+
// @ts-ignore
|
|
541
|
+
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
540
542
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
541
543
|
params.index = index;
|
|
542
544
|
} else if ((t as any)[parentKey] === n) {
|