@lcap/nasl 2.18.0-beta.7 → 2.20.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (336) hide show
  1. package/out/automate/engine/index.js +3 -3
  2. package/out/automate/engine/index.js.map +1 -1
  3. package/out/bak/translator.js +85 -37
  4. package/out/bak/translator.js.map +1 -1
  5. package/out/common/BaseNode.d.ts +6 -10
  6. package/out/common/BaseNode.js +7 -53
  7. package/out/common/BaseNode.js.map +1 -1
  8. package/out/concepts/AnonymousFunction__.js.map +1 -1
  9. package/out/concepts/App__.d.ts +0 -10
  10. package/out/concepts/App__.js +0 -74
  11. package/out/concepts/App__.js.map +1 -1
  12. package/out/concepts/Assignee__.js.map +1 -1
  13. package/out/concepts/AssignmentLine__.d.ts +5 -5
  14. package/out/concepts/AssignmentLine__.js +6 -6
  15. package/out/concepts/AssignmentLine__.js.map +1 -1
  16. package/out/concepts/Assignment__.js +2 -1
  17. package/out/concepts/Assignment__.js.map +1 -1
  18. package/out/concepts/BatchAssignment__.d.ts +60 -60
  19. package/out/concepts/BatchAssignment__.js +41 -68
  20. package/out/concepts/BatchAssignment__.js.map +1 -1
  21. package/out/concepts/BindAttribute__.d.ts +0 -19
  22. package/out/concepts/BindAttribute__.js +2 -39
  23. package/out/concepts/BindAttribute__.js.map +1 -1
  24. package/out/concepts/BindEvent__.js.map +1 -1
  25. package/out/concepts/BindStyle__.d.ts +2 -2
  26. package/out/concepts/BindStyle__.js +3 -3
  27. package/out/concepts/BindStyle__.js.map +1 -1
  28. package/out/concepts/BooleanLiteral__.js +8 -0
  29. package/out/concepts/BooleanLiteral__.js.map +1 -1
  30. package/out/concepts/CallFunction__.js +25 -58
  31. package/out/concepts/CallFunction__.js.map +1 -1
  32. package/out/concepts/CallInterface__.d.ts +0 -7
  33. package/out/concepts/CallInterface__.js +7 -53
  34. package/out/concepts/CallInterface__.js.map +1 -1
  35. package/out/concepts/CallLogic__.d.ts +1 -2
  36. package/out/concepts/CallLogic__.js +25 -89
  37. package/out/concepts/CallLogic__.js.map +1 -1
  38. package/out/concepts/CallQueryComponent__.js +1 -13
  39. package/out/concepts/CallQueryComponent__.js.map +1 -1
  40. package/out/concepts/CompletionProperty__.js +0 -3
  41. package/out/concepts/CompletionProperty__.js.map +1 -1
  42. package/out/concepts/ConfigGroup__.js.map +1 -1
  43. package/out/concepts/ConfigProperty__.js.map +1 -1
  44. package/out/concepts/Configuration__.js.map +1 -1
  45. package/out/concepts/DataSource__.d.ts +0 -6
  46. package/out/concepts/DataSource__.js +0 -41
  47. package/out/concepts/DataSource__.js.map +1 -1
  48. package/out/concepts/Destination__.d.ts +2 -11
  49. package/out/concepts/Destination__.js +48 -148
  50. package/out/concepts/Destination__.js.map +1 -1
  51. package/out/concepts/EntityProperty__.d.ts +8 -21
  52. package/out/concepts/EntityProperty__.js +23 -109
  53. package/out/concepts/EntityProperty__.js.map +1 -1
  54. package/out/concepts/Entity__.d.ts +0 -32
  55. package/out/concepts/Entity__.js +2 -117
  56. package/out/concepts/Entity__.js.map +1 -1
  57. package/out/concepts/Enum__.js +4 -0
  58. package/out/concepts/Enum__.js.map +1 -1
  59. package/out/concepts/Event__.js.map +1 -1
  60. package/out/concepts/ForEachStatement__.d.ts +4 -0
  61. package/out/concepts/ForEachStatement__.js +8 -4
  62. package/out/concepts/ForEachStatement__.js.map +1 -1
  63. package/out/concepts/Function__.js.map +1 -1
  64. package/out/concepts/Identifier__.js +4 -16
  65. package/out/concepts/Identifier__.js.map +1 -1
  66. package/out/concepts/IfStatement__.d.ts +0 -8
  67. package/out/concepts/IfStatement__.js +0 -22
  68. package/out/concepts/IfStatement__.js.map +1 -1
  69. package/out/concepts/InterfaceParam__.js.map +1 -1
  70. package/out/concepts/Interface__.js.map +1 -1
  71. package/out/concepts/LogicItem__.d.ts +1 -1
  72. package/out/concepts/LogicItem__.js.map +1 -1
  73. package/out/concepts/Logic__.d.ts +1 -6
  74. package/out/concepts/Logic__.js +50 -150
  75. package/out/concepts/Logic__.js.map +1 -1
  76. package/out/concepts/MatchCase__.d.ts +1 -1
  77. package/out/concepts/MatchCase__.js +8 -15
  78. package/out/concepts/MatchCase__.js.map +1 -1
  79. package/out/concepts/Match__.d.ts +19 -21
  80. package/out/concepts/Match__.js +25 -112
  81. package/out/concepts/Match__.js.map +1 -1
  82. package/out/concepts/MemberExpression__.d.ts +1 -4
  83. package/out/concepts/MemberExpression__.js +15 -30
  84. package/out/concepts/MemberExpression__.js.map +1 -1
  85. package/out/concepts/Module__.js.map +1 -1
  86. package/out/concepts/Namespace__.js.map +1 -1
  87. package/out/concepts/NumericLiteral__.js +1 -1
  88. package/out/concepts/NumericLiteral__.js.map +1 -1
  89. package/out/concepts/OqlQueryComponent__.d.ts +3 -7
  90. package/out/concepts/OqlQueryComponent__.js +95 -56
  91. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  92. package/out/concepts/Param__.d.ts +1 -1
  93. package/out/concepts/Param__.js +4 -40
  94. package/out/concepts/Param__.js.map +1 -1
  95. package/out/concepts/ProcessComponent__.js.map +1 -1
  96. package/out/concepts/ProcessElement__.js.map +1 -1
  97. package/out/concepts/Process__.js.map +1 -1
  98. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  99. package/out/concepts/QueryOrderByExpression__.d.ts +3 -3
  100. package/out/concepts/QueryOrderByExpression__.js +3 -3
  101. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  102. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  103. package/out/concepts/Return__.js +2 -38
  104. package/out/concepts/Return__.js.map +1 -1
  105. package/out/concepts/SelectMembers__.d.ts +1 -1
  106. package/out/concepts/SelectMembers__.js +2 -2
  107. package/out/concepts/SelectMembers__.js.map +1 -1
  108. package/out/concepts/SqlQueryComponent__.d.ts +4 -2
  109. package/out/concepts/SqlQueryComponent__.js +88 -9
  110. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  111. package/out/concepts/StringLiteral__.js +7 -0
  112. package/out/concepts/StringLiteral__.js.map +1 -1
  113. package/out/concepts/StructureProperty__.js.map +1 -1
  114. package/out/concepts/Structure__.js.map +1 -1
  115. package/out/concepts/TypeAnnotation__.d.ts +0 -1
  116. package/out/concepts/TypeAnnotation__.js +12 -25
  117. package/out/concepts/TypeAnnotation__.js.map +1 -1
  118. package/out/concepts/TypeParam__.d.ts +0 -1
  119. package/out/concepts/TypeParam__.js +0 -2
  120. package/out/concepts/TypeParam__.js.map +1 -1
  121. package/out/concepts/UnaryExpression__.js +9 -6
  122. package/out/concepts/UnaryExpression__.js.map +1 -1
  123. package/out/concepts/ValidationRule__.js +23 -88
  124. package/out/concepts/ValidationRule__.js.map +1 -1
  125. package/out/concepts/Variable__.js +2 -38
  126. package/out/concepts/Variable__.js.map +1 -1
  127. package/out/concepts/ViewComponent__.js.map +1 -1
  128. package/out/concepts/ViewElement__.d.ts +29 -30
  129. package/out/concepts/ViewElement__.js +52 -118
  130. package/out/concepts/ViewElement__.js.map +1 -1
  131. package/out/concepts/View__.d.ts +3 -4
  132. package/out/concepts/View__.js +83 -97
  133. package/out/concepts/View__.js.map +1 -1
  134. package/out/concepts/WhileStatement__.js +1 -1
  135. package/out/concepts/WhileStatement__.js.map +1 -1
  136. package/out/concepts/basics/stdlib/nasl.browser.js +0 -50
  137. package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
  138. package/out/concepts/basics/stdlib/nasl.ui.js +4 -36
  139. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  140. package/out/concepts/basics/stdlib/nasl.util.js +43 -63
  141. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  142. package/out/concepts/index__.d.ts +0 -2
  143. package/out/concepts/index__.js +0 -2
  144. package/out/concepts/index__.js.map +1 -1
  145. package/out/generator/genBundleFiles.d.ts +2 -5
  146. package/out/generator/genBundleFiles.js +155 -108
  147. package/out/generator/genBundleFiles.js.map +1 -1
  148. package/out/generator/genMetaData.d.ts +10 -1
  149. package/out/generator/genMetaData.js +50 -189
  150. package/out/generator/genMetaData.js.map +1 -1
  151. package/out/generator/index.d.ts +0 -1
  152. package/out/generator/index.js +0 -1
  153. package/out/generator/index.js.map +1 -1
  154. package/out/index.d.ts +2 -3
  155. package/out/index.js +1 -5
  156. package/out/index.js.map +1 -1
  157. package/out/server/entity2LogicNamespace.js +11 -11
  158. package/out/server/entity2LogicNamespace.js.map +1 -1
  159. package/out/server/extendBaseNode.js +18 -4
  160. package/out/server/extendBaseNode.js.map +1 -1
  161. package/out/server/formatTsUtils.d.ts +2 -1
  162. package/out/server/formatTsUtils.js +64 -40
  163. package/out/server/formatTsUtils.js.map +1 -1
  164. package/out/server/getLogics.js +6 -13
  165. package/out/server/getLogics.js.map +1 -1
  166. package/out/server/getMemberIdentifier.js +7 -7
  167. package/out/server/getMemberIdentifier.js.map +1 -1
  168. package/out/server/getProcesses.d.ts +1 -1
  169. package/out/server/getProcesses.js +1 -1
  170. package/out/server/getProcesses.js.map +1 -1
  171. package/out/server/index.d.ts +1 -0
  172. package/out/server/index.js +27 -2
  173. package/out/server/index.js.map +1 -1
  174. package/out/server/naslServer.d.ts +7 -47
  175. package/out/server/naslServer.js +399 -604
  176. package/out/server/naslServer.js.map +1 -1
  177. package/out/server/naslStdlibMap.js +28 -30
  178. package/out/server/naslStdlibMap.js.map +1 -1
  179. package/out/server/translator.js +11 -59
  180. package/out/server/translator.js.map +1 -1
  181. package/out/service/storage/init.js +3 -33
  182. package/out/service/storage/init.js.map +1 -1
  183. package/out/templator/genCreateBlock.js +4 -6
  184. package/out/templator/genCreateBlock.js.map +1 -1
  185. package/out/templator/genCurdEditMultipleKeyBlock.js +4 -7
  186. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  187. package/out/templator/genCurdMultipleKeyBlock.js +5 -7
  188. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  189. package/out/templator/genEnumSelectBlock.js +2 -5
  190. package/out/templator/genEnumSelectBlock.js.map +1 -1
  191. package/out/templator/genGridViewBlock.js +2 -2
  192. package/out/templator/genGridViewBlock.js.map +1 -1
  193. package/out/templator/genListViewBlock.js +2 -2
  194. package/out/templator/genListViewBlock.js.map +1 -1
  195. package/out/templator/genQueryComponent.d.ts +2 -2
  196. package/out/templator/genQueryComponent.js +1 -4
  197. package/out/templator/genQueryComponent.js.map +1 -1
  198. package/out/templator/genTableBlock.js +2 -2
  199. package/out/templator/genTableBlock.js.map +1 -1
  200. package/out/templator/genUpdateBlock.js +3 -4
  201. package/out/templator/genUpdateBlock.js.map +1 -1
  202. package/out/templator/utils.js +1 -1
  203. package/out/templator/utils.js.map +1 -1
  204. package/out/test/integration/node-nasl-server.js +38 -10
  205. package/out/test/integration/node-nasl-server.js.map +1 -1
  206. package/out/translator/index.d.ts +0 -1
  207. package/out/translator/index.js +1 -1
  208. package/out/translator/index.js.map +1 -1
  209. package/out/utils/index.d.ts +0 -1
  210. package/out/utils/index.js +1 -38
  211. package/out/utils/index.js.map +1 -1
  212. package/out/utils/string.d.ts +2 -15
  213. package/out/utils/string.js +3 -18
  214. package/out/utils/string.js.map +1 -1
  215. package/package.json +2 -2
  216. package/sandbox/stdlib/nasl.auth.ts +1 -1
  217. package/sandbox/stdlib/nasl.core.ts +1 -0
  218. package/sandbox/stdlib/nasl.logging.ts +4 -4
  219. package/sandbox/stdlib/nasl.util.ts +8 -4
  220. package/src/automate/engine/index.js +4 -4
  221. package/src/automate/engine/uniqueName.js +3 -3
  222. package/src/automate/template/myProcess.js +1 -1
  223. package/src/automate/upgrader/2.20.js +41 -0
  224. package/src/bak/translator.js +4 -1
  225. package/src/concepts/AnonymousFunction__.ts +48 -2
  226. package/src/concepts/App__.ts +288 -615
  227. package/src/concepts/BatchAssignment__.ts +45 -1
  228. package/src/concepts/BindAttribute__.ts +18 -25
  229. package/src/concepts/BindDirective__.ts +7 -0
  230. package/src/concepts/BindEvent__.ts +7 -0
  231. package/src/concepts/BindStyle__.ts +7 -0
  232. package/src/concepts/CallFunction__.ts +34 -45
  233. package/src/concepts/CallInterface__.ts +2 -1
  234. package/src/concepts/CallLogic__.ts +61 -44
  235. package/src/concepts/CallQueryComponent__.ts +4 -1
  236. package/src/concepts/Constant__.ts +7 -0
  237. package/src/concepts/DataSource__.ts +57 -5
  238. package/src/concepts/Destination__.ts +8 -21
  239. package/src/concepts/Frontend__.ts +937 -0
  240. package/src/concepts/Identifier__.ts +18 -16
  241. package/src/concepts/LogicItem__.ts +8 -1
  242. package/src/concepts/Logic__.ts +128 -142
  243. package/src/concepts/Match__.ts +13 -29
  244. package/src/concepts/NewComposite__.ts +1357 -0
  245. package/src/concepts/NewList__.ts +440 -0
  246. package/src/concepts/NewMap__.ts +666 -0
  247. package/src/concepts/New__.ts +73 -0
  248. package/src/concepts/Param__.ts +245 -199
  249. package/src/concepts/ProcessElement__.ts +43 -36
  250. package/src/concepts/ProcessOutcomes__.ts +90 -0
  251. package/src/concepts/Process__.ts +1 -23
  252. package/src/concepts/Return__.ts +11 -1
  253. package/src/concepts/SelectMembers__.ts +3 -3
  254. package/src/concepts/Transactional__.ts +7 -0
  255. package/src/concepts/TypeAnnotation__.ts +54 -49
  256. package/src/concepts/ValidationRule__.ts +19 -1
  257. package/src/concepts/Variable__.ts +12 -6
  258. package/src/concepts/ViewElement__.ts +51 -7
  259. package/src/concepts/View__.ts +21 -25
  260. package/src/concepts/basics/stdlib/nasl.auth.ts +1 -1
  261. package/src/concepts/basics/stdlib/nasl.logging.ts +5 -0
  262. package/src/concepts/basics/stdlib/nasl.ui.ts +2 -0
  263. package/src/concepts/basics/stdlib/nasl.util.ts +153 -19
  264. package/src/concepts/index__.ts +7 -0
  265. package/src/enums/KEYWORDS.ts +9 -0
  266. package/src/generator/genBundleFiles.ts +43 -29
  267. package/src/generator/genMetaData.ts +5 -10
  268. package/src/generator/genReleaseBody.ts +77 -41
  269. package/src/generator/index.ts +1 -0
  270. package/src/generator/permission.ts +261 -0
  271. package/src/index.ts +1 -1
  272. package/src/server/entity2LogicNamespace.ts +90 -10
  273. package/src/server/extendBaseNode.ts +29 -3
  274. package/src/server/formatTsUtils.ts +6 -0
  275. package/src/server/getLogics.ts +13 -1
  276. package/src/server/getMemberIdentifier.ts +5 -5
  277. package/src/server/naslServer.ts +235 -58
  278. package/src/server/process2LogicNamespace.ts +8 -0
  279. package/src/server/translator.ts +33 -1
  280. package/src/service/creator/add.configs.js +4 -0
  281. package/src/service/datasource/api.js +11 -0
  282. package/src/service/datasource/index.js +6 -0
  283. package/src/service/storage/init.ts +12 -0
  284. package/src/service/video/VideoTranscribe.js +1 -0
  285. package/src/templator/genEditTableBlock.ts +8 -16
  286. package/src/templator/genGetBlock.ts +18 -19
  287. package/src/templator/genGridViewBlock.ts +18 -18
  288. package/src/templator/genListViewBlock.ts +8 -11
  289. package/src/templator/genTableBlock.ts +6 -10
  290. package/ts-worker/lib/tsserver.js +8 -1
  291. package/out/automate/engine/2.14-components.d.ts +0 -1115
  292. package/out/automate/engine/2.14-components.js +0 -1087
  293. package/out/automate/engine/2.14-components.js.map +0 -1
  294. package/out/concepts/ExternalDestination__.d.ts +0 -73
  295. package/out/concepts/ExternalDestination__.js +0 -264
  296. package/out/concepts/ExternalDestination__.js.map +0 -1
  297. package/out/concepts/MatchExpression__.d.ts +0 -97
  298. package/out/concepts/MatchExpression__.js +0 -281
  299. package/out/concepts/MatchExpression__.js.map +0 -1
  300. package/out/concepts/StringInterpolation__.d.ts +0 -113
  301. package/out/concepts/StringInterpolation__.js +0 -227
  302. package/out/concepts/StringInterpolation__.js.map +0 -1
  303. package/out/generator/genReleaseBody.d.ts +0 -41
  304. package/out/generator/genReleaseBody.js +0 -349
  305. package/out/generator/genReleaseBody.js.map +0 -1
  306. package/out/service/defaultErrorMessage.json +0 -97
  307. package/out/service/logic/api.d.ts +0 -9
  308. package/out/service/logic/api.js +0 -11
  309. package/out/service/logic/api.js.map +0 -1
  310. package/out/service/logic/index.d.ts +0 -2
  311. package/out/service/logic/index.js +0 -10
  312. package/out/service/logic/index.js.map +0 -1
  313. package/sandbox/stdlib/dist/nasl.logging.js +0 -0
  314. package/src/automate/engine/dist/index.dev.js +0 -517
  315. package/src/common/dist/BaseNode.js +0 -1101
  316. package/src/concepts/basics/stdlib/dist/nasl.util.js +0 -1503
  317. package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +0 -24
  318. package/src/concepts/dist/Anchor__.js +0 -179
  319. package/src/concepts/dist/Assignment__.js +0 -301
  320. package/src/concepts/dist/CallFunction__.js +0 -513
  321. package/src/concepts/dist/CallInterface__.js +0 -533
  322. package/src/concepts/dist/CallLogic__.js +0 -892
  323. package/src/concepts/dist/ForEachStatement__.js +0 -426
  324. package/src/concepts/dist/MatchCase__.js +0 -587
  325. package/src/concepts/dist/Match__.js +0 -631
  326. package/src/concepts/dist/MemberExpression__.js +0 -348
  327. package/src/concepts/dist/Param__.js +0 -538
  328. package/src/concepts/dist/Return__.js +0 -494
  329. package/src/concepts/dist/Variable__.js +0 -537
  330. package/src/concepts/dist/ViewElement__.js +0 -1680
  331. package/src/generator/dist/genBundleFiles.js +0 -261
  332. package/src/generator/dist/genMetaData.js +0 -249
  333. package/src/server/dist/formatTsUtils.js +0 -683
  334. package/src/server/dist/naslServer.js +0 -3474
  335. package/src/service/storage/dist/init.js +0 -572
  336. package/ts-worker/dist/webpack.config.dev.js +0 -108
