@lcap/nasl 2.20.0-beta.1 → 2.20.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/index.d.ts +1 -1
- package/out/automate/engine/index.js +7 -7
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/uniqueName.d.ts +1 -1
- package/out/automate/engine/uniqueName.js +3 -3
- package/out/automate/engine/uniqueName.js.map +1 -1
- package/out/automate/template/myProcess.js +1 -1
- package/out/automate/template/myProcess.js.map +1 -1
- package/out/bak/translator.js +38 -85
- package/out/bak/translator.js.map +1 -1
- package/out/common/BaseNode.d.ts +10 -6
- package/out/common/BaseNode.js +53 -7
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +1 -0
- package/out/concepts/AnonymousFunction__.js +40 -2
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.d.ts +89 -261
- package/out/concepts/App__.js +315 -367
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.d.ts +5 -5
- package/out/concepts/AssignmentLine__.js +6 -6
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.js +1 -2
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts +62 -60
- package/out/concepts/BatchAssignment__.js +113 -42
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +24 -0
- package/out/concepts/BindAttribute__.js +54 -4
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +5 -0
- package/out/concepts/BindDirective__.js +6 -0
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +5 -0
- package/out/concepts/BindEvent__.js +6 -0
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +7 -2
- package/out/concepts/BindStyle__.js +9 -3
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.js +0 -8
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.js +90 -38
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +7 -0
- package/out/concepts/CallInterface__.js +54 -7
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +2 -1
- package/out/concepts/CallLogic__.js +171 -37
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +16 -1
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js +3 -0
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Constant__.d.ts +5 -0
- package/out/concepts/Constant__.js +6 -0
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +8 -0
- package/out/concepts/DataSource__.js +96 -1
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +11 -2
- package/out/concepts/Destination__.js +156 -51
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +21 -8
- package/out/concepts/EntityProperty__.js +109 -23
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +32 -0
- package/out/concepts/Entity__.js +117 -2
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.js +0 -4
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.d.ts +73 -0
- package/out/concepts/ExternalDestination__.js +264 -0
- package/out/concepts/ExternalDestination__.js.map +1 -0
- package/out/concepts/ForEachStatement__.d.ts +0 -4
- package/out/concepts/ForEachStatement__.js +4 -8
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +370 -0
- package/out/concepts/Frontend__.js +669 -0
- package/out/concepts/Frontend__.js.map +1 -0
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +1 -0
- package/out/concepts/Identifier__.js +33 -10
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.d.ts +8 -0
- package/out/concepts/IfStatement__.js +22 -0
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +6 -1
- package/out/concepts/LogicItem__.js +6 -0
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +91 -80
- package/out/concepts/Logic__.js +178 -59
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.d.ts +1 -1
- package/out/concepts/MatchCase__.js +15 -8
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.d.ts +21 -19
- package/out/concepts/Match__.js +118 -26
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +4 -1
- package/out/concepts/MemberExpression__.js +30 -15
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +345 -0
- package/out/concepts/NewComposite__.js +1068 -0
- package/out/concepts/NewComposite__.js.map +1 -0
- package/out/concepts/NewList__.d.ts +130 -0
- package/out/concepts/NewList__.js +349 -0
- package/out/concepts/NewList__.js.map +1 -0
- package/out/concepts/NewMap__.d.ts +221 -0
- package/out/concepts/NewMap__.js +480 -0
- package/out/concepts/NewMap__.js.map +1 -0
- package/out/concepts/New__.d.ts +19 -0
- package/out/concepts/New__.js +66 -0
- package/out/concepts/New__.js.map +1 -0
- package/out/concepts/NumericLiteral__.js +1 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.d.ts +7 -3
- package/out/concepts/OqlQueryComponent__.js +56 -95
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.d.ts +8 -1
- package/out/concepts/Param__.js +85 -6
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +42 -13
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.d.ts +30 -0
- package/out/concepts/ProcessOutcomes__.js +87 -0
- package/out/concepts/ProcessOutcomes__.js.map +1 -0
- package/out/concepts/Process__.d.ts +4 -20
- package/out/concepts/Process__.js +0 -7
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.d.ts +3 -3
- package/out/concepts/QueryOrderByExpression__.js +3 -3
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +5 -0
- package/out/concepts/Return__.js +45 -2
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SelectMembers__.d.ts +1 -1
- package/out/concepts/SelectMembers__.js +5 -5
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +2 -4
- package/out/concepts/SqlQueryComponent__.js +9 -88
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StringInterpolation__.d.ts +113 -0
- package/out/concepts/StringInterpolation__.js +227 -0
- package/out/concepts/StringInterpolation__.js.map +1 -0
- package/out/concepts/StringLiteral__.js +0 -7
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/Transactional__.d.ts +5 -0
- package/out/concepts/Transactional__.js +6 -0
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +4 -0
- package/out/concepts/TypeAnnotation__.js +67 -15
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.d.ts +1 -0
- package/out/concepts/TypeParam__.js +2 -0
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +6 -9
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.js +87 -22
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +5 -0
- package/out/concepts/Variable__.js +46 -3
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +35 -29
- package/out/concepts/ViewElement__.js +138 -54
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +10 -3
- package/out/concepts/View__.js +116 -86
- 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/nasl.auth.js +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.browser.js +50 -0
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.logging.js +5 -0
- package/out/concepts/basics/stdlib/nasl.logging.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +38 -4
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +214 -62
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/index__.d.ts +9 -0
- package/out/concepts/index__.js +9 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/enums/KEYWORDS.d.ts +1 -0
- package/out/enums/KEYWORDS.js +9 -1
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +10 -4
- package/out/generator/genBundleFiles.js +127 -162
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.d.ts +2 -11
- package/out/generator/genMetaData.js +185 -51
- package/out/generator/genMetaData.js.map +1 -1
- package/out/generator/genReleaseBody.d.ts +57 -0
- package/out/generator/genReleaseBody.js +380 -0
- package/out/generator/genReleaseBody.js.map +1 -0
- package/out/generator/index.d.ts +2 -0
- package/out/generator/index.js +2 -0
- package/out/generator/index.js.map +1 -1
- package/out/generator/permission.d.ts +17 -0
- package/out/generator/permission.js +221 -0
- package/out/generator/permission.js.map +1 -0
- package/out/index.d.ts +3 -2
- package/out/index.js +7 -1
- package/out/index.js.map +1 -1
- package/out/server/entity2LogicNamespace.js +100 -20
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/extendBaseNode.js +33 -20
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.d.ts +1 -2
- package/out/server/formatTsUtils.js +46 -64
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.d.ts +2 -1
- package/out/server/getLogics.js +24 -6
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +11 -11
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +1 -1
- package/out/server/getProcesses.js +1 -1
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/index.d.ts +0 -1
- package/out/server/index.js +2 -27
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +50 -8
- package/out/server/naslServer.js +816 -429
- package/out/server/naslServer.js.map +1 -1
- package/out/server/naslStdlibMap.js +30 -28
- package/out/server/naslStdlibMap.js.map +1 -1
- package/out/server/process2LogicNamespace.js +8 -0
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.js +90 -12
- package/out/server/translator.js.map +1 -1
- package/out/service/creator/add.configs.js +4 -0
- package/out/service/creator/add.configs.js.map +1 -1
- package/out/service/datasource/api.d.ts +12 -0
- package/out/service/datasource/api.js +14 -0
- package/out/service/datasource/api.js.map +1 -0
- package/out/service/datasource/index.d.ts +2 -0
- package/out/service/datasource/index.js +10 -0
- package/out/service/datasource/index.js.map +1 -0
- package/out/service/defaultErrorMessage.json +97 -0
- package/out/service/logic/api.d.ts +9 -0
- package/out/service/logic/api.js +11 -0
- package/out/service/logic/api.js.map +1 -0
- package/out/service/logic/index.d.ts +2 -0
- package/out/service/logic/index.js +10 -0
- package/out/service/logic/index.js.map +1 -0
- package/out/service/storage/init.js +48 -7
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +6 -4
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +7 -4
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +7 -5
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +4 -5
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genEnumSelectBlock.js +5 -2
- package/out/templator/genEnumSelectBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +4 -3
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +18 -16
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +7 -7
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.d.ts +2 -2
- package/out/templator/genQueryComponent.js +4 -1
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genTableBlock.js +8 -12
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +4 -3
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.js +1 -1
- package/out/templator/utils.js.map +1 -1
- package/out/test/integration/node-nasl-server.js +10 -38
- package/out/test/integration/node-nasl-server.js.map +1 -1
- package/out/translator/index.d.ts +1 -0
- package/out/translator/index.js +1 -1
- package/out/translator/index.js.map +1 -1
- package/out/utils/index.d.ts +1 -0
- package/out/utils/index.js +38 -1
- package/out/utils/index.js.map +1 -1
- package/out/utils/string.d.ts +15 -2
- package/out/utils/string.js +18 -3
- package/out/utils/string.js.map +1 -1
- package/package.json +1 -1
- package/src/concepts/App__.ts +11 -36
- package/src/concepts/Frontend__.ts +8 -0
- package/src/concepts/ViewElement__.ts +7 -28
- package/src/concepts/View__.ts +1 -1
- package/src/generator/permission.ts +1 -1
- package/src/server/getLogics.ts +2 -2
- package/src/server/naslServer.ts +8 -8
- package/src/service/storage/init.ts +3 -4
package/out/concepts/App__.js
CHANGED
|
@@ -46,11 +46,9 @@ const Structure__1 = __importDefault(require("./Structure__"));
|
|
|
46
46
|
const Enum__1 = __importDefault(require("./Enum__"));
|
|
47
47
|
const Logic__1 = __importDefault(require("./Logic__"));
|
|
48
48
|
const Interface__1 = __importDefault(require("./Interface__"));
|
|
49
|
-
const
|
|
50
|
-
const Variable__1 = __importDefault(require("./Variable__"));
|
|
49
|
+
const Frontend__1 = __importDefault(require("./Frontend__"));
|
|
51
50
|
const Process__1 = __importDefault(require("./Process__"));
|
|
52
51
|
const Role__1 = __importDefault(require("./Role__"));
|
|
53
|
-
const Theme__1 = __importDefault(require("./Theme__"));
|
|
54
52
|
const Configuration__1 = __importDefault(require("./Configuration__"));
|
|
55
53
|
const Module__1 = __importDefault(require("./Module__"));
|
|
56
54
|
/**
|
|
@@ -89,18 +87,6 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
89
87
|
* 域名
|
|
90
88
|
*/
|
|
91
89
|
dnsAddr = undefined;
|
|
92
|
-
/**
|
|
93
|
-
* PC/H5 端
|
|
94
|
-
*/
|
|
95
|
-
scope = undefined;
|
|
96
|
-
/**
|
|
97
|
-
* 制品应用标题
|
|
98
|
-
*/
|
|
99
|
-
documentTitle = undefined;
|
|
100
|
-
/**
|
|
101
|
-
* 制品应用图标
|
|
102
|
-
*/
|
|
103
|
-
documentIcon = undefined;
|
|
104
90
|
/**
|
|
105
91
|
* 是否有用户中心
|
|
106
92
|
*/
|
|
@@ -130,13 +116,9 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
130
116
|
*/
|
|
131
117
|
interfaces = [];
|
|
132
118
|
/**
|
|
133
|
-
*
|
|
119
|
+
* 端列表
|
|
134
120
|
*/
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* 变量列表
|
|
138
|
-
*/
|
|
139
|
-
frontendVariables = [];
|
|
121
|
+
frontends = [];
|
|
140
122
|
/**
|
|
141
123
|
* 流程列表
|
|
142
124
|
*/
|
|
@@ -145,10 +127,6 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
145
127
|
* 角色列表
|
|
146
128
|
*/
|
|
147
129
|
roles = [];
|
|
148
|
-
/**
|
|
149
|
-
* 主题配置
|
|
150
|
-
*/
|
|
151
|
-
theme = new Theme__1.default();
|
|
152
130
|
/**
|
|
153
131
|
* 配置管理
|
|
154
132
|
*/
|
|
@@ -161,10 +139,6 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
161
139
|
* 接口应用列表(兼容老版)
|
|
162
140
|
*/
|
|
163
141
|
interfaceDependencies = [];
|
|
164
|
-
/**
|
|
165
|
-
* 扩展组件列表(兼容老版)
|
|
166
|
-
*/
|
|
167
|
-
componentDependencies = [];
|
|
168
142
|
/**
|
|
169
143
|
* @param source 需要合并的部分参数
|
|
170
144
|
*/
|
|
@@ -187,28 +161,6 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
187
161
|
}
|
|
188
162
|
return params;
|
|
189
163
|
}
|
|
190
|
-
/**
|
|
191
|
-
* 设置制品应用标题
|
|
192
|
-
*/
|
|
193
|
-
setDocumentTitle(documentTitle) {
|
|
194
|
-
const object = {
|
|
195
|
-
documentTitle,
|
|
196
|
-
};
|
|
197
|
-
this.update({
|
|
198
|
-
...object,
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* 设置制品应用图标
|
|
203
|
-
*/
|
|
204
|
-
setDocumentIcon(documentIcon) {
|
|
205
|
-
const object = {
|
|
206
|
-
documentIcon,
|
|
207
|
-
};
|
|
208
|
-
this.update({
|
|
209
|
-
...object,
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
164
|
getDataSourceUniqueName(name = 'dataSource1') {
|
|
213
165
|
return utils.unique(name, this.getDataSourceExistingNames(), undefined, true);
|
|
214
166
|
}
|
|
@@ -505,123 +457,63 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
505
457
|
});
|
|
506
458
|
return node;
|
|
507
459
|
}
|
|
508
|
-
|
|
509
|
-
const excludedSet = new Set(excludedList);
|
|
510
|
-
return (this.views || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
511
|
-
}
|
|
512
|
-
getViewUniqueName(name = 'view1') {
|
|
513
|
-
return utils.unique(name, this.getViewExistingNames(), undefined, true);
|
|
514
|
-
}
|
|
515
|
-
_insertViewAt(options, index) {
|
|
516
|
-
const viewOptions = {};
|
|
517
|
-
const relationOptions = { parentNode: this, parentKey: 'views' };
|
|
518
|
-
let view;
|
|
519
|
-
if (!options) {
|
|
520
|
-
view = View__1.default.from({
|
|
521
|
-
...viewOptions,
|
|
522
|
-
name: this.getViewUniqueName(),
|
|
523
|
-
}, this, 'views');
|
|
524
|
-
}
|
|
525
|
-
else if (typeof options === 'string') {
|
|
526
|
-
view = View__1.default.from({
|
|
527
|
-
...viewOptions,
|
|
528
|
-
name: options,
|
|
529
|
-
}, this, 'views');
|
|
530
|
-
}
|
|
531
|
-
else if (options instanceof View__1.default) {
|
|
532
|
-
options.ensureDelete(); // 同一实例不支持多处存在
|
|
533
|
-
view = options;
|
|
534
|
-
Object.assign(view, relationOptions);
|
|
535
|
-
}
|
|
536
|
-
else {
|
|
537
|
-
view = View__1.default.from({
|
|
538
|
-
...viewOptions,
|
|
539
|
-
...options,
|
|
540
|
-
}, this, 'views');
|
|
541
|
-
}
|
|
542
|
-
this.views.splice(index, 0, view);
|
|
543
|
-
return view;
|
|
544
|
-
}
|
|
545
|
-
insertViewAt(options, index) {
|
|
546
|
-
const node = this._insertViewAt(options, index);
|
|
547
|
-
node.create({
|
|
548
|
-
index,
|
|
549
|
-
parentNode: this,
|
|
550
|
-
parentKey: 'views',
|
|
551
|
-
});
|
|
552
|
-
return node;
|
|
553
|
-
}
|
|
554
|
-
_addView(options) {
|
|
555
|
-
const index = this.views.length;
|
|
556
|
-
return this._insertViewAt(options, index);
|
|
557
|
-
}
|
|
558
|
-
addView(options) {
|
|
559
|
-
const node = this._addView(options);
|
|
560
|
-
const index = this.views.indexOf(node);
|
|
561
|
-
node.create({
|
|
562
|
-
index,
|
|
563
|
-
parentNode: this,
|
|
564
|
-
parentKey: 'views',
|
|
565
|
-
});
|
|
566
|
-
return node;
|
|
567
|
-
}
|
|
568
|
-
getVarExistingNames(excludedList = []) {
|
|
460
|
+
getFrontendExistingNames(excludedList = []) {
|
|
569
461
|
const excludedSet = new Set(excludedList);
|
|
570
|
-
return (this.
|
|
462
|
+
return (this.frontends || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
571
463
|
}
|
|
572
|
-
|
|
573
|
-
return utils.unique(name, this.
|
|
464
|
+
getFrontendUniqueName(name = 'frontend1') {
|
|
465
|
+
return utils.unique(name, this.getFrontendExistingNames(), undefined, true);
|
|
574
466
|
}
|
|
575
|
-
|
|
576
|
-
const
|
|
577
|
-
const relationOptions = { parentNode: this, parentKey: '
|
|
578
|
-
let
|
|
467
|
+
_insertFrontendAt(options, index) {
|
|
468
|
+
const frontendOptions = {};
|
|
469
|
+
const relationOptions = { parentNode: this, parentKey: 'frontends' };
|
|
470
|
+
let frontend;
|
|
579
471
|
if (!options) {
|
|
580
|
-
|
|
581
|
-
...
|
|
582
|
-
name: this.
|
|
583
|
-
}, this, '
|
|
472
|
+
frontend = Frontend__1.default.from({
|
|
473
|
+
...frontendOptions,
|
|
474
|
+
name: this.getFrontendUniqueName(),
|
|
475
|
+
}, this, 'frontends');
|
|
584
476
|
}
|
|
585
477
|
else if (typeof options === 'string') {
|
|
586
|
-
|
|
587
|
-
...
|
|
478
|
+
frontend = Frontend__1.default.from({
|
|
479
|
+
...frontendOptions,
|
|
588
480
|
name: options,
|
|
589
|
-
}, this, '
|
|
481
|
+
}, this, 'frontends');
|
|
590
482
|
}
|
|
591
|
-
else if (options instanceof
|
|
483
|
+
else if (options instanceof Frontend__1.default) {
|
|
592
484
|
options.ensureDelete(); // 同一实例不支持多处存在
|
|
593
|
-
|
|
594
|
-
Object.assign(
|
|
485
|
+
frontend = options;
|
|
486
|
+
Object.assign(frontend, relationOptions);
|
|
595
487
|
}
|
|
596
488
|
else {
|
|
597
|
-
|
|
598
|
-
...
|
|
489
|
+
frontend = Frontend__1.default.from({
|
|
490
|
+
...frontendOptions,
|
|
599
491
|
...options,
|
|
600
|
-
}, this, '
|
|
492
|
+
}, this, 'frontends');
|
|
601
493
|
}
|
|
602
|
-
this.
|
|
603
|
-
return
|
|
494
|
+
this.frontends.splice(index, 0, frontend);
|
|
495
|
+
return frontend;
|
|
604
496
|
}
|
|
605
|
-
|
|
606
|
-
const node = this.
|
|
497
|
+
insertFrontendAt(options, index) {
|
|
498
|
+
const node = this._insertFrontendAt(options, index);
|
|
607
499
|
node.create({
|
|
608
500
|
index,
|
|
609
501
|
parentNode: this,
|
|
610
|
-
parentKey: '
|
|
502
|
+
parentKey: 'frontends',
|
|
611
503
|
});
|
|
612
504
|
return node;
|
|
613
505
|
}
|
|
614
|
-
|
|
615
|
-
const index = this.
|
|
616
|
-
return this.
|
|
506
|
+
_addFrontend(options) {
|
|
507
|
+
const index = this.frontends.length;
|
|
508
|
+
return this._insertFrontendAt(options, index);
|
|
617
509
|
}
|
|
618
|
-
|
|
619
|
-
const node = this.
|
|
620
|
-
const index = this.
|
|
510
|
+
addFrontend(options) {
|
|
511
|
+
const node = this._addFrontend(options);
|
|
512
|
+
const index = this.frontends.indexOf(node);
|
|
621
513
|
node.create({
|
|
622
514
|
index,
|
|
623
515
|
parentNode: this,
|
|
624
|
-
parentKey: '
|
|
516
|
+
parentKey: 'frontends',
|
|
625
517
|
});
|
|
626
518
|
return node;
|
|
627
519
|
}
|
|
@@ -858,59 +750,6 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
858
750
|
});
|
|
859
751
|
return node;
|
|
860
752
|
}
|
|
861
|
-
_insertModuleInComponentDependenciesAt(options, index) {
|
|
862
|
-
const moduleOptions = {};
|
|
863
|
-
const relationOptions = { parentNode: this, parentKey: 'componentDependencies' };
|
|
864
|
-
let module;
|
|
865
|
-
if (!options) {
|
|
866
|
-
module = Module__1.default.from({
|
|
867
|
-
...moduleOptions,
|
|
868
|
-
name: this.getModuleUniqueName(),
|
|
869
|
-
}, this, 'componentDependencies');
|
|
870
|
-
}
|
|
871
|
-
else if (typeof options === 'string') {
|
|
872
|
-
module = Module__1.default.from({
|
|
873
|
-
...moduleOptions,
|
|
874
|
-
name: options,
|
|
875
|
-
}, this, 'componentDependencies');
|
|
876
|
-
}
|
|
877
|
-
else if (options instanceof Module__1.default) {
|
|
878
|
-
options.ensureDelete(); // 同一实例不支持多处存在
|
|
879
|
-
module = options;
|
|
880
|
-
Object.assign(module, relationOptions);
|
|
881
|
-
}
|
|
882
|
-
else {
|
|
883
|
-
module = Module__1.default.from({
|
|
884
|
-
...moduleOptions,
|
|
885
|
-
...options,
|
|
886
|
-
}, this, 'componentDependencies');
|
|
887
|
-
}
|
|
888
|
-
this.componentDependencies.splice(index, 0, module);
|
|
889
|
-
return module;
|
|
890
|
-
}
|
|
891
|
-
insertModuleInComponentDependenciesAt(options, index) {
|
|
892
|
-
const node = this._insertModuleInComponentDependenciesAt(options, index);
|
|
893
|
-
node.create({
|
|
894
|
-
index,
|
|
895
|
-
parentNode: this,
|
|
896
|
-
parentKey: 'componentDependencies',
|
|
897
|
-
});
|
|
898
|
-
return node;
|
|
899
|
-
}
|
|
900
|
-
_addModuleInComponentDependencies(options) {
|
|
901
|
-
const index = this.componentDependencies.length;
|
|
902
|
-
return this._insertModuleInComponentDependenciesAt(options, index);
|
|
903
|
-
}
|
|
904
|
-
addModuleInComponentDependencies(options) {
|
|
905
|
-
const node = this._addModuleInComponentDependencies(options);
|
|
906
|
-
const index = this.componentDependencies.indexOf(node);
|
|
907
|
-
node.create({
|
|
908
|
-
index,
|
|
909
|
-
parentNode: this,
|
|
910
|
-
parentKey: 'componentDependencies',
|
|
911
|
-
});
|
|
912
|
-
return node;
|
|
913
|
-
}
|
|
914
753
|
removeDataSource(options) {
|
|
915
754
|
let dataSource;
|
|
916
755
|
if (typeof options === 'string') {
|
|
@@ -1091,72 +930,36 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
1091
930
|
}
|
|
1092
931
|
return params;
|
|
1093
932
|
}
|
|
1094
|
-
|
|
1095
|
-
let
|
|
1096
|
-
if (typeof options === 'string') {
|
|
1097
|
-
view = this.views.find((item) => item.name === options);
|
|
1098
|
-
if (!view) {
|
|
1099
|
-
throw new Error('找不到页面 ' + options);
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
else {
|
|
1103
|
-
view = options;
|
|
1104
|
-
}
|
|
1105
|
-
return view.delete();
|
|
1106
|
-
}
|
|
1107
|
-
__removeView(view) {
|
|
1108
|
-
const parentKey = view.parentKey;
|
|
1109
|
-
const params = {
|
|
1110
|
-
parentNode: this,
|
|
1111
|
-
parentKey,
|
|
1112
|
-
index: -1,
|
|
1113
|
-
object: null,
|
|
1114
|
-
oldObject: view,
|
|
1115
|
-
};
|
|
1116
|
-
if (parentKey) {
|
|
1117
|
-
params.parentKey = parentKey;
|
|
1118
|
-
if (Array.isArray(this[parentKey])) {
|
|
1119
|
-
const index = this[parentKey].indexOf(view);
|
|
1120
|
-
~index && this[parentKey].splice(index, 1);
|
|
1121
|
-
params.index = index;
|
|
1122
|
-
}
|
|
1123
|
-
else if (this[parentKey] === view) {
|
|
1124
|
-
params.index = 0;
|
|
1125
|
-
this[parentKey] = undefined;
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
return params;
|
|
1129
|
-
}
|
|
1130
|
-
removeVariable(options) {
|
|
1131
|
-
let variable;
|
|
933
|
+
removeFrontend(options) {
|
|
934
|
+
let frontend;
|
|
1132
935
|
if (typeof options === 'string') {
|
|
1133
|
-
|
|
1134
|
-
if (!
|
|
1135
|
-
throw new Error('
|
|
936
|
+
frontend = this.frontends.find((item) => item.name === options);
|
|
937
|
+
if (!frontend) {
|
|
938
|
+
throw new Error('找不到端 ' + options);
|
|
1136
939
|
}
|
|
1137
940
|
}
|
|
1138
941
|
else {
|
|
1139
|
-
|
|
942
|
+
frontend = options;
|
|
1140
943
|
}
|
|
1141
|
-
return
|
|
944
|
+
return frontend.delete();
|
|
1142
945
|
}
|
|
1143
|
-
|
|
1144
|
-
const parentKey =
|
|
946
|
+
__removeFrontend(frontend) {
|
|
947
|
+
const parentKey = frontend.parentKey;
|
|
1145
948
|
const params = {
|
|
1146
949
|
parentNode: this,
|
|
1147
950
|
parentKey,
|
|
1148
951
|
index: -1,
|
|
1149
952
|
object: null,
|
|
1150
|
-
oldObject:
|
|
953
|
+
oldObject: frontend,
|
|
1151
954
|
};
|
|
1152
955
|
if (parentKey) {
|
|
1153
956
|
params.parentKey = parentKey;
|
|
1154
957
|
if (Array.isArray(this[parentKey])) {
|
|
1155
|
-
const index = this[parentKey].indexOf(
|
|
958
|
+
const index = this[parentKey].indexOf(frontend);
|
|
1156
959
|
~index && this[parentKey].splice(index, 1);
|
|
1157
960
|
params.index = index;
|
|
1158
961
|
}
|
|
1159
|
-
else if (this[parentKey] ===
|
|
962
|
+
else if (this[parentKey] === frontend) {
|
|
1160
963
|
params.index = 0;
|
|
1161
964
|
this[parentKey] = undefined;
|
|
1162
965
|
}
|
|
@@ -1235,42 +1038,6 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
1235
1038
|
}
|
|
1236
1039
|
return params;
|
|
1237
1040
|
}
|
|
1238
|
-
removeTheme(options) {
|
|
1239
|
-
let theme;
|
|
1240
|
-
if (typeof options === 'string') {
|
|
1241
|
-
theme = this.theme;
|
|
1242
|
-
if (!theme) {
|
|
1243
|
-
throw new Error('找不到主题 ' + options);
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
else {
|
|
1247
|
-
theme = options;
|
|
1248
|
-
}
|
|
1249
|
-
return theme.delete();
|
|
1250
|
-
}
|
|
1251
|
-
__removeTheme(theme) {
|
|
1252
|
-
const parentKey = theme.parentKey;
|
|
1253
|
-
const params = {
|
|
1254
|
-
parentNode: this,
|
|
1255
|
-
parentKey,
|
|
1256
|
-
index: -1,
|
|
1257
|
-
object: null,
|
|
1258
|
-
oldObject: theme,
|
|
1259
|
-
};
|
|
1260
|
-
if (parentKey) {
|
|
1261
|
-
params.parentKey = parentKey;
|
|
1262
|
-
if (Array.isArray(this[parentKey])) {
|
|
1263
|
-
const index = this[parentKey].indexOf(theme);
|
|
1264
|
-
~index && this[parentKey].splice(index, 1);
|
|
1265
|
-
params.index = index;
|
|
1266
|
-
}
|
|
1267
|
-
else if (this[parentKey] === theme) {
|
|
1268
|
-
params.index = 0;
|
|
1269
|
-
this[parentKey] = undefined;
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
return params;
|
|
1273
|
-
}
|
|
1274
1041
|
removeConfiguration(options) {
|
|
1275
1042
|
let configuration;
|
|
1276
1043
|
if (typeof options === 'string') {
|
|
@@ -1333,19 +1100,6 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
1333
1100
|
}
|
|
1334
1101
|
return module.delete();
|
|
1335
1102
|
}
|
|
1336
|
-
removeModuleInComponentDependencies(options) {
|
|
1337
|
-
let module;
|
|
1338
|
-
if (typeof options === 'string') {
|
|
1339
|
-
module = this.componentDependencies.find((item) => item.name === options);
|
|
1340
|
-
if (!module) {
|
|
1341
|
-
throw new Error('找不到模块 ' + options);
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
else {
|
|
1345
|
-
module = options;
|
|
1346
|
-
}
|
|
1347
|
-
return module.delete();
|
|
1348
|
-
}
|
|
1349
1103
|
__removeModule(module) {
|
|
1350
1104
|
const parentKey = module.parentKey;
|
|
1351
1105
|
const params = {
|
|
@@ -1373,9 +1127,6 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
1373
1127
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
1374
1128
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
1375
1129
|
//================================================================================
|
|
1376
|
-
findComponentDependencyByName(name) {
|
|
1377
|
-
return this.componentDependencies.find((componentDependency) => componentDependency.name === name);
|
|
1378
|
-
}
|
|
1379
1130
|
findDataSourceByName(name) {
|
|
1380
1131
|
return this.dataSources.find((dataSourceItem) => dataSourceItem.name === name);
|
|
1381
1132
|
}
|
|
@@ -1427,6 +1178,10 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
1427
1178
|
* 从模板创建的模板 Id
|
|
1428
1179
|
*/
|
|
1429
1180
|
templateId = undefined;
|
|
1181
|
+
/**
|
|
1182
|
+
* 全局设置
|
|
1183
|
+
*/
|
|
1184
|
+
preferenceMap = {};
|
|
1430
1185
|
/**
|
|
1431
1186
|
* 获取命名空间
|
|
1432
1187
|
*/
|
|
@@ -1474,50 +1229,37 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
1474
1229
|
}
|
|
1475
1230
|
return node;
|
|
1476
1231
|
}
|
|
1477
|
-
/**
|
|
1478
|
-
* @param path 路径
|
|
1479
|
-
* path 为要查找路径:如 /dashboard/student/list、/dashboard/student/list
|
|
1480
|
-
*/
|
|
1481
|
-
findViewByPath(path) {
|
|
1482
|
-
const arr = path.split('/');
|
|
1483
|
-
if (arr[0] === '')
|
|
1484
|
-
arr.shift();
|
|
1485
|
-
if (!arr.length)
|
|
1486
|
-
throw Error('Cannot find View ' + path);
|
|
1487
|
-
const childName = arr.shift();
|
|
1488
|
-
const subView = this.views.find((child) => child.name === childName);
|
|
1489
|
-
return arr.length ? subView.findViewByPath(arr.join('/')) : subView;
|
|
1490
|
-
}
|
|
1491
|
-
findViewByName(name) {
|
|
1492
|
-
return utils.traverse((current) => {
|
|
1493
|
-
if (current.node.name === name)
|
|
1494
|
-
return current.node;
|
|
1495
|
-
}, { node: { name: '', children: this.views } });
|
|
1496
|
-
}
|
|
1497
1232
|
loadEnvList() {
|
|
1498
1233
|
this.envList = ['dev', 'online'];
|
|
1499
1234
|
}
|
|
1500
|
-
|
|
1501
|
-
packageInfo = null;
|
|
1502
|
-
loadPackageInfo() {
|
|
1235
|
+
loadPackageInfo(scope) {
|
|
1503
1236
|
const dependencyMap = window.globalData.ideVersionDetail.dependencies;
|
|
1504
|
-
|
|
1505
|
-
template: { name: '', version: '' },
|
|
1506
|
-
ui: { name: '', version: '' },
|
|
1237
|
+
const packageInfo = {
|
|
1238
|
+
template: { name: '', version: '', scope },
|
|
1239
|
+
ui: { name: '', version: '', scope },
|
|
1240
|
+
scope,
|
|
1507
1241
|
};
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1242
|
+
packageInfo.template.name = scope === 'h5' ? '@lcap/mobile-template' : 'lcap-pc-template';
|
|
1243
|
+
packageInfo.template.version = scope === 'h5' ? dependencyMap.FrontendArchH5.version : dependencyMap.FrontendArchPC.version;
|
|
1244
|
+
packageInfo.ui.name = scope === 'h5' ? '@lcap/mobile-ui' : 'cloud-ui.vusion';
|
|
1245
|
+
packageInfo.ui.version = scope === 'h5' ? dependencyMap.FrontendComponentLibraryH5.version : dependencyMap.FrontendComponentLibraryPC.version;
|
|
1246
|
+
return packageInfo;
|
|
1247
|
+
}
|
|
1248
|
+
packageInfos = [];
|
|
1249
|
+
loadPackageInfos() {
|
|
1250
|
+
const scopes = ['pc', 'h5'];
|
|
1251
|
+
scopes.forEach((scope) => {
|
|
1252
|
+
this.packageInfos.push(this.loadPackageInfo(scope));
|
|
1253
|
+
});
|
|
1512
1254
|
}
|
|
1513
1255
|
/**
|
|
1514
1256
|
* 根据 packageInfo 的信息生成用于 load 的 assetsInfo
|
|
1515
1257
|
* 在环境中需要 basic 和 custom 分开 load,否则容易报错
|
|
1516
1258
|
* @param prefix
|
|
1517
1259
|
*/
|
|
1518
|
-
genAllAssetsInfo(prefix) {
|
|
1519
|
-
const packageInfo = this.packageInfo;
|
|
1520
|
-
const
|
|
1260
|
+
genAllAssetsInfo(prefix, scope) {
|
|
1261
|
+
// const packageInfo = this.packageInfo;
|
|
1262
|
+
const packageInfo = this.packageInfos.find((info) => info.scope === scope);
|
|
1521
1263
|
const result = {
|
|
1522
1264
|
basic: {
|
|
1523
1265
|
js: [
|
|
@@ -1537,25 +1279,24 @@ let App = App_1 = class App extends BaseNode_1.default {
|
|
|
1537
1279
|
names: [],
|
|
1538
1280
|
},
|
|
1539
1281
|
};
|
|
1540
|
-
this.
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1282
|
+
const frontends = this.frontends.filter((frontend) => frontend.type === scope);
|
|
1283
|
+
const existingSet = new Set();
|
|
1284
|
+
frontends.forEach((frontend) => {
|
|
1285
|
+
frontend.componentDependencies.forEach((dep) => {
|
|
1286
|
+
const { name, version } = dep;
|
|
1287
|
+
const jsName = `${prefix}/packages/${name}@${version}/dist-theme/index.js`;
|
|
1288
|
+
if (!existingSet.has(jsName)) {
|
|
1289
|
+
existingSet.add(jsName);
|
|
1290
|
+
result.custom.js.push(jsName);
|
|
1291
|
+
if (utils.shouldLoadCss(name, version)) {
|
|
1292
|
+
result.custom.css.push(`${prefix}/packages/${name}@${version}/dist-theme/index.css`);
|
|
1293
|
+
}
|
|
1294
|
+
result.custom.names.push(name);
|
|
1295
|
+
}
|
|
1296
|
+
});
|
|
1547
1297
|
});
|
|
1548
1298
|
return result;
|
|
1549
1299
|
}
|
|
1550
|
-
genThemeCSS() {
|
|
1551
|
-
const keys = Object.keys(this.theme?.variableMap || {});
|
|
1552
|
-
if (!keys.length)
|
|
1553
|
-
return;
|
|
1554
|
-
return `:root {
|
|
1555
|
-
${keys.map((key) => ` ${key}: ${this.theme?.variableMap[key]};`).join('\n')}
|
|
1556
|
-
}
|
|
1557
|
-
`;
|
|
1558
|
-
}
|
|
1559
1300
|
onChange($event) {
|
|
1560
1301
|
this.emit('change', $event);
|
|
1561
1302
|
}
|
|
@@ -1594,7 +1335,7 @@ ${keys.map((key) => ` ${key}: ${this.theme?.variableMap[key]};`).join('\n')}
|
|
|
1594
1335
|
structureCount: this.structures.length,
|
|
1595
1336
|
enumCount: this.enums.length,
|
|
1596
1337
|
logicCount: this.logics.length,
|
|
1597
|
-
viewCount:
|
|
1338
|
+
viewCount: sum(this.frontends.map((frontend) => countView(frontend.views))),
|
|
1598
1339
|
processCount: this.processes.length,
|
|
1599
1340
|
};
|
|
1600
1341
|
}
|
|
@@ -1613,6 +1354,228 @@ ${keys.map((key) => ` ${key}: ${this.theme?.variableMap[key]};`).join('\n')}
|
|
|
1613
1354
|
const dataSources = this.dataSources.concat(dependDatasources);
|
|
1614
1355
|
return (dataSources || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1615
1356
|
}
|
|
1357
|
+
/**
|
|
1358
|
+
* 更新全局设置 preferenceMap
|
|
1359
|
+
*/
|
|
1360
|
+
updatePreferenceMap(preferences = {}) {
|
|
1361
|
+
this.emit('collect:start', { actionMsg: '修改实体表名列名' });
|
|
1362
|
+
const oldPreferenceMap = { ...this.preferenceMap };
|
|
1363
|
+
Object.assign(this.preferenceMap, preferences);
|
|
1364
|
+
// 更新实体表名和列名
|
|
1365
|
+
this.dataSources.forEach((ds) => {
|
|
1366
|
+
ds.entities.forEach((e) => {
|
|
1367
|
+
if (oldPreferenceMap['namingConvention.tableName'] !== preferences['namingConvention.tableName']) {
|
|
1368
|
+
e.formatTableName();
|
|
1369
|
+
}
|
|
1370
|
+
if (oldPreferenceMap['namingConvention.columnName'] !== preferences['namingConvention.columnName']) {
|
|
1371
|
+
e.formatPropertyColumnName();
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
});
|
|
1375
|
+
// 使撤销生效
|
|
1376
|
+
Object.assign(this.preferenceMap, oldPreferenceMap);
|
|
1377
|
+
this.update({
|
|
1378
|
+
preferenceMap: preferences,
|
|
1379
|
+
});
|
|
1380
|
+
this.emit('collect:end');
|
|
1381
|
+
}
|
|
1382
|
+
getSelectRef(newTypeAnnotation) {
|
|
1383
|
+
try {
|
|
1384
|
+
const { typeName, typeKind, typeNamespace, typeArguments } = newTypeAnnotation;
|
|
1385
|
+
let completionChildren;
|
|
1386
|
+
if (typeKind === 'reference') {
|
|
1387
|
+
if (typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.process' || typeNamespace === 'nasl.auth') {
|
|
1388
|
+
const node = (0, utils_1.getNaslNodeByNodeCallee)(typeNamespace, typeName);
|
|
1389
|
+
const properties = node?.properties || [];
|
|
1390
|
+
completionChildren = properties;
|
|
1391
|
+
}
|
|
1392
|
+
else if (typeNamespace.endsWith('.enums')) {
|
|
1393
|
+
completionChildren = [];
|
|
1394
|
+
}
|
|
1395
|
+
else {
|
|
1396
|
+
const node = (0, utils_1.getNodeByNodeCallee)(this, typeNamespace + '.' + typeName);
|
|
1397
|
+
const properties = node?.properties || [];
|
|
1398
|
+
completionChildren = properties;
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
else if (typeKind === 'generic') {
|
|
1402
|
+
const node = (0, utils_1.getNaslNodeByNodeCallee)(typeNamespace, typeName);
|
|
1403
|
+
const properties = (node?.properties && [...node?.properties]) || [];
|
|
1404
|
+
for (let i = 0; i < properties.length; i++) {
|
|
1405
|
+
const item = properties[i];
|
|
1406
|
+
if (item?.typeAnnotation?.typeKind === 'typeParam') {
|
|
1407
|
+
const newItem = BaseNode_1.default.from(item.toJSON());
|
|
1408
|
+
newItem.typeAnnotation = typeArguments[0];
|
|
1409
|
+
newItem.parentNode = this;
|
|
1410
|
+
properties[i] = newItem;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
completionChildren = properties;
|
|
1414
|
+
}
|
|
1415
|
+
else {
|
|
1416
|
+
completionChildren = [];
|
|
1417
|
+
}
|
|
1418
|
+
return completionChildren;
|
|
1419
|
+
}
|
|
1420
|
+
catch (err) {
|
|
1421
|
+
console.log(err);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
/* 判断接口是否有误,需要重新导出 */
|
|
1425
|
+
getQualifiedInterface(interfaces = this.interfaces) {
|
|
1426
|
+
const errorList = [];
|
|
1427
|
+
interfaces.forEach((item) => {
|
|
1428
|
+
const logic = this.logics.find((logic) => logic.name === item.originLogicName);
|
|
1429
|
+
const logicParamMap = {};
|
|
1430
|
+
logic.params.forEach((param) => {
|
|
1431
|
+
logicParamMap[param.name] = param.typeAnnotation;
|
|
1432
|
+
});
|
|
1433
|
+
item.params.forEach((param) => {
|
|
1434
|
+
const logicTypeAnnotation = logicParamMap[param.name]?.toJSON();
|
|
1435
|
+
delete logicParamMap[param.name];
|
|
1436
|
+
if (!logicTypeAnnotation) {
|
|
1437
|
+
return errorList.push({
|
|
1438
|
+
logicName: logic.name,
|
|
1439
|
+
interfaceName: item.name,
|
|
1440
|
+
param: param.name,
|
|
1441
|
+
type: 1,
|
|
1442
|
+
message: `参数“${param.name}”已被删除,请确定请求类型无误后点击“重新导出”为接口`,
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
const interfaceTypeAnnotation = param.typeAnnotation.toJSON();
|
|
1446
|
+
let isSame = false;
|
|
1447
|
+
if (logicTypeAnnotation?.typeNamespace === 'app.enums') {
|
|
1448
|
+
if (interfaceTypeAnnotation.typeNamespace === 'nasl.core' && interfaceTypeAnnotation.typeName === 'String') {
|
|
1449
|
+
isSame = true;
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
if (JSON.stringify(logicTypeAnnotation) === JSON.stringify(interfaceTypeAnnotation)) {
|
|
1453
|
+
isSame = true;
|
|
1454
|
+
}
|
|
1455
|
+
if (!isSame) {
|
|
1456
|
+
errorList.push({
|
|
1457
|
+
logicName: logic.name,
|
|
1458
|
+
interfaceName: item.name,
|
|
1459
|
+
param: param.name,
|
|
1460
|
+
type: 2,
|
|
1461
|
+
message: `参数“${param.name}”数据类型变更,请确定请求类型无误后点击“重新导出”为接口`,
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
});
|
|
1465
|
+
const logicReturns = logic.returns;
|
|
1466
|
+
const interfaceReturns = item.returns;
|
|
1467
|
+
if (logicReturns?.length > interfaceReturns?.length) {
|
|
1468
|
+
if (!logicReturns[0].typeAnnotation) {
|
|
1469
|
+
errorList.push({
|
|
1470
|
+
logicName: logic.name,
|
|
1471
|
+
interfaceName: item.name,
|
|
1472
|
+
resultName: logicReturns[0].name,
|
|
1473
|
+
type: 4,
|
|
1474
|
+
message: `输出参数发生变更,请点击“重新导出”`,
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
else {
|
|
1478
|
+
errorList.push({
|
|
1479
|
+
logicName: logic.name,
|
|
1480
|
+
interfaceName: item.name,
|
|
1481
|
+
resultName: logicReturns[0].name,
|
|
1482
|
+
type: 4,
|
|
1483
|
+
message: `输出参数发生变更,请点击“重新导出”`,
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
else if (logicReturns?.length < interfaceReturns?.length) {
|
|
1488
|
+
errorList.push({
|
|
1489
|
+
logicName: logic.name,
|
|
1490
|
+
interfaceName: item.name,
|
|
1491
|
+
resultName: interfaceReturns[0].name,
|
|
1492
|
+
type: 4,
|
|
1493
|
+
message: `输出参数发生变更,请点击“重新导出”`,
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
else if (logicReturns?.length === interfaceReturns?.length) {
|
|
1497
|
+
if (logicReturns.length !== 0) {
|
|
1498
|
+
if (logicReturns[0].name !== interfaceReturns[0].name) {
|
|
1499
|
+
errorList.push({
|
|
1500
|
+
logicName: logic.name,
|
|
1501
|
+
interfaceName: item.name,
|
|
1502
|
+
resultName: logicReturns[0].name,
|
|
1503
|
+
type: 4,
|
|
1504
|
+
message: `输出参数发生变更,请点击“重新导出”`,
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
else if (!logicReturns[0].typeAnnotation) {
|
|
1508
|
+
if (!logicReturns[0]?.__TypeAnnotation) {
|
|
1509
|
+
errorList.push({
|
|
1510
|
+
logicName: logic.name,
|
|
1511
|
+
interfaceName: item.name,
|
|
1512
|
+
resultName: logicReturns[0].name,
|
|
1513
|
+
type: 7,
|
|
1514
|
+
message: `输出参数“${logicReturns[0].name}”没有数据类型,无法导出`,
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
else if (JSON.stringify(logicReturns[0]?.__TypeAnnotation?.toJSON()) !== JSON.stringify(interfaceReturns[0]?.typeAnnotation?.toJSON())) {
|
|
1518
|
+
errorList.push({
|
|
1519
|
+
logicName: logic.name,
|
|
1520
|
+
interfaceName: item.name,
|
|
1521
|
+
resultName: logicReturns[0].name,
|
|
1522
|
+
type: 4,
|
|
1523
|
+
message: `输出参数发生变更,请点击“重新导出”`,
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
else if (JSON.stringify(logicReturns[0]?.typeAnnotation?.toJSON()) !== JSON.stringify(interfaceReturns[0]?.typeAnnotation?.toJSON())) {
|
|
1528
|
+
errorList.push({
|
|
1529
|
+
logicName: logic.name,
|
|
1530
|
+
interfaceName: item.name,
|
|
1531
|
+
resultName: logicReturns[0].name,
|
|
1532
|
+
type: 4,
|
|
1533
|
+
message: `输出参数发生变更,请点击“重新导出”`,
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
for (const i in logicParamMap) {
|
|
1539
|
+
errorList.push({
|
|
1540
|
+
logicName: logic.name,
|
|
1541
|
+
param: i,
|
|
1542
|
+
message: `新增参数“${i}”,请确定请求类型无误后点击“重新导出”为接口`,
|
|
1543
|
+
type: 3,
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
});
|
|
1547
|
+
return errorList;
|
|
1548
|
+
}
|
|
1549
|
+
addFrontendForType(options) {
|
|
1550
|
+
let insertIndex = -1;
|
|
1551
|
+
this.frontends.forEach((frontend, index) => {
|
|
1552
|
+
if (frontend.type === options.type) {
|
|
1553
|
+
insertIndex = index;
|
|
1554
|
+
}
|
|
1555
|
+
});
|
|
1556
|
+
if (options.type === 'h5' && insertIndex === -1) {
|
|
1557
|
+
insertIndex = this.frontends.length;
|
|
1558
|
+
}
|
|
1559
|
+
const node = this._insertFrontendAt(options, insertIndex + 1);
|
|
1560
|
+
const index = this.frontends.indexOf(node);
|
|
1561
|
+
node.create({
|
|
1562
|
+
index,
|
|
1563
|
+
parentNode: this,
|
|
1564
|
+
parentKey: 'frontends',
|
|
1565
|
+
});
|
|
1566
|
+
return node;
|
|
1567
|
+
}
|
|
1568
|
+
getFrontendExistingTitles(excludedList = []) {
|
|
1569
|
+
const excludedSet = new Set(excludedList);
|
|
1570
|
+
return (this.frontends || []).filter((item) => !excludedSet.has(item)).map((item) => item.title);
|
|
1571
|
+
}
|
|
1572
|
+
getExtensionsCallbackLogics() {
|
|
1573
|
+
let resultLogics = [];
|
|
1574
|
+
this.frontends.forEach((frontend) => {
|
|
1575
|
+
resultLogics = [...resultLogics, ...frontend.getExtensionsCallbackLogics()];
|
|
1576
|
+
});
|
|
1577
|
+
return Array.from(new Set(resultLogics));
|
|
1578
|
+
}
|
|
1616
1579
|
};
|
|
1617
1580
|
__decorate([
|
|
1618
1581
|
(0, decorators_1.property)()
|
|
@@ -1638,15 +1601,6 @@ __decorate([
|
|
|
1638
1601
|
__decorate([
|
|
1639
1602
|
(0, decorators_1.property)()
|
|
1640
1603
|
], App.prototype, "dnsAddr", void 0);
|
|
1641
|
-
__decorate([
|
|
1642
|
-
(0, decorators_1.property)()
|
|
1643
|
-
], App.prototype, "scope", void 0);
|
|
1644
|
-
__decorate([
|
|
1645
|
-
(0, decorators_1.property)()
|
|
1646
|
-
], App.prototype, "documentTitle", void 0);
|
|
1647
|
-
__decorate([
|
|
1648
|
-
(0, decorators_1.property)()
|
|
1649
|
-
], App.prototype, "documentIcon", void 0);
|
|
1650
1604
|
__decorate([
|
|
1651
1605
|
(0, decorators_1.property)()
|
|
1652
1606
|
], App.prototype, "hasUserCenter", void 0);
|
|
@@ -1669,20 +1623,14 @@ __decorate([
|
|
|
1669
1623
|
(0, decorators_1.property)('Interface')
|
|
1670
1624
|
], App.prototype, "interfaces", void 0);
|
|
1671
1625
|
__decorate([
|
|
1672
|
-
(0, decorators_1.property)('
|
|
1673
|
-
], App.prototype, "
|
|
1674
|
-
__decorate([
|
|
1675
|
-
(0, decorators_1.property)('Variable')
|
|
1676
|
-
], App.prototype, "frontendVariables", void 0);
|
|
1626
|
+
(0, decorators_1.property)('Frontend')
|
|
1627
|
+
], App.prototype, "frontends", void 0);
|
|
1677
1628
|
__decorate([
|
|
1678
1629
|
(0, decorators_1.property)('Process')
|
|
1679
1630
|
], App.prototype, "processes", void 0);
|
|
1680
1631
|
__decorate([
|
|
1681
1632
|
(0, decorators_1.property)('Role')
|
|
1682
1633
|
], App.prototype, "roles", void 0);
|
|
1683
|
-
__decorate([
|
|
1684
|
-
(0, decorators_1.property)('Theme')
|
|
1685
|
-
], App.prototype, "theme", void 0);
|
|
1686
1634
|
__decorate([
|
|
1687
1635
|
(0, decorators_1.property)('Configuration')
|
|
1688
1636
|
], App.prototype, "configuration", void 0);
|
|
@@ -1692,9 +1640,6 @@ __decorate([
|
|
|
1692
1640
|
__decorate([
|
|
1693
1641
|
(0, decorators_1.property)('Module')
|
|
1694
1642
|
], App.prototype, "interfaceDependencies", void 0);
|
|
1695
|
-
__decorate([
|
|
1696
|
-
(0, decorators_1.property)('Module')
|
|
1697
|
-
], App.prototype, "componentDependencies", void 0);
|
|
1698
1643
|
__decorate([
|
|
1699
1644
|
(0, decorators_1.excludedInJSON)()
|
|
1700
1645
|
], App.prototype, "officialType", void 0);
|
|
@@ -1722,6 +1667,9 @@ __decorate([
|
|
|
1722
1667
|
__decorate([
|
|
1723
1668
|
(0, decorators_1.excludedInJSON)()
|
|
1724
1669
|
], App.prototype, "templateId", void 0);
|
|
1670
|
+
__decorate([
|
|
1671
|
+
(0, decorators_1.property)()
|
|
1672
|
+
], App.prototype, "preferenceMap", void 0);
|
|
1725
1673
|
App = App_1 = __decorate([
|
|
1726
1674
|
(0, decorators_1.concept)('应用')
|
|
1727
1675
|
], App);
|