@lcap/nasl 2.20.0-beta.2 → 2.20.0

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 (323) hide show
  1. package/out/automate/engine/index.d.ts +1 -1
  2. package/out/automate/engine/index.js +2 -3
  3. package/out/automate/engine/index.js.map +1 -1
  4. package/out/automate/engine/uniqueName.d.ts +1 -1
  5. package/out/automate/engine/uniqueName.js +2 -2
  6. package/out/automate/engine/uniqueName.js.map +1 -1
  7. package/out/automate/engine/utils.js +4 -1
  8. package/out/automate/engine/utils.js.map +1 -1
  9. package/out/automate/template/myProcess.d.ts +1 -1
  10. package/out/automate/template/myProcess.js +2 -2
  11. package/out/automate/template/myProcess.js.map +1 -1
  12. package/out/bak/translator.js +14 -22
  13. package/out/bak/translator.js.map +1 -1
  14. package/out/common/BaseNode.js +4 -1
  15. package/out/common/BaseNode.js.map +1 -1
  16. package/out/common/Command.d.ts +1 -0
  17. package/out/common/Command.js +5 -1
  18. package/out/common/Command.js.map +1 -1
  19. package/out/concepts/App__.d.ts +4 -0
  20. package/out/concepts/App__.js +30 -6
  21. package/out/concepts/App__.js.map +1 -1
  22. package/out/concepts/Assignee__.js +4 -3
  23. package/out/concepts/Assignee__.js.map +1 -1
  24. package/out/concepts/BatchAssignment__.js +3 -3
  25. package/out/concepts/BatchAssignment__.js.map +1 -1
  26. package/out/concepts/BindAttribute__.d.ts +7 -0
  27. package/out/concepts/BindAttribute__.js +270 -39
  28. package/out/concepts/BindAttribute__.js.map +1 -1
  29. package/out/concepts/BindDirective__.d.ts +7 -0
  30. package/out/concepts/BindDirective__.js +215 -17
  31. package/out/concepts/BindDirective__.js.map +1 -1
  32. package/out/concepts/BindStyle__.d.ts +7 -0
  33. package/out/concepts/BindStyle__.js +194 -4
  34. package/out/concepts/BindStyle__.js.map +1 -1
  35. package/out/concepts/CallFunction__.js +22 -8
  36. package/out/concepts/CallFunction__.js.map +1 -1
  37. package/out/concepts/CallInterface__.js +3 -2
  38. package/out/concepts/CallInterface__.js.map +1 -1
  39. package/out/concepts/CallLogic__.d.ts +3 -0
  40. package/out/concepts/CallLogic__.js +78 -89
  41. package/out/concepts/CallLogic__.js.map +1 -1
  42. package/out/concepts/CallQueryComponent__.js +20 -3
  43. package/out/concepts/CallQueryComponent__.js.map +1 -1
  44. package/out/concepts/ConfigGroup__.d.ts +1 -0
  45. package/out/concepts/ConfigGroup__.js +13 -0
  46. package/out/concepts/ConfigGroup__.js.map +1 -1
  47. package/out/concepts/ConfigProperty__.d.ts +19 -0
  48. package/out/concepts/ConfigProperty__.js +61 -0
  49. package/out/concepts/ConfigProperty__.js.map +1 -1
  50. package/out/concepts/Configuration__.d.ts +1 -0
  51. package/out/concepts/Configuration__.js +13 -0
  52. package/out/concepts/Configuration__.js.map +1 -1
  53. package/out/concepts/DataSource__.js.map +1 -1
  54. package/out/concepts/Destination__.d.ts +1 -0
  55. package/out/concepts/Destination__.js +61 -7
  56. package/out/concepts/Destination__.js.map +1 -1
  57. package/out/concepts/EntityProperty__.js +9 -1
  58. package/out/concepts/EntityProperty__.js.map +1 -1
  59. package/out/concepts/EnumItem__.d.ts +5 -5
  60. package/out/concepts/EnumItem__.js +6 -6
  61. package/out/concepts/Enum__.d.ts +20 -19
  62. package/out/concepts/Enum__.js +28 -1
  63. package/out/concepts/Enum__.js.map +1 -1
  64. package/out/concepts/ExternalDestination__.d.ts +1 -0
  65. package/out/concepts/ExternalDestination__.js +21 -3
  66. package/out/concepts/ExternalDestination__.js.map +1 -1
  67. package/out/concepts/ForEachStatement__.js +2 -0
  68. package/out/concepts/ForEachStatement__.js.map +1 -1
  69. package/out/concepts/Frontend__.d.ts +2 -1
  70. package/out/concepts/Frontend__.js.map +1 -1
  71. package/out/concepts/Identifier__.js +16 -5
  72. package/out/concepts/Identifier__.js.map +1 -1
  73. package/out/concepts/InterfaceParam__.js +9 -1
  74. package/out/concepts/InterfaceParam__.js.map +1 -1
  75. package/out/concepts/JSBlock__.js +5 -1
  76. package/out/concepts/JSBlock__.js.map +1 -1
  77. package/out/concepts/Logic__.d.ts +79 -79
  78. package/out/concepts/Logic__.js +16 -3
  79. package/out/concepts/Logic__.js.map +1 -1
  80. package/out/concepts/Match__.d.ts +0 -3
  81. package/out/concepts/Match__.js +11 -66
  82. package/out/concepts/Match__.js.map +1 -1
  83. package/out/concepts/MemberExpression__.js +9 -0
  84. package/out/concepts/MemberExpression__.js.map +1 -1
  85. package/out/concepts/Module__.d.ts +16 -0
  86. package/out/concepts/Module__.js +43 -0
  87. package/out/concepts/Module__.js.map +1 -1
  88. package/out/concepts/NewComposite__.d.ts +2 -4
  89. package/out/concepts/NewComposite__.js +91 -126
  90. package/out/concepts/NewComposite__.js.map +1 -1
  91. package/out/concepts/NewList__.d.ts +1 -0
  92. package/out/concepts/NewList__.js +22 -2
  93. package/out/concepts/NewList__.js.map +1 -1
  94. package/out/concepts/NewMap__.d.ts +1 -0
  95. package/out/concepts/NewMap__.js +43 -11
  96. package/out/concepts/NewMap__.js.map +1 -1
  97. package/out/concepts/OqlQueryComponent__.js +40 -12
  98. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  99. package/out/concepts/Param__.js +10 -2
  100. package/out/concepts/Param__.js.map +1 -1
  101. package/out/concepts/ProcessElement__.js +2 -1
  102. package/out/concepts/ProcessElement__.js.map +1 -1
  103. package/out/concepts/ProcessOutcome__.js +1 -1
  104. package/out/concepts/ProcessOutcome__.js.map +1 -1
  105. package/out/concepts/ProcessOutcomes__.js +1 -1
  106. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  107. package/out/concepts/Process__.js +1 -0
  108. package/out/concepts/Process__.js.map +1 -1
  109. package/out/concepts/Return__.js +10 -2
  110. package/out/concepts/Return__.js.map +1 -1
  111. package/out/concepts/StringInterpolation__.js +14 -2
  112. package/out/concepts/StringInterpolation__.js.map +1 -1
  113. package/out/concepts/StringLiteral__.js +6 -6
  114. package/out/concepts/StringLiteral__.js.map +1 -1
  115. package/out/concepts/StructureProperty__.js +9 -1
  116. package/out/concepts/StructureProperty__.js.map +1 -1
  117. package/out/concepts/TypeAnnotation__.d.ts +6 -3
  118. package/out/concepts/TypeAnnotation__.js +67 -13
  119. package/out/concepts/TypeAnnotation__.js.map +1 -1
  120. package/out/concepts/ValidationRule__.d.ts +1 -0
  121. package/out/concepts/ValidationRule__.js +53 -0
  122. package/out/concepts/ValidationRule__.js.map +1 -1
  123. package/out/concepts/Variable__.js +9 -1
  124. package/out/concepts/Variable__.js.map +1 -1
  125. package/out/concepts/ViewElement__.js +17 -1
  126. package/out/concepts/ViewElement__.js.map +1 -1
  127. package/out/concepts/View__.d.ts +1 -3
  128. package/out/concepts/View__.js +22 -11
  129. package/out/concepts/View__.js.map +1 -1
  130. package/out/concepts/basics/stdlib/nasl.collection.js +6 -1
  131. package/out/concepts/basics/stdlib/nasl.collection.js.map +1 -1
  132. package/out/concepts/basics/stdlib/nasl.configuration.js +3 -0
  133. package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -1
  134. package/out/concepts/basics/stdlib/nasl.core.d.ts +2 -0
  135. package/out/concepts/basics/stdlib/nasl.core.js +34 -0
  136. package/out/concepts/basics/stdlib/nasl.core.js.map +1 -1
  137. package/out/concepts/basics/stdlib/nasl.util.js +4 -2
  138. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  139. package/out/concepts/basics/types/index.d.ts +1 -0
  140. package/out/concepts/basics/types/index.js +3 -1
  141. package/out/concepts/basics/types/index.js.map +1 -1
  142. package/out/concepts/index__.d.ts +0 -1
  143. package/out/concepts/index__.js +0 -1
  144. package/out/concepts/index__.js.map +1 -1
  145. package/out/enums/KEYWORDS.js +8 -0
  146. package/out/enums/KEYWORDS.js.map +1 -1
  147. package/out/generator/genBundleFiles.js +24 -5
  148. package/out/generator/genBundleFiles.js.map +1 -1
  149. package/out/generator/genReleaseBody.d.ts +2 -3
  150. package/out/generator/genReleaseBody.js +97 -23
  151. package/out/generator/genReleaseBody.js.map +1 -1
  152. package/out/generator/permission.d.ts +2 -10
  153. package/out/generator/permission.js +27 -14
  154. package/out/generator/permission.js.map +1 -1
  155. package/out/server/entity2LogicNamespace.js +2 -20
  156. package/out/server/entity2LogicNamespace.js.map +1 -1
  157. package/out/server/extendBaseNode.js +16 -5
  158. package/out/server/extendBaseNode.js.map +1 -1
  159. package/out/server/formatTsUtils.d.ts +2 -1
  160. package/out/server/formatTsUtils.js +40 -10
  161. package/out/server/formatTsUtils.js.map +1 -1
  162. package/out/server/getLogics.d.ts +2 -2
  163. package/out/server/getLogics.js +3 -3
  164. package/out/server/getLogics.js.map +1 -1
  165. package/out/server/getMemberIdentifier.d.ts +1 -0
  166. package/out/server/getMemberIdentifier.js +27 -1
  167. package/out/server/getMemberIdentifier.js.map +1 -1
  168. package/out/server/index.js +1 -0
  169. package/out/server/index.js.map +1 -1
  170. package/out/server/naslServer.d.ts +7 -1
  171. package/out/server/naslServer.js +519 -46
  172. package/out/server/naslServer.js.map +1 -1
  173. package/out/server/translator.js +109 -33
  174. package/out/server/translator.js.map +1 -1
  175. package/out/service/storage/init.js +21 -1
  176. package/out/service/storage/init.js.map +1 -1
  177. package/out/templator/genCreateBlock.js +1 -3
  178. package/out/templator/genCreateBlock.js.map +1 -1
  179. package/out/templator/genCurdEditMultipleKeyBlock.js +1 -3
  180. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  181. package/out/templator/genCurdMultipleKeyBlock.js +2 -4
  182. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  183. package/out/templator/genGetBlock.js +1 -1
  184. package/out/templator/genGetBlock.js.map +1 -1
  185. package/out/templator/genGridViewBlock.js +2 -2
  186. package/out/templator/genGridViewBlock.js.map +1 -1
  187. package/out/templator/genListViewBlock.js +7 -1
  188. package/out/templator/genListViewBlock.js.map +1 -1
  189. package/out/templator/genSelectBlock.js +1 -1
  190. package/out/templator/genSelectBlock.js.map +1 -1
  191. package/out/templator/genTableBlock.js +2 -2
  192. package/out/templator/genTableBlock.js.map +1 -1
  193. package/out/templator/genUpdateBlock.js +2 -3
  194. package/out/templator/genUpdateBlock.js.map +1 -1
  195. package/out/utils/traverse.js +8 -2
  196. package/out/utils/traverse.js.map +1 -1
  197. package/package.json +2 -2
  198. package/sandbox/stdlib/dist/nasl.logging.js +0 -0
  199. package/sandbox/stdlib/dist/nasl.util.js +0 -0
  200. package/sandbox/stdlib/nasl.collection.ts +1 -0
  201. package/sandbox/stdlib/nasl.core.ts +34 -0
  202. package/sandbox/stdlib/nasl.oql.ts +71 -15
  203. package/sandbox/stdlib/nasl.util.ts +9 -3
  204. package/src/automate/engine/dist/index.dev.js +517 -0
  205. package/src/automate/engine/index.js +2 -3
  206. package/src/automate/engine/uniqueName.js +2 -2
  207. package/src/automate/engine/utils.js +4 -2
  208. package/src/automate/template/myProcess.js +2 -2
  209. package/src/bak/translator.js +16 -25
  210. package/src/common/BaseNode.ts +3 -1
  211. package/src/common/Command.ts +4 -0
  212. package/src/common/dist/BaseNode.js +1101 -0
  213. package/src/concepts/App__.ts +36 -7
  214. package/src/concepts/Assignee__.ts +4 -3
  215. package/src/concepts/BatchAssignment__.ts +3 -3
  216. package/src/concepts/BindAttribute__.ts +299 -38
  217. package/src/concepts/BindDirective__.ts +204 -31
  218. package/src/concepts/BindStyle__.ts +187 -24
  219. package/src/concepts/CallFunction__.ts +55 -10
  220. package/src/concepts/CallInterface__.ts +3 -2
  221. package/src/concepts/CallLogic__.ts +110 -90
  222. package/src/concepts/CallQueryComponent__.ts +18 -3
  223. package/src/concepts/ConfigGroup__.ts +17 -4
  224. package/src/concepts/ConfigProperty__.ts +70 -4
  225. package/src/concepts/Configuration__.ts +14 -5
  226. package/src/concepts/DataSource__.ts +4 -1
  227. package/src/concepts/Destination__.ts +61 -7
  228. package/src/concepts/EntityProperty__.ts +7 -1
  229. package/src/concepts/EnumItem__.ts +6 -6
  230. package/src/concepts/Enum__.ts +22 -19
  231. package/src/concepts/ExternalDestination__.ts +28 -8
  232. package/src/concepts/ForEachStatement__.ts +2 -0
  233. package/src/concepts/Frontend__.ts +2 -1
  234. package/src/concepts/Identifier__.ts +16 -5
  235. package/src/concepts/InterfaceParam__.ts +7 -1
  236. package/src/concepts/JSBlock__.ts +3 -2
  237. package/src/concepts/Logic__.ts +95 -83
  238. package/src/concepts/Match__.ts +31 -67
  239. package/src/concepts/MemberExpression__.ts +6 -0
  240. package/src/concepts/Module__.ts +57 -0
  241. package/src/concepts/NewComposite__.ts +95 -140
  242. package/src/concepts/NewList__.ts +23 -2
  243. package/src/concepts/NewMap__.ts +48 -24
  244. package/src/concepts/OqlQueryComponent__.ts +40 -20
  245. package/src/concepts/Param__.ts +178 -176
  246. package/src/concepts/ProcessElement__.ts +2 -1
  247. package/src/concepts/ProcessOutcome__.ts +1 -1
  248. package/src/concepts/ProcessOutcomes__.ts +1 -1
  249. package/src/concepts/Process__.ts +1 -0
  250. package/src/concepts/Return__.ts +8 -2
  251. package/src/concepts/StringInterpolation__.ts +19 -7
  252. package/src/concepts/StringLiteral__.ts +7 -6
  253. package/src/concepts/StructureProperty__.ts +7 -1
  254. package/src/concepts/TypeAnnotation__.ts +101 -14
  255. package/src/concepts/ValidationRule__.ts +58 -9
  256. package/src/concepts/Variable__.ts +11 -1
  257. package/src/concepts/ViewElement__.ts +39 -2
  258. package/src/concepts/View__.ts +26 -14
  259. package/src/concepts/basics/stdlib/dist/nasl.util.js +1602 -0
  260. package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +24 -0
  261. package/src/concepts/basics/stdlib/nasl.collection.ts +6 -1
  262. package/src/concepts/basics/stdlib/nasl.configuration.ts +3 -0
  263. package/src/concepts/basics/stdlib/nasl.core.ts +33 -2
  264. package/src/concepts/basics/stdlib/nasl.util.ts +4 -2
  265. package/src/concepts/basics/types/index.ts +1 -0
  266. package/src/concepts/dist/BindAttribute__.js +795 -0
  267. package/src/concepts/dist/BindEvent__.js +732 -0
  268. package/src/concepts/dist/CallFunction__.js +527 -0
  269. package/src/concepts/dist/CallLogic__.js +932 -0
  270. package/src/concepts/dist/Destination__.js +708 -0
  271. package/src/concepts/dist/ExternalDestination__.js +298 -0
  272. package/src/concepts/dist/Identifier__.js +311 -0
  273. package/src/concepts/dist/StringInterpolation__.js +231 -0
  274. package/src/concepts/dist/TypeAnnotation__.js +834 -0
  275. package/src/concepts/dist/ViewElement__.js +1692 -0
  276. package/src/concepts/dist/View__.js +1601 -0
  277. package/src/concepts/index__.ts +0 -1
  278. package/src/enums/KEYWORDS.ts +8 -0
  279. package/src/generator/dist/genBundleFiles.js +261 -0
  280. package/src/generator/dist/genMetaData.js +245 -0
  281. package/src/generator/dist/permission.js +405 -0
  282. package/src/generator/genBundleFiles.ts +24 -5
  283. package/src/generator/genReleaseBody.ts +75 -30
  284. package/src/generator/permission.ts +31 -15
  285. package/src/server/entity2LogicNamespace.ts +2 -20
  286. package/src/server/extendBaseNode.ts +15 -5
  287. package/src/server/formatTsUtils.ts +41 -10
  288. package/src/server/getLogics.ts +4 -4
  289. package/src/server/getMemberIdentifier.ts +27 -1
  290. package/src/server/index.ts +2 -0
  291. package/src/server/naslServer.ts +520 -48
  292. package/src/server/translator.ts +96 -34
  293. package/src/service/storage/dist/init.js +579 -0
  294. package/src/service/storage/init.ts +22 -2
  295. package/src/templator/dist/genEditTableBlock.js +204 -0
  296. package/src/templator/dist/genGridViewBlock.js +265 -0
  297. package/src/templator/dist/genListViewBlock.js +84 -0
  298. package/src/templator/dist/genTableBlock.js +209 -0
  299. package/src/templator/dist/utils.js +527 -0
  300. package/src/templator/genCreateBlock.ts +1 -3
  301. package/src/templator/genCurdEditMultipleKeyBlock.ts +1 -3
  302. package/src/templator/genCurdMultipleKeyBlock.ts +2 -4
  303. package/src/templator/genGetBlock.ts +1 -1
  304. package/src/templator/genGridViewBlock.ts +3 -4
  305. package/src/templator/genListViewBlock.ts +9 -3
  306. package/src/templator/genSelectBlock.ts +1 -1
  307. package/src/templator/genTableBlock.ts +3 -3
  308. package/src/templator/genUpdateBlock.ts +2 -3
  309. package/src/utils/traverse.ts +10 -2
  310. package/ts-worker/lib/tsserver.js +10 -2
  311. package/ts-worker/package.json +1 -0
  312. package/ts-worker/webpack.config.js +11 -2
  313. package/out/concepts/ConstructArgument__.d.ts +0 -40
  314. package/out/concepts/ConstructArgument__.js +0 -108
  315. package/out/concepts/ConstructArgument__.js.map +0 -1
  316. package/out/concepts/Construct__.d.ts +0 -189
  317. package/out/concepts/Construct__.js +0 -340
  318. package/out/concepts/Construct__.js.map +0 -1
  319. package/out/templator/sql-parser/index.d.ts +0 -1
  320. package/out/templator/sql-parser/index.js +0 -228
  321. package/out/templator/sql-parser/index.js.map +0 -1
  322. package/out/templator/sql-parser/parser.js +0 -26664
  323. package/out/templator/sql-parser/parser.js.map +0 -1
@@ -0,0 +1,298 @@
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
+ //================================================================================
@@ -0,0 +1,311 @@
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
+ //================================================================================