@lcap/nasl 2.20.0-beta.4 → 2.20.1-beta.1
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/2.14-components.d.ts +1115 -0
- package/out/automate/engine/2.14-components.js +1087 -0
- package/out/automate/engine/2.14-components.js.map +1 -0
- package/out/automate/engine/operators.d.ts +0 -9
- package/out/automate/engine/viewCache.d.ts +0 -1
- package/out/automate/template/myProcess.d.ts +0 -1
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/Command.d.ts +1 -1
- package/out/common/EventEmitter.d.ts +1 -1
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.js +13 -0
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.d.ts +9 -14
- package/out/concepts/Attribute__.js +12 -39
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +1 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.js +1 -1
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +13 -6
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +8 -6
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataElement__.js.map +1 -1
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.js +1 -1
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +1 -1
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +1 -1
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.js +1 -1
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.d.ts +212 -0
- package/out/concepts/FrontendLibrary__.js +349 -0
- package/out/concepts/FrontendLibrary__.js.map +1 -0
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js.map +1 -1
- 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/JSBlock__.js.map +1 -1
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js +26 -13
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +49 -49
- package/out/concepts/Module__.js +50 -50
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.js +3 -0
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Slot__.d.ts +16 -0
- package/out/concepts/Slot__.js +43 -0
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js +1 -1
- package/out/concepts/StringInterpolation__.js.map +1 -1
- 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/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +1 -1
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +3 -0
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewBlock__.d.ts +34 -0
- package/out/concepts/ViewBlock__.js +82 -0
- package/out/concepts/ViewBlock__.js.map +1 -0
- package/out/concepts/ViewComponent__.d.ts +85 -0
- package/out/concepts/ViewComponent__.js +104 -0
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +1 -0
- package/out/concepts/View__.js +13 -8
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/index__.d.ts +2 -0
- package/out/concepts/index__.js +2 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/config.d.ts +1 -1
- package/out/decorators/index.d.ts +2 -2
- package/out/generator/permission.d.ts +1 -1
- package/out/server/getLogics.js +12 -0
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getProcesses.d.ts +3 -3
- package/out/server/getScope.d.ts +1 -1
- package/out/server/naslServer.d.ts +1 -1
- package/out/server/naslServer.js +70 -36
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +1 -1
- package/out/service/storage/init.js +1 -1
- package/out/service/storage/init.js.map +1 -1
- package/out/translator/index.d.ts +1 -1
- package/out/translator/lsp.d.ts +3 -3
- package/out/utils/index.d.ts +4 -4
- package/package.json +1 -1
- package/src/concepts/App__.ts +13 -0
- package/src/concepts/Attribute__.ts +10 -59
- package/src/concepts/BindAttribute__.ts +11 -12
- package/src/concepts/BindDirective__.ts +16 -1
- package/src/concepts/BindStyle__.ts +16 -1
- package/src/concepts/CallLogic__.ts +12 -37
- package/src/concepts/ConfigProperty__.ts +8 -6
- package/src/concepts/Destination__.ts +19 -1
- package/src/concepts/ExternalDestination__.ts +6 -6
- package/src/concepts/FrontendLibrary__.ts +518 -0
- package/src/concepts/Frontend__.ts +12 -1
- package/src/concepts/Identifier__.ts +9 -0
- package/src/concepts/Logic__.ts +27 -14
- package/src/concepts/Module__.ts +92 -121
- package/src/concepts/Param__.ts +4 -0
- package/src/concepts/ProcessElement__.ts +23 -1
- package/src/concepts/Process__.ts +16 -1
- package/src/concepts/Return__.ts +2 -0
- package/src/concepts/Slot__.ts +55 -0
- package/src/concepts/StringInterpolation__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +1 -1
- package/src/concepts/ValidationRule__.ts +9 -9
- package/src/concepts/Variable__.ts +2 -0
- package/src/concepts/ViewBlock__.ts +91 -0
- package/src/concepts/ViewComponent__.ts +199 -0
- package/src/concepts/View__.ts +39 -10
- package/src/concepts/index__.ts +2 -0
- package/src/server/getLogics.ts +13 -0
- package/src/server/naslServer.ts +66 -34
- package/src/server/translator.ts +1 -1
- package/src/service/storage/init.ts +1 -1
- package/yarn-error.log +2087 -0
- package/sandbox/stdlib/dist/nasl.logging.js +0 -0
- package/sandbox/stdlib/dist/nasl.util.js +0 -0
- package/src/automate/engine/dist/index.dev.js +0 -517
- package/src/common/dist/BaseNode.js +0 -1101
- package/src/concepts/basics/stdlib/dist/nasl.util.js +0 -1602
- package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +0 -24
- package/src/concepts/dist/BindAttribute__.js +0 -795
- package/src/concepts/dist/BindEvent__.js +0 -732
- package/src/concepts/dist/CallFunction__.js +0 -527
- package/src/concepts/dist/CallLogic__.js +0 -932
- package/src/concepts/dist/Destination__.js +0 -708
- package/src/concepts/dist/ExternalDestination__.js +0 -298
- package/src/concepts/dist/Identifier__.js +0 -311
- package/src/concepts/dist/StringInterpolation__.js +0 -231
- package/src/concepts/dist/TypeAnnotation__.js +0 -834
- package/src/concepts/dist/ViewElement__.js +0 -1692
- package/src/concepts/dist/View__.js +0 -1601
- package/src/generator/dist/genBundleFiles.js +0 -261
- package/src/generator/dist/genMetaData.js +0 -245
- package/src/generator/dist/permission.js +0 -405
- package/src/service/storage/dist/init.js +0 -579
- package/src/templator/dist/genEditTableBlock.js +0 -204
- package/src/templator/dist/genGridViewBlock.js +0 -265
- package/src/templator/dist/genListViewBlock.js +0 -84
- package/src/templator/dist/genTableBlock.js +0 -209
- package/src/templator/dist/utils.js +0 -527
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.genBundleFiles = void 0;
|
|
4
|
-
var utils = require("../utils");
|
|
5
|
-
var _1 = require(".");
|
|
6
|
-
var compileComponent_1 = require("./compileComponent");
|
|
7
|
-
var JSON5 = require("json5");
|
|
8
|
-
var prettier = require("prettier");
|
|
9
|
-
// @ts-ignore:next-line
|
|
10
|
-
var parserBabel = require("prettier/parser-babel");
|
|
11
|
-
var UglifyJS = require("uglify-js-export");
|
|
12
|
-
var genMetaData_1 = require("./genMetaData");
|
|
13
|
-
function genBundleFiles(app, config) {
|
|
14
|
-
var _a;
|
|
15
|
-
var _b, _c, _d;
|
|
16
|
-
var fnNuimsDomain = ((_b = config === null || config === void 0 ? void 0 : config.envNuimsDomain) === null || _b === void 0 ? void 0 : _b[config === null || config === void 0 ? void 0 : config.env]) || (config === null || config === void 0 ? void 0 : config.nuimsDomain);
|
|
17
|
-
var fnLowcodeDomain = ((_d = (_c = config === null || config === void 0 ? void 0 : config.envLcpDomain) === null || _c === void 0 ? void 0 : _c[config === null || config === void 0 ? void 0 : config.env]) === null || _d === void 0 ? void 0 : _d.lcpDomain) || (config === null || config === void 0 ? void 0 : config.lowcodeDomain);
|
|
18
|
-
var modules = [];
|
|
19
|
-
var views = [];
|
|
20
|
-
app.dependencies && modules.push.apply(modules, app.dependencies);
|
|
21
|
-
app.interfaceDependencies && modules.push.apply(modules, app.interfaceDependencies);
|
|
22
|
-
app.views && views.push.apply(views, app.views);
|
|
23
|
-
modules.forEach(function (module) {
|
|
24
|
-
module.views && views.push.apply(views, module.views);
|
|
25
|
-
});
|
|
26
|
-
var componentMap = {};
|
|
27
|
-
utils.traverse(function (current) {
|
|
28
|
-
if (current.node.toVueOptions)
|
|
29
|
-
componentMap[current.node.id] = current.node.toVueOptions();
|
|
30
|
-
}, {
|
|
31
|
-
node: {
|
|
32
|
-
children: views
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
/**
|
|
36
|
-
* vue.config.js page options
|
|
37
|
-
*/
|
|
38
|
-
var routes = [];
|
|
39
|
-
// 开启了权限的页面
|
|
40
|
-
var authResourceViews = [];
|
|
41
|
-
var baseResourcePaths = [];
|
|
42
|
-
var rootViewData = [];
|
|
43
|
-
var defaultRoute = '';
|
|
44
|
-
// 遍历页面
|
|
45
|
-
var traverseViews = function (view, isParentViewAuth) {
|
|
46
|
-
var parentNode = view.parentNode || {};
|
|
47
|
-
var isRootView = parentNode.concept !== 'View';
|
|
48
|
-
var viewName = view.name;
|
|
49
|
-
// 页面是否需要权限,如果父页面需要权限,子页面也一定需要
|
|
50
|
-
var isViewAuth = isParentViewAuth || view.auth;
|
|
51
|
-
// 路由地址
|
|
52
|
-
var routePath = viewName;
|
|
53
|
-
if (isRootView) {
|
|
54
|
-
rootViewData.push({ name: viewName, title: view.title || viewName, isIndex: view.isIndex });
|
|
55
|
-
routePath = "/" + viewName;
|
|
56
|
-
if (!isViewAuth) {
|
|
57
|
-
if (viewName === 'notFound') {
|
|
58
|
-
defaultRoute = routePath;
|
|
59
|
-
}
|
|
60
|
-
if (view.isIndex) {
|
|
61
|
-
if (!defaultRoute) {
|
|
62
|
-
defaultRoute = routePath;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
var route = {
|
|
68
|
-
path: routePath,
|
|
69
|
-
component: compileComponent_1.compileComponent(componentMap[view.id]),
|
|
70
|
-
children: []
|
|
71
|
-
};
|
|
72
|
-
var viewChildren = view.children;
|
|
73
|
-
if (Array.isArray(viewChildren) && viewChildren.length) {
|
|
74
|
-
for (var i = 0; i < viewChildren.length; i++) {
|
|
75
|
-
var subView = viewChildren[i];
|
|
76
|
-
var subViewRoute = traverseViews(subView, isViewAuth).route;
|
|
77
|
-
route.children.push(subViewRoute);
|
|
78
|
-
if (subView.isIndex) {
|
|
79
|
-
route.children.push({
|
|
80
|
-
path: '',
|
|
81
|
-
redirect: "'" + subView.name + "'"
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
var viewPath = view.path;
|
|
87
|
-
if (isViewAuth) {
|
|
88
|
-
authResourceViews.push(view);
|
|
89
|
-
}
|
|
90
|
-
if (!isViewAuth) {
|
|
91
|
-
baseResourcePaths.push(viewPath);
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
route: route,
|
|
95
|
-
isViewAuth: isViewAuth
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
// 页面
|
|
99
|
-
views.forEach(function (view) {
|
|
100
|
-
var route = traverseViews(view).route;
|
|
101
|
-
routes.push(route);
|
|
102
|
-
if (view.isIndex) {
|
|
103
|
-
routes.push({
|
|
104
|
-
path: '/',
|
|
105
|
-
redirect: "'/" + view.name + "'"
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
var authResourcePathMap = {};
|
|
110
|
-
// 默认跳转子页面开启权限的情况,需要把父页面也都加入权限校验列表
|
|
111
|
-
if (Array.isArray(authResourceViews)) {
|
|
112
|
-
authResourceViews.forEach(function (authResourceView) {
|
|
113
|
-
if (authResourceView) {
|
|
114
|
-
authResourcePathMap[authResourceView.path] = true;
|
|
115
|
-
var viewNode = authResourceView;
|
|
116
|
-
while (viewNode.concept === 'View' && viewNode.isIndex) {
|
|
117
|
-
var parentViewNode = viewNode.parentNode;
|
|
118
|
-
if (parentViewNode.concept === 'View') {
|
|
119
|
-
authResourcePathMap[parentViewNode.path] = true;
|
|
120
|
-
}
|
|
121
|
-
else { // viewNode是根页面
|
|
122
|
-
authResourcePathMap['/'] = true;
|
|
123
|
-
}
|
|
124
|
-
viewNode = parentViewNode;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
var authResourcePaths = Object.keys(authResourcePathMap);
|
|
130
|
-
function routeToString(route) {
|
|
131
|
-
var _a, _b;
|
|
132
|
-
var content = "{\n path: '" + route.path + "',\n";
|
|
133
|
-
if ((_a = route === null || route === void 0 ? void 0 : route.component) === null || _a === void 0 ? void 0 : _a.script) {
|
|
134
|
-
var template = route.component.template;
|
|
135
|
-
if (config.env !== 'dev') {
|
|
136
|
-
template = template.replace(/[\t\r\n]/g, '');
|
|
137
|
-
}
|
|
138
|
-
content += "component: (function(){\n var componentOptions = " + (route.component.script ? '(function(){\n' + route.component.script.trim().replace(/export default |module\.exports +=/, 'return ') + '\n})()' : '{}') + ";\n Object.assign(componentOptions, {\n template: `" + template.replace(/[`$]/g, function (m) { return '\\' + m; }) + "`,\n });\n return componentOptions;\n })(),\n";
|
|
139
|
-
}
|
|
140
|
-
if ((_b = route === null || route === void 0 ? void 0 : route.children) === null || _b === void 0 ? void 0 : _b.length) {
|
|
141
|
-
content += "children: [\n " + route.children.map(routeToString).join(',\n') + "\n ],\n";
|
|
142
|
-
}
|
|
143
|
-
if (route === null || route === void 0 ? void 0 : route.redirect) {
|
|
144
|
-
content += "redirect: " + (route === null || route === void 0 ? void 0 : route.redirect) + ",\n";
|
|
145
|
-
}
|
|
146
|
-
content += '}';
|
|
147
|
-
return content;
|
|
148
|
-
}
|
|
149
|
-
var routesStr = '[';
|
|
150
|
-
routes.forEach(function (route) {
|
|
151
|
-
routesStr += routeToString(route) + ",\n";
|
|
152
|
-
});
|
|
153
|
-
if (defaultRoute) {
|
|
154
|
-
routesStr += "{\n path: '*',\n redirect: '" + defaultRoute + "',\n }\n";
|
|
155
|
-
}
|
|
156
|
-
routesStr += ']';
|
|
157
|
-
var platformConfig = JSON5.stringify({
|
|
158
|
-
appConfig: {
|
|
159
|
-
project: app.name,
|
|
160
|
-
domainName: app.name,
|
|
161
|
-
nuimsDomain: fnNuimsDomain,
|
|
162
|
-
envNuimsDomain: config.envNuimsDomain,
|
|
163
|
-
tenantType: config.tenantType,
|
|
164
|
-
tenantLevel: config.tenantLevel,
|
|
165
|
-
extendedConfig: config.extendedConfig,
|
|
166
|
-
envConfig: {
|
|
167
|
-
lowcodeDomain: fnLowcodeDomain
|
|
168
|
-
},
|
|
169
|
-
tenant: config.tenant,
|
|
170
|
-
documentTitle: app.documentTitle,
|
|
171
|
-
rootViewData: rootViewData
|
|
172
|
-
},
|
|
173
|
-
dnsAddr: app.dnsAddr,
|
|
174
|
-
devDnsAddr: config.devDnsAddr,
|
|
175
|
-
tenant: config.tenant,
|
|
176
|
-
env: config.env,
|
|
177
|
-
hasUserCenter: app.hasUserCenter,
|
|
178
|
-
hasAuth: app.hasAuth,
|
|
179
|
-
authResourcePaths: authResourcePaths,
|
|
180
|
-
baseResourcePaths: baseResourcePaths,
|
|
181
|
-
miniEnable: config.miniEnable
|
|
182
|
-
}, null, 4);
|
|
183
|
-
var metaData = genMetaData_1.genMetaData(app);
|
|
184
|
-
var metaDataStr = JSON5.stringify(metaData);
|
|
185
|
-
var assetsInfo = app.genAllAssetsInfo(config.STATIC_URL);
|
|
186
|
-
var customNames = JSON5.stringify(assetsInfo.custom.names);
|
|
187
|
-
var content = "(function(){\n ";
|
|
188
|
-
var themeCSS = app.genThemeCSS();
|
|
189
|
-
if (themeCSS) {
|
|
190
|
-
content += "{\n const el = document.createElement('style');\n el.id = 'theme';\n el.innerHTML = `" + themeCSS + "`;\n document.head.appendChild(el);\n }\n ";
|
|
191
|
-
}
|
|
192
|
-
if (app.documentIcon) {
|
|
193
|
-
content += "{\n const link = document.createElement('link');\n link.rel = 'shortcut icon';\n link.href = `" + app.documentIcon + "`;\n document.head.appendChild(link);\n }";
|
|
194
|
-
}
|
|
195
|
-
content += "\n var customNames = " + customNames + ";\n for(var i=0;i<customNames.length;i++){\n var name = window.kebab2Camel(customNames[i]);\n if(window[name]){\n window.CloudUI.install(window.Vue, window[name]);\n }\n }";
|
|
196
|
-
content += "\n var platformConfig = " + platformConfig + ";\n var metaData = " + metaDataStr + ";\n var routes = " + routesStr + ";\n\n window.createLcapApp = () => window.appVM = window.cloudAdminDesigner.init(platformConfig.appConfig, platformConfig, routes, metaData);\n window.createLcapApp();\n })();";
|
|
197
|
-
if (config.env === 'dev') {
|
|
198
|
-
// 加载资源js
|
|
199
|
-
// const domain = fnLowcodeDomain.slice(fnLowcodeDomain.indexOf('.') + 1);
|
|
200
|
-
// const targetUrl = `${typeof location !== 'undefined' ? location.origin : `http://${config.tenant}.${fnLowcodeDomain}`}/empty?url=${domain}&appid=${config.appid}`;
|
|
201
|
-
// if(!document.querySelector("iframe[name='iframeEmpty']")){
|
|
202
|
-
// var el = document.createElement('iframe');
|
|
203
|
-
// el.setAttribute('src', "${targetUrl}");
|
|
204
|
-
// el.setAttribute('name', 'iframeEmpty');
|
|
205
|
-
// el.setAttribute('width', 0);
|
|
206
|
-
// el.setAttribute('height', 0);
|
|
207
|
-
// el.style.borderWidth = 0
|
|
208
|
-
// el.style.display= "block"
|
|
209
|
-
// document.getElementsByTagName('body')[0].appendChild(el);
|
|
210
|
-
// document.domain = '${domain}'
|
|
211
|
-
var str = "\n var _div = document.createElement('div');\n _div.classList = \"div-load\"\n _div.innerHTML = \"<div class='loading-container'></div><div>\u6B63\u5728\u66F4\u65B0\u6700\u65B0\u53D1\u5E03\u5185\u5BB9...</div>\"\n document.getElementsByTagName('body')[0].appendChild(_div);\n window.showLoading = function(){\n document.querySelector(\".div-load\").style.display =\"flex\"\n }\n window.hideLoading = function(){\n document.querySelector(\".div-load\").style.display =\"none\"\n }\n var style = document.createElement('style');\n style.innerHTML=`.div-load{\n width: 208px;\n height: 40px;\n background: rgba(48, 48, 48, 0.8);\n box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.1);\n border-radius: 4px;\n position: fixed;\n top: 120px;\n left: 50%;\n margin-left: -104px;\n color: #FFFFFF;\n font-size: 14px;\n display: none;\n justify-content: center;\n align-items: center;\n }\n\n .loading-container{\n width: 12px;\n height: 12px;\n margin-right: 10px;\n animation: loading-animation 0.8s infinite linear;\n border: 2px solid #f3f3f3;\n border-top: 2px solid rgb(109, 108, 108);\n border-right: 2px solid rgb(109, 108, 108);\n border-bottom: 2px solid rgb(109, 108, 108);\n border-radius: 50%;\n }\n\n @keyframes loading-animation{\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }`\n document.getElementsByTagName('body')[0].appendChild(style);\n window.addEventListener('message', function (e) {\n console.log('message:',e)\n if(e.data ===\"release-start\"){\n showLoading()\n }\n if(e.data===\"release-end\"){\n hideLoading()\n window.location.reload();\n }\n })\n ";
|
|
212
|
-
content += str;
|
|
213
|
-
}
|
|
214
|
-
var bundlePath = config.USER_STATIC_URL + "/" + config.tenant + "/" + app.id + "/" + config.env + "/bundle." + _1.genHash(content) + ".js";
|
|
215
|
-
var bundleSourceMapPath = bundlePath + ".map";
|
|
216
|
-
var bundleMinPath = config.USER_STATIC_URL + "/" + config.tenant + "/" + app.id + "/" + config.env + "/bundle." + _1.genHash(content) + ".min.js";
|
|
217
|
-
var otherJsList = config.miniEnable ? ['//res.wx.qq.com/open/js/jweixin-1.3.2.js'] : [];
|
|
218
|
-
var assetsContent = "(function() {\n LazyLoad.js(" + JSON5.stringify(assetsInfo.basic.js.concat(assetsInfo.custom.js, otherJsList).concat([bundleMinPath])) + ");\n LazyLoad.css(" + JSON5.stringify(assetsInfo.basic.css.concat(assetsInfo.custom.css)) + ");\n})()\n";
|
|
219
|
-
var minifyObj;
|
|
220
|
-
// 开发环境加上sourceMap
|
|
221
|
-
if (config.env === 'dev') {
|
|
222
|
-
content = prettier.format(content, {
|
|
223
|
-
parser: 'babel',
|
|
224
|
-
plugins: [parserBabel],
|
|
225
|
-
tabWidth: 4
|
|
226
|
-
});
|
|
227
|
-
minifyObj = UglifyJS.minify((_a = {},
|
|
228
|
-
_a[bundlePath] = content,
|
|
229
|
-
_a), {
|
|
230
|
-
sourceMap: {
|
|
231
|
-
url: bundleSourceMapPath
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
minifyObj = UglifyJS.minify(content);
|
|
237
|
-
}
|
|
238
|
-
var outputs = [
|
|
239
|
-
{
|
|
240
|
-
name: bundleMinPath,
|
|
241
|
-
content: minifyObj.code
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
name: config.USER_STATIC_URL + "/" + config.tenant + "/" + app.id + "/" + config.env + "/client.js",
|
|
245
|
-
content: assetsContent
|
|
246
|
-
},
|
|
247
|
-
];
|
|
248
|
-
// 开发环境加上sourceMap
|
|
249
|
-
if (config.env === 'dev') {
|
|
250
|
-
// map和源文件
|
|
251
|
-
outputs.push({
|
|
252
|
-
name: bundlePath,
|
|
253
|
-
content: content
|
|
254
|
-
}, {
|
|
255
|
-
name: bundleSourceMapPath,
|
|
256
|
-
content: minifyObj.map
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
return outputs;
|
|
260
|
-
}
|
|
261
|
-
exports.genBundleFiles = genBundleFiles;
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.genMetaData = void 0;
|
|
4
|
-
var concepts_1 = require("../concepts");
|
|
5
|
-
var utils = require("../utils");
|
|
6
|
-
// 生成typeKey
|
|
7
|
-
function genSortedTypeKey(typeAnnotation) {
|
|
8
|
-
var _a = typeAnnotation || {}, typeKind = _a.typeKind, typeNamespace = _a.typeNamespace, typeName = _a.typeName, typeArguments = _a.typeArguments, properties = _a.properties;
|
|
9
|
-
var typeKeyArr = [];
|
|
10
|
-
if (typeKind === 'union') { // 联合类型
|
|
11
|
-
if (Array.isArray(typeArguments)) {
|
|
12
|
-
// 按返回的每个具体项排序
|
|
13
|
-
var childTypeArgs = typeArguments.map(function (typeArg) { return genSortedTypeKey(typeArg); }).sort(function (name1, name2) { return name1 > name2 ? 1 : -1; });
|
|
14
|
-
typeKeyArr.push(childTypeArgs.join(' | '));
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
else if (typeKind === 'anonymousStructure') { // 匿名数据结构
|
|
18
|
-
typeKeyArr.push('{');
|
|
19
|
-
if (Array.isArray(properties)) {
|
|
20
|
-
// 按匿名数据结构的key排序
|
|
21
|
-
var childTypeArgs = properties.sort(function (_a, _b) {
|
|
22
|
-
var name1 = _a.name;
|
|
23
|
-
var name2 = _b.name;
|
|
24
|
-
return name1 > name2 ? 1 : -1;
|
|
25
|
-
}).map(function (typeArg) {
|
|
26
|
-
var _a = typeArg || {}, typeArgName = _a.name, typeArgTypeAnnotation = _a.typeAnnotation;
|
|
27
|
-
return typeArgName + ": " + genSortedTypeKey(typeArgTypeAnnotation);
|
|
28
|
-
});
|
|
29
|
-
typeKeyArr.push(childTypeArgs.join(', '));
|
|
30
|
-
}
|
|
31
|
-
typeKeyArr.push('}');
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
var typeArr = [];
|
|
35
|
-
typeNamespace && typeArr.push(typeNamespace);
|
|
36
|
-
typeName && typeArr.push(typeName);
|
|
37
|
-
var typeKey = typeArr.join('.');
|
|
38
|
-
typeKey && typeKeyArr.push(typeKey);
|
|
39
|
-
if (typeKind === 'generic') {
|
|
40
|
-
typeKeyArr.push('<');
|
|
41
|
-
if (Array.isArray(typeArguments)) {
|
|
42
|
-
// 必须按typeArguments定义的顺序,否则实参位置不对
|
|
43
|
-
var childTypeArgs = typeArguments.map(function (typeArg) { return genSortedTypeKey(typeArg); });
|
|
44
|
-
typeKeyArr.push(childTypeArgs.join(', '));
|
|
45
|
-
}
|
|
46
|
-
typeKeyArr.push('>');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return typeKeyArr.join('');
|
|
50
|
-
}
|
|
51
|
-
function genMetaData(app) {
|
|
52
|
-
var modules = [];
|
|
53
|
-
var views = [];
|
|
54
|
-
var entities = [];
|
|
55
|
-
var structures = [];
|
|
56
|
-
var enums = [];
|
|
57
|
-
var logics = [];
|
|
58
|
-
var interfaces = [];
|
|
59
|
-
var processes = [];
|
|
60
|
-
app.views && views.push.apply(views, app.views);
|
|
61
|
-
if (Array.isArray(app.dataSources)) {
|
|
62
|
-
app.dataSources.forEach(function (dataSource) {
|
|
63
|
-
if (Array.isArray(dataSource.entities)) {
|
|
64
|
-
entities.push.apply(entities, dataSource.entities);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
app.structures && structures.push.apply(structures, app.structures);
|
|
69
|
-
app.enums && enums.push.apply(enums, app.enums);
|
|
70
|
-
app.logics && logics.push.apply(logics, app.logics);
|
|
71
|
-
app.processes && processes.push.apply(processes, app.processes);
|
|
72
|
-
app.dependencies && modules.push.apply(modules, app.dependencies);
|
|
73
|
-
app.interfaceDependencies && modules.push.apply(modules, app.interfaceDependencies);
|
|
74
|
-
modules.forEach(function (module) {
|
|
75
|
-
module.views && views.push.apply(views, module.views);
|
|
76
|
-
module.structures && structures.push.apply(structures, module.structures);
|
|
77
|
-
module.enums && enums.push.apply(enums, module.enums);
|
|
78
|
-
module.logics && logics.push.apply(logics, module.logics);
|
|
79
|
-
module.interfaces && interfaces.push.apply(interfaces, module.interfaces);
|
|
80
|
-
if (Array.isArray(module.dataSources)) {
|
|
81
|
-
module.dataSources.forEach(function (dataSource) {
|
|
82
|
-
if (Array.isArray(dataSource.entities)) {
|
|
83
|
-
entities.push.apply(entities, dataSource.entities);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
var dataTypes = [];
|
|
89
|
-
var dataTypesMap = {};
|
|
90
|
-
var frontendVariables = app.frontendVariables;
|
|
91
|
-
var enumsMap = {};
|
|
92
|
-
var logicsMap = {};
|
|
93
|
-
var _custom = {};
|
|
94
|
-
var allLogics = [];
|
|
95
|
-
if (Array.isArray(enums)) {
|
|
96
|
-
dataTypes.push.apply(dataTypes, enums);
|
|
97
|
-
enums.forEach(function (node) {
|
|
98
|
-
var _a = node || {}, name = _a.name, enumItems = _a.enumItems;
|
|
99
|
-
if (node.module) {
|
|
100
|
-
name = "extensions." + node.module.name + ".enums." + name;
|
|
101
|
-
}
|
|
102
|
-
var enumObj = {};
|
|
103
|
-
enumItems.forEach(function (_a) {
|
|
104
|
-
var label = _a.label, value = _a.value;
|
|
105
|
-
enumObj[value] = label;
|
|
106
|
-
});
|
|
107
|
-
enumsMap[name] = enumObj;
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
if (Array.isArray(entities)) {
|
|
111
|
-
dataTypes.push.apply(dataTypes, entities);
|
|
112
|
-
entities.forEach(function (entity) {
|
|
113
|
-
var ns = entity.ns;
|
|
114
|
-
if (Array.isArray(ns === null || ns === void 0 ? void 0 : ns.logics)) {
|
|
115
|
-
allLogics.push.apply(allLogics, ns.logics);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
if (Array.isArray(structures)) {
|
|
120
|
-
dataTypes.push.apply(dataTypes, structures);
|
|
121
|
-
}
|
|
122
|
-
dataTypes.forEach(function (node) {
|
|
123
|
-
var _a;
|
|
124
|
-
var namespace = node.getNamespace();
|
|
125
|
-
var id = namespace + "." + node.name;
|
|
126
|
-
dataTypesMap[id] = (_a = node.toJSON) === null || _a === void 0 ? void 0 : _a.call(node);
|
|
127
|
-
var properties = (node).properties;
|
|
128
|
-
if (Array.isArray(properties)) {
|
|
129
|
-
properties.forEach(function (property) {
|
|
130
|
-
collectTypeAnnotation(property === null || property === void 0 ? void 0 : property.typeAnnotation);
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
[
|
|
135
|
-
{
|
|
136
|
-
namespace: 'nasl.ui',
|
|
137
|
-
list: concepts_1.uiStructures
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
namespace: 'nasl.collection',
|
|
141
|
-
list: concepts_1.collectionStructures
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
namespace: 'nasl.interface',
|
|
145
|
-
list: concepts_1.interfaceStructures
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
namespace: 'nasl.process',
|
|
149
|
-
list: concepts_1.processStructures
|
|
150
|
-
},
|
|
151
|
-
].forEach(function (item) {
|
|
152
|
-
var _a = item || {}, namespace = _a.namespace, list = _a.list;
|
|
153
|
-
if (Array.isArray(list)) {
|
|
154
|
-
list.forEach(function (node) {
|
|
155
|
-
var _a;
|
|
156
|
-
var id = namespace + "." + node.name;
|
|
157
|
-
dataTypesMap[id] = (_a = node.toJSON) === null || _a === void 0 ? void 0 : _a.call(node);
|
|
158
|
-
var properties = (node).properties;
|
|
159
|
-
if (Array.isArray(properties)) {
|
|
160
|
-
properties.forEach(function (property) {
|
|
161
|
-
collectTypeAnnotation(property === null || property === void 0 ? void 0 : property.typeAnnotation);
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
if (Array.isArray(logics)) {
|
|
168
|
-
allLogics.push.apply(allLogics, logics);
|
|
169
|
-
}
|
|
170
|
-
allLogics.forEach(function (node) {
|
|
171
|
-
var namespace = node.getNamespace();
|
|
172
|
-
var id = namespace ? namespace + "." + node.name : node.name;
|
|
173
|
-
logicsMap[id] = node.toService();
|
|
174
|
-
});
|
|
175
|
-
processes.forEach(function (process) {
|
|
176
|
-
if (Array.isArray(process.logics)) {
|
|
177
|
-
process.logics.forEach(function (node) {
|
|
178
|
-
var namespace = node.getNamespace();
|
|
179
|
-
var id = namespace ? namespace + "." + node.name : node.name;
|
|
180
|
-
logicsMap[id] = node.toProcessService();
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
interfaces.forEach(function (interfaceItem) {
|
|
185
|
-
_custom[interfaceItem.getNamespace() + "." + interfaceItem.name] = interfaceItem.toService();
|
|
186
|
-
});
|
|
187
|
-
utils.traverse(function (current) {
|
|
188
|
-
var node = (current || {}).node;
|
|
189
|
-
var typeAnnotation = (node === null || node === void 0 ? void 0 : node.typeAnnotation) || (node === null || node === void 0 ? void 0 : node.__TypeAnnotation);
|
|
190
|
-
collectTypeAnnotation(typeAnnotation);
|
|
191
|
-
}, {
|
|
192
|
-
node: {
|
|
193
|
-
children: views
|
|
194
|
-
}
|
|
195
|
-
}, {
|
|
196
|
-
mode: 'anyObject',
|
|
197
|
-
excludedKeySet: new Set([
|
|
198
|
-
'parentNode',
|
|
199
|
-
'sourceMap',
|
|
200
|
-
'storageJSON',
|
|
201
|
-
'tsErrorDetail',
|
|
202
|
-
'NaslAnnotatedJSON',
|
|
203
|
-
'calledFrom',
|
|
204
|
-
'_events',
|
|
205
|
-
'_collectingList',
|
|
206
|
-
'_historyList',
|
|
207
|
-
])
|
|
208
|
-
});
|
|
209
|
-
if (Array.isArray(frontendVariables)) {
|
|
210
|
-
frontendVariables.forEach(function (frontendVariable) {
|
|
211
|
-
var typeAnnotation = frontendVariable.typeAnnotation || frontendVariable.__TypeAnnotation;
|
|
212
|
-
collectTypeAnnotation(typeAnnotation);
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
function collectTypeAnnotation(typeAnnotation) {
|
|
216
|
-
var _a, _b;
|
|
217
|
-
if (typeAnnotation) {
|
|
218
|
-
var sortedTypeKey = genSortedTypeKey(typeAnnotation);
|
|
219
|
-
if (!dataTypesMap[sortedTypeKey]) {
|
|
220
|
-
dataTypesMap[sortedTypeKey] = (_b = (_a = typeAnnotation === null || typeAnnotation === void 0 ? void 0 : typeAnnotation.toJSON) === null || _a === void 0 ? void 0 : _a.call(typeAnnotation)) !== null && _b !== void 0 ? _b : typeAnnotation;
|
|
221
|
-
var _c = (dataTypesMap[sortedTypeKey] || {}), properties = _c.properties, typeArguments = _c.typeArguments;
|
|
222
|
-
if (Array.isArray(properties)) {
|
|
223
|
-
properties.forEach(function (property) {
|
|
224
|
-
collectTypeAnnotation(property === null || property === void 0 ? void 0 : property.typeAnnotation);
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
if (Array.isArray(typeArguments)) {
|
|
228
|
-
typeArguments.forEach(function (typeArg) {
|
|
229
|
-
collectTypeAnnotation(typeArg);
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
return {
|
|
236
|
-
frontendVariables: frontendVariables,
|
|
237
|
-
dataTypesMap: dataTypesMap,
|
|
238
|
-
enumsMap: enumsMap,
|
|
239
|
-
logicsMap: logicsMap,
|
|
240
|
-
servicesMap: {
|
|
241
|
-
_custom: _custom
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
exports.genMetaData = genMetaData;
|