@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.
Files changed (217) hide show
  1. package/out/automate/engine/2.14-components.d.ts +1115 -0
  2. package/out/automate/engine/2.14-components.js +1087 -0
  3. package/out/automate/engine/2.14-components.js.map +1 -0
  4. package/out/automate/engine/operators.d.ts +0 -9
  5. package/out/automate/engine/viewCache.d.ts +0 -1
  6. package/out/automate/template/myProcess.d.ts +0 -1
  7. package/out/common/BaseNode.js.map +1 -1
  8. package/out/common/Command.d.ts +1 -1
  9. package/out/common/EventEmitter.d.ts +1 -1
  10. package/out/concepts/Anchor__.js.map +1 -1
  11. package/out/concepts/AnonymousFunction__.js.map +1 -1
  12. package/out/concepts/App__.js +13 -0
  13. package/out/concepts/App__.js.map +1 -1
  14. package/out/concepts/Argument__.js.map +1 -1
  15. package/out/concepts/Assignee__.js.map +1 -1
  16. package/out/concepts/AssignmentLine__.js.map +1 -1
  17. package/out/concepts/Assignment__.js.map +1 -1
  18. package/out/concepts/Attribute__.d.ts +9 -14
  19. package/out/concepts/Attribute__.js +12 -39
  20. package/out/concepts/Attribute__.js.map +1 -1
  21. package/out/concepts/BatchAssignment__.js.map +1 -1
  22. package/out/concepts/BinaryExpression__.js.map +1 -1
  23. package/out/concepts/BindAttribute__.js.map +1 -1
  24. package/out/concepts/BindDirective__.js +1 -1
  25. package/out/concepts/BindDirective__.js.map +1 -1
  26. package/out/concepts/BindEvent__.js.map +1 -1
  27. package/out/concepts/BindStyle__.js +1 -1
  28. package/out/concepts/BindStyle__.js.map +1 -1
  29. package/out/concepts/BooleanLiteral__.js.map +1 -1
  30. package/out/concepts/CallFunction__.js.map +1 -1
  31. package/out/concepts/CallInterface__.js.map +1 -1
  32. package/out/concepts/CallLogic__.js +13 -6
  33. package/out/concepts/CallLogic__.js.map +1 -1
  34. package/out/concepts/CallQueryComponent__.js.map +1 -1
  35. package/out/concepts/Comment__.js.map +1 -1
  36. package/out/concepts/CompletionProperty__.js.map +1 -1
  37. package/out/concepts/ConfigGroup__.js.map +1 -1
  38. package/out/concepts/ConfigPropertyValue__.js.map +1 -1
  39. package/out/concepts/ConfigProperty__.js +8 -6
  40. package/out/concepts/ConfigProperty__.js.map +1 -1
  41. package/out/concepts/Configuration__.js.map +1 -1
  42. package/out/concepts/Constant__.js.map +1 -1
  43. package/out/concepts/DataElement__.js.map +1 -1
  44. package/out/concepts/DataSource__.js.map +1 -1
  45. package/out/concepts/Destination__.js +1 -1
  46. package/out/concepts/Destination__.js.map +1 -1
  47. package/out/concepts/End__.js.map +1 -1
  48. package/out/concepts/EntityIndex__.d.ts +1 -1
  49. package/out/concepts/EntityIndex__.js.map +1 -1
  50. package/out/concepts/EntityProperty__.d.ts +1 -1
  51. package/out/concepts/EntityProperty__.js.map +1 -1
  52. package/out/concepts/Entity__.js.map +1 -1
  53. package/out/concepts/EnumItem__.js.map +1 -1
  54. package/out/concepts/Enum__.js.map +1 -1
  55. package/out/concepts/Event__.js.map +1 -1
  56. package/out/concepts/ExternalDestination__.js +1 -1
  57. package/out/concepts/ExternalDestination__.js.map +1 -1
  58. package/out/concepts/ForEachStatement__.js.map +1 -1
  59. package/out/concepts/FrontendLibrary__.d.ts +212 -0
  60. package/out/concepts/FrontendLibrary__.js +349 -0
  61. package/out/concepts/FrontendLibrary__.js.map +1 -0
  62. package/out/concepts/Frontend__.js.map +1 -1
  63. package/out/concepts/Function__.js.map +1 -1
  64. package/out/concepts/Identifier__.js.map +1 -1
  65. package/out/concepts/IfStatement__.js.map +1 -1
  66. package/out/concepts/InterfaceParam__.js.map +1 -1
  67. package/out/concepts/Interface__.js.map +1 -1
  68. package/out/concepts/JSBlock__.js.map +1 -1
  69. package/out/concepts/LogicItem__.js.map +1 -1
  70. package/out/concepts/Logic__.js +26 -13
  71. package/out/concepts/Logic__.js.map +1 -1
  72. package/out/concepts/MatchCase__.js.map +1 -1
  73. package/out/concepts/Match__.js.map +1 -1
  74. package/out/concepts/MemberExpression__.js.map +1 -1
  75. package/out/concepts/Module__.d.ts +49 -49
  76. package/out/concepts/Module__.js +50 -50
  77. package/out/concepts/Module__.js.map +1 -1
  78. package/out/concepts/Namespace__.js.map +1 -1
  79. package/out/concepts/NewComposite__.js.map +1 -1
  80. package/out/concepts/NewList__.js.map +1 -1
  81. package/out/concepts/NewMap__.js.map +1 -1
  82. package/out/concepts/New__.js.map +1 -1
  83. package/out/concepts/NullLiteral__.js.map +1 -1
  84. package/out/concepts/NumericLiteral__.js.map +1 -1
  85. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  86. package/out/concepts/Param__.js.map +1 -1
  87. package/out/concepts/Point__.js.map +1 -1
  88. package/out/concepts/ProcessComponent__.js.map +1 -1
  89. package/out/concepts/ProcessElement__.js.map +1 -1
  90. package/out/concepts/ProcessOutcome__.js.map +1 -1
  91. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  92. package/out/concepts/Process__.js.map +1 -1
  93. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  94. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  95. package/out/concepts/QueryFromExpression__.js.map +1 -1
  96. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  97. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  98. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  99. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  100. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  101. package/out/concepts/Rect__.js.map +1 -1
  102. package/out/concepts/Return__.js +3 -0
  103. package/out/concepts/Return__.js.map +1 -1
  104. package/out/concepts/Role__.js.map +1 -1
  105. package/out/concepts/SelectMembers__.js.map +1 -1
  106. package/out/concepts/Slot__.d.ts +16 -0
  107. package/out/concepts/Slot__.js +43 -0
  108. package/out/concepts/Slot__.js.map +1 -1
  109. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  110. package/out/concepts/Start__.js.map +1 -1
  111. package/out/concepts/StringInterpolation__.js +1 -1
  112. package/out/concepts/StringInterpolation__.js.map +1 -1
  113. package/out/concepts/StringLiteral__.js.map +1 -1
  114. package/out/concepts/StructureProperty__.js.map +1 -1
  115. package/out/concepts/Structure__.js.map +1 -1
  116. package/out/concepts/SwitchCase__.js.map +1 -1
  117. package/out/concepts/SwitchStatement__.js.map +1 -1
  118. package/out/concepts/Theme__.js.map +1 -1
  119. package/out/concepts/Transactional__.js.map +1 -1
  120. package/out/concepts/TypeAnnotation__.js +1 -1
  121. package/out/concepts/TypeAnnotation__.js.map +1 -1
  122. package/out/concepts/TypeParam__.js.map +1 -1
  123. package/out/concepts/UnaryExpression__.js.map +1 -1
  124. package/out/concepts/Unparsed__.js.map +1 -1
  125. package/out/concepts/UseComponent__.js.map +1 -1
  126. package/out/concepts/ValidationRule__.js.map +1 -1
  127. package/out/concepts/Variable__.js +3 -0
  128. package/out/concepts/Variable__.js.map +1 -1
  129. package/out/concepts/ViewBlock__.d.ts +34 -0
  130. package/out/concepts/ViewBlock__.js +82 -0
  131. package/out/concepts/ViewBlock__.js.map +1 -0
  132. package/out/concepts/ViewComponent__.d.ts +85 -0
  133. package/out/concepts/ViewComponent__.js +104 -0
  134. package/out/concepts/ViewComponent__.js.map +1 -1
  135. package/out/concepts/ViewElement__.js.map +1 -1
  136. package/out/concepts/View__.d.ts +1 -0
  137. package/out/concepts/View__.js +13 -8
  138. package/out/concepts/View__.js.map +1 -1
  139. package/out/concepts/WhileStatement__.js.map +1 -1
  140. package/out/concepts/index__.d.ts +2 -0
  141. package/out/concepts/index__.js +2 -0
  142. package/out/concepts/index__.js.map +1 -1
  143. package/out/config.d.ts +1 -1
  144. package/out/decorators/index.d.ts +2 -2
  145. package/out/generator/permission.d.ts +1 -1
  146. package/out/server/getLogics.js +12 -0
  147. package/out/server/getLogics.js.map +1 -1
  148. package/out/server/getProcesses.d.ts +3 -3
  149. package/out/server/getScope.d.ts +1 -1
  150. package/out/server/naslServer.d.ts +1 -1
  151. package/out/server/naslServer.js +70 -36
  152. package/out/server/naslServer.js.map +1 -1
  153. package/out/server/translator.js +1 -1
  154. package/out/service/storage/init.js +1 -1
  155. package/out/service/storage/init.js.map +1 -1
  156. package/out/translator/index.d.ts +1 -1
  157. package/out/translator/lsp.d.ts +3 -3
  158. package/out/utils/index.d.ts +4 -4
  159. package/package.json +1 -1
  160. package/src/concepts/App__.ts +13 -0
  161. package/src/concepts/Attribute__.ts +10 -59
  162. package/src/concepts/BindAttribute__.ts +11 -12
  163. package/src/concepts/BindDirective__.ts +16 -1
  164. package/src/concepts/BindStyle__.ts +16 -1
  165. package/src/concepts/CallLogic__.ts +12 -37
  166. package/src/concepts/ConfigProperty__.ts +8 -6
  167. package/src/concepts/Destination__.ts +19 -1
  168. package/src/concepts/ExternalDestination__.ts +6 -6
  169. package/src/concepts/FrontendLibrary__.ts +518 -0
  170. package/src/concepts/Frontend__.ts +12 -1
  171. package/src/concepts/Identifier__.ts +9 -0
  172. package/src/concepts/Logic__.ts +27 -14
  173. package/src/concepts/Module__.ts +92 -121
  174. package/src/concepts/Param__.ts +4 -0
  175. package/src/concepts/ProcessElement__.ts +23 -1
  176. package/src/concepts/Process__.ts +16 -1
  177. package/src/concepts/Return__.ts +2 -0
  178. package/src/concepts/Slot__.ts +55 -0
  179. package/src/concepts/StringInterpolation__.ts +1 -1
  180. package/src/concepts/TypeAnnotation__.ts +1 -1
  181. package/src/concepts/ValidationRule__.ts +9 -9
  182. package/src/concepts/Variable__.ts +2 -0
  183. package/src/concepts/ViewBlock__.ts +91 -0
  184. package/src/concepts/ViewComponent__.ts +199 -0
  185. package/src/concepts/View__.ts +39 -10
  186. package/src/concepts/index__.ts +2 -0
  187. package/src/server/getLogics.ts +13 -0
  188. package/src/server/naslServer.ts +66 -34
  189. package/src/server/translator.ts +1 -1
  190. package/src/service/storage/init.ts +1 -1
  191. package/yarn-error.log +2087 -0
  192. package/sandbox/stdlib/dist/nasl.logging.js +0 -0
  193. package/sandbox/stdlib/dist/nasl.util.js +0 -0
  194. package/src/automate/engine/dist/index.dev.js +0 -517
  195. package/src/common/dist/BaseNode.js +0 -1101
  196. package/src/concepts/basics/stdlib/dist/nasl.util.js +0 -1602
  197. package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +0 -24
  198. package/src/concepts/dist/BindAttribute__.js +0 -795
  199. package/src/concepts/dist/BindEvent__.js +0 -732
  200. package/src/concepts/dist/CallFunction__.js +0 -527
  201. package/src/concepts/dist/CallLogic__.js +0 -932
  202. package/src/concepts/dist/Destination__.js +0 -708
  203. package/src/concepts/dist/ExternalDestination__.js +0 -298
  204. package/src/concepts/dist/Identifier__.js +0 -311
  205. package/src/concepts/dist/StringInterpolation__.js +0 -231
  206. package/src/concepts/dist/TypeAnnotation__.js +0 -834
  207. package/src/concepts/dist/ViewElement__.js +0 -1692
  208. package/src/concepts/dist/View__.js +0 -1601
  209. package/src/generator/dist/genBundleFiles.js +0 -261
  210. package/src/generator/dist/genMetaData.js +0 -245
  211. package/src/generator/dist/permission.js +0 -405
  212. package/src/service/storage/dist/init.js +0 -579
  213. package/src/templator/dist/genEditTableBlock.js +0 -204
  214. package/src/templator/dist/genGridViewBlock.js +0 -265
  215. package/src/templator/dist/genListViewBlock.js +0 -84
  216. package/src/templator/dist/genTableBlock.js +0 -209
  217. package/src/templator/dist/utils.js +0 -527