@@ -1,572 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __spreadArrays = (this && this.__spreadArrays) || function () {
39
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
40
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
41
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
42
- r[k] = a[j];
43
- return r;
44
- };
45
- exports.__esModule = true;
46
- exports.loadAppSync = exports.loadApp = exports.handleApp = exports.batchAction = exports.batchQuery = void 0;
47
- var concepts_1 = require("../../concepts");
48
- var decorators_1 = require("../../decorators");
49
- var config_1 = require("../../config");
50
- var vue_1 = require("vue");
51
- var service_1 = require("./service");
52
- /// #if !process.env.NODE_ENV || process.env.BUILD_TARGET === 'node'
53
- var fs = require("fs-extra");
54
- var jsoner = require("./jsoner");
55
- /// #endif
56
- exports.batchQuery = service_1["default"].batchQuery;
57
- exports.batchAction = service_1["default"].batchAction;
58
- function getLogic(key, app, diffLogicList) {
59
- var _a;
60
- if (!diffLogicList.includes(key)) {
61
- diffLogicList.push(key);
62
- if (key.startsWith('app')) {
63
- var index = key.lastIndexOf('.');
64
- var name_1 = key.slice(index + 1);
65
- var logic = app.logics.find(function (item) { return item.name === name_1; });
66
- if (logic && logic.body && logic.body.length > 2) {
67
- logic.body.map(function (item) { return getStatement(item, app, diffLogicList); });
68
- }
69
- }
70
- else if (key.startsWith('extensions')) {
71
- var _pathArr = key.split('.');
72
- var _name_1 = _pathArr[1];
73
- var _path_1 = _pathArr[3];
74
- var _list = app.dependencies;
75
- var _module = _list.find(function (it) {
76
- var name = it.name.replaceAll('-', '_');
77
- return name === _name_1;
78
- });
79
- var logic = (_a = _module === null || _module === void 0 ? void 0 : _module.logics) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.name === _path_1; });
80
- if (logic && logic.body && logic.body.length > 2) {
81
- logic.body.map(function (item) { return getStatement(item, app, diffLogicList); });
82
- }
83
- }
84
- }
85
- }
86
- /* 获取LogicITEM */
87
- function getStatement(state, app, diffLogicList) {
88
- var _a, _b, _c, _d, _e;
89
- var logicItems = [];
90
- switch (state.concept) {
91
- case 'Assignment':
92
- logicItems = [state.left, state.right];
93
- break;
94
- case 'IfStatement':
95
- logicItems = __spreadArrays(state.consequent, state.alternate);
96
- break;
97
- case 'ForEachStatement':
98
- logicItems = __spreadArrays(state.body, [state.each, state.start, state.end]);
99
- break;
100
- case 'Match':
101
- logicItems = state.cases.map(getStatement).flat(1);
102
- break;
103
- case 'MatchCase':
104
- logicItems = __spreadArrays(state.patterns, state.body);
105
- break;
106
- case 'SwitchStatement':
107
- logicItems = state.cases.map(getStatement).flat(1);
108
- break;
109
- case 'SwitchCase':
110
- logicItems = __spreadArrays([state.test], state.consequent);
111
- break;
112
- case 'WhileStatement':
113
- logicItems = __spreadArrays([state.test], state.body);
114
- break;
115
- case 'CallLogic':
116
- logicItems = (_a = state.arguments) === null || _a === void 0 ? void 0 : _a.map(function (item) { return item.expression; });
117
- getLogic(state.calleewholeKey, app, diffLogicList);
118
- break;
119
- case 'CallFunction':
120
- logicItems = (_b = state.arguments) === null || _b === void 0 ? void 0 : _b.map(function (item) { return item.expression; });
121
- break;
122
- case 'CallInterface':
123
- logicItems = (_c = state.arguments) === null || _c === void 0 ? void 0 : _c.map(function (item) { return item.expression; });
124
- break;
125
- case 'BatchAssignment':
126
- logicItems = __spreadArrays([(_d = state.left) === null || _d === void 0 ? void 0 : _d.expression], (_e = state.left) === null || _e === void 0 ? void 0 : _e.members, state.rights.map(function (item) { return __spreadArrays([item === null || item === void 0 ? void 0 : item.expression], item === null || item === void 0 ? void 0 : item.members); }).flat(1));
127
- default:
128
- break;
129
- }
130
- return logicItems.filter(function (item) { return !!item; });
131
- }
132
- /* 小程序影响的服务端发布 */
133
- function getMiniAppChange(target, obj, action) {
134
- var _a;
135
- if (!target.app.miniEnable) {
136
- return false;
137
- }
138
- /* 分端以后需要改 */
139
- var len = (_a = target.nodePath) === null || _a === void 0 ? void 0 : _a.split('.').length;
140
- if (len > 2) {
141
- return false;
142
- }
143
- if (action === 'delete') {
144
- return true;
145
- }
146
- else {
147
- if ('name' in obj || 'title' in obj) {
148
- return true;
149
- }
150
- }
151
- }
152
- /**
153
- * 执行更新
154
- */
155
- function doAction(app, actionItem) {
156
- return __awaiter(this, void 0, void 0, function () {
157
- var hasFrontEnd, hasBackEnd, actionList, _a, list, actionMsg, action, itemloop, loopEle, ChangedNASLType, err, error_1, json, actionMap, msg;
158
- return __generator(this, function (_b) {
159
- switch (_b.label) {
160
- case 0:
161
- app.emit('saving');
162
- hasFrontEnd = false;
163
- hasBackEnd = false;
164
- actionList = [];
165
- _a = actionItem || {}, list = _a.list, actionMsg = _a.actionMsg, action = _a.action;
166
- itemloop = function (_i, app, diffArr) {
167
- var _l = getStatement(_i, app, diffArr);
168
- if (_l.length) {
169
- _l.map(function (_ii) { return itemloop(_ii, app, diffArr); });
170
- }
171
- };
172
- loopEle = function (view, checkAuth) {
173
- var _a, _b;
174
- if (view instanceof concepts_1.View) {
175
- (_a = view === null || view === void 0 ? void 0 : view.elements) === null || _a === void 0 ? void 0 : _a.forEach(function (item) { return loopEle(item, checkAuth); });
176
- }
177
- (_b = view === null || view === void 0 ? void 0 : view.children) === null || _b === void 0 ? void 0 : _b.forEach(function (item) { return loopEle(item, checkAuth); });
178
- if (view instanceof concepts_1.ViewElement) {
179
- if (view.bindEvents.length) {
180
- var diffArr_1 = [];
181
- view.bindEvents.forEach(function (bindEvent) {
182
- bindEvent.logics.forEach(function (logic) {
183
- logic.body.forEach(function (logicItem) { return itemloop(logicItem, app, diffArr_1); });
184
- });
185
- });
186
- var result = diffArr_1.filter(function (item) { return item.startsWith('app') || item.startsWith('extensions'); });
187
- if (result.length) {
188
- hasBackEnd = true;
189
- }
190
- }
191
- if (view.tag === 'u-uploader' || view.tag === 'van-uploader') {
192
- var bute = view === null || view === void 0 ? void 0 : view.bindAttrs.find(function (item) { return item.name === 'url'; });
193
- if (checkAuth) {
194
- if ((bute === null || bute === void 0 ? void 0 : bute.value.endsWith('/import')) && !view.view.parentAuth) {
195
- hasBackEnd = true;
196
- }
197
- }
198
- else {
199
- if (bute === null || bute === void 0 ? void 0 : bute.value.endsWith('/import')) {
200
- hasBackEnd = true;
201
- }
202
- }
203
- }
204
- }
205
- };
206
- try {
207
- if (Array.isArray(list)) {
208
- list.forEach(function (event) {
209
- var _a, _b, _c, _d, _e, _f, _g, _h;
210
- var emitTarget = (_a = event === null || event === void 0 ? void 0 : event.originEvent) === null || _a === void 0 ? void 0 : _a.target;
211
- var _path = event.originEvent.path;
212
- var _root = ((_b = _path.split('.')) === null || _b === void 0 ? void 0 : _b[1]) || '';
213
- if (['dataSources', 'processes', 'logics', 'enums', 'structures', 'interfaces', 'interfaceDependencies', 'configuration', 'dependencies'].some(function (item) { return _root.startsWith(item); })) {
214
- hasBackEnd = true;
215
- }
216
- if (emitTarget.concept === 'Logic') {
217
- var diffArr_2 = [];
218
- if (emitTarget.body.length > 2) {
219
- emitTarget.body.forEach(function (it) {
220
- itemloop(it, app, diffArr_2);
221
- });
222
- }
223
- var result = diffArr_2.filter(function (item) { return item.startsWith('app') || item.startsWith('extensions'); });
224
- if (result.length) {
225
- hasBackEnd = true;
226
- }
227
- }
228
- if (emitTarget.view) {
229
- hasFrontEnd = true;
230
- }
231
- if (emitTarget.concept === 'View') {
232
- if (getMiniAppChange(emitTarget, (_c = event === null || event === void 0 ? void 0 : event.originEvent) === null || _c === void 0 ? void 0 : _c.object, (_d = event === null || event === void 0 ? void 0 : event.originEvent) === null || _d === void 0 ? void 0 : _d.action)) {
233
- hasBackEnd = true;
234
- }
235
- var isDelete_1 = ((_e = event === null || event === void 0 ? void 0 : event.originEvent) === null || _e === void 0 ? void 0 : _e.action) === 'delete';
236
- var isUpdateAuth = ((_f = event === null || event === void 0 ? void 0 : event.originEvent) === null || _f === void 0 ? void 0 : _f.action) === 'update' && ((_g = event === null || event === void 0 ? void 0 : event.originEvent) === null || _g === void 0 ? void 0 : _g.object) && 'auth' in ((_h = event === null || event === void 0 ? void 0 : event.originEvent) === null || _h === void 0 ? void 0 : _h.object);
237
- if (isDelete_1 || isUpdateAuth) {
238
- var app_1 = emitTarget.app;
239
- var diffArr_3 = [];
240
- emitTarget.logics.forEach(function (logic) {
241
- if (logic.body.length > 2) {
242
- logic.body.forEach(function (it) {
243
- itemloop(it, app_1, diffArr_3);
244
- });
245
- }
246
- });
247
- var result = diffArr_3.filter(function (item) { return item.startsWith('app') || item.startsWith('extensions'); });
248
- if (result.length) {
249
- hasBackEnd = true;
250
- }
251
- emitTarget.children.forEach(function (item) { return loopEle(item, isDelete_1); });
252
- emitTarget.elements.forEach(function (item) { return loopEle(item, isDelete_1); });
253
- }
254
- hasFrontEnd = true;
255
- }
256
- if (emitTarget.concept === 'ViewElement') {
257
- loopEle(emitTarget, true);
258
- }
259
- if (emitTarget.concept === 'BindAttribute' && emitTarget.name === 'url' && emitTarget.value.endsWith('/import')) {
260
- if (!emitTarget.view.parentAuth) {
261
- hasBackEnd = true;
262
- }
263
- }
264
- if (emitTarget.concept === 'CallLogic') {
265
- var arrlist = [];
266
- getLogic(emitTarget.calleeKey, emitTarget.app, arrlist);
267
- var result = arrlist.filter(function (item) { return item.startsWith('app') || item.startsWith('extensions'); });
268
- // console.log(result, 'CallLogic');
269
- if (result.length) {
270
- hasBackEnd = true;
271
- }
272
- }
273
- event.eventList.forEach(function (_a) {
274
- var action = _a.action, path = _a.path, objItem = _a.object;
275
- if (Array.isArray(objItem)) {
276
- if (action === 'update') {
277
- actionList.push({
278
- action: action,
279
- path: path,
280
- node: objItem[0]
281
- });
282
- }
283
- else {
284
- objItem.forEach(function (item, index) {
285
- actionList.push({
286
- action: action,
287
- path: path,
288
- node: item
289
- });
290
- });
291
- }
292
- }
293
- else {
294
- actionList.push({
295
- action: action,
296
- path: path,
297
- object: objItem
298
- });
299
- }
300
- });
301
- });
302
- }
303
- }
304
- catch (error) {
305
- console.log(error);
306
- app.emit('refresh');
307
- }
308
- ChangedNASLType = '';
309
- if (hasFrontEnd && hasBackEnd) {
310
- ChangedNASLType = 'both';
311
- }
312
- else if (hasFrontEnd) {
313
- ChangedNASLType = 'web';
314
- }
315
- else if (hasBackEnd) {
316
- ChangedNASLType = 'backend';
317
- }
318
- if (!(config_1.config.storage.protocol === 'http')) return [3 /*break*/, 5];
319
- _b.label = 1;
320
- case 1:
321
- _b.trys.push([1, 3, , 4]);
322
- return [4 /*yield*/, service_1["default"].batchAction({
323
- body: actionList,
324
- headers: {
325
- appId: app.id,
326
- ChangedNASLType: ChangedNASLType
327
- }
328
- })];
329
- case 2:
330
- _b.sent();
331
- return [3 /*break*/, 4];
332
- case 3:
333
- error_1 = _b.sent();
334
- err = error_1;
335
- // 401650, 检测到当前应用拉取操作已被强制结束, 用户确认后再刷新
336
- if ((error_1 === null || error_1 === void 0 ? void 0 : error_1.code) !== 401650)
337
- app.emit('refresh');
338
- return [3 /*break*/, 4];
339
- case 4: return [3 /*break*/, 9];
340
- case 5:
341
- if (!(config_1.config.storage.protocol === 'mock')) return [3 /*break*/, 6];
342
- return [3 /*break*/, 9];
343
- case 6: return [4 /*yield*/, fs.readJSON(config_1.config.storage.basePath)];
344
- case 7:
345
- json = _b.sent();
346
- jsoner.batchAction(json, actionList);
347
- return [4 /*yield*/, fs.writeJSON(config_1.config.storage.basePath, json, {
348
- spaces: 4
349
- })];
350
- case 8:
351
- _b.sent();
352
- _b.label = 9;
353
- case 9:
354
- app.emit('saved', err);
355
- if (!app._historying) {
356
- if (app._historyIndex !== app._historyList.length) {
357
- app._historyList = app._historyList.splice(0, app._historyIndex);
358
- }
359
- app._historyList.push({
360
- actionMsg: actionMsg,
361
- list: list.map(function (item) { return item.originEvent; })
362
- });
363
- app._historyIndex = app._historyList.length;
364
- }
365
- else {
366
- actionMap = {
367
- undo: '已撤销操作:',
368
- redo: '已重做操作:'
369
- };
370
- msg = actionMap[action];
371
- msg += actionMsg;
372
- vue_1["default"].prototype.$toast.info(msg);
373
- app._historying = false;
374
- }
375
- return [2 /*return*/];
376
- }
377
- });
378
- });
379
- }
380
- function handleApp(app) {
381
- var _this = this;
382
- app._isCollectingCount = 0;
383
- app._collectingList = [];
384
- app._historyList = [];
385
- app._historyIndex = 0;
386
- app._historying = false;
387
- app._timer = null;
388
- app.on('undo', function () {
389
- app._historying = true;
390
- });
391
- app.on('redo', function () {
392
- app._historying = true;
393
- });
394
- /**
395
- * 开启收集
396
- */
397
- app.on('collect:start', function (event) {
398
- if (app._timer) {
399
- clearTimeout(app._timer);
400
- }
401
- if (!app._noTimer) {
402
- app._noTimer = event.noTimer;
403
- }
404
- if (!app._noTimer) {
405
- app._timer = setTimeout(function () {
406
- console.error('收集超时,请及时排查原因');
407
- app.emit('refresh');
408
- }, 800);
409
- }
410
- if (!app._isCollectingCount) {
411
- app._actionMsg = event === null || event === void 0 ? void 0 : event.actionMsg;
412
- app._action = event === null || event === void 0 ? void 0 : event.action;
413
- }
414
- app._isCollectingCount++;
415
- });
416
- /**
417
- * 结束收集
418
- */
419
- app.on('collect:end', function () { return __awaiter(_this, void 0, void 0, function () {
420
- var collectingList, actionMsg, action;
421
- return __generator(this, function (_a) {
422
- switch (_a.label) {
423
- case 0:
424
- app._isCollectingCount--;
425
- if (!(app._isCollectingCount === 0)) return [3 /*break*/, 3];
426
- if (app._timer) {
427
- clearTimeout(app._timer);
428
- }
429
- collectingList = app._collectingList;
430
- actionMsg = app._actionMsg;
431
- action = app._action;
432
- app._collectingList = [];
433
- app._actionMsg = '';
434
- app._action = '';
435
- app._noTimer = undefined;
436
- if (!(Array.isArray(collectingList) && collectingList.length)) return [3 /*break*/, 2];
437
- app.naslServer.embeddedTSEmitter.emit('change', {
438
- value: collectingList
439
- });
440
- return [4 /*yield*/, doAction(app, {
441
- list: collectingList,
442
- actionMsg: actionMsg,
443
- action: action
444
- })];
445
- case 1:
446
- _a.sent();
447
- _a.label = 2;
448
- case 2: return [3 /*break*/, 4];
449
- case 3:
450
- if (app._isCollectingCount < 0) {
451
- app._isCollectingCount = 0;
452
- throw Error('关闭收集有问题,请排查');
453
- }
454
- _a.label = 4;
455
- case 4: return [2 /*return*/];
456
- }
457
- });
458
- }); });
459
- /**
460
- * 有变更
461
- */
462
- app.on('storage', function (event) {
463
- // 是否正在收集
464
- if (app._isCollectingCount === 0) {
465
- app.naslServer.embeddedTSEmitter.emit('change', {
466
- value: [event]
467
- });
468
- var actionMsg = '';
469
- var _a = event.originEvent || {}, action = _a.action, target = _a.target;
470
- var _b = target || {}, concept = _b.concept, name = _b.name;
471
- switch (action) {
472
- case 'create':
473
- actionMsg = '添加';
474
- break;
475
- case 'delete':
476
- actionMsg = '删除';
477
- break;
478
- case 'update':
479
- actionMsg = '修改';
480
- break;
481
- }
482
- actionMsg += decorators_1.getConceptConstructor(concept).nodeTitle;
483
- if (name) {
484
- actionMsg += "\u201C" + name + "\u201D";
485
- }
486
- doAction(app, {
487
- list: [event],
488
- actionMsg: actionMsg
489
- });
490
- }
491
- else {
492
- app._collectingList.push(event);
493
- }
494
- });
495
- }
496
- exports.handleApp = handleApp;
497
- /**
498
- * 加载 app
499
- * @param appId 如果是从文件读,就不需要传
500
- * @returns app 对象
501
- */
502
- function loadApp(appId) {
503
- return __awaiter(this, void 0, void 0, function () {
504
- var app, data, json;
505
- return __generator(this, function (_a) {
506
- switch (_a.label) {
507
- case 0:
508
- if (!(config_1.config.storage.protocol === 'http')) return [3 /*break*/, 2];
509
- return [4 /*yield*/, service_1["default"].batchQuery({
510
- body: [
511
- {
512
- path: 'app'
513
- },
514
- ],
515
- headers: {
516
- appId: appId
517
- }
518
- })];
519
- case 1:
520
- data = _a.sent();
521
- // const data = res?.data?.result;
522
- app = new concepts_1.App(Object.assign(data === null || data === void 0 ? void 0 : data[0], { id: appId }));
523
- return [3 /*break*/, 5];
524
- case 2:
525
- if (!(config_1.config.storage.protocol === 'mock')) return [3 /*break*/, 3];
526
- app = new concepts_1.App({
527
- id: appId,
528
- concept: 'App',
529
- name: 'devapp',
530
- title: '开发应用',
531
- scope: 'pc',
532
- envs: 'dev,online',
533
- hasAuth: true,
534
- dataSources: [],
535
- structures: [],
536
- enums: [],
537
- logics: [],
538
- interfaces: [],
539
- views: [],
540
- processes: [],
541
- roles: [],
542
- dependencies: [],
543
- interfaceDependencies: [],
544
- componentDependencies: []
545
- });
546
- return [3 /*break*/, 5];
547
- case 3: return [4 /*yield*/, fs.readJSON(config_1.config.storage.basePath)];
548
- case 4:
549
- json = _a.sent();
550
- app = new concepts_1.App(appId ? Object.assign(json, { id: appId }) : json);
551
- _a.label = 5;
552
- case 5:
553
- config_1.config.scope = app.scope;
554
- handleApp(app);
555
- app._isCollectingCount = 0;
556
- return [2 /*return*/, app];
557
- }
558
- });
559
- });
560
- }
561
- exports.loadApp = loadApp;
562
- /**
563
- * 加载 app
564
- * @returns app 对象
565
- */
566
- function loadAppSync() {
567
- var json = fs.readJSONSync(config_1.config.storage.basePath);
568
- var app = new concepts_1.App(json);
569
- handleApp(app);
570
- return app;
571
- }
572
- exports.loadAppSync = loadAppSync;
@@ -1,108 +0,0 @@
1
- "use strict";
2
-
3
- var path = require('path'); // const HtmlWebpackPlugin = require('html-webpack-plugin');
4
-
5
-
6
- module.exports = {
7
- mode: 'development',
8
- //mode: 'production',
9
- entry: {
10
- bundle: './src/index.js'
11
- },
12
- output: {
13
- path: path.resolve(__dirname, '../../../src/static/'),
14
- filename: 'ts-worker.js'
15
- },
16
- target: 'webworker',
17
- resolve: {
18
- // Use our versions of Node modules.
19
- alias: {
20
- // fs: 'browserfs/dist/shims/fs.js',
21
- // os: require.resolve('os-browserify/browser'),
22
- // // path: require.resolve('path-browserify'),
23
- // buffer: 'browserfs/dist/shims/buffer.js',
24
- // path: 'browserfs/dist/shims/path.js',
25
- // processGlobal: 'browserfs/dist/shims/process.js',
26
- // bufferGlobal: 'browserfs/dist/shims/bufferGlobal.js',
27
- // bfsGlobal: require.resolve('browserfs'),
28
- ts: path.resolve(__dirname, 'typescript')
29
- },
30
- // DISABLE Webpack's built-in process and Buffer polyfills!
31
- fallback: {
32
- fs: false,
33
- os: false,
34
- inspector: false,
35
- // fs: 'browserfs/dist/shims/fs.js',
36
- crypto: require.resolve('crypto-browserify'),
37
- stream: require.resolve('stream-browserify'),
38
- path: require.resolve('path-browserify'),
39
- // processGlobal: 'browserfs/dist/shims/process.js',
40
- // bufferGlobal: 'browserfs/dist/shims/bufferGlobal.js',
41
- // bfsGlobal: require.resolve('browserfs'),
42
- // process: false,
43
- // Buffer: false,
44
- child_process: false,
45
- worker_threads: false,
46
- net: false,
47
- readline: false,
48
- perf_hooks: false
49
- },
50
- extensions: ['.ts', '.tsx', '.js']
51
- },
52
- node: {
53
- __dirname: true,
54
- __filename: true
55
- },
56
- // REQUIRED to avoid issue "Uncaught TypeError: BrowserFS.BFSRequire is not a function"
57
- // See: https://github.com/jvilk/BrowserFS/issues/201
58
- module: {
59
- // noParse: /browserfs\.js/,
60
- rules: [{
61
- test: /\.tsx?$/,
62
- loader: 'ts-loader'
63
- }, {
64
- test: /\.jsx?$|\.tsx?$/,
65
- loader: 'ifdef-loader'
66
- }, {
67
- include: [/node_modules[\\/]@?typescript[\\/]/ // /vusion-api\/out\/fs\/Library\.js$/,
68
- // /prettier\/index\.js$/,
69
- // /prettier\/third-party\.js$/,
70
- // /prettier\/parser-glimmer\.js$/,
71
- // /babel\/core\/lib\/config\/files\/plugins\.js$/,
72
- // /babel\/core\/lib\/config\/files\/configuration\.js$/,
73
- // /\/src\/extension\//,
74
- // /node-plop\/lib\/node-plop\.js$/,
75
- ],
76
- use: [require.resolve('./webpack/loaders/non-webpack-require-loader')]
77
- }]
78
- },
79
- plugins: [// Expose BrowserFS, process, and Buffer globals.
80
- // NOTE: If you intend to use BrowserFS in a script tag, you do not need
81
- // to expose a BrowserFS global.
82
- // new NodePolyfillPlugin(),
83
- // new webpack.ProvidePlugin({ BrowserFS: 'bfsGlobal', process: 'processGlobal', Buffer: 'bufferGlobal' }),
84
- // 先不打开
85
- // new HtmlWebpackPlugin({
86
- // filename: 'index.html',
87
- // chunks: ['bundle'],
88
- // }),
89
- // new HtmlWebpackPlugin({
90
- // filename: 'webpack.html',
91
- // chunks: ['webpack'],
92
- // }),
93
- ],
94
- devServer: {
95
- port: 8700,
96
- // static: {
97
- // directory: __dirname,
98
- // },
99
- proxy: {
100
- '/src': {
101
- target: 'http://localhost:8080',
102
- pathRewrite: {
103
- '/src': '/src'
104
- }
105
- }
106
- }
107
- }
108
- };