@lcap/nasl 2.22.1 → 2.22.2-beta.2

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.
Files changed (152) hide show
  1. package/out/breakpoint/generator/AfterStartNode.d.ts +7 -0
  2. package/out/breakpoint/generator/AfterStartNode.js +27 -0
  3. package/out/breakpoint/generator/AfterStartNode.js.map +1 -0
  4. package/out/breakpoint/generator/BeforeEndNode.d.ts +7 -0
  5. package/out/breakpoint/generator/BeforeEndNode.js +27 -0
  6. package/out/breakpoint/generator/BeforeEndNode.js.map +1 -0
  7. package/out/breakpoint/generator/BreakpointNode.d.ts +14 -0
  8. package/out/breakpoint/generator/BreakpointNode.js +200 -0
  9. package/out/breakpoint/generator/BreakpointNode.js.map +1 -0
  10. package/out/breakpoint/generator/index.d.ts +4 -0
  11. package/out/breakpoint/generator/index.js +98 -0
  12. package/out/breakpoint/generator/index.js.map +1 -0
  13. package/out/breakpoint/index.d.ts +3 -0
  14. package/out/breakpoint/index.js +20 -0
  15. package/out/breakpoint/index.js.map +1 -0
  16. package/out/breakpoint/shared/constants.d.ts +31 -0
  17. package/out/breakpoint/shared/constants.js +91 -0
  18. package/out/breakpoint/shared/constants.js.map +1 -0
  19. package/out/breakpoint/shared/index.d.ts +3 -0
  20. package/out/breakpoint/shared/index.js +33 -0
  21. package/out/breakpoint/shared/index.js.map +1 -0
  22. package/out/breakpoint/shared/operations.d.ts +10 -0
  23. package/out/breakpoint/shared/operations.js +25 -0
  24. package/out/breakpoint/shared/operations.js.map +1 -0
  25. package/out/breakpoint/shared/socket.d.ts +47 -0
  26. package/out/breakpoint/shared/socket.js +210 -0
  27. package/out/breakpoint/shared/socket.js.map +1 -0
  28. package/out/breakpoint/shared/utils.d.ts +23 -0
  29. package/out/breakpoint/shared/utils.js +165 -0
  30. package/out/breakpoint/shared/utils.js.map +1 -0
  31. package/out/breakpoint/store/core.d.ts +32 -0
  32. package/out/breakpoint/store/core.js +388 -0
  33. package/out/breakpoint/store/core.js.map +1 -0
  34. package/out/breakpoint/store/dock.d.ts +1 -0
  35. package/out/breakpoint/store/dock.js +127 -0
  36. package/out/breakpoint/store/dock.js.map +1 -0
  37. package/out/breakpoint/store/index.d.ts +2 -0
  38. package/out/breakpoint/store/index.js +19 -0
  39. package/out/breakpoint/store/index.js.map +1 -0
  40. package/out/common/Command.js +1 -1
  41. package/out/common/Command.js.map +1 -1
  42. package/out/common/asyncFuncMap.d.ts +2 -0
  43. package/out/common/asyncFuncMap.js +16 -0
  44. package/out/common/asyncFuncMap.js.map +1 -0
  45. package/out/concepts/AnonymousFunction__.js +11 -9
  46. package/out/concepts/AnonymousFunction__.js.map +1 -1
  47. package/out/concepts/AuthInterface__.d.ts +37 -0
  48. package/out/concepts/AuthInterface__.js +141 -0
  49. package/out/concepts/AuthInterface__.js.map +1 -0
  50. package/out/concepts/AuthLogicForCallInterface__.d.ts +138 -0
  51. package/out/concepts/AuthLogicForCallInterface__.js +493 -0
  52. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -0
  53. package/out/concepts/AuthLogic__.d.ts +66 -0
  54. package/out/concepts/AuthLogic__.js +206 -0
  55. package/out/concepts/AuthLogic__.js.map +1 -0
  56. package/out/concepts/BackendVariable__.d.ts +137 -0
  57. package/out/concepts/BackendVariable__.js +422 -0
  58. package/out/concepts/BackendVariable__.js.map +1 -0
  59. package/out/concepts/Backend__.d.ts +134 -0
  60. package/out/concepts/Backend__.js +274 -0
  61. package/out/concepts/Backend__.js.map +1 -0
  62. package/out/concepts/CallAuthInterface__.d.ts +126 -0
  63. package/out/concepts/CallAuthInterface__.js +408 -0
  64. package/out/concepts/CallAuthInterface__.js.map +1 -0
  65. package/out/concepts/CallConnector__.d.ts +42 -0
  66. package/out/concepts/CallConnector__.js +198 -0
  67. package/out/concepts/CallConnector__.js.map +1 -0
  68. package/out/concepts/ConnectorTrigger__.d.ts +78 -0
  69. package/out/concepts/ConnectorTrigger__.js +155 -0
  70. package/out/concepts/ConnectorTrigger__.js.map +1 -0
  71. package/out/concepts/Connector__.d.ts +464 -0
  72. package/out/concepts/Connector__.js +698 -0
  73. package/out/concepts/Connector__.js.map +1 -0
  74. package/out/concepts/Destination__.js +6 -4
  75. package/out/concepts/Destination__.js.map +1 -1
  76. package/out/concepts/FrontendVariable__.d.ts +21 -0
  77. package/out/concepts/FrontendVariable__.js +64 -0
  78. package/out/concepts/FrontendVariable__.js.map +1 -0
  79. package/out/concepts/Match__.js +25 -6
  80. package/out/concepts/Match__.js.map +1 -1
  81. package/out/concepts/MsgTriggerEvent__.d.ts +137 -0
  82. package/out/concepts/MsgTriggerEvent__.js +228 -0
  83. package/out/concepts/MsgTriggerEvent__.js.map +1 -0
  84. package/out/concepts/MsgTriggerLauncher__.d.ts +118 -0
  85. package/out/concepts/MsgTriggerLauncher__.js +204 -0
  86. package/out/concepts/MsgTriggerLauncher__.js.map +1 -0
  87. package/out/concepts/OverriddenLogic__.d.ts +643 -0
  88. package/out/concepts/OverriddenLogic__.js +1602 -0
  89. package/out/concepts/OverriddenLogic__.js.map +1 -0
  90. package/out/concepts/Param__.js +1 -1
  91. package/out/concepts/Param__.js.map +1 -1
  92. package/out/concepts/StringLiteral__.js +5 -1
  93. package/out/concepts/StringLiteral__.js.map +1 -1
  94. package/out/concepts/TriggerEvent__.d.ts +120 -0
  95. package/out/concepts/TriggerEvent__.js +222 -0
  96. package/out/concepts/TriggerEvent__.js.map +1 -0
  97. package/out/concepts/TriggerLauncher__.d.ts +88 -0
  98. package/out/concepts/TriggerLauncher__.js +235 -0
  99. package/out/concepts/TriggerLauncher__.js.map +1 -0
  100. package/out/concepts/basics/stdlib/nasl.http.d.ts +7 -0
  101. package/out/concepts/basics/stdlib/nasl.http.js +167 -0
  102. package/out/concepts/basics/stdlib/nasl.http.js.map +1 -0
  103. package/out/concepts/types__.d.ts +124 -0
  104. package/out/concepts/types__.js +3 -0
  105. package/out/concepts/types__.js.map +1 -0
  106. package/out/server/getConnector.d.ts +11 -0
  107. package/out/server/getConnector.js +42 -0
  108. package/out/server/getConnector.js.map +1 -0
  109. package/out/server/naslServer.js +55 -0
  110. package/out/server/naslServer.js.map +1 -1
  111. package/out/service/creator/errHandles.js +5 -0
  112. package/out/service/creator/errHandles.js.map +1 -1
  113. package/out/templator/genCreateBlock.js +2 -1
  114. package/out/templator/genCreateBlock.js.map +1 -1
  115. package/out/templator/genCurdEditMultipleKeyBlock.js +6 -3
  116. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  117. package/out/templator/genCurdMultipleKeyBlock.js +4 -2
  118. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  119. package/out/templator/genEditTableBlock.js +2 -1
  120. package/out/templator/genEditTableBlock.js.map +1 -1
  121. package/out/templator/genUpdateBlock.js +2 -1
  122. package/out/templator/genUpdateBlock.js.map +1 -1
  123. package/package.json +2 -2
  124. package/src/common/Command.ts +1 -1
  125. package/src/common/dist/Command.js +39 -0
  126. package/src/concepts/AnonymousFunction__.ts +13 -11
  127. package/src/concepts/Destination__.ts +7 -5
  128. package/src/concepts/Match__.ts +24 -6
  129. package/src/concepts/Param__.ts +1 -1
  130. package/src/concepts/StringLiteral__.ts +5 -1
  131. package/src/concepts/dist/App__.js +2204 -0
  132. package/src/concepts/dist/CallLogic__.js +1149 -0
  133. package/src/concepts/dist/Destination__.js +756 -0
  134. package/src/concepts/dist/Entity__.js +729 -0
  135. package/src/concepts/dist/Logic__.js +1612 -0
  136. package/src/concepts/dist/Match__.js +768 -0
  137. package/src/concepts/dist/MsgTriggerEvent__.js +245 -0
  138. package/src/concepts/dist/OqlQueryComponent__.js +377 -0
  139. package/src/concepts/dist/Param__.js +1 -1
  140. package/src/concepts/dist/StringLiteral__.js +158 -0
  141. package/src/generator/dist/genBundleFiles.js +15 -4
  142. package/src/generator/dist/genReleaseBody.js +501 -0
  143. package/src/server/dist/naslServer.js +76 -6
  144. package/src/server/naslServer.ts +54 -0
  145. package/src/service/creator/errHandles.js +8 -3
  146. package/src/service/storage/dist/init.js +34 -32
  147. package/src/templator/genCreateBlock.ts +2 -1
  148. package/src/templator/genCurdEditMultipleKeyBlock.ts +6 -3
  149. package/src/templator/genCurdMultipleKeyBlock.ts +4 -2
  150. package/src/templator/genEditTableBlock.ts +2 -1
  151. package/src/templator/genUpdateBlock.ts +2 -1
  152. package/test/examples/qzbusiness.json +1 -98265
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __assign = (this && this.__assign) || function () {
16
+ __assign = Object.assign || function(t) {
17
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
18
+ s = arguments[i];
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
+ t[p] = s[p];
21
+ }
22
+ return t;
23
+ };
24
+ return __assign.apply(this, arguments);
25
+ };
26
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
27
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
31
+ };
32
+ exports.__esModule = true;
33
+ exports.StringLiteral = void 0;
34
+ var translator_1 = require("../translator");
35
+ var decorators_1 = require("../decorators");
36
+ var classMap_1 = require("../common/classMap");
37
+ var LogicItem__1 = require("./LogicItem__");
38
+ /**
39
+ * 字符串字面量
40
+ */
41
+ var StringLiteral = /** @class */ (function (_super) {
42
+ __extends(StringLiteral, _super);
43
+ /**
44
+ * @param source 需要合并的部分参数
45
+ */
46
+ function StringLiteral(source) {
47
+ var _this = this;
48
+ source = Object.assign({}, StringLiteral_1.getDefaultOptions(), source);
49
+ _this = _super.call(this, source) || this;
50
+ /**
51
+ * 产品概念
52
+ */
53
+ _this.concept = 'StringLiteral';
54
+ /**
55
+ * 字面量的值
56
+ */
57
+ _this.value = '';
58
+ _super.prototype.subConstructor.call(_this, source);
59
+ return _this;
60
+ }
61
+ StringLiteral_1 = StringLiteral;
62
+ StringLiteral.prototype.getClassName = function () {
63
+ return 'StringLiteral';
64
+ };
65
+ StringLiteral.from = function (source, parentNode, parentKey) {
66
+ return _super.from.call(this, source, parentNode, parentKey);
67
+ };
68
+ //================================================================================
69
+ // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
70
+ // 自动生成的代码已结束。下面可以手动编写。
71
+ //================================================================================
72
+ StringLiteral.prototype.toVue = function (options) {
73
+ var code = '';
74
+ if (typeof this.value === 'string') {
75
+ code = "`" + this.value + "`";
76
+ if ((options === null || options === void 0 ? void 0 : options.finalCode) !== false) {
77
+ code = "`" + this.value.replace(/['"`\\]/g, function (m) {
78
+ var escape = '\\\\';
79
+ escape = '\\\\';
80
+ /// #if process.env.BUILD_TARGET === 'node'
81
+ escape = '\\';
82
+ /// #endif
83
+ if (m === '\\') {
84
+ return "" + escape + escape;
85
+ }
86
+ else {
87
+ return "" + escape + m;
88
+ }
89
+ }) + "`";
90
+ }
91
+ }
92
+ return code;
93
+ };
94
+ StringLiteral.prototype.toUI = function () {
95
+ var code = '';
96
+ if (typeof this.value === 'string') {
97
+ code = "`" + this.value + "`";
98
+ }
99
+ return code;
100
+ };
101
+ StringLiteral.prototype.toJS = function () {
102
+ var code = "";
103
+ if (typeof this.value === 'string') {
104
+ code += "`" + this.value.replace(/['"`\\]/g, function (m) { return "\\" + m; }) + "`";
105
+ }
106
+ return code;
107
+ };
108
+ StringLiteral.prototype.toBrief = function () {
109
+ return "`" + this.value + "`";
110
+ };
111
+ StringLiteral.prototype.toEmbeddedTS = function (state, isRequired) {
112
+ var code = '';
113
+ if (typeof this.value === 'string') {
114
+ code += "new nasl.core.String('StringLiteral')";
115
+ }
116
+ else {
117
+ code += isRequired ? '__IDENTIFIER__' : "''";
118
+ }
119
+ return code;
120
+ };
121
+ /**
122
+ * 设置字符串内容
123
+ */
124
+ StringLiteral.prototype.setValue = function (value) {
125
+ var object = {
126
+ value: value
127
+ };
128
+ this.update(__assign({}, object));
129
+ };
130
+ /**
131
+ * 获取添加时的默认选项
132
+ * @returns
133
+ */
134
+ StringLiteral.getDefaultOptions = function () {
135
+ return { value: '' };
136
+ };
137
+ var StringLiteral_1;
138
+ __decorate([
139
+ decorators_1.property()
140
+ ], StringLiteral.prototype, "concept");
141
+ __decorate([
142
+ decorators_1.property()
143
+ ], StringLiteral.prototype, "value");
144
+ __decorate([
145
+ translator_1.withSourceMap()
146
+ ], StringLiteral.prototype, "toEmbeddedTS");
147
+ StringLiteral = StringLiteral_1 = __decorate([
148
+ decorators_1.concept('字符串字面量')
149
+ ], StringLiteral);
150
+ return StringLiteral;
151
+ }(LogicItem__1["default"]));
152
+ exports.StringLiteral = StringLiteral;
153
+ classMap_1["default"].StringLiteral = StringLiteral;
154
+ exports["default"] = StringLiteral;
155
+ //================================================================================
156
+ // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
157
+ // 自动生成的代码已结束。下面可以手动编写。
158
+ //================================================================================
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
3
  exports.genFrontendBundleFiles = exports.genBundleFiles = void 0;
4
+ var breakpoint_1 = require("../breakpoint");
4
5
  var utils = require("../utils");
5
6
  var _1 = require(".");
6
7
  var compileComponent_1 = require("./compileComponent");
7
8
  var JSON5 = require("json5");
8
9
  var UglifyJS = require("uglify-js-export");
9
10
  var genMetaData_1 = require("./genMetaData");
11
+ var microApp_1 = require("./microApp");
10
12
  function genBundleFiles(app, frontend, config) {
11
13
  var _a, _b, _c, _d, _e;
12
14
  var fnNuimsDomain = ((_a = config === null || config === void 0 ? void 0 : config.envNuimsDomain) === null || _a === void 0 ? void 0 : _a[config === null || config === void 0 ? void 0 : config.env]) || (config === null || config === void 0 ? void 0 : config.nuimsDomain);
@@ -20,6 +22,7 @@ function genBundleFiles(app, frontend, config) {
20
22
  module.views && views.push.apply(views, module.views);
21
23
  });
22
24
  var componentMap = {};
25
+ (config === null || config === void 0 ? void 0 : config.debug) && breakpoint_1.genBreakpoints(app);
23
26
  utils.traverse(function (current) {
24
27
  if (current.node.toVueOptions)
25
28
  componentMap[current.node.id] = current.node.toVueOptions();
@@ -28,6 +31,7 @@ function genBundleFiles(app, frontend, config) {
28
31
  children: views
29
32
  }
30
33
  });
34
+ (config === null || config === void 0 ? void 0 : config.debug) && breakpoint_1.clearBreakpoints(app);
31
35
  /**
32
36
  * vue.config.js page options
33
37
  */
@@ -161,6 +165,7 @@ function genBundleFiles(app, frontend, config) {
161
165
  routesStr += ']';
162
166
  var platformConfig = JSON5.stringify({
163
167
  appConfig: {
168
+ id: app.id,
164
169
  project: app.name,
165
170
  domainName: app.name,
166
171
  nuimsDomain: fnNuimsDomain,
@@ -175,7 +180,7 @@ function genBundleFiles(app, frontend, config) {
175
180
  documentTitle: frontend.documentTitle,
176
181
  rootViewData: rootViewData,
177
182
  basePath: frontend.prefixPath,
178
- frontendName: frontend.name,
183
+ //frontendName: frontend.name,
179
184
  // 加上统一前缀
180
185
  sysPrefixPath: app.sysPrefixPath
181
186
  },
@@ -201,8 +206,11 @@ function genBundleFiles(app, frontend, config) {
201
206
  if (frontend.documentIcon) {
202
207
  content += "{\n const link = document.createElement('link');\n link.rel = 'shortcut icon';\n link.href = `" + frontend.documentIcon + "`;\n document.head.appendChild(link);\n }";
203
208
  }
209
+ if (frontend.globalScaleEnabled) {
210
+ content += "{\n const body = document.body;\n const rootElement = document.documentElement;\n\n function scalePage() {\n const windowWidth = window.innerWidth;\n const baseWidth = " + (frontend.canvasWidth || frontend.defaultCanvasWidth) + ";\n const scale = windowWidth / baseWidth;\n body.style.transform = `scale(${scale})`;\n body.style.transformOrigin = '0 0';\n body.style.width = baseWidth + 'px';\n rootElement.style.height = '100vh';\n rootElement.style.overflow = 'auto';\n rootElement.style.setProperty('--scrollbar-size', 0);\n }\n window.addEventListener('resize', scalePage);\n scalePage()\n }";
211
+ }
204
212
  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 }";
205
- 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 })();";
213
+ content += "\n var platformConfig = " + platformConfig + ";\n var metaData = " + metaDataStr + ";\n var routes = " + routesStr + ";\n\n window.createLcapApp = () => {\n appVM = window.cloudAdminDesigner.init(platformConfig.appConfig, platformConfig, routes, metaData);\n\n try {\n var push = appVM.$router.history.push;\n appVM.$router.history.push = function (a, b) {\n push.apply(this, [a, b, console.warn]);\n };\n } catch (e) { console.error(e) }\n\n return window.appVM = appVM;\n };\n window.createLcapApp();\n })();";
206
214
  if (config.env === 'dev') {
207
215
  // 加载资源js
208
216
  // const domain = fnLowcodeDomain.slice(fnLowcodeDomain.indexOf('.') + 1);
@@ -226,7 +234,11 @@ function genBundleFiles(app, frontend, config) {
226
234
  bundleMinPath = "" + baseUrl + frontend.basePath + "/bundle." + _1.genHash(content) + ".min.js";
227
235
  }
228
236
  var otherJsList = ((_e = (_d = frontend) === null || _d === void 0 ? void 0 : _d.appletsConfig) === null || _e === void 0 ? void 0 : _e.enable) ? ['//res.wx.qq.com/open/js/jweixin-1.3.2.js'] : [];
229
- 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";
237
+ var microAppIntegration = microApp_1.integrateMicroApp(frontend);
238
+ if (config === null || config === void 0 ? void 0 : config.debug) {
239
+ otherJsList.push(config.STATIC_URL + "/packages/@lcap/breakpoint-client@1.0.0/dist/index.js?time=" + Date.now());
240
+ }
241
+ var assetsContent = "(function() {\n const loadAssets = () => {\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\n " + (microAppIntegration || 'loadAssets();') + "\n})()\n";
230
242
  var minifyObj = { code: '' };
231
243
  // 开发环境加上sourceMap
232
244
  if (config.env === 'dev') {
@@ -250,7 +262,6 @@ function genBundleFiles(app, frontend, config) {
250
262
  content: assetsContent
251
263
  },
252
264
  ];
253
- console.log('outputs:', outputs);
254
265
  return outputs;
255
266
  }
256
267
  exports.genBundleFiles = genBundleFiles;