@@ -1,298 +0,0 @@
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.ExternalDestination = void 0;
34
- var translator_1 = require("../translator");
35
- var __1 = require("..");
36
- var decorators_1 = require("../decorators");
37
- var classMap_1 = require("../common/classMap");
38
- var LogicItem__1 = require("./LogicItem__");
39
- /**
40
- * 外部链接
41
- */
42
- var ExternalDestination = /** @class */ (function (_super) {
43
- __extends(ExternalDestination, _super);
44
- /**
45
- * @param source 需要合并的部分参数
46
- */
47
- function ExternalDestination(source) {
48
- var _this = this;
49
- source = Object.assign({}, ExternalDestination_1.getDefaultOptions(), source);
50
- _this = _super.call(this, source) || this;
51
- /**
52
- * 产品概念
53
- */
54
- _this.concept = 'ExternalDestination';
55
- /**
56
- * 外部链接
57
- */
58
- _this.link = undefined;
59
- /**
60
- * target
61
- */
62
- _this.target = '_self';
63
- /**
64
- * 锚点参数
65
- */
66
- _this.anchor = undefined;
67
- _super.prototype.subConstructor.call(_this, source);
68
- return _this;
69
- }
70
- ExternalDestination_1 = ExternalDestination;
71
- ExternalDestination.from = function (source, parentNode, parentKey) {
72
- return _super.from.call(this, source, parentNode, parentKey);
73
- };
74
- /**
75
- * 设置外部链接
76
- */
77
- ExternalDestination.prototype.setLink = function (link) {
78
- link._delete();
79
- var relationOptions = { parentNode: this, parentKey: 'link' };
80
- Object.assign(link, relationOptions);
81
- var object = {
82
- link: link
83
- };
84
- this.update(__assign({}, object));
85
- };
86
- /**
87
- * 设置target
88
- */
89
- ExternalDestination.prototype.setTarget = function (target) {
90
- var object = {
91
- target: target
92
- };
93
- this.update(__assign({}, object));
94
- };
95
- /**
96
- * 设置锚点参数
97
- */
98
- ExternalDestination.prototype.setAnchor = function (anchor) {
99
- anchor._delete();
100
- var relationOptions = { parentNode: this, parentKey: 'anchor' };
101
- Object.assign(anchor, relationOptions);
102
- var object = {
103
- anchor: anchor
104
- };
105
- this.update(__assign({}, object));
106
- };
107
- ExternalDestination.prototype.removeLink = function (options) {
108
- var link;
109
- if (typeof options === 'string') {
110
- link = this.link;
111
- if (!link) {
112
- throw new Error('找不到逻辑项 ' + options);
113
- }
114
- }
115
- else {
116
- link = options;
117
- }
118
- return link["delete"]();
119
- };
120
- ExternalDestination.prototype.removeAnchor = function (options) {
121
- var anchor;
122
- if (typeof options === 'string') {
123
- anchor = this.anchor;
124
- if (!anchor) {
125
- throw new Error('找不到锚点参数 ' + options);
126
- }
127
- }
128
- else {
129
- anchor = options;
130
- }
131
- return anchor["delete"]();
132
- };
133
- ExternalDestination.prototype.__removeLogicItem = function (logicItem) {
134
- var parentKey = logicItem.parentKey;
135
- var params = {
136
- parentNode: this,
137
- parentKey: parentKey,
138
- index: -1,
139
- object: null,
140
- oldObject: logicItem
141
- };
142
- if (parentKey) {
143
- params.parentKey = parentKey;
144
- if (Array.isArray(this[parentKey])) {
145
- var index = this[parentKey].indexOf(logicItem);
146
- ~index && this[parentKey].splice(index, 1);
147
- params.index = index;
148
- }
149
- else if (this[parentKey] === logicItem) {
150
- params.index = 0;
151
- this[parentKey] = undefined;
152
- }
153
- }
154
- return params;
155
- };
156
- //================================================================================
157
- // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
158
- // 自动生成的代码已结束。下面可以手动编写。
159
- //================================================================================
160
- ExternalDestination.prototype.toEmbeddedTS = function (state, isHaveKeyWord) {
161
- var _a;
162
- var code = '';
163
- if (this.link) {
164
- code += (this.link).toEmbeddedTS(translator_1.shiftState(state, code)) + ';';
165
- }
166
- else {
167
- code += '__IDENTIFIER__;';
168
- }
169
- // code += this.anchor?.expression?.toEmbeddedTS(shiftState(state, code)) + ';' || '';
170
- code += ((_a = this.anchor) === null || _a === void 0 ? void 0 : _a.toEmbeddedTS(translator_1.shiftState(state, code), true)) || '';
171
- return code;
172
- };
173
- ExternalDestination.prototype.toInViewMethod = function () {
174
- var code = '';
175
- var tempLink = this.link ? this.link.toJS() : '';
176
- code += "const link = " + tempLink + ";\n let anchor = '';\n ";
177
- if (this.anchor) {
178
- var anchor = this.anchor.toJS();
179
- if (anchor)
180
- code += "anchor = " + anchor + ";";
181
- }
182
- code += 'return `${link}#${anchor}`';
183
- return "await (async () => {\n try {\n " + code + "\n } catch(err) {\n console.log(err);\n }\n })();";
184
- };
185
- ExternalDestination.prototype.toVue = function (options) {
186
- var url = '`';
187
- var tempLink = this.link ? this.link.toVue(options) : '';
188
- url += '${';
189
- url += "" + tempLink;
190
- url += '}';
191
- if (this.anchor) {
192
- var anchor = this.anchor.toVue();
193
- if (anchor)
194
- url += "#${" + anchor + "}";
195
- }
196
- url += '`';
197
- return url;
198
- };
199
- ExternalDestination.prototype.toUI = function (state) {
200
- var code = '';
201
- if (this.link) {
202
- code += this.link.toUI(translator_1.shiftState(state, code));
203
- }
204
- else {
205
- code += '';
206
- }
207
- if (this.anchor) {
208
- var anchor = this.anchor.toUI();
209
- if (anchor)
210
- code += "#${" + anchor + "}";
211
- }
212
- return code;
213
- };
214
- ExternalDestination.prototype.toJS = function (state) {
215
- var url = '';
216
- if (this.link) {
217
- url += 'this.$link(`${';
218
- url += "" + this.link.toJS();
219
- url += '}';
220
- if (this.anchor) {
221
- var anchor = this.anchor.toJS(translator_1.shiftState(state, url));
222
- if (anchor)
223
- url += "#${" + anchor + "}";
224
- }
225
- url += '`,"';
226
- url += "" + this.target;
227
- url += '")';
228
- }
229
- return url;
230
- };
231
- ExternalDestination.prototype.toBrief = function () {
232
- if (!this.anchor.expression)
233
- return '';
234
- return this.anchor.toBrief();
235
- };
236
- ExternalDestination.getDefaultOptions = function () {
237
- return {
238
- anchor: {
239
- concept: 'Anchor'
240
- }
241
- };
242
- };
243
- ExternalDestination.prototype.changeParentTarget = function () {
244
- var _a, _b;
245
- var target = this.target;
246
- if (this.parentNode instanceof __1.BindAttribute) {
247
- var grandParent = (_a = this.parentNode) === null || _a === void 0 ? void 0 : _a.parentNode;
248
- if (grandParent instanceof __1.ViewElement) {
249
- var targetNode = (_b = grandParent === null || grandParent === void 0 ? void 0 : grandParent.bindAttrs) === null || _b === void 0 ? void 0 : _b.find(function (x) { return x.name === 'target'; });
250
- if (targetNode) {
251
- targetNode.setValue(target);
252
- }
253
- }
254
- }
255
- };
256
- ExternalDestination.prototype.inheritTargetFromGrandPa = function () {
257
- var _a, _b;
258
- if (this.parentNode instanceof __1.BindAttribute) {
259
- var grandParent = (_a = this.parentNode) === null || _a === void 0 ? void 0 : _a.parentNode;
260
- if (grandParent instanceof __1.ViewElement) {
261
- var targetNode = (_b = grandParent === null || grandParent === void 0 ? void 0 : grandParent.bindAttrs) === null || _b === void 0 ? void 0 : _b.find(function (x) { return x.name === 'target'; });
262
- if (targetNode && targetNode.value !== this.target) {
263
- this.target = targetNode.value;
264
- this.update({
265
- target: this.target
266
- });
267
- }
268
- }
269
- }
270
- };
271
- var ExternalDestination_1;
272
- __decorate([
273
- decorators_1.property()
274
- ], ExternalDestination.prototype, "concept");
275
- __decorate([
276
- decorators_1.property('LogicItem')
277
- ], ExternalDestination.prototype, "link");
278
- __decorate([
279
- decorators_1.property()
280
- ], ExternalDestination.prototype, "target");
281
- __decorate([
282
- decorators_1.property('Anchor')
283
- ], ExternalDestination.prototype, "anchor");
284
- __decorate([
285
- translator_1.withSourceMap()
286
- ], ExternalDestination.prototype, "toEmbeddedTS");
287
- ExternalDestination = ExternalDestination_1 = __decorate([
288
- decorators_1.concept('外部链接')
289
- ], ExternalDestination);
290
- return ExternalDestination;
291
- }(LogicItem__1["default"]));
292
- exports.ExternalDestination = ExternalDestination;
293
- classMap_1["default"].ExternalDestination = ExternalDestination;
294
- exports["default"] = ExternalDestination;
295
- //================================================================================
296
- // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
297
- // 自动生成的代码已结束。下面可以手动编写。
298
- //================================================================================
@@ -1,311 +0,0 @@
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.Identifier = void 0;
34
- var translator_1 = require("../translator");
35
- var __1 = require("..");
36
- var utils_1 = require("../utils");
37
- var decorators_1 = require("../decorators");
38
- var classMap_1 = require("../common/classMap");
39
- var LogicItem__1 = require("./LogicItem__");
40
- /**
41
- * 标识符
42
- */
43
- var Identifier = /** @class */ (function (_super) {
44
- __extends(Identifier, _super);
45
- /**
46
- * @param source 需要合并的部分参数
47
- */
48
- function Identifier(source) {
49
- var _this = this;
50
- source = Object.assign({}, Identifier_1.getDefaultOptions(), source);
51
- _this = _super.call(this, source) || this;
52
- /**
53
- * 产品概念
54
- */
55
- _this.concept = 'Identifier';
56
- /**
57
- * namespace
58
- */
59
- _this.namespace = undefined;
60
- /**
61
- * 标识符名称
62
- */
63
- _this.name = undefined;
64
- //================================================================================
65
- // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
66
- // 自动生成的代码已结束。下面可以手动编写。
67
- //================================================================================
68
- // 选中的数据类型,这个用作暂存
69
- _this.typeAnnotation = undefined;
70
- _this.globalDataMap = {
71
- $route: true,
72
- $global: true,
73
- $refs: true
74
- };
75
- _super.prototype.subConstructor.call(_this, source);
76
- return _this;
77
- }
78
- Identifier_1 = Identifier;
79
- Identifier.from = function (source, parentNode, parentKey) {
80
- return _super.from.call(this, source, parentNode, parentKey);
81
- };
82
- Identifier.prototype.isEnum = function () {
83
- return utils_1.findConceptKeyWordByNamespace(this.namespace) === 'enums';
84
- };
85
- Identifier.prototype.toVue = function (options) {
86
- var name = this.name;
87
- var namespace = this.namespace;
88
- if (namespace) {
89
- if ((this.namespace.endsWith('nasl.browser') || this.namespace.endsWith('nasl.auth') || this.namespace.endsWith('nasl.configuration') || this.namespace.endsWith('nasl.process'))) {
90
- name = "$global." + this.name;
91
- }
92
- else if (this.namespace.endsWith('frontendVariables')) {
93
- name = "$global.frontendVariables." + this.name;
94
- }
95
- else if (this.isEnum()) {
96
- var enumName = this.name;
97
- if (this.namespace.startsWith('extensions.')) {
98
- enumName = this.namespace + "." + this.name;
99
- }
100
- name = enumName;
101
- }
102
- else if (this.namespace.endsWith('logics')) {
103
- name = "'" + this.namespace + "." + name + "'";
104
- }
105
- }
106
- return name;
107
- };
108
- Identifier.prototype.toUI = function () {
109
- var name = this.name;
110
- var namespace = this.namespace;
111
- if (namespace) {
112
- if (namespace.startsWith('nasl.')) {
113
- name = namespace + "." + this.name;
114
- }
115
- else if (namespace.endsWith('frontendVariables')) {
116
- name = "nasl.frontendVariables." + this.name;
117
- }
118
- else if (this.isEnum()) {
119
- var enumName = this.name;
120
- if (this.namespace.startsWith('extensions.')) {
121
- enumName = this.namespace + "." + this.name;
122
- }
123
- name = enumName;
124
- }
125
- }
126
- return name;
127
- };
128
- Object.defineProperty(Identifier.prototype, "jsName", {
129
- // 在页面 表达式/逻辑 中的名字
130
- get: function () {
131
- var name = this.name;
132
- var namespace = this.namespace;
133
- if (namespace) {
134
- if (namespace.endsWith('nasl.browser') || namespace.endsWith('nasl.auth') || namespace.endsWith('nasl.configuration') || this.namespace.endsWith('nasl.process')) {
135
- name = "$global." + this.name;
136
- }
137
- else if (namespace.endsWith('frontendVariables')) {
138
- name = "$global.frontendVariables." + this.name;
139
- }
140
- else if (this.isEnum()) {
141
- var enumName = this.name;
142
- if (this.namespace.startsWith('extensions.')) {
143
- enumName = this.namespace + "." + this.name;
144
- }
145
- name = enumName;
146
- }
147
- else if (this.namespace.endsWith('logics')) {
148
- name = "'" + this.namespace + "." + name + "'";
149
- }
150
- }
151
- return name;
152
- },
153
- enumerable: false,
154
- configurable: true
155
- });
156
- Identifier.prototype.toJS = function () {
157
- var name = this.jsName;
158
- return this.isViewOrGlobalDataVariable() ? "this." + name : name;
159
- };
160
- // 页面/全局 级别的变量
161
- Identifier.prototype.isViewOrGlobalDataVariable = function () {
162
- var _a, _b, _c, _d, _e, _f;
163
- var dataMap = {};
164
- (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.forEach(function (param) {
165
- dataMap[param.name] = true;
166
- });
167
- (_d = (_c = this.view) === null || _c === void 0 ? void 0 : _c.variables) === null || _d === void 0 ? void 0 : _d.forEach(function (variable) {
168
- dataMap[variable.name] = true;
169
- });
170
- // 目前前端逻辑也会被当成可选变量(以datasource为典型)
171
- (_f = (_e = this.view) === null || _e === void 0 ? void 0 : _e.logics) === null || _f === void 0 ? void 0 : _f.forEach(function (logics) {
172
- dataMap[logics.name] = true;
173
- });
174
- var parentNode = this.parentNode;
175
- var isMemberExpressionProperty = false;
176
- if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.concept) === 'MemberExpression' && this.parentKey === 'property') {
177
- isMemberExpressionProperty = true;
178
- }
179
- var name = this.jsName;
180
- var namespace = this.namespace;
181
- if (name === 'UserStatusEnum') {
182
- console.log(this);
183
- }
184
- return (dataMap[name]
185
- || this.globalDataMap[name]
186
- || (namespace === null || namespace === void 0 ? void 0 : namespace.endsWith('nasl.browser'))
187
- || (namespace === null || namespace === void 0 ? void 0 : namespace.endsWith('nasl.auth'))
188
- || (namespace === null || namespace === void 0 ? void 0 : namespace.endsWith('nasl.configuration'))
189
- || (namespace === null || namespace === void 0 ? void 0 : namespace.endsWith('nasl.process'))
190
- || (namespace === null || namespace === void 0 ? void 0 : namespace.endsWith('frontendVariables'))
191
- || this.isEnum()) && !isMemberExpressionProperty;
192
- };
193
- Identifier.prototype.toBrief = function () {
194
- return this.name || '-';
195
- };
196
- Identifier.prototype.toEmbeddedTS = function (state) {
197
- var _this = this;
198
- var _a;
199
- // 只有data-source可以是函数 ,也可能是属性
200
- if (this.parentNode instanceof __1.BindAttribute && this.parentNode.name === 'data-source') {
201
- var view = this.view;
202
- var viewLogics = view.logics;
203
- var findLogic = viewLogics.find(function (item) { return item.name === _this.name; });
204
- if (findLogic) {
205
- return this.name;
206
- }
207
- }
208
- // 全局变量在不是页面的地方放置,就会报错
209
- if (((_a = this.namespace) === null || _a === void 0 ? void 0 : _a.startsWith('app.frontendVariables')) && !this.view) {
210
- return '__FRONTENDVARIABLES__';
211
- }
212
- // 如果是nasl.util.Enum 的子集里的 Identifier > MemberExpression > Argument > callfunction
213
- // nasl.util.Enum 的 右侧是转成字符串的
214
- // 如果是identifier 而且枚举
215
- // if (this.parentNode?.parentNode?.parentNode instanceof CallFunction) {
216
- // const calleeNamespace = this.parentNode.parentNode.parentNode.calleeNamespace;
217
- // const calleeName = this.parentNode.parentNode.parentNode.calleeName;
218
- // if (calleeNamespace + '.' + calleeName === 'nasl.util.Enum') {
219
- // const str = (this.namespace ? this.namespace + '.' : '') + this.name;
220
- // return str.includes('.enums.') ? str : str + '.toString()';
221
- // }
222
- // }
223
- // having 下选择的变量不生成 namespace 前缀
224
- if (this.namespace === 'inner' && this.getAncestor('CallQueryComponent')) {
225
- return "__" + this.name || '__IDENTIFIER__';
226
- }
227
- return this.namespace ? this.namespace + '.' + this.name : this.name || '__IDENTIFIER__';
228
- };
229
- // 方便快速取值
230
- Identifier.prototype.getValue = function () {
231
- // 实体逻辑 deleteBy/updateBy 的 filter 参数的回调函数的参数:_
232
- // 处理 _ 的显示问题
233
- if (this.name === '_') {
234
- var parentNode = this.parentNode;
235
- if (parentNode) {
236
- var p = parentNode;
237
- while (p && p.concept !== 'CallLogic') {
238
- p = p.parentNode;
239
- }
240
- if (p && (p.calleeName === 'deleteBy' || p.calleeName === 'updateBy')) {
241
- var ns = p.calleeNamespace.split('.');
242
- return ns[ns.length - 2] || this.name;
243
- }
244
- else {
245
- return 'item';
246
- }
247
- }
248
- }
249
- return this.name;
250
- };
251
- Object.defineProperty(Identifier.prototype, "completeName", {
252
- get: function () {
253
- var arr = [this.name];
254
- if (this.namespace) {
255
- arr.unshift(this.namespace);
256
- }
257
- return arr.join('.');
258
- },
259
- enumerable: false,
260
- configurable: true
261
- });
262
- /**
263
- * 设置函数名称
264
- */
265
- Identifier.prototype.setNamespace = function (namespace) {
266
- var object = {
267
- namespace: namespace
268
- };
269
- this.update(__assign({}, object));
270
- };
271
- /**
272
- * 设置函数名称
273
- */
274
- Identifier.prototype.setName = function (name) {
275
- var object = {
276
- name: name
277
- };
278
- this.update(__assign({}, object));
279
- };
280
- Identifier.prototype.setNameAndNamespace = function (name, namespace) {
281
- var object = {
282
- name: name,
283
- namespace: namespace
284
- };
285
- this.update(__assign({}, object));
286
- };
287
- var Identifier_1;
288
- __decorate([
289
- decorators_1.property()
290
- ], Identifier.prototype, "concept");
291
- __decorate([
292
- decorators_1.property()
293
- ], Identifier.prototype, "namespace");
294
- __decorate([
295
- decorators_1.property()
296
- ], Identifier.prototype, "name");
297
- __decorate([
298
- translator_1.withSourceMap()
299
- ], Identifier.prototype, "toEmbeddedTS");
300
- Identifier = Identifier_1 = __decorate([
301
- decorators_1.concept('标识符')
302
- ], Identifier);
303
- return Identifier;
304
- }(LogicItem__1["default"]));
305
- exports.Identifier = Identifier;
306
- classMap_1["default"].Identifier = Identifier;
307
- exports["default"] = Identifier;
308
- //================================================================================
309
- // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
310
- // 自动生成的代码已结束。下面可以手动编写。
311
- //================================================================================