@lcap/nasl 3.4.0-beta.3 → 3.4.0-beta.4

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 (880) hide show
  1. package/out/automate/engine/index.d.ts +4 -4
  2. package/out/automate/engine/index.js +363 -363
  3. package/out/automate/engine/operators.d.ts +26 -16
  4. package/out/automate/engine/operators.js +363 -363
  5. package/out/automate/engine/uniqueName.d.ts +12 -12
  6. package/out/automate/engine/uniqueName.js +111 -111
  7. package/out/automate/engine/utils.d.ts +25 -25
  8. package/out/automate/engine/utils.js +443 -443
  9. package/out/automate/engine/viewCache.d.ts +19 -18
  10. package/out/automate/engine/viewCache.js +44 -44
  11. package/out/automate/template/myProcess.d.ts +10 -9
  12. package/out/automate/template/myProcess.js +11501 -11500
  13. package/out/automate/template/myProcess.js.map +1 -1
  14. package/out/automate/upgrader/2.12.d.ts +7 -7
  15. package/out/automate/upgrader/2.12.js +62 -62
  16. package/out/automate/upgrader/2.14-components.d.ts +1115 -1115
  17. package/out/automate/upgrader/2.14-components.js +1086 -1086
  18. package/out/automate/upgrader/2.14.d.ts +10 -10
  19. package/out/automate/upgrader/2.14.js +235 -235
  20. package/out/automate/upgrader/2.14.old.d.ts +1 -1
  21. package/out/automate/upgrader/2.14.old.js +124 -124
  22. package/out/automate/upgrader/2.16.d.ts +10 -10
  23. package/out/automate/upgrader/2.16.js +74 -74
  24. package/out/automate/upgrader/2.17.d.ts +21 -21
  25. package/out/automate/upgrader/2.17.js +556 -556
  26. package/out/automate/upgrader/2.18.d.ts +10 -10
  27. package/out/automate/upgrader/2.18.js +106 -106
  28. package/out/automate/upgrader/2.20.d.ts +17 -17
  29. package/out/automate/upgrader/2.20.js +67 -67
  30. package/out/bak/translator.d.ts +1 -1
  31. package/out/bak/translator.js +143 -143
  32. package/out/breakpoint/generator/AfterStartNode.d.ts +7 -7
  33. package/out/breakpoint/generator/AfterStartNode.js +29 -29
  34. package/out/breakpoint/generator/BeforeEndNode.d.ts +7 -7
  35. package/out/breakpoint/generator/BeforeEndNode.js +27 -27
  36. package/out/breakpoint/generator/BreakpointNode.d.ts +15 -15
  37. package/out/breakpoint/generator/BreakpointNode.js +283 -283
  38. package/out/breakpoint/generator/CallbackNode.d.ts +4 -4
  39. package/out/breakpoint/generator/CallbackNode.js +21 -21
  40. package/out/breakpoint/generator/FragmentNode.d.ts +4 -4
  41. package/out/breakpoint/generator/FragmentNode.js +17 -17
  42. package/out/breakpoint/generator/index.d.ts +4 -4
  43. package/out/breakpoint/generator/index.js +118 -118
  44. package/out/breakpoint/index.d.ts +3 -3
  45. package/out/breakpoint/index.js +19 -19
  46. package/out/breakpoint/shared/constants.d.ts +37 -37
  47. package/out/breakpoint/shared/constants.js +105 -105
  48. package/out/breakpoint/shared/index.d.ts +3 -3
  49. package/out/breakpoint/shared/index.js +32 -32
  50. package/out/breakpoint/shared/operations.d.ts +10 -10
  51. package/out/breakpoint/shared/operations.js +24 -24
  52. package/out/breakpoint/shared/socket.d.ts +48 -48
  53. package/out/breakpoint/shared/socket.js +256 -256
  54. package/out/breakpoint/shared/utils.d.ts +27 -27
  55. package/out/breakpoint/shared/utils.js +228 -228
  56. package/out/breakpoint/store/core.d.ts +80 -80
  57. package/out/breakpoint/store/core.js +415 -415
  58. package/out/breakpoint/store/dock.d.ts +1 -1
  59. package/out/breakpoint/store/dock.js +159 -159
  60. package/out/breakpoint/store/index.d.ts +2 -2
  61. package/out/breakpoint/store/index.js +18 -18
  62. package/out/common/BaseNode.d.ts +347 -334
  63. package/out/common/BaseNode.js +1376 -1325
  64. package/out/common/BaseNode.js.map +1 -1
  65. package/out/common/Command.d.ts +21 -21
  66. package/out/common/Command.js +78 -78
  67. package/out/common/ComponentAPI.d.ts +110 -110
  68. package/out/common/ComponentAPI.js +2 -2
  69. package/out/common/EventEmitter.d.ts +60 -60
  70. package/out/common/EventEmitter.js +68 -68
  71. package/out/common/EventEmitter.js.map +1 -1
  72. package/out/common/Messager.d.ts +91 -91
  73. package/out/common/Messager.js +206 -206
  74. package/out/common/asyncFuncMap.d.ts +2 -2
  75. package/out/common/asyncFuncMap.js +15 -15
  76. package/out/common/index.d.ts +3 -3
  77. package/out/common/index.js +19 -19
  78. package/out/concepts/Abort__.d.ts +28 -26
  79. package/out/concepts/Abort__.js +83 -81
  80. package/out/concepts/Abort__.js.map +1 -1
  81. package/out/concepts/AbstractInterface__.d.ts +22 -0
  82. package/out/concepts/AbstractInterface__.js +60 -0
  83. package/out/concepts/AbstractInterface__.js.map +1 -0
  84. package/out/concepts/Anchor__.d.ts +48 -46
  85. package/out/concepts/Anchor__.js +208 -206
  86. package/out/concepts/Anchor__.js.map +1 -1
  87. package/out/concepts/AnonymousFunction__.d.ts +175 -173
  88. package/out/concepts/AnonymousFunction__.js +548 -546
  89. package/out/concepts/AnonymousFunction__.js.map +1 -1
  90. package/out/concepts/App__.d.ts +1770 -1687
  91. package/out/concepts/App__.js +2777 -2670
  92. package/out/concepts/App__.js.map +1 -1
  93. package/out/concepts/Argument__.d.ts +70 -68
  94. package/out/concepts/Argument__.js +285 -285
  95. package/out/concepts/Argument__.js.map +1 -1
  96. package/out/concepts/Assignee__.d.ts +291 -289
  97. package/out/concepts/Assignee__.js +455 -452
  98. package/out/concepts/Assignee__.js.map +1 -1
  99. package/out/concepts/AssignmentLine__.d.ts +44 -42
  100. package/out/concepts/AssignmentLine__.js +120 -118
  101. package/out/concepts/AssignmentLine__.js.map +1 -1
  102. package/out/concepts/Assignment__.d.ts +77 -75
  103. package/out/concepts/Assignment__.js +328 -327
  104. package/out/concepts/Assignment__.js.map +1 -1
  105. package/out/concepts/Attribute__.d.ts +112 -110
  106. package/out/concepts/Attribute__.js +259 -265
  107. package/out/concepts/Attribute__.js.map +1 -1
  108. package/out/concepts/AuthInterface__.d.ts +38 -36
  109. package/out/concepts/AuthInterface__.js +86 -85
  110. package/out/concepts/AuthInterface__.js.map +1 -1
  111. package/out/concepts/AuthLogicForCallInterface__.d.ts +141 -139
  112. package/out/concepts/AuthLogicForCallInterface__.js +535 -532
  113. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  114. package/out/concepts/AuthLogic__.d.ts +69 -67
  115. package/out/concepts/AuthLogic__.js +222 -221
  116. package/out/concepts/AuthLogic__.js.map +1 -1
  117. package/out/concepts/BackendVariable__.d.ts +148 -146
  118. package/out/concepts/BackendVariable__.js +482 -481
  119. package/out/concepts/BackendVariable__.js.map +1 -1
  120. package/out/concepts/Backend__.d.ts +137 -135
  121. package/out/concepts/Backend__.js +287 -285
  122. package/out/concepts/Backend__.js.map +1 -1
  123. package/out/concepts/BatchAssignment__.d.ts +255 -253
  124. package/out/concepts/BatchAssignment__.js +883 -880
  125. package/out/concepts/BatchAssignment__.js.map +1 -1
  126. package/out/concepts/BinaryExpression__.d.ts +74 -72
  127. package/out/concepts/BinaryExpression__.js +398 -398
  128. package/out/concepts/BinaryExpression__.js.map +1 -1
  129. package/out/concepts/BindAttribute__.d.ts +330 -328
  130. package/out/concepts/BindAttribute__.js +1064 -1071
  131. package/out/concepts/BindAttribute__.js.map +1 -1
  132. package/out/concepts/BindDirective__.d.ts +169 -167
  133. package/out/concepts/BindDirective__.js +558 -562
  134. package/out/concepts/BindDirective__.js.map +1 -1
  135. package/out/concepts/BindEvent__.d.ts +255 -253
  136. package/out/concepts/BindEvent__.js +943 -942
  137. package/out/concepts/BindEvent__.js.map +1 -1
  138. package/out/concepts/BindStyle__.d.ts +142 -140
  139. package/out/concepts/BindStyle__.js +424 -423
  140. package/out/concepts/BindStyle__.js.map +1 -1
  141. package/out/concepts/BooleanLiteral__.d.ts +38 -36
  142. package/out/concepts/BooleanLiteral__.js +109 -108
  143. package/out/concepts/BooleanLiteral__.js.map +1 -1
  144. package/out/concepts/CallAuthInterface__.d.ts +128 -126
  145. package/out/concepts/CallAuthInterface__.js +421 -414
  146. package/out/concepts/CallAuthInterface__.js.map +1 -1
  147. package/out/concepts/CallConnector__.d.ts +49 -47
  148. package/out/concepts/CallConnector__.js +267 -266
  149. package/out/concepts/CallConnector__.js.map +1 -1
  150. package/out/concepts/CallFunction__.d.ts +161 -159
  151. package/out/concepts/CallFunction__.js +589 -568
  152. package/out/concepts/CallFunction__.js.map +1 -1
  153. package/out/concepts/CallInterface__.d.ts +132 -130
  154. package/out/concepts/CallInterface__.js +808 -802
  155. package/out/concepts/CallInterface__.js.map +1 -1
  156. package/out/concepts/CallLogic__.d.ts +233 -231
  157. package/out/concepts/CallLogic__.js +1317 -1319
  158. package/out/concepts/CallLogic__.js.map +1 -1
  159. package/out/concepts/CallQueryComponent__.d.ts +435 -433
  160. package/out/concepts/CallQueryComponent__.js +1313 -1325
  161. package/out/concepts/CallQueryComponent__.js.map +1 -1
  162. package/out/concepts/Comment__.d.ts +35 -33
  163. package/out/concepts/Comment__.js +101 -100
  164. package/out/concepts/Comment__.js.map +1 -1
  165. package/out/concepts/CompletionProperty__.d.ts +107 -105
  166. package/out/concepts/CompletionProperty__.js +279 -283
  167. package/out/concepts/CompletionProperty__.js.map +1 -1
  168. package/out/concepts/ConfigGroup__.d.ts +127 -125
  169. package/out/concepts/ConfigGroup__.js +266 -264
  170. package/out/concepts/ConfigGroup__.js.map +1 -1
  171. package/out/concepts/ConfigPropertyValue__.d.ts +47 -45
  172. package/out/concepts/ConfigPropertyValue__.js +110 -110
  173. package/out/concepts/ConfigPropertyValue__.js.map +1 -1
  174. package/out/concepts/ConfigProperty__.d.ts +156 -154
  175. package/out/concepts/ConfigProperty__.js +334 -334
  176. package/out/concepts/ConfigProperty__.js.map +1 -1
  177. package/out/concepts/Configuration__.d.ts +126 -124
  178. package/out/concepts/Configuration__.js +239 -236
  179. package/out/concepts/Configuration__.js.map +1 -1
  180. package/out/concepts/Connection__.d.ts +168 -166
  181. package/out/concepts/Connection__.js +347 -347
  182. package/out/concepts/Connection__.js.map +1 -1
  183. package/out/concepts/ConnectorTrigger__.d.ts +81 -79
  184. package/out/concepts/ConnectorTrigger__.js +160 -161
  185. package/out/concepts/ConnectorTrigger__.js.map +1 -1
  186. package/out/concepts/Connector__.d.ts +929 -570
  187. package/out/concepts/Connector__.js +1346 -907
  188. package/out/concepts/Connector__.js.map +1 -1
  189. package/out/concepts/Constant__.d.ts +121 -119
  190. package/out/concepts/Constant__.js +313 -313
  191. package/out/concepts/Constant__.js.map +1 -1
  192. package/out/concepts/DataSource__.d.ts +171 -169
  193. package/out/concepts/DataSource__.js +477 -477
  194. package/out/concepts/DataSource__.js.map +1 -1
  195. package/out/concepts/DatabaseTypeAnnotation__.d.ts +34 -32
  196. package/out/concepts/DatabaseTypeAnnotation__.js +82 -82
  197. package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
  198. package/out/concepts/DefaultValue__.d.ts +98 -98
  199. package/out/concepts/DefaultValue__.js +210 -209
  200. package/out/concepts/DefaultValue__.js.map +1 -1
  201. package/out/concepts/Destination__.d.ts +160 -158
  202. package/out/concepts/Destination__.js +804 -804
  203. package/out/concepts/Destination__.js.map +1 -1
  204. package/out/concepts/End__.d.ts +27 -25
  205. package/out/concepts/End__.js +117 -115
  206. package/out/concepts/End__.js.map +1 -1
  207. package/out/concepts/EntityIndex__.d.ts +98 -96
  208. package/out/concepts/EntityIndex__.js +227 -229
  209. package/out/concepts/EntityIndex__.js.map +1 -1
  210. package/out/concepts/EntityProperty__.d.ts +289 -287
  211. package/out/concepts/EntityProperty__.js +883 -888
  212. package/out/concepts/EntityProperty__.js.map +1 -1
  213. package/out/concepts/Entity__.d.ts +342 -340
  214. package/out/concepts/Entity__.js +779 -769
  215. package/out/concepts/Entity__.js.map +1 -1
  216. package/out/concepts/EnumItem__.d.ts +67 -65
  217. package/out/concepts/EnumItem__.js +155 -155
  218. package/out/concepts/EnumItem__.js.map +1 -1
  219. package/out/concepts/Enum__.d.ts +141 -139
  220. package/out/concepts/Enum__.js +341 -341
  221. package/out/concepts/Enum__.js.map +1 -1
  222. package/out/concepts/Event__.d.ts +146 -144
  223. package/out/concepts/Event__.js +261 -263
  224. package/out/concepts/Event__.js.map +1 -1
  225. package/out/concepts/ExternalDestination__.d.ts +78 -76
  226. package/out/concepts/ExternalDestination__.js +292 -291
  227. package/out/concepts/ExternalDestination__.js.map +1 -1
  228. package/out/concepts/ForEachStatement__.d.ts +173 -190
  229. package/out/concepts/ForEachStatement__.js +533 -534
  230. package/out/concepts/ForEachStatement__.js.map +1 -1
  231. package/out/concepts/FrontendLibrary__.d.ts +216 -214
  232. package/out/concepts/FrontendLibrary__.js +374 -372
  233. package/out/concepts/FrontendLibrary__.js.map +1 -1
  234. package/out/concepts/FrontendVariable__.d.ts +24 -22
  235. package/out/concepts/FrontendVariable__.js +66 -63
  236. package/out/concepts/FrontendVariable__.js.map +1 -1
  237. package/out/concepts/Frontend__.d.ts +511 -509
  238. package/out/concepts/Frontend__.js +1043 -1003
  239. package/out/concepts/Frontend__.js.map +1 -1
  240. package/out/concepts/Function__.d.ts +420 -418
  241. package/out/concepts/Function__.js +805 -801
  242. package/out/concepts/Function__.js.map +1 -1
  243. package/out/concepts/I18nInfo__.d.ts +44 -44
  244. package/out/concepts/I18nInfo__.js +110 -110
  245. package/out/concepts/I18nInfo__.js.map +1 -1
  246. package/out/concepts/Identifier__.d.ts +54 -52
  247. package/out/concepts/Identifier__.js +309 -305
  248. package/out/concepts/Identifier__.js.map +1 -1
  249. package/out/concepts/IfStatement__.d.ts +161 -159
  250. package/out/concepts/IfStatement__.js +353 -352
  251. package/out/concepts/IfStatement__.js.map +1 -1
  252. package/out/concepts/Integration__.d.ts +146 -144
  253. package/out/concepts/Integration__.js +301 -298
  254. package/out/concepts/Integration__.js.map +1 -1
  255. package/out/concepts/InterfaceFromExample__.d.ts +88 -0
  256. package/out/concepts/InterfaceFromExample__.js +172 -0
  257. package/out/concepts/InterfaceFromExample__.js.map +1 -0
  258. package/out/concepts/InterfaceParam__.d.ts +151 -144
  259. package/out/concepts/InterfaceParam__.js +354 -346
  260. package/out/concepts/InterfaceParam__.js.map +1 -1
  261. package/out/concepts/Interface__.d.ts +334 -331
  262. package/out/concepts/Interface__.js +923 -910
  263. package/out/concepts/Interface__.js.map +1 -1
  264. package/out/concepts/JSBlock__.d.ts +37 -35
  265. package/out/concepts/JSBlock__.js +113 -112
  266. package/out/concepts/JSBlock__.js.map +1 -1
  267. package/out/concepts/JavaLogic__.d.ts +45 -43
  268. package/out/concepts/JavaLogic__.js +127 -128
  269. package/out/concepts/JavaLogic__.js.map +1 -1
  270. package/out/concepts/LogicItem__.d.ts +154 -152
  271. package/out/concepts/LogicItem__.js +289 -291
  272. package/out/concepts/LogicItem__.js.map +1 -1
  273. package/out/concepts/Logic__.d.ts +648 -644
  274. package/out/concepts/Logic__.js +1967 -1946
  275. package/out/concepts/Logic__.js.map +1 -1
  276. package/out/concepts/MatchCase__.d.ts +261 -259
  277. package/out/concepts/MatchCase__.js +703 -693
  278. package/out/concepts/MatchCase__.js.map +1 -1
  279. package/out/concepts/Match__.d.ts +127 -125
  280. package/out/concepts/Match__.js +697 -695
  281. package/out/concepts/Match__.js.map +1 -1
  282. package/out/concepts/MemberExpression__.d.ts +77 -75
  283. package/out/concepts/MemberExpression__.js +496 -495
  284. package/out/concepts/MemberExpression__.js.map +1 -1
  285. package/out/concepts/MicroApp__.d.ts +54 -52
  286. package/out/concepts/MicroApp__.js +122 -127
  287. package/out/concepts/MicroApp__.js.map +1 -1
  288. package/out/concepts/Module__.d.ts +985 -1236
  289. package/out/concepts/Module__.js +1450 -1756
  290. package/out/concepts/Module__.js.map +1 -1
  291. package/out/concepts/MsgTriggerEvent__.d.ts +140 -138
  292. package/out/concepts/MsgTriggerEvent__.js +239 -236
  293. package/out/concepts/MsgTriggerEvent__.js.map +1 -1
  294. package/out/concepts/MsgTriggerLauncher__.d.ts +129 -127
  295. package/out/concepts/MsgTriggerLauncher__.js +234 -232
  296. package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
  297. package/out/concepts/Namespace__.d.ts +1086 -1070
  298. package/out/concepts/Namespace__.js +1546 -1491
  299. package/out/concepts/Namespace__.js.map +1 -1
  300. package/out/concepts/NewComposite__.d.ts +351 -349
  301. package/out/concepts/NewComposite__.js +1261 -1311
  302. package/out/concepts/NewComposite__.js.map +1 -1
  303. package/out/concepts/NewList__.d.ts +138 -136
  304. package/out/concepts/NewList__.js +455 -449
  305. package/out/concepts/NewList__.js.map +1 -1
  306. package/out/concepts/NewMap__.d.ts +229 -227
  307. package/out/concepts/NewMap__.js +600 -589
  308. package/out/concepts/NewMap__.js.map +1 -1
  309. package/out/concepts/New__.d.ts +23 -21
  310. package/out/concepts/New__.js +71 -69
  311. package/out/concepts/New__.js.map +1 -1
  312. package/out/concepts/NullLiteral__.d.ts +29 -27
  313. package/out/concepts/NullLiteral__.js +84 -82
  314. package/out/concepts/NullLiteral__.js.map +1 -1
  315. package/out/concepts/NumericLiteral__.d.ts +59 -57
  316. package/out/concepts/NumericLiteral__.js +190 -189
  317. package/out/concepts/NumericLiteral__.js.map +1 -1
  318. package/out/concepts/OqlQueryComponent__.d.ts +76 -74
  319. package/out/concepts/OqlQueryComponent__.js +368 -365
  320. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  321. package/out/concepts/OverriddenLogic__.d.ts +637 -635
  322. package/out/concepts/OverriddenLogic__.js +1693 -1691
  323. package/out/concepts/OverriddenLogic__.js.map +1 -1
  324. package/out/concepts/Param__.d.ts +182 -180
  325. package/out/concepts/Param__.js +512 -512
  326. package/out/concepts/Param__.js.map +1 -1
  327. package/out/concepts/Point__.d.ts +34 -32
  328. package/out/concepts/Point__.js +82 -82
  329. package/out/concepts/Point__.js.map +1 -1
  330. package/out/concepts/ProcessComponent__.d.ts +222 -220
  331. package/out/concepts/ProcessComponent__.js +360 -360
  332. package/out/concepts/ProcessComponent__.js.map +1 -1
  333. package/out/concepts/ProcessElement__.d.ts +649 -647
  334. package/out/concepts/ProcessElement__.js +1335 -1334
  335. package/out/concepts/ProcessElement__.js.map +1 -1
  336. package/out/concepts/ProcessOutcome__.d.ts +33 -32
  337. package/out/concepts/ProcessOutcome__.js +108 -92
  338. package/out/concepts/ProcessOutcome__.js.map +1 -1
  339. package/out/concepts/ProcessOutcomes__.d.ts +33 -32
  340. package/out/concepts/ProcessOutcomes__.js +110 -93
  341. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  342. package/out/concepts/Process__.d.ts +616 -614
  343. package/out/concepts/Process__.js +1139 -1135
  344. package/out/concepts/Process__.js.map +1 -1
  345. package/out/concepts/QueryAggregateExpression__.d.ts +54 -52
  346. package/out/concepts/QueryAggregateExpression__.js +159 -159
  347. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  348. package/out/concepts/QueryFieldExpression__.d.ts +56 -54
  349. package/out/concepts/QueryFieldExpression__.js +163 -164
  350. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  351. package/out/concepts/QueryFromExpression__.d.ts +101 -99
  352. package/out/concepts/QueryFromExpression__.js +220 -220
  353. package/out/concepts/QueryFromExpression__.js.map +1 -1
  354. package/out/concepts/QueryGroupByExpression__.d.ts +49 -47
  355. package/out/concepts/QueryGroupByExpression__.js +150 -148
  356. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  357. package/out/concepts/QueryJoinExpression__.d.ts +188 -186
  358. package/out/concepts/QueryJoinExpression__.js +347 -348
  359. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  360. package/out/concepts/QueryLimitExpression__.d.ts +60 -58
  361. package/out/concepts/QueryLimitExpression__.js +172 -171
  362. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  363. package/out/concepts/QueryOrderByExpression__.d.ts +71 -69
  364. package/out/concepts/QueryOrderByExpression__.js +185 -184
  365. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  366. package/out/concepts/QuerySelectExpression__.d.ts +206 -204
  367. package/out/concepts/QuerySelectExpression__.js +311 -308
  368. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  369. package/out/concepts/Rect__.d.ts +42 -40
  370. package/out/concepts/Rect__.js +98 -100
  371. package/out/concepts/Rect__.js.map +1 -1
  372. package/out/concepts/Return__.d.ts +147 -145
  373. package/out/concepts/Return__.js +410 -409
  374. package/out/concepts/Return__.js.map +1 -1
  375. package/out/concepts/Role__.d.ts +65 -63
  376. package/out/concepts/Role__.js +172 -173
  377. package/out/concepts/Role__.js.map +1 -1
  378. package/out/concepts/SelectMembers__.d.ts +145 -143
  379. package/out/concepts/SelectMembers__.js +307 -305
  380. package/out/concepts/SelectMembers__.js.map +1 -1
  381. package/out/concepts/Slot__.d.ts +77 -75
  382. package/out/concepts/Slot__.js +175 -178
  383. package/out/concepts/Slot__.js.map +1 -1
  384. package/out/concepts/SqlQueryComponent__.d.ts +74 -72
  385. package/out/concepts/SqlQueryComponent__.js +291 -292
  386. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  387. package/out/concepts/Start__.d.ts +27 -25
  388. package/out/concepts/Start__.js +76 -74
  389. package/out/concepts/Start__.js.map +1 -1
  390. package/out/concepts/StringInterpolation__.d.ts +118 -116
  391. package/out/concepts/StringInterpolation__.js +275 -272
  392. package/out/concepts/StringInterpolation__.js.map +1 -1
  393. package/out/concepts/StringLiteral__.d.ts +45 -43
  394. package/out/concepts/StringLiteral__.js +165 -157
  395. package/out/concepts/StringLiteral__.js.map +1 -1
  396. package/out/concepts/StructureProperty__.d.ts +150 -148
  397. package/out/concepts/StructureProperty__.js +373 -372
  398. package/out/concepts/StructureProperty__.js.map +1 -1
  399. package/out/concepts/Structure__.d.ts +252 -248
  400. package/out/concepts/Structure__.js +521 -506
  401. package/out/concepts/Structure__.js.map +1 -1
  402. package/out/concepts/SwitchCase__.d.ts +97 -95
  403. package/out/concepts/SwitchCase__.js +287 -281
  404. package/out/concepts/SwitchCase__.js.map +1 -1
  405. package/out/concepts/SwitchStatement__.d.ts +87 -85
  406. package/out/concepts/SwitchStatement__.js +212 -209
  407. package/out/concepts/SwitchStatement__.js.map +1 -1
  408. package/out/concepts/Theme__.d.ts +40 -38
  409. package/out/concepts/Theme__.js +91 -89
  410. package/out/concepts/Theme__.js.map +1 -1
  411. package/out/concepts/Transactional__.d.ts +90 -88
  412. package/out/concepts/Transactional__.js +171 -172
  413. package/out/concepts/Transactional__.js.map +1 -1
  414. package/out/concepts/TriggerEvent__.d.ts +123 -121
  415. package/out/concepts/TriggerEvent__.js +236 -234
  416. package/out/concepts/TriggerEvent__.js.map +1 -1
  417. package/out/concepts/TriggerLauncher__.d.ts +84 -82
  418. package/out/concepts/TriggerLauncher__.js +223 -225
  419. package/out/concepts/TriggerLauncher__.js.map +1 -1
  420. package/out/concepts/TypeAnnotation__.d.ts +304 -299
  421. package/out/concepts/TypeAnnotation__.js +1054 -1025
  422. package/out/concepts/TypeAnnotation__.js.map +1 -1
  423. package/out/concepts/TypeParam__.d.ts +28 -26
  424. package/out/concepts/TypeParam__.js +82 -81
  425. package/out/concepts/TypeParam__.js.map +1 -1
  426. package/out/concepts/UnaryExpression__.d.ts +52 -50
  427. package/out/concepts/UnaryExpression__.js +200 -199
  428. package/out/concepts/UnaryExpression__.js.map +1 -1
  429. package/out/concepts/Unparsed__.d.ts +36 -33
  430. package/out/concepts/Unparsed__.js +103 -102
  431. package/out/concepts/Unparsed__.js.map +1 -1
  432. package/out/concepts/UseComponent__.d.ts +34 -32
  433. package/out/concepts/UseComponent__.js +82 -82
  434. package/out/concepts/UseComponent__.js.map +1 -1
  435. package/out/concepts/ValidationRule__.d.ts +152 -150
  436. package/out/concepts/ValidationRule__.js +531 -525
  437. package/out/concepts/ValidationRule__.js.map +1 -1
  438. package/out/concepts/Variable__.d.ts +167 -165
  439. package/out/concepts/Variable__.js +479 -478
  440. package/out/concepts/Variable__.js.map +1 -1
  441. package/out/concepts/ViewBlock__.d.ts +38 -36
  442. package/out/concepts/ViewBlock__.js +90 -91
  443. package/out/concepts/ViewBlock__.js.map +1 -1
  444. package/out/concepts/ViewComponent__.d.ts +568 -566
  445. package/out/concepts/ViewComponent__.js +819 -816
  446. package/out/concepts/ViewComponent__.js.map +1 -1
  447. package/out/concepts/ViewElement__.d.ts +628 -626
  448. package/out/concepts/ViewElement__.js +2315 -2316
  449. package/out/concepts/ViewElement__.js.map +1 -1
  450. package/out/concepts/View__.d.ts +725 -723
  451. package/out/concepts/View__.js +2219 -2217
  452. package/out/concepts/View__.js.map +1 -1
  453. package/out/concepts/WhileStatement__.d.ts +100 -98
  454. package/out/concepts/WhileStatement__.js +251 -247
  455. package/out/concepts/WhileStatement__.js.map +1 -1
  456. package/out/concepts/basics/constants.d.ts +1 -0
  457. package/out/concepts/basics/constants.js +6 -0
  458. package/out/concepts/basics/constants.js.map +1 -0
  459. package/out/concepts/basics/stdlib/index.d.ts +4 -4
  460. package/out/concepts/basics/stdlib/index.js +44 -44
  461. package/out/concepts/basics/stdlib/nasl.auth.d.ts +7 -7
  462. package/out/concepts/basics/stdlib/nasl.auth.js +163 -163
  463. package/out/concepts/basics/stdlib/nasl.browser.d.ts +3 -3
  464. package/out/concepts/basics/stdlib/nasl.browser.js +148 -148
  465. package/out/concepts/basics/stdlib/nasl.collection.d.ts +7 -7
  466. package/out/concepts/basics/stdlib/nasl.collection.js +51 -51
  467. package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -3
  468. package/out/concepts/basics/stdlib/nasl.configuration.js +55 -55
  469. package/out/concepts/basics/stdlib/nasl.core.d.ts +5 -5
  470. package/out/concepts/basics/stdlib/nasl.core.js +48 -48
  471. package/out/concepts/basics/stdlib/nasl.event.d.ts +3 -3
  472. package/out/concepts/basics/stdlib/nasl.event.js +24 -24
  473. package/out/concepts/basics/stdlib/nasl.http.d.ts +7 -7
  474. package/out/concepts/basics/stdlib/nasl.http.js +168 -168
  475. package/out/concepts/basics/stdlib/nasl.interface.d.ts +7 -7
  476. package/out/concepts/basics/stdlib/nasl.interface.js +42 -42
  477. package/out/concepts/basics/stdlib/nasl.io.d.ts +3 -3
  478. package/out/concepts/basics/stdlib/nasl.io.js +51 -51
  479. package/out/concepts/basics/stdlib/nasl.logging.d.ts +3 -3
  480. package/out/concepts/basics/stdlib/nasl.logging.js +55 -55
  481. package/out/concepts/basics/stdlib/nasl.process.d.ts +7 -7
  482. package/out/concepts/basics/stdlib/nasl.process.js +637 -637
  483. package/out/concepts/basics/stdlib/nasl.ui.d.ts +7 -7
  484. package/out/concepts/basics/stdlib/nasl.ui.js +1062 -1062
  485. package/out/concepts/basics/stdlib/nasl.util.d.ts +5 -5
  486. package/out/concepts/basics/stdlib/nasl.util.js +2291 -2291
  487. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  488. package/out/concepts/basics/stdlib/nasl.validation.d.ts +3 -3
  489. package/out/concepts/basics/stdlib/nasl.validation.js +564 -564
  490. package/out/concepts/basics/stdlib/reference2TypeAnnotationList.d.ts +5 -5
  491. package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js +25 -25
  492. package/out/concepts/basics/stdlib/timeZone.d.ts +5 -5
  493. package/out/concepts/basics/stdlib/timeZone.js +195 -195
  494. package/out/concepts/basics/types/coreTypeList.d.ts +2 -2
  495. package/out/concepts/basics/types/coreTypeList.js +14 -14
  496. package/out/concepts/basics/types/index.d.ts +16 -16
  497. package/out/concepts/basics/types/index.js +34 -34
  498. package/out/concepts/index.d.ts +6 -6
  499. package/out/concepts/index.js +24 -24
  500. package/out/concepts/index__.d.ts +126 -124
  501. package/out/concepts/index__.js +142 -140
  502. package/out/concepts/index__.js.map +1 -1
  503. package/out/concepts/types__.d.ts +128 -126
  504. package/out/concepts/types__.js +2 -2
  505. package/out/config.d.ts +43 -43
  506. package/out/config.js +71 -71
  507. package/out/decorators/index.d.ts +69 -57
  508. package/out/decorators/index.js +216 -172
  509. package/out/decorators/index.js.map +1 -1
  510. package/out/decorators/promise.d.ts +7 -7
  511. package/out/decorators/promise.js +27 -27
  512. package/out/enums/KEYWORDS.d.ts +6 -6
  513. package/out/enums/KEYWORDS.js +1245 -1243
  514. package/out/enums/KEYWORDS.js.map +1 -1
  515. package/out/enums/LEVEL_NAME_MAP.d.ts +26 -26
  516. package/out/enums/LEVEL_NAME_MAP.js +29 -29
  517. package/out/eventBus.d.ts +3 -3
  518. package/out/eventBus.js +6 -6
  519. package/out/generator/compileComponent.d.ts +11 -11
  520. package/out/generator/compileComponent.js +11 -11
  521. package/out/generator/genBundleFiles.d.ts +34 -34
  522. package/out/generator/genBundleFiles.js +356 -356
  523. package/out/generator/genBundleFiles.js.map +1 -1
  524. package/out/generator/genHash.d.ts +7 -7
  525. package/out/generator/genHash.js +38 -38
  526. package/out/generator/genMetaData.d.ts +31 -31
  527. package/out/generator/genMetaData.js +305 -301
  528. package/out/generator/genMetaData.js.map +1 -1
  529. package/out/generator/genReleaseBody.d.ts +72 -72
  530. package/out/generator/genReleaseBody.js +323 -321
  531. package/out/generator/genReleaseBody.js.map +1 -1
  532. package/out/generator/icestark.d.ts +2 -2
  533. package/out/generator/icestark.js +7 -5
  534. package/out/generator/icestark.js.map +1 -1
  535. package/out/generator/index.d.ts +7 -7
  536. package/out/generator/index.js +23 -23
  537. package/out/generator/microApp.d.ts +2 -2
  538. package/out/generator/microApp.js +35 -35
  539. package/out/generator/permission.d.ts +10 -10
  540. package/out/generator/permission.js +269 -269
  541. package/out/generator/qiankun.d.ts +2 -2
  542. package/out/generator/qiankun.js +6 -4
  543. package/out/generator/qiankun.js.map +1 -1
  544. package/out/generator/styleReplacer.d.ts +3 -3
  545. package/out/generator/styleReplacer.js +67 -67
  546. package/out/index.d.ts +13 -13
  547. package/out/index.js +66 -66
  548. package/out/manager/diagnostic.d.ts +35 -35
  549. package/out/manager/diagnostic.js +62 -62
  550. package/out/manager/stepRecorder.d.ts +20 -20
  551. package/out/manager/stepRecorder.js +108 -108
  552. package/out/natural/componentData.d.ts +31 -31
  553. package/out/natural/componentData.js +84 -84
  554. package/out/natural/genNaturalTS.d.ts +3 -3
  555. package/out/natural/genNaturalTS.js +89 -90
  556. package/out/natural/genNaturalTS.js.map +1 -1
  557. package/out/natural/index.d.ts +2 -2
  558. package/out/natural/index.js +18 -18
  559. package/out/natural/naslStdlibMap.d.ts +2 -2
  560. package/out/natural/naslStdlibMap.js +25 -25
  561. package/out/natural/transformTSCode.d.ts +7 -7
  562. package/out/natural/transformTSCode.js +919 -877
  563. package/out/natural/transformTSCode.js.map +1 -1
  564. package/out/sentry/index.d.ts +34 -34
  565. package/out/sentry/index.js +148 -147
  566. package/out/sentry/index.js.map +1 -1
  567. package/out/server/createUiTs.d.ts +16 -16
  568. package/out/server/createUiTs.js +242 -242
  569. package/out/server/entity2LogicNamespace.d.ts +10 -10
  570. package/out/server/entity2LogicNamespace.js +381 -381
  571. package/out/server/event.d.ts +30 -30
  572. package/out/server/event.js +150 -150
  573. package/out/server/extendBaseNode.d.ts +1 -1
  574. package/out/server/extendBaseNode.js +574 -543
  575. package/out/server/extendBaseNode.js.map +1 -1
  576. package/out/server/formatTsUtils.d.ts +37 -37
  577. package/out/server/formatTsUtils.js +851 -851
  578. package/out/server/getConnector.d.ts +14 -14
  579. package/out/server/getConnector.js +77 -77
  580. package/out/server/getExtensionModules.d.ts +3 -3
  581. package/out/server/getExtensionModules.js +33 -33
  582. package/out/server/getFunctions.d.ts +3 -3
  583. package/out/server/getFunctions.js +19 -19
  584. package/out/server/getInterfaces.d.ts +2 -2
  585. package/out/server/getInterfaces.js +47 -47
  586. package/out/server/getLogging.d.ts +1 -1
  587. package/out/server/getLogging.js +8 -8
  588. package/out/server/getLogics.d.ts +4 -4
  589. package/out/server/getLogics.js +380 -380
  590. package/out/server/getMemberIdentifier.d.ts +17 -17
  591. package/out/server/getMemberIdentifier.js +508 -508
  592. package/out/server/getProcessComponents.d.ts +2 -2
  593. package/out/server/getProcessComponents.js +12 -12
  594. package/out/server/getProcesses.d.ts +33 -33
  595. package/out/server/getProcesses.js +596 -596
  596. package/out/server/getScope.d.ts +13 -13
  597. package/out/server/getScope.js +60 -60
  598. package/out/server/getValidates.d.ts +3 -3
  599. package/out/server/getValidates.js +13 -13
  600. package/out/server/index.d.ts +5 -5
  601. package/out/server/index.js +41 -41
  602. package/out/server/naslServer.d.ts +375 -371
  603. package/out/server/naslServer.js +4706 -4585
  604. package/out/server/naslServer.js.map +1 -1
  605. package/out/server/naslStdlibMap.d.ts +2 -2
  606. package/out/server/naslStdlibMap.js +53 -53
  607. package/out/server/process2LogicNamespace.d.ts +26 -26
  608. package/out/server/process2LogicNamespace.js +108 -108
  609. package/out/server/translator.d.ts +26 -26
  610. package/out/server/translator.js +819 -805
  611. package/out/server/translator.js.map +1 -1
  612. package/out/service/creator/add.configs.d.ts +1 -1
  613. package/out/service/creator/add.configs.js +102 -102
  614. package/out/service/creator/errHandles.d.ts +18 -18
  615. package/out/service/creator/errHandles.js +67 -67
  616. package/out/service/creator/index.d.ts +1 -1
  617. package/out/service/creator/index.js +86 -86
  618. package/out/service/datasource/api.d.ts +12 -12
  619. package/out/service/datasource/api.js +13 -13
  620. package/out/service/datasource/index.d.ts +2 -2
  621. package/out/service/datasource/index.js +9 -9
  622. package/out/service/defaultErrorMessage.json +98 -98
  623. package/out/service/logic/api.d.ts +9 -9
  624. package/out/service/logic/api.js +10 -10
  625. package/out/service/logic/checktypeSocket.d.ts +5 -5
  626. package/out/service/logic/checktypeSocket.js +54 -54
  627. package/out/service/logic/index.d.ts +2 -2
  628. package/out/service/logic/index.js +9 -9
  629. package/out/service/storage/api.d.ts +54 -54
  630. package/out/service/storage/api.js +41 -41
  631. package/out/service/storage/index.d.ts +2 -2
  632. package/out/service/storage/index.js +9 -9
  633. package/out/service/storage/init.d.ts +102 -102
  634. package/out/service/storage/init.js +1161 -1161
  635. package/out/service/storage/jsoner.d.ts +36 -36
  636. package/out/service/storage/jsoner.js +128 -130
  637. package/out/service/storage/jsoner.js.map +1 -1
  638. package/out/service/storage/map.d.ts +4 -4
  639. package/out/service/storage/map.js +53 -53
  640. package/out/service/storage/service.d.ts +25 -25
  641. package/out/service/storage/service.js +79 -79
  642. package/out/service/storage/storagePoint.d.ts +17 -17
  643. package/out/service/storage/storagePoint.js +75 -75
  644. package/out/service/video/BaseService.d.ts +7 -7
  645. package/out/service/video/BaseService.js +60 -60
  646. package/out/service/video/MainCallbackService.d.ts +12 -12
  647. package/out/service/video/MainCallbackService.js +182 -182
  648. package/out/service/video/VideoTranscribe.d.ts +15 -15
  649. package/out/service/video/VideoTranscribe.js +95 -95
  650. package/out/service/video/publishService.d.ts +1 -1
  651. package/out/service/video/publishService.js +57 -57
  652. package/out/templator/genCallComponentLogic.d.ts +17 -17
  653. package/out/templator/genCallComponentLogic.js +28 -28
  654. package/out/templator/genCreateBlock.d.ts +10 -10
  655. package/out/templator/genCreateBlock.js +297 -297
  656. package/out/templator/genCurdEditMultipleKeyBlock.d.ts +8 -8
  657. package/out/templator/genCurdEditMultipleKeyBlock.js +398 -398
  658. package/out/templator/genCurdMultipleKeyBlock.d.ts +34 -34
  659. package/out/templator/genCurdMultipleKeyBlock.js +541 -541
  660. package/out/templator/genEditTableBlock.d.ts +51 -51
  661. package/out/templator/genEditTableBlock.js +255 -255
  662. package/out/templator/genEnumSelectBlock.d.ts +10 -10
  663. package/out/templator/genEnumSelectBlock.js +21 -21
  664. package/out/templator/genGetBlock.d.ts +6 -6
  665. package/out/templator/genGetBlock.js +96 -96
  666. package/out/templator/genGridViewBlock.d.ts +55 -55
  667. package/out/templator/genGridViewBlock.js +286 -286
  668. package/out/templator/genListViewBlock.d.ts +19 -19
  669. package/out/templator/genListViewBlock.js +108 -108
  670. package/out/templator/genQueryComponent.d.ts +34 -34
  671. package/out/templator/genQueryComponent.js +348 -348
  672. package/out/templator/genSelectBlock.d.ts +45 -45
  673. package/out/templator/genSelectBlock.js +340 -340
  674. package/out/templator/genTableBlock.d.ts +53 -53
  675. package/out/templator/genTableBlock.js +226 -226
  676. package/out/templator/genUpdateBlock.d.ts +6 -6
  677. package/out/templator/genUpdateBlock.js +322 -322
  678. package/out/templator/index.d.ts +19 -19
  679. package/out/templator/index.js +37 -37
  680. package/out/templator/utils.d.ts +683 -683
  681. package/out/templator/utils.js +458 -458
  682. package/out/translator/constant.d.ts +6 -6
  683. package/out/translator/constant.js +9 -9
  684. package/out/translator/index.d.ts +3 -3
  685. package/out/translator/index.js +19 -19
  686. package/out/translator/types.d.ts +33 -32
  687. package/out/translator/types.js +2 -2
  688. package/out/translator/utils.d.ts +17 -17
  689. package/out/translator/utils.js +110 -97
  690. package/out/translator/utils.js.map +1 -1
  691. package/out/utils/cookie.d.ts +9 -9
  692. package/out/utils/cookie.js +61 -61
  693. package/out/utils/env.d.ts +2 -2
  694. package/out/utils/env.js +5 -5
  695. package/out/utils/i18nInfo.d.ts +5 -5
  696. package/out/utils/i18nInfo.js +60 -60
  697. package/out/utils/index.d.ts +44 -44
  698. package/out/utils/index.js +200 -200
  699. package/out/utils/logger.d.ts +7 -7
  700. package/out/utils/logger.js +22 -22
  701. package/out/utils/sortTsString.d.ts +1 -1
  702. package/out/utils/sortTsString.js +43 -37
  703. package/out/utils/sortTsString.js.map +1 -1
  704. package/out/utils/string.d.ts +51 -51
  705. package/out/utils/string.js +106 -106
  706. package/out/utils/time-slicing.d.ts +41 -41
  707. package/out/utils/time-slicing.js +81 -81
  708. package/out/utils/traverse.d.ts +36 -36
  709. package/out/utils/traverse.js +142 -142
  710. package/out/utils/types.d.ts +1 -1
  711. package/out/utils/types.js +2 -2
  712. package/out/utils/window.d.ts +7 -7
  713. package/out/utils/window.js +13 -13
  714. package/package.json +8 -8
  715. package/sandbox/stdlib/nasl.oql.ts +6 -1
  716. package/sandbox-natural/stdlib/nasl.core.ts +6 -3
  717. package/sandbox-natural/stdlib/nasl.oql.ts +6 -0
  718. package/sandbox-natural/stdlib/nasl.util.ts +2 -1
  719. package/src/automate/template/myProcess.js +3 -2
  720. package/src/common/BaseNode.ts +108 -51
  721. package/src/concepts/Abort__.ts +4 -1
  722. package/src/concepts/AbstractInterface__.ts +64 -0
  723. package/src/concepts/Anchor__.ts +6 -2
  724. package/src/concepts/AnonymousFunction__.ts +11 -5
  725. package/src/concepts/App__.ts +1648 -1378
  726. package/src/concepts/Argument__.ts +7 -3
  727. package/src/concepts/Assignee__.ts +10 -5
  728. package/src/concepts/AssignmentLine__.ts +3 -0
  729. package/src/concepts/Assignment__.ts +8 -4
  730. package/src/concepts/Attribute__.ts +7 -2
  731. package/src/concepts/AuthInterface__.ts +3 -0
  732. package/src/concepts/AuthLogicForCallInterface__.ts +8 -4
  733. package/src/concepts/AuthLogic__.ts +3 -0
  734. package/src/concepts/BackendVariable__.ts +11 -4
  735. package/src/concepts/Backend__.ts +5 -1
  736. package/src/concepts/BatchAssignment__.ts +13 -8
  737. package/src/concepts/BinaryExpression__.ts +10 -6
  738. package/src/concepts/BindAttribute__.ts +6 -2
  739. package/src/concepts/BindDirective__.ts +11 -4
  740. package/src/concepts/BindEvent__.ts +8 -3
  741. package/src/concepts/BindStyle__.ts +5 -1
  742. package/src/concepts/BooleanLiteral__.ts +4 -1
  743. package/src/concepts/CallAuthInterface__.ts +11 -3
  744. package/src/concepts/CallConnector__.ts +3 -0
  745. package/src/concepts/CallFunction__.ts +41 -15
  746. package/src/concepts/CallInterface__.ts +33 -21
  747. package/src/concepts/CallLogic__.ts +41 -35
  748. package/src/concepts/CallQueryComponent__.ts +11 -14
  749. package/src/concepts/Comment__.ts +3 -0
  750. package/src/concepts/CompletionProperty__.ts +5 -1
  751. package/src/concepts/ConfigGroup__.ts +5 -1
  752. package/src/concepts/ConfigPropertyValue__.ts +3 -0
  753. package/src/concepts/ConfigProperty__.ts +5 -1
  754. package/src/concepts/Configuration__.ts +5 -1
  755. package/src/concepts/Connection__.ts +5 -1
  756. package/src/concepts/ConnectorTrigger__.ts +3 -0
  757. package/src/concepts/Connector__.ts +910 -25
  758. package/src/concepts/Constant__.ts +9 -4
  759. package/src/concepts/DataSource__.ts +5 -1
  760. package/src/concepts/DatabaseTypeAnnotation__.ts +3 -0
  761. package/src/concepts/DefaultValue__.ts +4 -3
  762. package/src/concepts/Destination__.ts +8 -4
  763. package/src/concepts/End__.ts +3 -0
  764. package/src/concepts/EntityIndex__.ts +3 -0
  765. package/src/concepts/EntityProperty__.ts +14 -4
  766. package/src/concepts/Entity__.ts +17 -2
  767. package/src/concepts/EnumItem__.ts +3 -0
  768. package/src/concepts/Enum__.ts +5 -1
  769. package/src/concepts/Event__.ts +5 -1
  770. package/src/concepts/ExternalDestination__.ts +7 -3
  771. package/src/concepts/ForEachStatement__.ts +21 -16
  772. package/src/concepts/FrontendLibrary__.ts +7 -2
  773. package/src/concepts/FrontendVariable__.ts +3 -0
  774. package/src/concepts/Frontend__.ts +59 -14
  775. package/src/concepts/Function__.ts +15 -7
  776. package/src/concepts/I18nInfo__.ts +1 -0
  777. package/src/concepts/Identifier__.ts +9 -2
  778. package/src/concepts/IfStatement__.ts +25 -22
  779. package/src/concepts/Integration__.ts +8 -4
  780. package/src/concepts/InterfaceFromExample__.ts +194 -0
  781. package/src/concepts/InterfaceParam__.ts +20 -4
  782. package/src/concepts/Interface__.ts +51 -25
  783. package/src/concepts/JSBlock__.ts +3 -0
  784. package/src/concepts/JavaLogic__.ts +3 -0
  785. package/src/concepts/LogicItem__.ts +3 -0
  786. package/src/concepts/Logic__.ts +48 -19
  787. package/src/concepts/MatchCase__.ts +16 -5
  788. package/src/concepts/Match__.ts +8 -4
  789. package/src/concepts/MemberExpression__.ts +8 -4
  790. package/src/concepts/MicroApp__.ts +3 -0
  791. package/src/concepts/Module__.ts +286 -893
  792. package/src/concepts/MsgTriggerEvent__.ts +5 -1
  793. package/src/concepts/MsgTriggerLauncher__.ts +6 -2
  794. package/src/concepts/Namespace__.ts +246 -173
  795. package/src/concepts/NewComposite__.ts +54 -103
  796. package/src/concepts/NewList__.ts +27 -18
  797. package/src/concepts/NewMap__.ts +29 -15
  798. package/src/concepts/New__.ts +3 -0
  799. package/src/concepts/NullLiteral__.ts +4 -1
  800. package/src/concepts/NumericLiteral__.ts +6 -2
  801. package/src/concepts/OqlQueryComponent__.ts +8 -1
  802. package/src/concepts/OverriddenLogic__.ts +18 -7
  803. package/src/concepts/Param__.ts +8 -2
  804. package/src/concepts/Point__.ts +3 -0
  805. package/src/concepts/ProcessComponent__.ts +7 -2
  806. package/src/concepts/ProcessElement__.ts +19 -8
  807. package/src/concepts/ProcessOutcome__.ts +20 -2
  808. package/src/concepts/ProcessOutcomes__.ts +20 -2
  809. package/src/concepts/Process__.ts +15 -7
  810. package/src/concepts/QueryAggregateExpression__.ts +5 -1
  811. package/src/concepts/QueryFieldExpression__.ts +3 -0
  812. package/src/concepts/QueryFromExpression__.ts +5 -1
  813. package/src/concepts/QueryGroupByExpression__.ts +5 -1
  814. package/src/concepts/QueryJoinExpression__.ts +5 -1
  815. package/src/concepts/QueryLimitExpression__.ts +5 -1
  816. package/src/concepts/QueryOrderByExpression__.ts +5 -1
  817. package/src/concepts/QuerySelectExpression__.ts +5 -1
  818. package/src/concepts/Rect__.ts +3 -0
  819. package/src/concepts/Return__.ts +9 -3
  820. package/src/concepts/Role__.ts +3 -0
  821. package/src/concepts/SelectMembers__.ts +5 -1
  822. package/src/concepts/Slot__.ts +5 -1
  823. package/src/concepts/SqlQueryComponent__.ts +5 -1
  824. package/src/concepts/Start__.ts +3 -0
  825. package/src/concepts/StringInterpolation__.ts +7 -3
  826. package/src/concepts/StringLiteral__.ts +12 -3
  827. package/src/concepts/StructureProperty__.ts +12 -4
  828. package/src/concepts/Structure__.ts +25 -3
  829. package/src/concepts/SwitchCase__.ts +9 -1
  830. package/src/concepts/SwitchStatement__.ts +7 -3
  831. package/src/concepts/Theme__.ts +3 -0
  832. package/src/concepts/Transactional__.ts +3 -0
  833. package/src/concepts/TriggerEvent__.ts +5 -1
  834. package/src/concepts/TriggerLauncher__.ts +3 -0
  835. package/src/concepts/TypeAnnotation__.ts +62 -23
  836. package/src/concepts/TypeParam__.ts +3 -0
  837. package/src/concepts/UnaryExpression__.ts +8 -4
  838. package/src/concepts/Unparsed__.ts +5 -2
  839. package/src/concepts/UseComponent__.ts +3 -0
  840. package/src/concepts/ValidationRule__.ts +21 -7
  841. package/src/concepts/Variable__.ts +10 -4
  842. package/src/concepts/ViewBlock__.ts +3 -0
  843. package/src/concepts/ViewComponent__.ts +15 -6
  844. package/src/concepts/ViewElement__.ts +13 -5
  845. package/src/concepts/View__.ts +27 -11
  846. package/src/concepts/WhileStatement__.ts +7 -1
  847. package/src/concepts/basics/constants.ts +2 -0
  848. package/src/concepts/basics/stdlib/nasl.util.ts +3 -3
  849. package/src/concepts/index__.ts +2 -0
  850. package/src/concepts/types__.ts +4 -0
  851. package/src/decorators/index.ts +55 -0
  852. package/src/enums/KEYWORDS.ts +2 -0
  853. package/src/generator/genBundleFiles.ts +7 -7
  854. package/src/generator/genMetaData.ts +7 -2
  855. package/src/generator/genReleaseBody.ts +8 -4
  856. package/src/generator/icestark.ts +4 -2
  857. package/src/generator/qiankun.ts +3 -1
  858. package/src/natural/genNaturalTS.ts +5 -6
  859. package/src/natural/transformTSCode.ts +53 -13
  860. package/src/sentry/index.ts +3 -1
  861. package/src/server/extendBaseNode.ts +30 -2
  862. package/src/server/naslServer.ts +142 -22
  863. package/src/server/translator.ts +13 -1
  864. package/src/service/storage/jsoner.ts +2 -2
  865. package/src/translator/types.ts +1 -0
  866. package/src/translator/utils.ts +15 -0
  867. package/src/utils/sortTsString.ts +9 -4
  868. package/test/concepts/call-function/__snapshots__/toEmbeddedTS.spec.ts.snap +26 -0
  869. package/test/concepts/call-function/__snapshots__/toJS.spec.ts.snap +26 -0
  870. package/test/concepts/call-function/constant.ts +5 -0
  871. package/test/concepts/call-function/fixtures/from-string.json +100 -0
  872. package/test/concepts/call-function/fixtures/to-string-global-tz.json +99 -0
  873. package/test/concepts/call-function/fixtures/to-string-no-tz.json +89 -0
  874. package/test/concepts/call-function/fixtures/to-string-user-tz.json +101 -0
  875. package/test/concepts/call-function/fixtures/to-string-utc-tz.json +101 -0
  876. package/test/concepts/call-function/toEmbeddedTS.spec.ts +14 -0
  877. package/test/concepts/call-function/toJS.spec.ts +14 -0
  878. package/test/concepts/call-interface/__snapshots__/toEmbeddedTS.spec.ts.snap +6 -3
  879. package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +3 -3
  880. package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +3 -3
@@ -1,1162 +1,1162 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.loadAppSync = exports.mountDatabaseTypes = exports.loadApp = exports.handleApp = exports.taskQueue = exports.operationRecordPlayback = exports.operationRecordQuery = exports.doOperationRecord = exports.operationRecordInfoMap = exports.databaseTypes = exports.breakpoint = exports.batchInstruct = exports.batchAction = exports.batchQuery = void 0;
30
- const lodash_1 = require("lodash");
31
- const concepts_1 = require("../../concepts");
32
- const breakpoint_1 = require("../../breakpoint");
33
- const decorators_1 = require("../../decorators");
34
- const config_1 = require("../../config");
35
- const service_1 = __importDefault(require("./service"));
36
- const uuid_1 = require("uuid");
37
- const stepRecorder_1 = __importDefault(require("../../manager/stepRecorder"));
38
- const jsoner = __importStar(require("./jsoner"));
39
- /// #if !process.env.NODE_ENV || process.env.BUILD_TARGET === 'node'
40
- const fs = __importStar(require("fs-extra"));
41
- /// #endif
42
- exports.batchQuery = service_1.default.batchQuery;
43
- exports.batchAction = service_1.default.batchAction;
44
- exports.batchInstruct = service_1.default.batchInstruct;
45
- exports.breakpoint = service_1.default.breakpoint;
46
- let tabTimestamp;
47
- exports.databaseTypes = service_1.default.databaseTypes;
48
- exports.operationRecordInfoMap = new Map();
49
- // 操作栈记录
50
- function doOperationRecord(operation) {
51
- const request = indexedDB.open('naslData', 1);
52
- request.onupgradeneeded = (event) => {
53
- const db = event.target.result;
54
- const objectStore = db.createObjectStore('operationRecord', { autoIncrement: true });
55
- objectStore.createIndex('appId', 'appId');
56
- objectStore.createIndex('timestamp', 'timestamp');
57
- };
58
- request.onsuccess = (event) => {
59
- const db = event.target.result;
60
- const transaction = db.transaction('operationRecord', 'readwrite');
61
- const objectStore = transaction.objectStore('operationRecord');
62
- operation.appId = exports.operationRecordInfoMap.get('appId');
63
- operation.branchId = exports.operationRecordInfoMap.get('branchId');
64
- operation.accountId = exports.operationRecordInfoMap.get('accountId');
65
- operation.userId = exports.operationRecordInfoMap.get('userId');
66
- operation.phone = exports.operationRecordInfoMap.get('phone');
67
- // 将时间戳添加到记录中
68
- operation.timestamp = Date.now();
69
- // 这份数据不存在向上的引用,因此用cloneDeep没有关系
70
- objectStore.put((0, lodash_1.cloneDeep)(operation));
71
- transaction.oncomplete = () => {
72
- db.close();
73
- };
74
- };
75
- request.onerror = function (event) {
76
- console.log('Failed to open database');
77
- };
78
- }
79
- exports.doOperationRecord = doOperationRecord;
80
- // 删除失效数据
81
- async function deleteExpiredRecords() {
82
- return new Promise((resolve, reject) => {
83
- const request = indexedDB.open('naslData', 1);
84
- request.onupgradeneeded = (event) => {
85
- const db = event.target.result;
86
- const objectStore = db.createObjectStore('operationRecord', { autoIncrement: true });
87
- objectStore.createIndex('appId', 'appId');
88
- objectStore.createIndex('timestamp', 'timestamp');
89
- };
90
- request.onsuccess = (event) => {
91
- const db = event.target.result;
92
- const transaction = db.transaction('operationRecord', 'readwrite');
93
- const objectStore = transaction.objectStore('operationRecord');
94
- const index = objectStore.index('timestamp');
95
- // 设置有效期,默认7天
96
- const localStorageExpiresAt = window.localStorage.getItem('expiresAt');
97
- const expiresAt = Date.now() - (localStorageExpiresAt ? +localStorageExpiresAt : 7 * 24 * 60 * 60 * 1000);
98
- const range = IDBKeyRange.upperBound(expiresAt);
99
- const expiredRecordsRequest = index.openCursor(range);
100
- expiredRecordsRequest.onsuccess = (event) => {
101
- const cursor = event.target.result;
102
- if (cursor) {
103
- console.log(cursor);
104
- objectStore.delete(cursor.primaryKey);
105
- cursor.continue();
106
- }
107
- else {
108
- resolve(void 0);
109
- }
110
- };
111
- transaction.oncomplete = () => {
112
- db.close();
113
- };
114
- };
115
- request.onerror = (event) => {
116
- reject('Failed to open database');
117
- };
118
- });
119
- }
120
- // 操作栈查询
121
- function operationRecordQuery(app) {
122
- return new Promise((resolve, reject) => {
123
- const appId = app?.id;
124
- const branchId = app?.__branchId;
125
- const request = indexedDB.open('naslData', 1);
126
- request.onsuccess = (event) => {
127
- const db = event.target.result;
128
- const transaction = db.transaction('operationRecord', 'readonly');
129
- const objectStore = transaction.objectStore('operationRecord');
130
- const index = objectStore.index('appId'); // 查询 'appId' 索引
131
- const range = IDBKeyRange.only(appId);
132
- const result = [];
133
- const request = index.openCursor(range);
134
- request.onsuccess = (event) => {
135
- const cursor = event.target.result;
136
- if (cursor) {
137
- const record = cursor.value;
138
- const branchId = exports.operationRecordInfoMap.get('branchId');
139
- if (record.branchId === branchId) {
140
- result.push(record);
141
- }
142
- cursor.continue();
143
- }
144
- else {
145
- console.log('操作记录栈:', result);
146
- resolve(result);
147
- }
148
- };
149
- transaction.oncomplete = () => {
150
- db.close();
151
- };
152
- };
153
- request.onerror = (event) => {
154
- reject('Failed to open database');
155
- };
156
- });
157
- }
158
- exports.operationRecordQuery = operationRecordQuery;
159
- // 获取父对象
160
- function getParentInfo(appJson, path) {
161
- const pathArr = [];
162
- (path?.split('.') || []).forEach((pathItem) => {
163
- const arrayPropertyKey = pathItem.split('[')[0];
164
- const matchArr = pathItem.match(/\[(.+?)\]/);
165
- if (matchArr) {
166
- pathArr.push(arrayPropertyKey, matchArr[0]);
167
- }
168
- else {
169
- pathArr.push(pathItem);
170
- }
171
- });
172
- pathArr.pop();
173
- let parentPath = '';
174
- pathArr.forEach((pathItem, index) => {
175
- const matchArr = pathItem.match(/\[(.+?)\]/);
176
- if (matchArr || index === 0) {
177
- parentPath += pathItem;
178
- }
179
- else {
180
- parentPath += `.${pathItem}`;
181
- }
182
- });
183
- const parentNode = jsoner.queryNodeByPath(appJson, parentPath);
184
- return {
185
- parentPath,
186
- parentNode,
187
- };
188
- }
189
- // 操作记录回放
190
- async function operationRecordPlayback(app, action) {
191
- const operationRecord = await operationRecordQuery(app);
192
- let operationRecordIndex = exports.operationRecordInfoMap.get('operationRecordIndex');
193
- if ([null, undefined].includes(operationRecordIndex)) {
194
- operationRecordIndex = operationRecord?.length;
195
- }
196
- const appJson = app.toJSON();
197
- if (action === 'undo') {
198
- if (operationRecordIndex > 0) {
199
- const currentRecordItem = operationRecord?.[operationRecordIndex];
200
- const { type, action: recordItemAction } = currentRecordItem || {};
201
- // 多人协作
202
- if (type === 'cooperation' && recordItemAction === 'confirmPull') {
203
- console.log(`当前所处栈位置:${operationRecordIndex},已经进行了多人协作“合并”操作,无法继续对操作栈进行回放!`);
204
- return;
205
- }
206
- operationRecordIndex--;
207
- }
208
- else {
209
- console.log(`当前所处栈位置:${operationRecordIndex},无法继续回放`);
210
- console.log('当前appJSON:', appJson);
211
- return;
212
- }
213
- }
214
- else {
215
- if (operationRecordIndex < operationRecord?.length) {
216
- operationRecordIndex++;
217
- }
218
- else {
219
- console.log(`当前所处栈位置:${operationRecordIndex},无法继续前进`);
220
- console.log('当前appJSON:', appJson);
221
- return;
222
- }
223
- }
224
- exports.operationRecordInfoMap.set('operationRecordIndex', operationRecordIndex);
225
- const currentIndex = operationRecordIndex;
226
- ([...operationRecord].splice(currentIndex, operationRecord?.length) || []).reverse()?.forEach((recordItem) => {
227
- const { actionItem } = recordItem || {};
228
- const { list } = actionItem || {};
229
- [...(list || [])].reverse().forEach((actionItem) => {
230
- const { path, action, oldObject, parentKey, index: oldIndex } = actionItem || {};
231
- const { parentNode } = getParentInfo(appJson, path);
232
- const node = jsoner.queryNodeByPath(appJson, path);
233
- switch (action) {
234
- case 'create':
235
- if (Array.isArray(parentNode)) {
236
- const index = parentNode.indexOf(node);
237
- if (index !== -1) {
238
- parentNode.splice(index, 1);
239
- }
240
- }
241
- else {
242
- parentNode[parentKey] = null;
243
- }
244
- break;
245
- case 'delete':
246
- if (Array.isArray(parentNode) && oldIndex !== -1) {
247
- parentNode.splice(oldIndex, 0, oldObject);
248
- }
249
- else {
250
- parentNode[parentKey] = oldObject;
251
- }
252
- break;
253
- case 'update':
254
- for (const key in oldObject) {
255
- node[key] = oldObject[key] ?? null;
256
- }
257
- break;
258
- }
259
- });
260
- });
261
- console.log('当前所处栈位置:', currentIndex);
262
- console.log('当前appJSON:', appJson);
263
- return appJson;
264
- }
265
- exports.operationRecordPlayback = operationRecordPlayback;
266
- function getLogic(key, app, diffLogicList) {
267
- if (!diffLogicList.includes(key)) {
268
- diffLogicList.push(key);
269
- if (key.startsWith('app')) {
270
- const index = key.lastIndexOf('.');
271
- const name = key.slice(index + 1);
272
- const logic = app.logics.find((item) => item.name === name);
273
- if (logic && logic.body && logic.body.length > 2) {
274
- logic.body.map((item) => getStatement(item, app, diffLogicList));
275
- }
276
- }
277
- else if (key.startsWith('extensions')) {
278
- const _pathArr = key.split('.');
279
- const _name = _pathArr[1];
280
- const _path = _pathArr[3];
281
- const _list = app.dependencies;
282
- const _module = _list.find((it) => {
283
- const name = it.name.replaceAll('-', '_');
284
- return name === _name;
285
- });
286
- const logic = _module?.logics?.find((item) => item.name === _path);
287
- if (logic && logic.body && logic.body.length > 2) {
288
- logic.body.map((item) => getStatement(item, app, diffLogicList));
289
- }
290
- }
291
- }
292
- }
293
- /* 获取LogicITEM */
294
- function getStatement(state, app, diffLogicList) {
295
- let logicItems = [];
296
- switch (state.concept) {
297
- case 'Assignment':
298
- logicItems = [state.left, state.right];
299
- break;
300
- case 'IfStatement':
301
- logicItems = [...state.consequent, ...state.alternate];
302
- break;
303
- case 'ForEachStatement':
304
- logicItems = [...state.body, state.each, state.start, state.end];
305
- break;
306
- case 'Match':
307
- logicItems = [state.expression, ...state.cases.map(getStatement).flat(1)];
308
- break;
309
- case 'MatchCase':
310
- logicItems = [...state.patterns, ...state.body];
311
- break;
312
- case 'SwitchStatement':
313
- logicItems = state.cases.map(getStatement).flat(1);
314
- break;
315
- case 'SwitchCase':
316
- logicItems = [state.test, ...state.consequent];
317
- break;
318
- case 'WhileStatement':
319
- logicItems = [state.test, ...state.body];
320
- break;
321
- case 'CallLogic':
322
- logicItems = state.arguments?.map((item) => item.expression);
323
- getLogic(state.calleewholeKey, app, diffLogicList);
324
- break;
325
- case 'CallFunction':
326
- logicItems = state.arguments?.map((item) => item.expression);
327
- break;
328
- case 'CallInterface':
329
- logicItems = state.arguments?.map((item) => item.expression);
330
- break;
331
- case 'ExternalDestination':
332
- logicItems = [state.anchor, state.link];
333
- break;
334
- case 'BatchAssignment':
335
- logicItems = [state.left?.expression, ...state.left?.members, ...state.rights.map((item) => [item?.expression, ...item?.members]).flat(1)];
336
- break;
337
- case 'MemberExpression':
338
- logicItems = [state.object, state.property];
339
- break;
340
- case 'StringInterpolation':
341
- logicItems = [...state.expressions];
342
- break;
343
- case 'NewComposite':
344
- logicItems = [...state.rights.map((item) => item.expression)];
345
- break;
346
- case 'NewList':
347
- logicItems = [...state.items];
348
- break;
349
- default:
350
- break;
351
- }
352
- return logicItems.filter((item) => !!item);
353
- }
354
- /* 小程序影响的服务端发布 */
355
- function getMiniAppChange(target, obj, action) {
356
- if (!target.app.miniEnable) {
357
- return false;
358
- }
359
- /* 分端以后需要改 */
360
- const len = target.nodePath?.split('.').length;
361
- if (len > 2) {
362
- return false;
363
- }
364
- if (action === 'delete') {
365
- return true;
366
- }
367
- else {
368
- if ('name' in obj || 'title' in obj) {
369
- return true;
370
- }
371
- }
372
- }
373
- let aiExecuted = 0;
374
- let sessionPath = '';
375
- // AI 生成内容是否被采纳
376
- const handleAIPoint = (app, actionItem) => {
377
- const { actionMsg, action } = actionItem || {};
378
- if (aiExecuted > 0) {
379
- app.emit('logic:accepted', { ...actionItem, sessionPath });
380
- aiExecuted -= 1;
381
- }
382
- if (actionMsg.includes('自然语言生成代码') && !action) {
383
- aiExecuted += 1;
384
- // eslint-disable-next-line prefer-destructuring
385
- sessionPath = actionMsg.match(/:(.*)/)[1];
386
- }
387
- };
388
- /**
389
- * 执行更新
390
- */
391
- async function doAction(app, actionItem) {
392
- const isOperationRecord = exports.operationRecordInfoMap.get('isOperationRecord');
393
- if (isOperationRecord) {
394
- console.log('正在进行操作栈回放操作,如需行任何Nasl操作请刷新页面');
395
- return;
396
- }
397
- let hasFrontEnd = false;
398
- let hasBackEnd = false;
399
- const actionList = [];
400
- const allRiskList = [];
401
- const { list, actionMsg, action } = actionItem || {};
402
- handleAIPoint(app, actionItem);
403
- const itemloop = (_i, app, diffArr) => {
404
- const _l = getStatement(_i, app, diffArr);
405
- if (_l.length) {
406
- _l.map((_ii) => itemloop(_ii, app, diffArr));
407
- }
408
- };
409
- const loopEle = (view, checkAuth) => {
410
- if (view instanceof concepts_1.View) {
411
- view?.elements?.forEach((item) => loopEle(item, checkAuth));
412
- }
413
- view?.children?.forEach((item) => loopEle(item, checkAuth));
414
- if (view instanceof concepts_1.ViewElement) {
415
- if (view.bindEvents.length) {
416
- const diffArr = [];
417
- view.bindEvents.forEach((bindEvent) => {
418
- bindEvent.logics.forEach((logic) => {
419
- logic.body.forEach((logicItem) => itemloop(logicItem, app, diffArr));
420
- });
421
- });
422
- const result = diffArr.filter((item) => item.startsWith('app') || item.startsWith('extensions'));
423
- if (result.length) {
424
- hasBackEnd = true;
425
- }
426
- }
427
- if (view.tag === 'u-uploader' || view.tag === 'van-uploader') {
428
- const bute = view?.bindAttrs.find((item) => item.name === 'url');
429
- const needUpdateBackEnd = bute?.value?.endsWith('/import') || bute?.value?.includes('/upload/');
430
- if (checkAuth) {
431
- if (needUpdateBackEnd && !view.view.parentAuth) {
432
- hasBackEnd = true;
433
- }
434
- }
435
- else {
436
- if (needUpdateBackEnd) {
437
- hasBackEnd = true;
438
- }
439
- }
440
- }
441
- }
442
- };
443
- const loopEleAuth = (viewElement) => {
444
- viewElement?.children?.forEach((item) => {
445
- const bindDirective = item?.bindDirectives?.find((item) => item.name === 'auth');
446
- if (bindDirective) {
447
- hasBackEnd = true;
448
- }
449
- loopEleAuth(item);
450
- });
451
- };
452
- try {
453
- if (Array.isArray(list)) {
454
- list.forEach((event) => {
455
- const emitTarget = event?.originEvent?.target;
456
- const _path = event.originEvent.path;
457
- const _root = _path.split('.')?.[1] || '';
458
- if (['backend', 'overriddenLogics', 'dataSources', 'processes', 'roles', 'logics', 'enums', 'structures', 'interfaces', 'interfaceDependencies', 'configuration', 'dependencies', 'authLogics', 'authLogicsForCallInterface', 'triggerLaunchers', 'connections'].some((item) => _root.startsWith(item))) {
459
- hasBackEnd = true;
460
- }
461
- if (emitTarget) {
462
- if (emitTarget.concept === 'App') {
463
- if (event?.object?.preferenceMap || event?.originEvent?.object?.preferenceMap) {
464
- hasBackEnd = true;
465
- hasFrontEnd = true;
466
- }
467
- }
468
- if (emitTarget.concept === 'ValidationRule') {
469
- if (event?.object?.enableServerValidation ||
470
- event?.originEvent?.object?.enableServerValidation) {
471
- hasBackEnd = true;
472
- hasFrontEnd = true;
473
- }
474
- }
475
- if (emitTarget.concept === 'Logic') {
476
- const diffArr = [];
477
- if (emitTarget.body.length > 2) {
478
- emitTarget.body.forEach((it) => {
479
- itemloop(it, app, diffArr);
480
- });
481
- }
482
- const result = diffArr.filter((item) => item.startsWith('app') || item.startsWith('extensions'));
483
- if (result.length) {
484
- hasBackEnd = true;
485
- }
486
- }
487
- if ('view' in emitTarget && emitTarget.view) {
488
- hasFrontEnd = true;
489
- }
490
- if (emitTarget.concept === 'BindDirective') {
491
- const isDelete = event?.originEvent?.action === 'delete';
492
- if (isDelete) {
493
- const isAuto = ~event?.originEvent?.path?.indexOf('name=auth');
494
- if (isAuto) {
495
- hasBackEnd = true;
496
- }
497
- }
498
- if (event?.originEvent?.object?.name === 'auth') {
499
- hasBackEnd = true;
500
- }
501
- }
502
- if (emitTarget.concept === 'View') {
503
- if (getMiniAppChange(emitTarget, event?.originEvent?.object, event?.originEvent?.action)) {
504
- hasBackEnd = true;
505
- }
506
- const isDelete = event?.originEvent?.action === 'delete';
507
- const isAuthView = emitTarget.auth && event?.originEvent?.object?.name;
508
- const isUpdateAuth = event?.originEvent?.action === 'update' && event?.originEvent?.object && event?.originEvent?.object?.auth;
509
- const isUpdateBindRoles = event?.originEvent?.action === 'update' && event?.originEvent?.object && event?.originEvent?.object?.bindRoles;
510
- if (isDelete || isUpdateAuth || isUpdateBindRoles || isAuthView) {
511
- hasBackEnd = true;
512
- // const app = emitTarget.app;
513
- // const diffArr: string[] = [];
514
- // emitTarget.logics.forEach((logic: Logic) => {
515
- // if (logic.body.length > 2) {
516
- // logic.body.forEach((it: LogicItem) => {
517
- // itemloop(it, app, diffArr);
518
- // });
519
- // }
520
- // });
521
- // const result = diffArr.filter((item) => item.startsWith('app') || item.startsWith('extensions'));
522
- // if (result.length) {
523
- // hasBackEnd = true;
524
- // }
525
- // emitTarget.children.forEach((item: View | ViewElement) => loopEle(item, isDelete));
526
- // emitTarget.elements.forEach((item: View | ViewElement) => loopEle(item, isDelete));
527
- }
528
- hasFrontEnd = true;
529
- }
530
- if (emitTarget.concept === 'ViewElement') {
531
- if (event?.originEvent?.object?.name) {
532
- const bindDirective = emitTarget.bindDirectives.find((item) => item.name === 'auth');
533
- if (bindDirective) {
534
- hasBackEnd = true;
535
- }
536
- }
537
- if (event?.originEvent?.action === 'delete') {
538
- const bindDirective = emitTarget?.bindDirectives?.find((item) => item.name === 'auth');
539
- if (bindDirective) {
540
- hasBackEnd = true;
541
- }
542
- loopEleAuth(emitTarget);
543
- }
544
- if (event?.originEvent?.action !== 'create') {
545
- if (event?.originEvent?.object && event?.originEvent?.object?.bindRoles) {
546
- hasBackEnd = true;
547
- }
548
- }
549
- loopEle(emitTarget, true);
550
- }
551
- if (emitTarget.concept === 'BindAttribute' && emitTarget.name === 'url') {
552
- const needUpdateBackEnd = emitTarget?.value?.endsWith('/import') || emitTarget?.value?.includes('/upload/');
553
- if (!emitTarget.view.parentAuth && needUpdateBackEnd) {
554
- hasBackEnd = true;
555
- }
556
- }
557
- if (emitTarget.concept === 'CallLogic') {
558
- const arrlist = [];
559
- getLogic(emitTarget.calleeKey, emitTarget.app, arrlist);
560
- const result = arrlist.filter((item) => item.startsWith('app') || item.startsWith('extensions'));
561
- // console.log(result, 'CallLogic');
562
- if (result.length) {
563
- hasBackEnd = true;
564
- }
565
- }
566
- // 更新端时需要出发后端更新
567
- if (emitTarget.concept === 'Frontend') {
568
- hasBackEnd = true;
569
- }
570
- }
571
- event.eventList.forEach(({ action, riskList, path, object: objItem }) => {
572
- if (riskList) {
573
- allRiskList.push(...(riskList || []));
574
- }
575
- if (Array.isArray(objItem)) {
576
- if (action === 'update') {
577
- actionList.push({
578
- action,
579
- path,
580
- node: objItem[0],
581
- });
582
- }
583
- else {
584
- objItem.forEach((item, index) => {
585
- actionList.push({
586
- action,
587
- path,
588
- node: item,
589
- });
590
- });
591
- }
592
- }
593
- else {
594
- actionList.push({
595
- action,
596
- path,
597
- object: objItem,
598
- });
599
- }
600
- });
601
- });
602
- }
603
- }
604
- catch (error) {
605
- console.log(error);
606
- exports.taskQueue.refreshNasl(app, {
607
- errorInfo: {
608
- message: error?.message,
609
- stack: error?.stack,
610
- },
611
- });
612
- return;
613
- }
614
- const uuid = (0, uuid_1.v4)().replace(/-/g, '');
615
- const instructList = [{
616
- uuid,
617
- actions: actionList,
618
- riskList: allRiskList
619
- }];
620
- const operation = {
621
- type: 'doAction',
622
- uuid,
623
- actionItem: {
624
- actionMsg,
625
- list: list.map((item) => {
626
- const { path, action, object, oldObject, parentKey, index } = item?.originEvent || {};
627
- return {
628
- path,
629
- action,
630
- parentKey,
631
- index,
632
- object: object?.toJSON?.() || object,
633
- oldObject: oldObject?.toJSON?.() || oldObject,
634
- };
635
- }),
636
- },
637
- };
638
- saveNasl({ app, hasFrontEnd, hasBackEnd, instructList, operationList: [operation] });
639
- // 进行nasl操作后需要将Index重置
640
- exports.operationRecordInfoMap.set('operationRecordIndex', null);
641
- if (!app._historying) {
642
- if (app._historyIndex !== app._historyList.length) {
643
- app._historyList = app._historyList.splice(0, app._historyIndex);
644
- }
645
- app._historyList.push({
646
- actionMsg,
647
- list: list.map((item) => item?.originEvent),
648
- });
649
- app._historyIndex = app._historyList.length;
650
- }
651
- else {
652
- const actionMap = {
653
- undo: '已撤销操作:',
654
- redo: '已重做操作:',
655
- };
656
- let msg = actionMap[action];
657
- msg += actionMsg;
658
- if (process.env.BUILD_TARGET !== 'node') {
659
- require('element-plus').ElMessage.info(msg);
660
- }
661
- app._historying = false;
662
- }
663
- stepRecorder_1.default.initialized && stepRecorder_1.default.record(actionMsg, actionItem, actionList);
664
- }
665
- var TaskQueueStatus;
666
- (function (TaskQueueStatus) {
667
- TaskQueueStatus[TaskQueueStatus["ExceedMaxTaskCount"] = 0] = "ExceedMaxTaskCount";
668
- TaskQueueStatus[TaskQueueStatus["Retrying"] = 1] = "Retrying";
669
- })(TaskQueueStatus || (TaskQueueStatus = {}));
670
- class TaskQueue {
671
- queue = [];
672
- lastQueue = [];
673
- running = false;
674
- maxTaskCount = 10;
675
- status = undefined;
676
- addTask(task) {
677
- this.queue.push(task);
678
- if (this.queue.length >= this.maxTaskCount) {
679
- this.status = TaskQueueStatus.ExceedMaxTaskCount;
680
- task.app.emit('ExceedMaxTaskCount');
681
- }
682
- this.run();
683
- }
684
- clear() {
685
- this.queue = [];
686
- this.lastQueue = [];
687
- this.status = undefined;
688
- this.running = false;
689
- }
690
- async run(queue = this.queue) {
691
- if (this.running)
692
- return;
693
- if (queue.length === 0)
694
- return;
695
- const app = queue[0].app;
696
- let hasFrontEnd = false;
697
- let hasBackEnd = false;
698
- let instructList = [];
699
- let operationList = [];
700
- for (const task of queue) {
701
- if (task.hasFrontEnd)
702
- hasFrontEnd = true;
703
- if (task.hasBackEnd)
704
- hasBackEnd = true;
705
- instructList = instructList.concat(task.instructList);
706
- operationList = operationList.concat(task.operationList);
707
- }
708
- if (queue === this.queue) {
709
- this.lastQueue = [...queue];
710
- this.queue = [];
711
- }
712
- this.running = true;
713
- const error = await _saveNasl({
714
- app, hasFrontEnd, hasBackEnd, instructList, operationList
715
- });
716
- // code: 401650, 检测到当前应用拉取操作已被强制结束, 用户确认后再刷新
717
- // code: 500502 msg: "该应用已在新tab 页打开,请刷新!" 不重试或刷新
718
- if (!error)
719
- this.recover(app);
720
- else if (![401650, 500502].includes(error.code)) {
721
- // 连接失败,或超时,或后端持久化异常
722
- if ((error.message === 'Network Error' || error.message?.includes('timeout') || error.code === 500500)
723
- && this.status !== TaskQueueStatus.Retrying) {
724
- this.running = false;
725
- this.retry();
726
- }
727
- else
728
- this.refreshNasl(app);
729
- return;
730
- }
731
- this.running = false;
732
- this.run();
733
- }
734
- retry() {
735
- if (this.lastQueue.length === 0)
736
- return;
737
- const app = this.lastQueue[0].app;
738
- this.status = TaskQueueStatus.Retrying;
739
- app.emit('Retrying');
740
- this.run(this.lastQueue);
741
- }
742
- async refreshNasl(app, options = { errorInfo: {} }) {
743
- const failedQueue = this.lastQueue.map(({ hasFrontEnd, hasBackEnd, instructList }) => ({
744
- hasFrontEnd, hasBackEnd, instructList,
745
- }));
746
- const queue = this.queue.map(({ hasFrontEnd, hasBackEnd, instructList }) => ({
747
- hasFrontEnd, hasBackEnd, instructList,
748
- }));
749
- await service_1.default.saveFrontendNasl({
750
- body: {
751
- nasl: app?.toJSON(),
752
- failedQueue,
753
- queue,
754
- errorInfo: options.errorInfo,
755
- },
756
- }).catch((err) => {
757
- console.log('备份 nasl 失败:', err);
758
- });
759
- this.clear();
760
- app.emit('refresh');
761
- }
762
- recover(app) {
763
- switch (this.status) {
764
- case TaskQueueStatus.ExceedMaxTaskCount:
765
- app.emit('BelowMaxTaskCount');
766
- this.status = undefined;
767
- break;
768
- case TaskQueueStatus.Retrying:
769
- app.emit('SuccessRetry');
770
- this.status = undefined;
771
- break;
772
- }
773
- }
774
- }
775
- exports.taskQueue = new TaskQueue();
776
- async function saveNasl(options) {
777
- exports.taskQueue.addTask(options);
778
- }
779
- class Operation {
780
- appId;
781
- branchId;
782
- accountId;
783
- userId;
784
- phone;
785
- actionItem;
786
- res;
787
- err;
788
- parentKey;
789
- timestamp;
790
- type;
791
- uuid;
792
- action;
793
- }
794
- // 确保操作非高危
795
- function ensureSafe(instructList) {
796
- const riskList = [];
797
- instructList?.forEach((instruct) => {
798
- if (instruct?.riskList) {
799
- riskList.push(...(instruct.riskList || []));
800
- }
801
- instruct?.actions?.forEach((actionItem) => {
802
- const { path, action, object } = actionItem || {};
803
- if (path === 'app') {
804
- switch (action) {
805
- case 'create':
806
- riskList.push('重复创建App');
807
- break;
808
- case 'delete':
809
- riskList.push('删除App');
810
- break;
811
- case 'update':
812
- if (object?.hasOwnProperty('id')) {
813
- riskList.push('修改AppId');
814
- }
815
- break;
816
- }
817
- }
818
- });
819
- });
820
- return riskList;
821
- }
822
- async function _saveNasl(options) {
823
- const { app, hasFrontEnd, hasBackEnd, instructList, operationList } = options;
824
- app.emit('saving');
825
- let ChangedNASLType = '';
826
- if (hasFrontEnd && hasBackEnd) {
827
- ChangedNASLType = 'both';
828
- }
829
- else if (hasFrontEnd) {
830
- ChangedNASLType = 'web';
831
- }
832
- else if (hasBackEnd) {
833
- ChangedNASLType = 'backend';
834
- }
835
- let res;
836
- let err;
837
- if (config_1.config.storage.protocol === 'http') {
838
- try {
839
- const riskList = ensureSafe(instructList);
840
- if (Array.isArray(riskList) && riskList.length) {
841
- throw Error(`存在以下高危操作:\n${riskList.map((risk, index) => {
842
- return `${index + 1}.${risk};`;
843
- }).join('\n')}\n请及时排查原因`);
844
- }
845
- // 接口请求
846
- res = await service_1.default.batchInstruct({
847
- body: instructList,
848
- headers: {
849
- appId: app.id,
850
- ChangedNASLType,
851
- tabTimestamp,
852
- // 其他封装在 storageService 里了
853
- },
854
- });
855
- }
856
- catch (error) {
857
- err = error;
858
- console.error(err);
859
- }
860
- operationList.forEach((operation) => {
861
- doOperationRecord({
862
- ...operation,
863
- res,
864
- err,
865
- });
866
- });
867
- }
868
- else if (config_1.config.storage.protocol === 'mock') {
869
- // Do nothing
870
- }
871
- else {
872
- const json = await fs.readJSON(config_1.config.storage.basePath);
873
- let actionList = [];
874
- for (const { actions } of instructList) {
875
- actionList = actionList.concat(actions);
876
- }
877
- jsoner.batchAction(json, actionList);
878
- await fs.writeJSON(config_1.config.storage.basePath, json, {
879
- spaces: 4,
880
- });
881
- }
882
- app.emit('saved', err);
883
- return err;
884
- }
885
- function handleApp(app) {
886
- app._isCollectingCount = 0;
887
- app._collectingList = [];
888
- app._historyList = [];
889
- app._historyIndex = 0;
890
- app._historying = false;
891
- app._timer = null;
892
- app.on('undo', function () {
893
- const proxyApp = this;
894
- proxyApp._historying = true;
895
- });
896
- app.on('redo', function () {
897
- const proxyApp = this;
898
- proxyApp._historying = true;
899
- });
900
- /**
901
- * 开启收集
902
- */
903
- app.on('collect:start', function (event) {
904
- const proxyApp = this;
905
- if (proxyApp._timer) {
906
- clearTimeout(proxyApp._timer);
907
- }
908
- if (!proxyApp._noTimer) {
909
- proxyApp._noTimer = event.noTimer;
910
- }
911
- if (!proxyApp._noTimer) {
912
- proxyApp._timer = setTimeout(() => {
913
- console.error('收集超时,请及时排查原因', event);
914
- exports.taskQueue.refreshNasl(proxyApp, {
915
- errorInfo: {
916
- message: '收集超时,请及时排查原因',
917
- },
918
- });
919
- }, 2500);
920
- }
921
- if (!proxyApp._isCollectingCount) {
922
- proxyApp._actionMsg = event?.actionMsg;
923
- proxyApp._action = event?.action;
924
- }
925
- proxyApp._isCollectingCount++;
926
- });
927
- /**
928
- * 结束收集
929
- */
930
- app.on('collect:end', async function () {
931
- const proxyApp = this;
932
- proxyApp._isCollectingCount--;
933
- if (proxyApp._isCollectingCount === 0) {
934
- if (proxyApp._timer) {
935
- clearTimeout(proxyApp._timer);
936
- }
937
- // 结束收集时,立即将全局收集变量状态重置,防止下次收集数据混乱
938
- const collectingList = proxyApp._collectingList;
939
- const actionMsg = proxyApp._actionMsg;
940
- const action = proxyApp._action;
941
- proxyApp._collectingList = [];
942
- proxyApp._actionMsg = '';
943
- proxyApp._action = '';
944
- proxyApp._noTimer = undefined;
945
- if (Array.isArray(collectingList) && collectingList.length) {
946
- mountDatabaseTypes(proxyApp);
947
- proxyApp.naslServer?.embeddedTSEmitter?.emit('change', {
948
- value: collectingList,
949
- });
950
- await doAction(proxyApp, {
951
- list: collectingList,
952
- actionMsg,
953
- action,
954
- });
955
- }
956
- }
957
- else if (proxyApp._isCollectingCount < 0) {
958
- proxyApp._isCollectingCount = 0;
959
- throw Error('关闭收集有问题,请排查');
960
- }
961
- });
962
- /**
963
- * 有变更
964
- */
965
- app.on('storage', function (event) {
966
- const proxyApp = this;
967
- // 是否正在收集
968
- if (proxyApp._isCollectingCount === 0) {
969
- proxyApp.naslServer?.embeddedTSEmitter?.emit('change', {
970
- value: [event],
971
- });
972
- let actionMsg = '';
973
- const { action, target } = event.originEvent || {};
974
- const { concept, name } = target || {};
975
- switch (action) {
976
- case 'create':
977
- actionMsg = '添加';
978
- break;
979
- case 'delete':
980
- actionMsg = '删除';
981
- break;
982
- case 'update':
983
- actionMsg = '修改';
984
- break;
985
- }
986
- actionMsg += (0, decorators_1.getConceptConstructor)(concept).nodeTitle;
987
- if (name) {
988
- actionMsg += `“${name}”`;
989
- }
990
- doAction(proxyApp, {
991
- list: [event],
992
- actionMsg,
993
- });
994
- }
995
- else {
996
- proxyApp._collectingList.push(event);
997
- }
998
- });
999
- }
1000
- exports.handleApp = handleApp;
1001
- /**
1002
- * 加载 app
1003
- * @param appId 如果是从文件读,就不需要传
1004
- * @returns app 对象
1005
- */
1006
- async function loadApp(appId) {
1007
- try {
1008
- // 删除失效数据
1009
- deleteExpiredRecords();
1010
- }
1011
- catch (err) { }
1012
- let app;
1013
- if (config_1.config.storage.protocol === 'http') {
1014
- console.time('batchQuery');
1015
- const promises = [
1016
- service_1.default.batchQuery({
1017
- body: [
1018
- {
1019
- path: 'app'
1020
- // excludes: ['views'],
1021
- }
1022
- ],
1023
- headers: {
1024
- appId,
1025
- checkTabOpenTime: 'true'
1026
- // 其他封装在 storageService 里了
1027
- },
1028
- config: {
1029
- shortResponse: false
1030
- }
1031
- }),
1032
- service_1.default.breakpoint({
1033
- body: { appId }
1034
- })
1035
- ];
1036
- const [batchQueryRes, breakpointRes] = await Promise.all(promises);
1037
- // 请求
1038
- console.timeEnd('batchQuery');
1039
- tabTimestamp = batchQueryRes?.headers?.tabtimestamp;
1040
- const data = batchQueryRes?.data?.result;
1041
- console.time('new App');
1042
- app = new concepts_1.App(Object.assign(data?.[0], { id: appId }));
1043
- breakpointRes?.forEach((item = {}) => {
1044
- const { path, breakpointStatus } = item;
1045
- if (breakpointStatus) {
1046
- const node = app.findNodeByPath(path);
1047
- if (node) {
1048
- node.breakpoint = breakpointStatus;
1049
- }
1050
- }
1051
- });
1052
- console.timeEnd('new App');
1053
- if (!app.id) {
1054
- app.id = appId;
1055
- }
1056
- (0, breakpoint_1.addBreakpointNodesFromApp)(app);
1057
- }
1058
- else if (config_1.config.storage.protocol === 'mock') {
1059
- app = new concepts_1.App({
1060
- id: appId,
1061
- concept: 'App',
1062
- name: 'devapp',
1063
- title: '开发应用',
1064
- envs: 'dev,online',
1065
- hasAuth: true,
1066
- hasUserCenter: true,
1067
- dataSources: [],
1068
- structures: [],
1069
- enums: [],
1070
- logics: [],
1071
- interfaces: [],
1072
- processes: [],
1073
- roles: [],
1074
- dependencies: [],
1075
- interfaceDependencies: [],
1076
- frontends: [],
1077
- });
1078
- }
1079
- else {
1080
- const json = await fs.readJSON(config_1.config.storage.basePath);
1081
- app = new concepts_1.App(appId ? Object.assign(json, { id: appId }) : json);
1082
- }
1083
- // config.scope = app.scope;
1084
- handleApp(app);
1085
- app._isCollectingCount = 0;
1086
- mountDatabaseTypes(app);
1087
- return app;
1088
- }
1089
- exports.loadApp = loadApp;
1090
- // 在app上挂载所有的数据库类型
1091
- async function mountDatabaseTypes(app) {
1092
- if (!app.__databaseTypeMap) {
1093
- app.__databaseTypeMap = {};
1094
- }
1095
- const dataSources = app?.dataSources;
1096
- const dbTypeSet = new Set();
1097
- if (Array.isArray(dataSources)) {
1098
- dataSources.forEach((dataSource) => {
1099
- const dataSourceSqlType = JSON.parse(dataSource.dataSourceConfig?.devProperty?.value || '{}')?.type;
1100
- if (dataSourceSqlType && !app.__databaseTypeMap[dataSourceSqlType]) {
1101
- dbTypeSet.add(dataSourceSqlType);
1102
- }
1103
- });
1104
- }
1105
- const dbTypes = [...dbTypeSet];
1106
- if (Array.isArray(dbTypes) && dbTypes.length) {
1107
- const res = await (0, exports.databaseTypes)({
1108
- query: {
1109
- dbTypes: dbTypes.join(','),
1110
- },
1111
- });
1112
- if (Array.isArray(res)) {
1113
- res.forEach((databaseType) => {
1114
- const { dbType, columnTypes } = databaseType || {};
1115
- const columnTypeMap = {};
1116
- if (Array.isArray(columnTypes)) {
1117
- columnTypes.forEach((columnType) => {
1118
- const { naslType, dataBaseTypes } = columnType;
1119
- const dataBaseTypeMap = {};
1120
- let defaultDataBaseType;
1121
- if (Array.isArray(dataBaseTypes)) {
1122
- dataBaseTypes.forEach((dataBaseType) => {
1123
- const { type } = dataBaseType || {};
1124
- if (type) {
1125
- dataBaseTypeMap[type] = dataBaseType;
1126
- const { defaultType } = dataBaseType;
1127
- if (defaultType) {
1128
- defaultDataBaseType = dataBaseType;
1129
- }
1130
- }
1131
- });
1132
- }
1133
- columnTypeMap[naslType] = {
1134
- dataBaseTypes,
1135
- dataBaseTypeMap,
1136
- defaultDataBaseType,
1137
- };
1138
- });
1139
- }
1140
- app.__databaseTypeMap[dbType] = columnTypeMap;
1141
- });
1142
- }
1143
- }
1144
- if (Array.isArray(dataSources)) {
1145
- dataSources.forEach((dataSource) => {
1146
- dataSource.__hasDatabaseConfig = !!(app.__databaseTypeMap?.[dataSource.dataSourceSqlType]);
1147
- });
1148
- }
1149
- }
1150
- exports.mountDatabaseTypes = mountDatabaseTypes;
1151
- /**
1152
- * 加载 app
1153
- * @returns app 对象
1154
- */
1155
- function loadAppSync() {
1156
- const json = fs.readJSONSync(config_1.config.storage.basePath);
1157
- const app = new concepts_1.App(json);
1158
- handleApp(app);
1159
- return app;
1160
- }
1161
- exports.loadAppSync = loadAppSync;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.loadAppSync = exports.mountDatabaseTypes = exports.loadApp = exports.handleApp = exports.taskQueue = exports.operationRecordPlayback = exports.operationRecordQuery = exports.doOperationRecord = exports.operationRecordInfoMap = exports.databaseTypes = exports.breakpoint = exports.batchInstruct = exports.batchAction = exports.batchQuery = void 0;
30
+ const lodash_1 = require("lodash");
31
+ const concepts_1 = require("../../concepts");
32
+ const breakpoint_1 = require("../../breakpoint");
33
+ const decorators_1 = require("../../decorators");
34
+ const config_1 = require("../../config");
35
+ const service_1 = __importDefault(require("./service"));
36
+ const uuid_1 = require("uuid");
37
+ const stepRecorder_1 = __importDefault(require("../../manager/stepRecorder"));
38
+ const jsoner = __importStar(require("./jsoner"));
39
+ /// #if !process.env.NODE_ENV || process.env.BUILD_TARGET === 'node'
40
+ const fs = __importStar(require("fs-extra"));
41
+ /// #endif
42
+ exports.batchQuery = service_1.default.batchQuery;
43
+ exports.batchAction = service_1.default.batchAction;
44
+ exports.batchInstruct = service_1.default.batchInstruct;
45
+ exports.breakpoint = service_1.default.breakpoint;
46
+ let tabTimestamp;
47
+ exports.databaseTypes = service_1.default.databaseTypes;
48
+ exports.operationRecordInfoMap = new Map();
49
+ // 操作栈记录
50
+ function doOperationRecord(operation) {
51
+ const request = indexedDB.open('naslData', 1);
52
+ request.onupgradeneeded = (event) => {
53
+ const db = event.target.result;
54
+ const objectStore = db.createObjectStore('operationRecord', { autoIncrement: true });
55
+ objectStore.createIndex('appId', 'appId');
56
+ objectStore.createIndex('timestamp', 'timestamp');
57
+ };
58
+ request.onsuccess = (event) => {
59
+ const db = event.target.result;
60
+ const transaction = db.transaction('operationRecord', 'readwrite');
61
+ const objectStore = transaction.objectStore('operationRecord');
62
+ operation.appId = exports.operationRecordInfoMap.get('appId');
63
+ operation.branchId = exports.operationRecordInfoMap.get('branchId');
64
+ operation.accountId = exports.operationRecordInfoMap.get('accountId');
65
+ operation.userId = exports.operationRecordInfoMap.get('userId');
66
+ operation.phone = exports.operationRecordInfoMap.get('phone');
67
+ // 将时间戳添加到记录中
68
+ operation.timestamp = Date.now();
69
+ // 这份数据不存在向上的引用,因此用cloneDeep没有关系
70
+ objectStore.put((0, lodash_1.cloneDeep)(operation));
71
+ transaction.oncomplete = () => {
72
+ db.close();
73
+ };
74
+ };
75
+ request.onerror = function (event) {
76
+ console.log('Failed to open database');
77
+ };
78
+ }
79
+ exports.doOperationRecord = doOperationRecord;
80
+ // 删除失效数据
81
+ async function deleteExpiredRecords() {
82
+ return new Promise((resolve, reject) => {
83
+ const request = indexedDB.open('naslData', 1);
84
+ request.onupgradeneeded = (event) => {
85
+ const db = event.target.result;
86
+ const objectStore = db.createObjectStore('operationRecord', { autoIncrement: true });
87
+ objectStore.createIndex('appId', 'appId');
88
+ objectStore.createIndex('timestamp', 'timestamp');
89
+ };
90
+ request.onsuccess = (event) => {
91
+ const db = event.target.result;
92
+ const transaction = db.transaction('operationRecord', 'readwrite');
93
+ const objectStore = transaction.objectStore('operationRecord');
94
+ const index = objectStore.index('timestamp');
95
+ // 设置有效期,默认7天
96
+ const localStorageExpiresAt = window.localStorage.getItem('expiresAt');
97
+ const expiresAt = Date.now() - (localStorageExpiresAt ? +localStorageExpiresAt : 7 * 24 * 60 * 60 * 1000);
98
+ const range = IDBKeyRange.upperBound(expiresAt);
99
+ const expiredRecordsRequest = index.openCursor(range);
100
+ expiredRecordsRequest.onsuccess = (event) => {
101
+ const cursor = event.target.result;
102
+ if (cursor) {
103
+ console.log(cursor);
104
+ objectStore.delete(cursor.primaryKey);
105
+ cursor.continue();
106
+ }
107
+ else {
108
+ resolve(void 0);
109
+ }
110
+ };
111
+ transaction.oncomplete = () => {
112
+ db.close();
113
+ };
114
+ };
115
+ request.onerror = (event) => {
116
+ reject('Failed to open database');
117
+ };
118
+ });
119
+ }
120
+ // 操作栈查询
121
+ function operationRecordQuery(app) {
122
+ return new Promise((resolve, reject) => {
123
+ const appId = app?.id;
124
+ const branchId = app?.__branchId;
125
+ const request = indexedDB.open('naslData', 1);
126
+ request.onsuccess = (event) => {
127
+ const db = event.target.result;
128
+ const transaction = db.transaction('operationRecord', 'readonly');
129
+ const objectStore = transaction.objectStore('operationRecord');
130
+ const index = objectStore.index('appId'); // 查询 'appId' 索引
131
+ const range = IDBKeyRange.only(appId);
132
+ const result = [];
133
+ const request = index.openCursor(range);
134
+ request.onsuccess = (event) => {
135
+ const cursor = event.target.result;
136
+ if (cursor) {
137
+ const record = cursor.value;
138
+ const branchId = exports.operationRecordInfoMap.get('branchId');
139
+ if (record.branchId === branchId) {
140
+ result.push(record);
141
+ }
142
+ cursor.continue();
143
+ }
144
+ else {
145
+ console.log('操作记录栈:', result);
146
+ resolve(result);
147
+ }
148
+ };
149
+ transaction.oncomplete = () => {
150
+ db.close();
151
+ };
152
+ };
153
+ request.onerror = (event) => {
154
+ reject('Failed to open database');
155
+ };
156
+ });
157
+ }
158
+ exports.operationRecordQuery = operationRecordQuery;
159
+ // 获取父对象
160
+ function getParentInfo(appJson, path) {
161
+ const pathArr = [];
162
+ (path?.split('.') || []).forEach((pathItem) => {
163
+ const arrayPropertyKey = pathItem.split('[')[0];
164
+ const matchArr = pathItem.match(/\[(.+?)\]/);
165
+ if (matchArr) {
166
+ pathArr.push(arrayPropertyKey, matchArr[0]);
167
+ }
168
+ else {
169
+ pathArr.push(pathItem);
170
+ }
171
+ });
172
+ pathArr.pop();
173
+ let parentPath = '';
174
+ pathArr.forEach((pathItem, index) => {
175
+ const matchArr = pathItem.match(/\[(.+?)\]/);
176
+ if (matchArr || index === 0) {
177
+ parentPath += pathItem;
178
+ }
179
+ else {
180
+ parentPath += `.${pathItem}`;
181
+ }
182
+ });
183
+ const parentNode = jsoner.queryNodeByPath(appJson, parentPath);
184
+ return {
185
+ parentPath,
186
+ parentNode,
187
+ };
188
+ }
189
+ // 操作记录回放
190
+ async function operationRecordPlayback(app, action) {
191
+ const operationRecord = await operationRecordQuery(app);
192
+ let operationRecordIndex = exports.operationRecordInfoMap.get('operationRecordIndex');
193
+ if ([null, undefined].includes(operationRecordIndex)) {
194
+ operationRecordIndex = operationRecord?.length;
195
+ }
196
+ const appJson = app.toJSON();
197
+ if (action === 'undo') {
198
+ if (operationRecordIndex > 0) {
199
+ const currentRecordItem = operationRecord?.[operationRecordIndex];
200
+ const { type, action: recordItemAction } = currentRecordItem || {};
201
+ // 多人协作
202
+ if (type === 'cooperation' && recordItemAction === 'confirmPull') {
203
+ console.log(`当前所处栈位置:${operationRecordIndex},已经进行了多人协作“合并”操作,无法继续对操作栈进行回放!`);
204
+ return;
205
+ }
206
+ operationRecordIndex--;
207
+ }
208
+ else {
209
+ console.log(`当前所处栈位置:${operationRecordIndex},无法继续回放`);
210
+ console.log('当前appJSON:', appJson);
211
+ return;
212
+ }
213
+ }
214
+ else {
215
+ if (operationRecordIndex < operationRecord?.length) {
216
+ operationRecordIndex++;
217
+ }
218
+ else {
219
+ console.log(`当前所处栈位置:${operationRecordIndex},无法继续前进`);
220
+ console.log('当前appJSON:', appJson);
221
+ return;
222
+ }
223
+ }
224
+ exports.operationRecordInfoMap.set('operationRecordIndex', operationRecordIndex);
225
+ const currentIndex = operationRecordIndex;
226
+ ([...operationRecord].splice(currentIndex, operationRecord?.length) || []).reverse()?.forEach((recordItem) => {
227
+ const { actionItem } = recordItem || {};
228
+ const { list } = actionItem || {};
229
+ [...(list || [])].reverse().forEach((actionItem) => {
230
+ const { path, action, oldObject, parentKey, index: oldIndex } = actionItem || {};
231
+ const { parentNode } = getParentInfo(appJson, path);
232
+ const node = jsoner.queryNodeByPath(appJson, path);
233
+ switch (action) {
234
+ case 'create':
235
+ if (Array.isArray(parentNode)) {
236
+ const index = parentNode.indexOf(node);
237
+ if (index !== -1) {
238
+ parentNode.splice(index, 1);
239
+ }
240
+ }
241
+ else {
242
+ parentNode[parentKey] = null;
243
+ }
244
+ break;
245
+ case 'delete':
246
+ if (Array.isArray(parentNode) && oldIndex !== -1) {
247
+ parentNode.splice(oldIndex, 0, oldObject);
248
+ }
249
+ else {
250
+ parentNode[parentKey] = oldObject;
251
+ }
252
+ break;
253
+ case 'update':
254
+ for (const key in oldObject) {
255
+ node[key] = oldObject[key] ?? null;
256
+ }
257
+ break;
258
+ }
259
+ });
260
+ });
261
+ console.log('当前所处栈位置:', currentIndex);
262
+ console.log('当前appJSON:', appJson);
263
+ return appJson;
264
+ }
265
+ exports.operationRecordPlayback = operationRecordPlayback;
266
+ function getLogic(key, app, diffLogicList) {
267
+ if (!diffLogicList.includes(key)) {
268
+ diffLogicList.push(key);
269
+ if (key.startsWith('app')) {
270
+ const index = key.lastIndexOf('.');
271
+ const name = key.slice(index + 1);
272
+ const logic = app.logics.find((item) => item.name === name);
273
+ if (logic && logic.body && logic.body.length > 2) {
274
+ logic.body.map((item) => getStatement(item, app, diffLogicList));
275
+ }
276
+ }
277
+ else if (key.startsWith('extensions')) {
278
+ const _pathArr = key.split('.');
279
+ const _name = _pathArr[1];
280
+ const _path = _pathArr[3];
281
+ const _list = app.dependencies;
282
+ const _module = _list.find((it) => {
283
+ const name = it.name.replaceAll('-', '_');
284
+ return name === _name;
285
+ });
286
+ const logic = _module?.logics?.find((item) => item.name === _path);
287
+ if (logic && logic.body && logic.body.length > 2) {
288
+ logic.body.map((item) => getStatement(item, app, diffLogicList));
289
+ }
290
+ }
291
+ }
292
+ }
293
+ /* 获取LogicITEM */
294
+ function getStatement(state, app, diffLogicList) {
295
+ let logicItems = [];
296
+ switch (state.concept) {
297
+ case 'Assignment':
298
+ logicItems = [state.left, state.right];
299
+ break;
300
+ case 'IfStatement':
301
+ logicItems = [...state.consequent, ...state.alternate];
302
+ break;
303
+ case 'ForEachStatement':
304
+ logicItems = [...state.body, state.each, state.start, state.end];
305
+ break;
306
+ case 'Match':
307
+ logicItems = [state.expression, ...state.cases.map(getStatement).flat(1)];
308
+ break;
309
+ case 'MatchCase':
310
+ logicItems = [...state.patterns, ...state.body];
311
+ break;
312
+ case 'SwitchStatement':
313
+ logicItems = state.cases.map(getStatement).flat(1);
314
+ break;
315
+ case 'SwitchCase':
316
+ logicItems = [state.test, ...state.consequent];
317
+ break;
318
+ case 'WhileStatement':
319
+ logicItems = [state.test, ...state.body];
320
+ break;
321
+ case 'CallLogic':
322
+ logicItems = state.arguments?.map((item) => item.expression);
323
+ getLogic(state.calleewholeKey, app, diffLogicList);
324
+ break;
325
+ case 'CallFunction':
326
+ logicItems = state.arguments?.map((item) => item.expression);
327
+ break;
328
+ case 'CallInterface':
329
+ logicItems = state.arguments?.map((item) => item.expression);
330
+ break;
331
+ case 'ExternalDestination':
332
+ logicItems = [state.anchor, state.link];
333
+ break;
334
+ case 'BatchAssignment':
335
+ logicItems = [state.left?.expression, ...state.left?.members, ...state.rights.map((item) => [item?.expression, ...item?.members]).flat(1)];
336
+ break;
337
+ case 'MemberExpression':
338
+ logicItems = [state.object, state.property];
339
+ break;
340
+ case 'StringInterpolation':
341
+ logicItems = [...state.expressions];
342
+ break;
343
+ case 'NewComposite':
344
+ logicItems = [...state.rights.map((item) => item.expression)];
345
+ break;
346
+ case 'NewList':
347
+ logicItems = [...state.items];
348
+ break;
349
+ default:
350
+ break;
351
+ }
352
+ return logicItems.filter((item) => !!item);
353
+ }
354
+ /* 小程序影响的服务端发布 */
355
+ function getMiniAppChange(target, obj, action) {
356
+ if (!target.app.miniEnable) {
357
+ return false;
358
+ }
359
+ /* 分端以后需要改 */
360
+ const len = target.nodePath?.split('.').length;
361
+ if (len > 2) {
362
+ return false;
363
+ }
364
+ if (action === 'delete') {
365
+ return true;
366
+ }
367
+ else {
368
+ if ('name' in obj || 'title' in obj) {
369
+ return true;
370
+ }
371
+ }
372
+ }
373
+ let aiExecuted = 0;
374
+ let sessionPath = '';
375
+ // AI 生成内容是否被采纳
376
+ const handleAIPoint = (app, actionItem) => {
377
+ const { actionMsg, action } = actionItem || {};
378
+ if (aiExecuted > 0) {
379
+ app.emit('logic:accepted', { ...actionItem, sessionPath });
380
+ aiExecuted -= 1;
381
+ }
382
+ if (actionMsg.includes('自然语言生成代码') && !action) {
383
+ aiExecuted += 1;
384
+ // eslint-disable-next-line prefer-destructuring
385
+ sessionPath = actionMsg.match(/:(.*)/)[1];
386
+ }
387
+ };
388
+ /**
389
+ * 执行更新
390
+ */
391
+ async function doAction(app, actionItem) {
392
+ const isOperationRecord = exports.operationRecordInfoMap.get('isOperationRecord');
393
+ if (isOperationRecord) {
394
+ console.log('正在进行操作栈回放操作,如需行任何Nasl操作请刷新页面');
395
+ return;
396
+ }
397
+ let hasFrontEnd = false;
398
+ let hasBackEnd = false;
399
+ const actionList = [];
400
+ const allRiskList = [];
401
+ const { list, actionMsg, action } = actionItem || {};
402
+ handleAIPoint(app, actionItem);
403
+ const itemloop = (_i, app, diffArr) => {
404
+ const _l = getStatement(_i, app, diffArr);
405
+ if (_l.length) {
406
+ _l.map((_ii) => itemloop(_ii, app, diffArr));
407
+ }
408
+ };
409
+ const loopEle = (view, checkAuth) => {
410
+ if (view instanceof concepts_1.View) {
411
+ view?.elements?.forEach((item) => loopEle(item, checkAuth));
412
+ }
413
+ view?.children?.forEach((item) => loopEle(item, checkAuth));
414
+ if (view instanceof concepts_1.ViewElement) {
415
+ if (view.bindEvents.length) {
416
+ const diffArr = [];
417
+ view.bindEvents.forEach((bindEvent) => {
418
+ bindEvent.logics.forEach((logic) => {
419
+ logic.body.forEach((logicItem) => itemloop(logicItem, app, diffArr));
420
+ });
421
+ });
422
+ const result = diffArr.filter((item) => item.startsWith('app') || item.startsWith('extensions'));
423
+ if (result.length) {
424
+ hasBackEnd = true;
425
+ }
426
+ }
427
+ if (view.tag === 'u-uploader' || view.tag === 'van-uploader') {
428
+ const bute = view?.bindAttrs.find((item) => item.name === 'url');
429
+ const needUpdateBackEnd = bute?.value?.endsWith('/import') || bute?.value?.includes('/upload/');
430
+ if (checkAuth) {
431
+ if (needUpdateBackEnd && !view.view.parentAuth) {
432
+ hasBackEnd = true;
433
+ }
434
+ }
435
+ else {
436
+ if (needUpdateBackEnd) {
437
+ hasBackEnd = true;
438
+ }
439
+ }
440
+ }
441
+ }
442
+ };
443
+ const loopEleAuth = (viewElement) => {
444
+ viewElement?.children?.forEach((item) => {
445
+ const bindDirective = item?.bindDirectives?.find((item) => item.name === 'auth');
446
+ if (bindDirective) {
447
+ hasBackEnd = true;
448
+ }
449
+ loopEleAuth(item);
450
+ });
451
+ };
452
+ try {
453
+ if (Array.isArray(list)) {
454
+ list.forEach((event) => {
455
+ const emitTarget = event?.originEvent?.target;
456
+ const _path = event.originEvent.path;
457
+ const _root = _path.split('.')?.[1] || '';
458
+ if (['backend', 'overriddenLogics', 'dataSources', 'processes', 'roles', 'logics', 'enums', 'structures', 'interfaces', 'interfaceDependencies', 'configuration', 'dependencies', 'authLogics', 'authLogicsForCallInterface', 'triggerLaunchers', 'connections'].some((item) => _root.startsWith(item))) {
459
+ hasBackEnd = true;
460
+ }
461
+ if (emitTarget) {
462
+ if (emitTarget.concept === 'App') {
463
+ if (event?.object?.preferenceMap || event?.originEvent?.object?.preferenceMap) {
464
+ hasBackEnd = true;
465
+ hasFrontEnd = true;
466
+ }
467
+ }
468
+ if (emitTarget.concept === 'ValidationRule') {
469
+ if (event?.object?.enableServerValidation ||
470
+ event?.originEvent?.object?.enableServerValidation) {
471
+ hasBackEnd = true;
472
+ hasFrontEnd = true;
473
+ }
474
+ }
475
+ if (emitTarget.concept === 'Logic') {
476
+ const diffArr = [];
477
+ if (emitTarget.body.length > 2) {
478
+ emitTarget.body.forEach((it) => {
479
+ itemloop(it, app, diffArr);
480
+ });
481
+ }
482
+ const result = diffArr.filter((item) => item.startsWith('app') || item.startsWith('extensions'));
483
+ if (result.length) {
484
+ hasBackEnd = true;
485
+ }
486
+ }
487
+ if ('view' in emitTarget && emitTarget.view) {
488
+ hasFrontEnd = true;
489
+ }
490
+ if (emitTarget.concept === 'BindDirective') {
491
+ const isDelete = event?.originEvent?.action === 'delete';
492
+ if (isDelete) {
493
+ const isAuto = ~event?.originEvent?.path?.indexOf('name=auth');
494
+ if (isAuto) {
495
+ hasBackEnd = true;
496
+ }
497
+ }
498
+ if (event?.originEvent?.object?.name === 'auth') {
499
+ hasBackEnd = true;
500
+ }
501
+ }
502
+ if (emitTarget.concept === 'View') {
503
+ if (getMiniAppChange(emitTarget, event?.originEvent?.object, event?.originEvent?.action)) {
504
+ hasBackEnd = true;
505
+ }
506
+ const isDelete = event?.originEvent?.action === 'delete';
507
+ const isAuthView = emitTarget.auth && event?.originEvent?.object?.name;
508
+ const isUpdateAuth = event?.originEvent?.action === 'update' && event?.originEvent?.object && event?.originEvent?.object?.auth;
509
+ const isUpdateBindRoles = event?.originEvent?.action === 'update' && event?.originEvent?.object && event?.originEvent?.object?.bindRoles;
510
+ if (isDelete || isUpdateAuth || isUpdateBindRoles || isAuthView) {
511
+ hasBackEnd = true;
512
+ // const app = emitTarget.app;
513
+ // const diffArr: string[] = [];
514
+ // emitTarget.logics.forEach((logic: Logic) => {
515
+ // if (logic.body.length > 2) {
516
+ // logic.body.forEach((it: LogicItem) => {
517
+ // itemloop(it, app, diffArr);
518
+ // });
519
+ // }
520
+ // });
521
+ // const result = diffArr.filter((item) => item.startsWith('app') || item.startsWith('extensions'));
522
+ // if (result.length) {
523
+ // hasBackEnd = true;
524
+ // }
525
+ // emitTarget.children.forEach((item: View | ViewElement) => loopEle(item, isDelete));
526
+ // emitTarget.elements.forEach((item: View | ViewElement) => loopEle(item, isDelete));
527
+ }
528
+ hasFrontEnd = true;
529
+ }
530
+ if (emitTarget.concept === 'ViewElement') {
531
+ if (event?.originEvent?.object?.name) {
532
+ const bindDirective = emitTarget.bindDirectives.find((item) => item.name === 'auth');
533
+ if (bindDirective) {
534
+ hasBackEnd = true;
535
+ }
536
+ }
537
+ if (event?.originEvent?.action === 'delete') {
538
+ const bindDirective = emitTarget?.bindDirectives?.find((item) => item.name === 'auth');
539
+ if (bindDirective) {
540
+ hasBackEnd = true;
541
+ }
542
+ loopEleAuth(emitTarget);
543
+ }
544
+ if (event?.originEvent?.action !== 'create') {
545
+ if (event?.originEvent?.object && event?.originEvent?.object?.bindRoles) {
546
+ hasBackEnd = true;
547
+ }
548
+ }
549
+ loopEle(emitTarget, true);
550
+ }
551
+ if (emitTarget.concept === 'BindAttribute' && emitTarget.name === 'url') {
552
+ const needUpdateBackEnd = emitTarget?.value?.endsWith('/import') || emitTarget?.value?.includes('/upload/');
553
+ if (!emitTarget.view.parentAuth && needUpdateBackEnd) {
554
+ hasBackEnd = true;
555
+ }
556
+ }
557
+ if (emitTarget.concept === 'CallLogic') {
558
+ const arrlist = [];
559
+ getLogic(emitTarget.calleeKey, emitTarget.app, arrlist);
560
+ const result = arrlist.filter((item) => item.startsWith('app') || item.startsWith('extensions'));
561
+ // console.log(result, 'CallLogic');
562
+ if (result.length) {
563
+ hasBackEnd = true;
564
+ }
565
+ }
566
+ // 更新端时需要出发后端更新
567
+ if (emitTarget.concept === 'Frontend') {
568
+ hasBackEnd = true;
569
+ }
570
+ }
571
+ event.eventList.forEach(({ action, riskList, path, object: objItem }) => {
572
+ if (riskList) {
573
+ allRiskList.push(...(riskList || []));
574
+ }
575
+ if (Array.isArray(objItem)) {
576
+ if (action === 'update') {
577
+ actionList.push({
578
+ action,
579
+ path,
580
+ node: objItem[0],
581
+ });
582
+ }
583
+ else {
584
+ objItem.forEach((item, index) => {
585
+ actionList.push({
586
+ action,
587
+ path,
588
+ node: item,
589
+ });
590
+ });
591
+ }
592
+ }
593
+ else {
594
+ actionList.push({
595
+ action,
596
+ path,
597
+ object: objItem,
598
+ });
599
+ }
600
+ });
601
+ });
602
+ }
603
+ }
604
+ catch (error) {
605
+ console.log(error);
606
+ exports.taskQueue.refreshNasl(app, {
607
+ errorInfo: {
608
+ message: error?.message,
609
+ stack: error?.stack,
610
+ },
611
+ });
612
+ return;
613
+ }
614
+ const uuid = (0, uuid_1.v4)().replace(/-/g, '');
615
+ const instructList = [{
616
+ uuid,
617
+ actions: actionList,
618
+ riskList: allRiskList
619
+ }];
620
+ const operation = {
621
+ type: 'doAction',
622
+ uuid,
623
+ actionItem: {
624
+ actionMsg,
625
+ list: list.map((item) => {
626
+ const { path, action, object, oldObject, parentKey, index } = item?.originEvent || {};
627
+ return {
628
+ path,
629
+ action,
630
+ parentKey,
631
+ index,
632
+ object: object?.toJSON?.() || object,
633
+ oldObject: oldObject?.toJSON?.() || oldObject,
634
+ };
635
+ }),
636
+ },
637
+ };
638
+ saveNasl({ app, hasFrontEnd, hasBackEnd, instructList, operationList: [operation] });
639
+ // 进行nasl操作后需要将Index重置
640
+ exports.operationRecordInfoMap.set('operationRecordIndex', null);
641
+ if (!app._historying) {
642
+ if (app._historyIndex !== app._historyList.length) {
643
+ app._historyList = app._historyList.splice(0, app._historyIndex);
644
+ }
645
+ app._historyList.push({
646
+ actionMsg,
647
+ list: list.map((item) => item?.originEvent),
648
+ });
649
+ app._historyIndex = app._historyList.length;
650
+ }
651
+ else {
652
+ const actionMap = {
653
+ undo: '已撤销操作:',
654
+ redo: '已重做操作:',
655
+ };
656
+ let msg = actionMap[action];
657
+ msg += actionMsg;
658
+ if (process.env.BUILD_TARGET !== 'node') {
659
+ require('element-plus').ElMessage.info(msg);
660
+ }
661
+ app._historying = false;
662
+ }
663
+ stepRecorder_1.default.initialized && stepRecorder_1.default.record(actionMsg, actionItem, actionList);
664
+ }
665
+ var TaskQueueStatus;
666
+ (function (TaskQueueStatus) {
667
+ TaskQueueStatus[TaskQueueStatus["ExceedMaxTaskCount"] = 0] = "ExceedMaxTaskCount";
668
+ TaskQueueStatus[TaskQueueStatus["Retrying"] = 1] = "Retrying";
669
+ })(TaskQueueStatus || (TaskQueueStatus = {}));
670
+ class TaskQueue {
671
+ queue = [];
672
+ lastQueue = [];
673
+ running = false;
674
+ maxTaskCount = 10;
675
+ status = undefined;
676
+ addTask(task) {
677
+ this.queue.push(task);
678
+ if (this.queue.length >= this.maxTaskCount) {
679
+ this.status = TaskQueueStatus.ExceedMaxTaskCount;
680
+ task.app.emit('ExceedMaxTaskCount');
681
+ }
682
+ this.run();
683
+ }
684
+ clear() {
685
+ this.queue = [];
686
+ this.lastQueue = [];
687
+ this.status = undefined;
688
+ this.running = false;
689
+ }
690
+ async run(queue = this.queue) {
691
+ if (this.running)
692
+ return;
693
+ if (queue.length === 0)
694
+ return;
695
+ const app = queue[0].app;
696
+ let hasFrontEnd = false;
697
+ let hasBackEnd = false;
698
+ let instructList = [];
699
+ let operationList = [];
700
+ for (const task of queue) {
701
+ if (task.hasFrontEnd)
702
+ hasFrontEnd = true;
703
+ if (task.hasBackEnd)
704
+ hasBackEnd = true;
705
+ instructList = instructList.concat(task.instructList);
706
+ operationList = operationList.concat(task.operationList);
707
+ }
708
+ if (queue === this.queue) {
709
+ this.lastQueue = [...queue];
710
+ this.queue = [];
711
+ }
712
+ this.running = true;
713
+ const error = await _saveNasl({
714
+ app, hasFrontEnd, hasBackEnd, instructList, operationList
715
+ });
716
+ // code: 401650, 检测到当前应用拉取操作已被强制结束, 用户确认后再刷新
717
+ // code: 500502 msg: "该应用已在新tab 页打开,请刷新!" 不重试或刷新
718
+ if (!error)
719
+ this.recover(app);
720
+ else if (![401650, 500502].includes(error.code)) {
721
+ // 连接失败,或超时,或后端持久化异常
722
+ if ((error.message === 'Network Error' || error.message?.includes('timeout') || error.code === 500500)
723
+ && this.status !== TaskQueueStatus.Retrying) {
724
+ this.running = false;
725
+ this.retry();
726
+ }
727
+ else
728
+ this.refreshNasl(app);
729
+ return;
730
+ }
731
+ this.running = false;
732
+ this.run();
733
+ }
734
+ retry() {
735
+ if (this.lastQueue.length === 0)
736
+ return;
737
+ const app = this.lastQueue[0].app;
738
+ this.status = TaskQueueStatus.Retrying;
739
+ app.emit('Retrying');
740
+ this.run(this.lastQueue);
741
+ }
742
+ async refreshNasl(app, options = { errorInfo: {} }) {
743
+ const failedQueue = this.lastQueue.map(({ hasFrontEnd, hasBackEnd, instructList }) => ({
744
+ hasFrontEnd, hasBackEnd, instructList,
745
+ }));
746
+ const queue = this.queue.map(({ hasFrontEnd, hasBackEnd, instructList }) => ({
747
+ hasFrontEnd, hasBackEnd, instructList,
748
+ }));
749
+ await service_1.default.saveFrontendNasl({
750
+ body: {
751
+ nasl: app?.toJSON(),
752
+ failedQueue,
753
+ queue,
754
+ errorInfo: options.errorInfo,
755
+ },
756
+ }).catch((err) => {
757
+ console.log('备份 nasl 失败:', err);
758
+ });
759
+ this.clear();
760
+ app.emit('refresh');
761
+ }
762
+ recover(app) {
763
+ switch (this.status) {
764
+ case TaskQueueStatus.ExceedMaxTaskCount:
765
+ app.emit('BelowMaxTaskCount');
766
+ this.status = undefined;
767
+ break;
768
+ case TaskQueueStatus.Retrying:
769
+ app.emit('SuccessRetry');
770
+ this.status = undefined;
771
+ break;
772
+ }
773
+ }
774
+ }
775
+ exports.taskQueue = new TaskQueue();
776
+ async function saveNasl(options) {
777
+ exports.taskQueue.addTask(options);
778
+ }
779
+ class Operation {
780
+ appId;
781
+ branchId;
782
+ accountId;
783
+ userId;
784
+ phone;
785
+ actionItem;
786
+ res;
787
+ err;
788
+ parentKey;
789
+ timestamp;
790
+ type;
791
+ uuid;
792
+ action;
793
+ }
794
+ // 确保操作非高危
795
+ function ensureSafe(instructList) {
796
+ const riskList = [];
797
+ instructList?.forEach((instruct) => {
798
+ if (instruct?.riskList) {
799
+ riskList.push(...(instruct.riskList || []));
800
+ }
801
+ instruct?.actions?.forEach((actionItem) => {
802
+ const { path, action, object } = actionItem || {};
803
+ if (path === 'app') {
804
+ switch (action) {
805
+ case 'create':
806
+ riskList.push('重复创建App');
807
+ break;
808
+ case 'delete':
809
+ riskList.push('删除App');
810
+ break;
811
+ case 'update':
812
+ if (object?.hasOwnProperty('id')) {
813
+ riskList.push('修改AppId');
814
+ }
815
+ break;
816
+ }
817
+ }
818
+ });
819
+ });
820
+ return riskList;
821
+ }
822
+ async function _saveNasl(options) {
823
+ const { app, hasFrontEnd, hasBackEnd, instructList, operationList } = options;
824
+ app.emit('saving');
825
+ let ChangedNASLType = '';
826
+ if (hasFrontEnd && hasBackEnd) {
827
+ ChangedNASLType = 'both';
828
+ }
829
+ else if (hasFrontEnd) {
830
+ ChangedNASLType = 'web';
831
+ }
832
+ else if (hasBackEnd) {
833
+ ChangedNASLType = 'backend';
834
+ }
835
+ let res;
836
+ let err;
837
+ if (config_1.config.storage.protocol === 'http') {
838
+ try {
839
+ const riskList = ensureSafe(instructList);
840
+ if (Array.isArray(riskList) && riskList.length) {
841
+ throw Error(`存在以下高危操作:\n${riskList.map((risk, index) => {
842
+ return `${index + 1}.${risk};`;
843
+ }).join('\n')}\n请及时排查原因`);
844
+ }
845
+ // 接口请求
846
+ res = await service_1.default.batchInstruct({
847
+ body: instructList,
848
+ headers: {
849
+ appId: app.id,
850
+ ChangedNASLType,
851
+ tabTimestamp,
852
+ // 其他封装在 storageService 里了
853
+ },
854
+ });
855
+ }
856
+ catch (error) {
857
+ err = error;
858
+ console.error(err);
859
+ }
860
+ operationList.forEach((operation) => {
861
+ doOperationRecord({
862
+ ...operation,
863
+ res,
864
+ err,
865
+ });
866
+ });
867
+ }
868
+ else if (config_1.config.storage.protocol === 'mock') {
869
+ // Do nothing
870
+ }
871
+ else {
872
+ const json = await fs.readJSON(config_1.config.storage.basePath);
873
+ let actionList = [];
874
+ for (const { actions } of instructList) {
875
+ actionList = actionList.concat(actions);
876
+ }
877
+ jsoner.batchAction(json, actionList);
878
+ await fs.writeJSON(config_1.config.storage.basePath, json, {
879
+ spaces: 4,
880
+ });
881
+ }
882
+ app.emit('saved', err);
883
+ return err;
884
+ }
885
+ function handleApp(app) {
886
+ app._isCollectingCount = 0;
887
+ app._collectingList = [];
888
+ app._historyList = [];
889
+ app._historyIndex = 0;
890
+ app._historying = false;
891
+ app._timer = null;
892
+ app.on('undo', function () {
893
+ const proxyApp = this;
894
+ proxyApp._historying = true;
895
+ });
896
+ app.on('redo', function () {
897
+ const proxyApp = this;
898
+ proxyApp._historying = true;
899
+ });
900
+ /**
901
+ * 开启收集
902
+ */
903
+ app.on('collect:start', function (event) {
904
+ const proxyApp = this;
905
+ if (proxyApp._timer) {
906
+ clearTimeout(proxyApp._timer);
907
+ }
908
+ if (!proxyApp._noTimer) {
909
+ proxyApp._noTimer = event.noTimer;
910
+ }
911
+ if (!proxyApp._noTimer) {
912
+ proxyApp._timer = setTimeout(() => {
913
+ console.error('收集超时,请及时排查原因', event);
914
+ exports.taskQueue.refreshNasl(proxyApp, {
915
+ errorInfo: {
916
+ message: '收集超时,请及时排查原因',
917
+ },
918
+ });
919
+ }, 2500);
920
+ }
921
+ if (!proxyApp._isCollectingCount) {
922
+ proxyApp._actionMsg = event?.actionMsg;
923
+ proxyApp._action = event?.action;
924
+ }
925
+ proxyApp._isCollectingCount++;
926
+ });
927
+ /**
928
+ * 结束收集
929
+ */
930
+ app.on('collect:end', async function () {
931
+ const proxyApp = this;
932
+ proxyApp._isCollectingCount--;
933
+ if (proxyApp._isCollectingCount === 0) {
934
+ if (proxyApp._timer) {
935
+ clearTimeout(proxyApp._timer);
936
+ }
937
+ // 结束收集时,立即将全局收集变量状态重置,防止下次收集数据混乱
938
+ const collectingList = proxyApp._collectingList;
939
+ const actionMsg = proxyApp._actionMsg;
940
+ const action = proxyApp._action;
941
+ proxyApp._collectingList = [];
942
+ proxyApp._actionMsg = '';
943
+ proxyApp._action = '';
944
+ proxyApp._noTimer = undefined;
945
+ if (Array.isArray(collectingList) && collectingList.length) {
946
+ mountDatabaseTypes(proxyApp);
947
+ proxyApp.naslServer?.embeddedTSEmitter?.emit('change', {
948
+ value: collectingList,
949
+ });
950
+ await doAction(proxyApp, {
951
+ list: collectingList,
952
+ actionMsg,
953
+ action,
954
+ });
955
+ }
956
+ }
957
+ else if (proxyApp._isCollectingCount < 0) {
958
+ proxyApp._isCollectingCount = 0;
959
+ throw Error('关闭收集有问题,请排查');
960
+ }
961
+ });
962
+ /**
963
+ * 有变更
964
+ */
965
+ app.on('storage', function (event) {
966
+ const proxyApp = this;
967
+ // 是否正在收集
968
+ if (proxyApp._isCollectingCount === 0) {
969
+ proxyApp.naslServer?.embeddedTSEmitter?.emit('change', {
970
+ value: [event],
971
+ });
972
+ let actionMsg = '';
973
+ const { action, target } = event.originEvent || {};
974
+ const { concept, name } = target || {};
975
+ switch (action) {
976
+ case 'create':
977
+ actionMsg = '添加';
978
+ break;
979
+ case 'delete':
980
+ actionMsg = '删除';
981
+ break;
982
+ case 'update':
983
+ actionMsg = '修改';
984
+ break;
985
+ }
986
+ actionMsg += (0, decorators_1.getConceptConstructor)(concept).nodeTitle;
987
+ if (name) {
988
+ actionMsg += `“${name}”`;
989
+ }
990
+ doAction(proxyApp, {
991
+ list: [event],
992
+ actionMsg,
993
+ });
994
+ }
995
+ else {
996
+ proxyApp._collectingList.push(event);
997
+ }
998
+ });
999
+ }
1000
+ exports.handleApp = handleApp;
1001
+ /**
1002
+ * 加载 app
1003
+ * @param appId 如果是从文件读,就不需要传
1004
+ * @returns app 对象
1005
+ */
1006
+ async function loadApp(appId) {
1007
+ try {
1008
+ // 删除失效数据
1009
+ deleteExpiredRecords();
1010
+ }
1011
+ catch (err) { }
1012
+ let app;
1013
+ if (config_1.config.storage.protocol === 'http') {
1014
+ console.time('batchQuery');
1015
+ const promises = [
1016
+ service_1.default.batchQuery({
1017
+ body: [
1018
+ {
1019
+ path: 'app'
1020
+ // excludes: ['views'],
1021
+ }
1022
+ ],
1023
+ headers: {
1024
+ appId,
1025
+ checkTabOpenTime: 'true'
1026
+ // 其他封装在 storageService 里了
1027
+ },
1028
+ config: {
1029
+ shortResponse: false
1030
+ }
1031
+ }),
1032
+ service_1.default.breakpoint({
1033
+ body: { appId }
1034
+ })
1035
+ ];
1036
+ const [batchQueryRes, breakpointRes] = await Promise.all(promises);
1037
+ // 请求
1038
+ console.timeEnd('batchQuery');
1039
+ tabTimestamp = batchQueryRes?.headers?.tabtimestamp;
1040
+ const data = batchQueryRes?.data?.result;
1041
+ console.time('new App');
1042
+ app = new concepts_1.App(Object.assign(data?.[0], { id: appId }));
1043
+ breakpointRes?.forEach((item = {}) => {
1044
+ const { path, breakpointStatus } = item;
1045
+ if (breakpointStatus) {
1046
+ const node = app.findNodeByPath(path);
1047
+ if (node) {
1048
+ node.breakpoint = breakpointStatus;
1049
+ }
1050
+ }
1051
+ });
1052
+ console.timeEnd('new App');
1053
+ if (!app.id) {
1054
+ app.id = appId;
1055
+ }
1056
+ (0, breakpoint_1.addBreakpointNodesFromApp)(app);
1057
+ }
1058
+ else if (config_1.config.storage.protocol === 'mock') {
1059
+ app = new concepts_1.App({
1060
+ id: appId,
1061
+ concept: 'App',
1062
+ name: 'devapp',
1063
+ title: '开发应用',
1064
+ envs: 'dev,online',
1065
+ hasAuth: true,
1066
+ hasUserCenter: true,
1067
+ dataSources: [],
1068
+ structures: [],
1069
+ enums: [],
1070
+ logics: [],
1071
+ interfaces: [],
1072
+ processes: [],
1073
+ roles: [],
1074
+ dependencies: [],
1075
+ interfaceDependencies: [],
1076
+ frontends: [],
1077
+ });
1078
+ }
1079
+ else {
1080
+ const json = await fs.readJSON(config_1.config.storage.basePath);
1081
+ app = new concepts_1.App(appId ? Object.assign(json, { id: appId }) : json);
1082
+ }
1083
+ // config.scope = app.scope;
1084
+ handleApp(app);
1085
+ app._isCollectingCount = 0;
1086
+ mountDatabaseTypes(app);
1087
+ return app;
1088
+ }
1089
+ exports.loadApp = loadApp;
1090
+ // 在app上挂载所有的数据库类型
1091
+ async function mountDatabaseTypes(app) {
1092
+ if (!app.__databaseTypeMap) {
1093
+ app.__databaseTypeMap = {};
1094
+ }
1095
+ const dataSources = app?.dataSources;
1096
+ const dbTypeSet = new Set();
1097
+ if (Array.isArray(dataSources)) {
1098
+ dataSources.forEach((dataSource) => {
1099
+ const dataSourceSqlType = JSON.parse(dataSource.dataSourceConfig?.devProperty?.value || '{}')?.type;
1100
+ if (dataSourceSqlType && !app.__databaseTypeMap[dataSourceSqlType]) {
1101
+ dbTypeSet.add(dataSourceSqlType);
1102
+ }
1103
+ });
1104
+ }
1105
+ const dbTypes = [...dbTypeSet];
1106
+ if (Array.isArray(dbTypes) && dbTypes.length) {
1107
+ const res = await (0, exports.databaseTypes)({
1108
+ query: {
1109
+ dbTypes: dbTypes.join(','),
1110
+ },
1111
+ });
1112
+ if (Array.isArray(res)) {
1113
+ res.forEach((databaseType) => {
1114
+ const { dbType, columnTypes } = databaseType || {};
1115
+ const columnTypeMap = {};
1116
+ if (Array.isArray(columnTypes)) {
1117
+ columnTypes.forEach((columnType) => {
1118
+ const { naslType, dataBaseTypes } = columnType;
1119
+ const dataBaseTypeMap = {};
1120
+ let defaultDataBaseType;
1121
+ if (Array.isArray(dataBaseTypes)) {
1122
+ dataBaseTypes.forEach((dataBaseType) => {
1123
+ const { type } = dataBaseType || {};
1124
+ if (type) {
1125
+ dataBaseTypeMap[type] = dataBaseType;
1126
+ const { defaultType } = dataBaseType;
1127
+ if (defaultType) {
1128
+ defaultDataBaseType = dataBaseType;
1129
+ }
1130
+ }
1131
+ });
1132
+ }
1133
+ columnTypeMap[naslType] = {
1134
+ dataBaseTypes,
1135
+ dataBaseTypeMap,
1136
+ defaultDataBaseType,
1137
+ };
1138
+ });
1139
+ }
1140
+ app.__databaseTypeMap[dbType] = columnTypeMap;
1141
+ });
1142
+ }
1143
+ }
1144
+ if (Array.isArray(dataSources)) {
1145
+ dataSources.forEach((dataSource) => {
1146
+ dataSource.__hasDatabaseConfig = !!(app.__databaseTypeMap?.[dataSource.dataSourceSqlType]);
1147
+ });
1148
+ }
1149
+ }
1150
+ exports.mountDatabaseTypes = mountDatabaseTypes;
1151
+ /**
1152
+ * 加载 app
1153
+ * @returns app 对象
1154
+ */
1155
+ function loadAppSync() {
1156
+ const json = fs.readJSONSync(config_1.config.storage.basePath);
1157
+ const app = new concepts_1.App(json);
1158
+ handleApp(app);
1159
+ return app;
1160
+ }
1161
+ exports.loadAppSync = loadAppSync;
1162
1162
  //# sourceMappingURL=init.js.map