@lcap/nasl 3.6.0-alpha.1 → 3.6.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/out/bak/translator.js +119 -39
  2. package/out/bak/translator.js.map +1 -1
  3. package/out/breakpoint/generator/BreakpointNode.d.ts +3 -0
  4. package/out/breakpoint/generator/BreakpointNode.js +9 -0
  5. package/out/breakpoint/generator/BreakpointNode.js.map +1 -1
  6. package/out/breakpoint/shared/constants.js +1 -0
  7. package/out/breakpoint/shared/constants.js.map +1 -1
  8. package/out/breakpoint/shared/utils.js +12 -6
  9. package/out/breakpoint/shared/utils.js.map +1 -1
  10. package/out/breakpoint/store/core.js +1 -1
  11. package/out/breakpoint/store/core.js.map +1 -1
  12. package/out/common/BaseNode.d.ts +1 -4
  13. package/out/common/BaseNode.js +23 -37
  14. package/out/common/BaseNode.js.map +1 -1
  15. package/out/concepts/AnonymousFunction__.d.ts +6 -1
  16. package/out/concepts/AnonymousFunction__.js +34 -16
  17. package/out/concepts/AnonymousFunction__.js.map +1 -1
  18. package/out/concepts/App__.d.ts +55 -51
  19. package/out/concepts/App__.js +76 -80
  20. package/out/concepts/App__.js.map +1 -1
  21. package/out/concepts/BackendVariable__.js +10 -2
  22. package/out/concepts/BackendVariable__.js.map +1 -1
  23. package/out/concepts/BindAttribute__.js +16 -6
  24. package/out/concepts/BindAttribute__.js.map +1 -1
  25. package/out/concepts/BindDirective__.d.ts +1 -0
  26. package/out/concepts/BindDirective__.js +19 -4
  27. package/out/concepts/BindDirective__.js.map +1 -1
  28. package/out/concepts/BindEvent__.d.ts +3 -1
  29. package/out/concepts/BindEvent__.js +39 -14
  30. package/out/concepts/BindEvent__.js.map +1 -1
  31. package/out/concepts/BusinessComponent__.d.ts +641 -0
  32. package/out/concepts/BusinessComponent__.js +1921 -0
  33. package/out/concepts/BusinessComponent__.js.map +1 -0
  34. package/out/concepts/BusinessLogic__.d.ts +38 -0
  35. package/out/concepts/BusinessLogic__.js +358 -0
  36. package/out/concepts/BusinessLogic__.js.map +1 -0
  37. package/out/concepts/CallEvent__.d.ts +101 -0
  38. package/out/concepts/CallEvent__.js +280 -0
  39. package/out/concepts/CallEvent__.js.map +1 -0
  40. package/out/concepts/CallFunction__.d.ts +0 -1
  41. package/out/concepts/CallFunction__.js +10 -10
  42. package/out/concepts/CallFunction__.js.map +1 -1
  43. package/out/concepts/CallLogic__.d.ts +2 -0
  44. package/out/concepts/CallLogic__.js +38 -27
  45. package/out/concepts/CallLogic__.js.map +1 -1
  46. package/out/concepts/Constant__.js +7 -6
  47. package/out/concepts/Constant__.js.map +1 -1
  48. package/out/concepts/Destination__.d.ts +1 -1
  49. package/out/concepts/Destination__.js +7 -5
  50. package/out/concepts/Destination__.js.map +1 -1
  51. package/out/concepts/End__.js +2 -1
  52. package/out/concepts/End__.js.map +1 -1
  53. package/out/concepts/Event__.d.ts +14 -0
  54. package/out/concepts/Event__.js +61 -0
  55. package/out/concepts/Event__.js.map +1 -1
  56. package/out/concepts/FrontendType__.d.ts +308 -0
  57. package/out/concepts/FrontendType__.js +605 -0
  58. package/out/concepts/FrontendType__.js.map +1 -0
  59. package/out/concepts/Frontend__.d.ts +0 -88
  60. package/out/concepts/Frontend__.js +1 -143
  61. package/out/concepts/Frontend__.js.map +1 -1
  62. package/out/concepts/Identifier__.d.ts +5 -0
  63. package/out/concepts/Identifier__.js +19 -9
  64. package/out/concepts/Identifier__.js.map +1 -1
  65. package/out/concepts/LogicItem__.d.ts +1 -1
  66. package/out/concepts/LogicItem__.js.map +1 -1
  67. package/out/concepts/Logic__.d.ts +3 -1
  68. package/out/concepts/Logic__.js +31 -21
  69. package/out/concepts/Logic__.js.map +1 -1
  70. package/out/concepts/Match__.d.ts +1 -1
  71. package/out/concepts/MemberExpression__.d.ts +1 -1
  72. package/out/concepts/MemberExpression__.js +3 -3
  73. package/out/concepts/MemberExpression__.js.map +1 -1
  74. package/out/concepts/NewComposite__.js.map +1 -1
  75. package/out/concepts/ParamWithGroup__.d.ts +39 -0
  76. package/out/concepts/ParamWithGroup__.js +85 -0
  77. package/out/concepts/ParamWithGroup__.js.map +1 -0
  78. package/out/concepts/Param__.js +11 -3
  79. package/out/concepts/Param__.js.map +1 -1
  80. package/out/concepts/ProcessElement__.js +9 -1
  81. package/out/concepts/ProcessElement__.js.map +1 -1
  82. package/out/concepts/Return__.js +17 -9
  83. package/out/concepts/Return__.js.map +1 -1
  84. package/out/concepts/ValidationRule__.js +2 -1
  85. package/out/concepts/ValidationRule__.js.map +1 -1
  86. package/out/concepts/Variable__.js +17 -8
  87. package/out/concepts/Variable__.js.map +1 -1
  88. package/out/concepts/ViewElement__.d.ts +17 -1
  89. package/out/concepts/ViewElement__.js +145 -16
  90. package/out/concepts/ViewElement__.js.map +1 -1
  91. package/out/concepts/View__.js +21 -20
  92. package/out/concepts/View__.js.map +1 -1
  93. package/out/concepts/index__.d.ts +5 -0
  94. package/out/concepts/index__.js +5 -0
  95. package/out/concepts/index__.js.map +1 -1
  96. package/out/concepts/utils/asserts.d.ts +258 -3
  97. package/out/concepts/utils/asserts.js +351 -13
  98. package/out/concepts/utils/asserts.js.map +1 -1
  99. package/out/concepts/utils/types.d.ts +20 -3
  100. package/out/generator/genBundleFiles.js +25 -11
  101. package/out/generator/genBundleFiles.js.map +1 -1
  102. package/out/generator/genReleaseBody.js +12 -3
  103. package/out/generator/genReleaseBody.js.map +1 -1
  104. package/out/generator/permission.js +3 -3
  105. package/out/generator/permission.js.map +1 -1
  106. package/out/natural/transformTSCode.js +1 -1
  107. package/out/natural/transformTSCode.js.map +1 -1
  108. package/out/server/extendBaseNode.js +6 -4
  109. package/out/server/extendBaseNode.js.map +1 -1
  110. package/out/server/getLogics.js +62 -27
  111. package/out/server/getLogics.js.map +1 -1
  112. package/out/server/getMemberIdentifier.js +6 -1
  113. package/out/server/getMemberIdentifier.js.map +1 -1
  114. package/out/server/getProcesses.js +3 -3
  115. package/out/server/getProcesses.js.map +1 -1
  116. package/out/server/naslServer.js +40 -19
  117. package/out/server/naslServer.js.map +1 -1
  118. package/out/server/translator.js +6 -1
  119. package/out/server/translator.js.map +1 -1
  120. package/out/service/storage/init.js +1 -2
  121. package/out/service/storage/init.js.map +1 -1
  122. package/out/templator/genCreateBlock.js +6 -6
  123. package/out/templator/genCreateBlock.js.map +1 -1
  124. package/out/templator/genCurdEditMultipleKeyBlock.js +16 -16
  125. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  126. package/out/templator/genCurdMultipleKeyBlock.js +36 -36
  127. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  128. package/out/templator/genGetBlock.js +6 -5
  129. package/out/templator/genGetBlock.js.map +1 -1
  130. package/out/templator/genGridViewBlock.js +12 -12
  131. package/out/templator/genGridViewBlock.js.map +1 -1
  132. package/out/templator/genListViewBlock.js +4 -4
  133. package/out/templator/genListViewBlock.js.map +1 -1
  134. package/out/templator/genSelectBlock.js +3 -3
  135. package/out/templator/genSelectBlock.js.map +1 -1
  136. package/out/templator/genTableBlock.js +10 -10
  137. package/out/templator/genTableBlock.js.map +1 -1
  138. package/out/templator/genUpdateBlock.js +10 -9
  139. package/out/templator/genUpdateBlock.js.map +1 -1
  140. package/out/templator/utils.d.ts +2 -2
  141. package/out/templator/utils.js.map +1 -1
  142. package/out/translator/utils.js +12 -1
  143. package/out/translator/utils.js.map +1 -1
  144. package/out/utils/i18nInfo.js +7 -2
  145. package/out/utils/i18nInfo.js.map +1 -1
  146. package/out/utils/index.d.ts +17 -0
  147. package/out/utils/index.js +184 -1
  148. package/out/utils/index.js.map +1 -1
  149. package/package.json +2 -2
  150. package/src/bak/translator.js +121 -43
  151. package/src/breakpoint/generator/BreakpointNode.ts +12 -0
  152. package/src/breakpoint/shared/constants.ts +1 -0
  153. package/src/breakpoint/shared/utils.ts +13 -8
  154. package/src/breakpoint/store/core.ts +1 -1
  155. package/src/common/BaseNode.ts +22 -41
  156. package/src/concepts/AnonymousFunction__.ts +36 -18
  157. package/src/concepts/App__.ts +129 -130
  158. package/src/concepts/BackendVariable__.ts +10 -2
  159. package/src/concepts/BindAttribute__.ts +14 -6
  160. package/src/concepts/BindDirective__.ts +19 -4
  161. package/src/concepts/BindEvent__.ts +41 -13
  162. package/src/concepts/BusinessComponent__.ts +2693 -0
  163. package/src/concepts/BusinessLogic__.ts +376 -0
  164. package/src/concepts/CallEvent__.ts +351 -0
  165. package/src/concepts/CallFunction__.ts +10 -13
  166. package/src/concepts/CallLogic__.ts +45 -32
  167. package/src/concepts/Constant__.ts +5 -7
  168. package/src/concepts/Destination__.ts +7 -5
  169. package/src/concepts/End__.ts +1 -0
  170. package/src/concepts/Event__.ts +70 -0
  171. package/src/concepts/FrontendType__.ts +919 -0
  172. package/src/concepts/Frontend__.ts +3 -251
  173. package/src/concepts/Identifier__.ts +29 -13
  174. package/src/concepts/LogicItem__.ts +1 -0
  175. package/src/concepts/Logic__.ts +36 -23
  176. package/src/concepts/MemberExpression__.ts +3 -3
  177. package/src/concepts/NewComposite__.ts +4 -6
  178. package/src/concepts/ParamWithGroup__.ts +101 -0
  179. package/src/concepts/Param__.ts +11 -3
  180. package/src/concepts/ProcessElement__.ts +8 -1
  181. package/src/concepts/Return__.ts +15 -12
  182. package/src/concepts/ValidationRule__.ts +6 -1
  183. package/src/concepts/Variable__.ts +17 -9
  184. package/src/concepts/ViewElement__.ts +168 -33
  185. package/src/concepts/View__.ts +23 -20
  186. package/src/concepts/index__.ts +5 -0
  187. package/src/concepts/utils/asserts.ts +367 -4
  188. package/src/concepts/utils/types.ts +28 -0
  189. package/src/generator/genBundleFiles.ts +33 -15
  190. package/src/generator/genReleaseBody.ts +14 -3
  191. package/src/generator/permission.ts +8 -6
  192. package/src/natural/transformTSCode.ts +1 -1
  193. package/src/server/extendBaseNode.ts +22 -20
  194. package/src/server/getLogics.ts +79 -41
  195. package/src/server/getMemberIdentifier.ts +7 -1
  196. package/src/server/getProcesses.ts +3 -3
  197. package/src/server/naslServer.ts +44 -20
  198. package/src/server/translator.ts +7 -1
  199. package/src/service/storage/init.ts +1 -2
  200. package/src/templator/genCreateBlock.ts +6 -6
  201. package/src/templator/genCurdEditMultipleKeyBlock.ts +16 -16
  202. package/src/templator/genCurdMultipleKeyBlock.ts +36 -36
  203. package/src/templator/genGetBlock.ts +6 -5
  204. package/src/templator/genGridViewBlock.ts +12 -12
  205. package/src/templator/genListViewBlock.ts +4 -4
  206. package/src/templator/genSelectBlock.ts +3 -3
  207. package/src/templator/genTableBlock.ts +10 -10
  208. package/src/templator/genUpdateBlock.ts +10 -9
  209. package/src/templator/utils.ts +2 -2
  210. package/src/translator/utils.ts +12 -1
  211. package/src/utils/i18nInfo.ts +7 -2
  212. package/src/utils/index.ts +211 -1
  213. package/test/concepts/call-function/fixtures/from-string.json +68 -59
  214. package/test/concepts/call-function/fixtures/to-string-global-tz.json +67 -58
  215. package/test/concepts/call-function/fixtures/to-string-no-tz.json +57 -48
  216. package/test/concepts/call-function/fixtures/to-string-user-tz.json +69 -60
  217. package/test/concepts/call-function/fixtures/to-string-utc-tz.json +69 -60
  218. package/test/concepts/call-interface/fixtures/only-interface.json +81 -72
  219. package/test/concepts/call-interface/fixtures/with-body-complex-argument.json +223 -214
  220. package/test/concepts/call-interface/fixtures/with-body-no-argument.json +85 -76
  221. package/test/concepts/call-interface/fixtures/with-body-simple-argument.json +100 -91
  222. package/test/concepts/call-interface/fixtures/with-headers-no-argument.json +88 -79
  223. package/test/concepts/call-interface/fixtures/with-headers.json +90 -81
  224. package/test/concepts/call-interface/fixtures/with-query-no-argument.json +88 -79
  225. package/test/concepts/call-interface/fixtures/with-query.json +90 -81
  226. package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +4 -2
  227. package/test/concepts/call-logic/fixtures/entries-get-with-arguments.json +104 -95
  228. package/test/concepts/call-logic/fixtures/entries-update-with-arguments.json +209 -200
  229. package/test/concepts/call-logic/fixtures/global-logic-argument-no-expression.json +97 -88
  230. package/test/concepts/call-logic/fixtures/global-logic-argument-some-expression.json +124 -115
  231. package/test/concepts/call-logic/fixtures/json-deserialize.json +120 -111
  232. package/test/concepts/call-logic/fixtures/json-serialize-with-string.json +124 -115
  233. package/test/concepts/call-logic/fixtures/json-serialize.json +124 -115
  234. package/test/concepts/call-logic/fixtures/view-buildin-logic-with-argument.json +91 -82
  235. package/test/concepts/call-logic/fixtures/view-component-logic-no-argument.json +88 -79
  236. package/test/concepts/call-logic/fixtures/view-component-with-validation.json +144 -135
  237. package/test/concepts/identifier/fixtures/view-variable.json +145 -136
  238. package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +1 -1
  239. package/test/concepts/view-element/fixtures/default-login.json +221 -212
  240. package/test/concepts/view-element/fixtures/default-not-found.json +183 -174
  241. package/test/concepts/view-element/fixtures/with-role-auth.json +91 -82
  242. package/test/concepts/view-element/fixtures/with-table.json +1894 -1885
  243. package/test/concepts/view-element/toVue.spec.ts +1 -0
  244. package/ts-worker/package.json +1 -1
  245. package/ts-worker/src/index.js +1 -0
@@ -1,6 +1,7 @@
1
1
  import type { App } from '../App__';
2
2
  import type { Module } from '../Module__';
3
3
  import type { Namespace } from '../Namespace__';
4
+ import type { FrontendType } from '../FrontendType__';
4
5
  import type { Frontend } from '../Frontend__';
5
6
  import type { Backend } from '../Backend__';
6
7
  import type { Integration } from '../Integration__';
@@ -24,6 +25,7 @@ import type { BindDirective } from '../BindDirective__';
24
25
  import type { BindEvent } from '../BindEvent__';
25
26
  import type { BindStyle } from '../BindStyle__';
26
27
  import type { ViewComponent } from '../ViewComponent__';
28
+ import type { BusinessComponent } from '../BusinessComponent__';
27
29
  import type { Attribute } from '../Attribute__';
28
30
  import type { Event } from '../Event__';
29
31
  import type { Slot } from '../Slot__';
@@ -31,10 +33,12 @@ import type { Theme } from '../Theme__';
31
33
  import type { StaticString } from '../StaticString__';
32
34
  import type { Logic } from '../Logic__';
33
35
  import type { AuthLogic } from '../AuthLogic__';
36
+ import type { BusinessLogic } from '../BusinessLogic__';
34
37
  import type { AuthLogicForCallInterface } from '../AuthLogicForCallInterface__';
35
38
  import type { OverriddenLogic } from '../OverriddenLogic__';
36
39
  import type { AbstractInterface } from '../AbstractInterface__';
37
40
  import type { Param } from '../Param__';
41
+ import type { ParamWithGroup } from '../ParamWithGroup__';
38
42
  import type { Return } from '../Return__';
39
43
  import type { Variable } from '../Variable__';
40
44
  import type { BackendVariable } from '../BackendVariable__';
@@ -60,6 +64,7 @@ import type { Assignment } from '../Assignment__';
60
64
  import type { BatchAssignment } from '../BatchAssignment__';
61
65
  import type { Comment } from '../Comment__';
62
66
  import type { CallLogic } from '../CallLogic__';
67
+ import type { CallEvent } from '../CallEvent__';
63
68
  import type { CallFunction } from '../CallFunction__';
64
69
  import type { CallInterface } from '../CallInterface__';
65
70
  import type { Destination } from '../Destination__';
@@ -136,6 +141,7 @@ export interface ConceptTypeofClassMap {
136
141
  App: typeof App;
137
142
  Module: typeof Module;
138
143
  Namespace: typeof Namespace;
144
+ FrontendType: typeof FrontendType;
139
145
  Frontend: typeof Frontend;
140
146
  Backend: typeof Backend;
141
147
  Integration: typeof Integration;
@@ -159,6 +165,7 @@ export interface ConceptTypeofClassMap {
159
165
  BindEvent: typeof BindEvent;
160
166
  BindStyle: typeof BindStyle;
161
167
  ViewComponent: typeof ViewComponent;
168
+ BusinessComponent: typeof BusinessComponent;
162
169
  Attribute: typeof Attribute;
163
170
  Event: typeof Event;
164
171
  Slot: typeof Slot;
@@ -166,10 +173,12 @@ export interface ConceptTypeofClassMap {
166
173
  StaticString: typeof StaticString;
167
174
  Logic: typeof Logic;
168
175
  AuthLogic: typeof AuthLogic;
176
+ BusinessLogic: typeof BusinessLogic;
169
177
  AuthLogicForCallInterface: typeof AuthLogicForCallInterface;
170
178
  OverriddenLogic: typeof OverriddenLogic;
171
179
  AbstractInterface: typeof AbstractInterface;
172
180
  Param: typeof Param;
181
+ ParamWithGroup: typeof ParamWithGroup;
173
182
  Return: typeof Return;
174
183
  Variable: typeof Variable;
175
184
  BackendVariable: typeof BackendVariable;
@@ -195,6 +204,7 @@ export interface ConceptTypeofClassMap {
195
204
  BatchAssignment: typeof BatchAssignment;
196
205
  Comment: typeof Comment;
197
206
  CallLogic: typeof CallLogic;
207
+ CallEvent: typeof CallEvent;
198
208
  CallFunction: typeof CallFunction;
199
209
  CallInterface: typeof CallInterface;
200
210
  Destination: typeof Destination;
@@ -272,6 +282,7 @@ export interface ConceptClassMap {
272
282
  App: App;
273
283
  Module: Module;
274
284
  Namespace: Namespace;
285
+ FrontendType: FrontendType;
275
286
  Frontend: Frontend;
276
287
  Backend: Backend;
277
288
  Integration: Integration;
@@ -295,6 +306,7 @@ export interface ConceptClassMap {
295
306
  BindEvent: BindEvent;
296
307
  BindStyle: BindStyle;
297
308
  ViewComponent: ViewComponent;
309
+ BusinessComponent: BusinessComponent;
298
310
  Attribute: Attribute;
299
311
  Event: Event;
300
312
  Slot: Slot;
@@ -302,10 +314,12 @@ export interface ConceptClassMap {
302
314
  StaticString: StaticString;
303
315
  Logic: Logic;
304
316
  AuthLogic: AuthLogic;
317
+ BusinessLogic: BusinessLogic;
305
318
  AuthLogicForCallInterface: AuthLogicForCallInterface;
306
319
  OverriddenLogic: OverriddenLogic;
307
320
  AbstractInterface: AbstractInterface;
308
321
  Param: Param;
322
+ ParamWithGroup: ParamWithGroup;
309
323
  Return: Return;
310
324
  Variable: Variable;
311
325
  BackendVariable: BackendVariable;
@@ -331,6 +345,7 @@ export interface ConceptClassMap {
331
345
  BatchAssignment: BatchAssignment;
332
346
  Comment: Comment;
333
347
  CallLogic: CallLogic;
348
+ CallEvent: CallEvent;
334
349
  CallFunction: CallFunction;
335
350
  CallInterface: CallInterface;
336
351
  Destination: Destination;
@@ -407,6 +422,7 @@ export type SyntaxNode =
407
422
  | App
408
423
  | Module
409
424
  | Namespace
425
+ | FrontendType
410
426
  | Frontend
411
427
  | Backend
412
428
  | Integration
@@ -430,6 +446,7 @@ export type SyntaxNode =
430
446
  | BindEvent
431
447
  | BindStyle
432
448
  | ViewComponent
449
+ | BusinessComponent
433
450
  | Attribute
434
451
  | Event
435
452
  | Slot
@@ -437,9 +454,11 @@ export type SyntaxNode =
437
454
  | StaticString
438
455
  | Logic
439
456
  | AuthLogic
457
+ | BusinessLogic
440
458
  | AuthLogicForCallInterface
441
459
  | OverriddenLogic
442
460
  | Param
461
+ | ParamWithGroup
443
462
  | Return
444
463
  | Variable
445
464
  | BackendVariable
@@ -463,6 +482,7 @@ export type SyntaxNode =
463
482
  | BatchAssignment
464
483
  | Comment
465
484
  | CallLogic
485
+ | CallEvent
466
486
  | CallFunction
467
487
  | CallInterface
468
488
  | Destination
@@ -545,6 +565,7 @@ export type ModuleNodeConcept = ModuleNode['concept'];
545
565
  export type LogicNode =
546
566
  | Logic
547
567
  | AuthLogic
568
+ | BusinessLogic
548
569
  | AuthLogicForCallInterface;
549
570
 
550
571
  export type LogicNodeConcept = LogicNode['concept'];
@@ -561,6 +582,12 @@ export type AbstractInterfaceNode =
561
582
 
562
583
  export type AbstractInterfaceNodeConcept = AbstractInterfaceNode['concept'];
563
584
 
585
+ export type ParamNode =
586
+ | Param
587
+ | ParamWithGroup;
588
+
589
+ export type ParamNodeConcept = ParamNode['concept'];
590
+
564
591
  export type VariableNode =
565
592
  | Variable
566
593
  | FrontendVariable;
@@ -581,6 +608,7 @@ export type LogicItemNode =
581
608
  | BatchAssignment
582
609
  | Comment
583
610
  | CallLogic
611
+ | CallEvent
584
612
  | CallFunction
585
613
  | CallInterface
586
614
  | Destination
@@ -4,7 +4,7 @@ import * as utils from '../utils';
4
4
 
5
5
  import { genBreakpoints, clearBreakpoints } from '../breakpoint';
6
6
 
7
- import { App, Module, View, Frontend, Connector, FrontendVariable } from '../concepts';
7
+ import { App, Module, View, Frontend, FrontendType, Connector, FrontendVariable } from '../concepts';
8
8
  import { genHash, RawOptions } from '.';
9
9
  import { compileComponent } from './compileComponent';
10
10
 
@@ -44,7 +44,7 @@ function stringifyMetaData(obj: any) {
44
44
  // 处理数组类型
45
45
  const elements: string[] = obj.map(element => stringifyMetaData(element));
46
46
  return `[${elements.join(',')}]`;
47
- }
47
+ }
48
48
  let newObj = obj;
49
49
  const properties: string[] = [];
50
50
  if (obj instanceof FrontendVariable) {
@@ -64,11 +64,29 @@ function stringifyMetaData(obj: any) {
64
64
  return `{
65
65
  ${properties.join(',')}
66
66
  }`;
67
- }
67
+ }
68
68
  return JSON5.stringify(obj);
69
69
  }
70
70
 
71
+ // 生成组件
72
+ function genComponetCode(component: RawOptions) {
73
+ return `(function(){
74
+ var componentOptions = ${component.script
75
+ ? `(function(){\n${component.script.trim().replace(/export default |module\.exports +=/, 'return ')}\n})()`
76
+ : '{}'
77
+ };
78
+ Object.assign(componentOptions, {
79
+ template: \`${component.template.replace(/[`$]/g, (m) => `\\${m}`)}\`,
80
+ });
81
+ return componentOptions;
82
+ })()`;
83
+ }
84
+
71
85
  export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
86
+ // 获取端类型
87
+ const frontendType = frontend.getAncestor('FrontendType') as FrontendType;
88
+ // 获取业务组件
89
+ const businessComponents = frontendType?.businessComponents || [];
72
90
  const configLowcodeDomain = config?.lowcodeDomain;
73
91
  const fnNuimsDomain = config?.envNuimsDomain?.[config?.env] || config?.nuimsDomain;
74
92
  const fnLowcodeDomain = config?.envLcpDomain?.[config?.env]?.lcpDomain || config?.lowcodeDomain;
@@ -98,6 +116,14 @@ export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
98
116
  }
99
117
  );
100
118
 
119
+ // 需要放在清除断点节点之前
120
+ let compRegStr = '';
121
+ businessComponents.forEach((businessComponent) => {
122
+ const vueOptions = businessComponent.toVueOptions();
123
+ const component = compileComponent(vueOptions);
124
+ compRegStr += `window.Vue.component('bs-${businessComponent.name}', ${genComponetCode(component)},\n);`;
125
+ });
126
+
101
127
  config?.debug && clearBreakpoints(app);
102
128
 
103
129
  /**
@@ -212,17 +238,7 @@ export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
212
238
  let content = `{
213
239
  path: '${route.path}',\n`;
214
240
  if (route?.component?.script) {
215
- const { template } = route.component;
216
- content += `component: (function(){
217
- var componentOptions = ${route.component.script
218
- ? `(function(){\n${route.component.script.trim().replace(/export default |module\.exports +=/, 'return ')}\n})()`
219
- : '{}'
220
- };
221
- Object.assign(componentOptions, {
222
- template: \`${template.replace(/[`$]/g, (m) => `\\${m}`)}\`,
223
- });
224
- return componentOptions;
225
- })(),\n`;
241
+ content += `component: ${genComponetCode(route.component)},\n`;
226
242
  }
227
243
  if (route?.children?.length) {
228
244
  content += `children: [
@@ -338,6 +354,8 @@ export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
338
354
 
339
355
  const assetsInfo = app.genAllAssetsInfo(config.STATIC_URL, frontend.type);
340
356
  const customNames = JSON5.stringify(assetsInfo.custom.names);
357
+
358
+
341
359
  let content = `(function(){
342
360
  `;
343
361
  if (frontend.globalScaleEnabled) {
@@ -438,7 +456,7 @@ export function genBundleFiles(app: App, frontend: Frontend, config: Config) {
438
456
 
439
457
  window.createLcapApp = () => {
440
458
  appVM = window.cloudAdminDesigner.init(platformConfig.appConfig, platformConfig, routes, metaData);
441
-
459
+ ${compRegStr}
442
460
  try {
443
461
  var push = appVM.$router.history.push;
444
462
  appVM.$router.history.push = function (a, b) {
@@ -4,12 +4,20 @@ import {
4
4
  View,
5
5
  ViewElement,
6
6
  Frontend,
7
+ FrontendType,
7
8
  } from '../concepts';
8
9
  import { genFrontendBundleFiles } from './genBundleFiles';
9
10
  import { genPermissionData, genLogicAuthFlag } from './permission';
10
11
 
11
12
  import * as utils from '../utils';
12
13
 
14
+ /**
15
+ * 获取端类型下的所有端
16
+ */
17
+ function getFrontendsByTypes(frontendTypes: FrontendType[] = []) {
18
+ return (frontendTypes?.map((frontendType) => (frontendType?.frontends || [])) || []).flat(2);
19
+ }
20
+
13
21
  interface ServerValidationData {
14
22
  rules: object[];
15
23
  failureRules: object[];
@@ -50,7 +58,8 @@ async function mergeBodyData(app: App, opt: ReleaseData) {
50
58
  const authReport: ReturnType<typeof getAuthReport> = getAuthReport(app, opt.frontends);
51
59
  opt.logPublishFunc?.(`[权限] "[${app.title}]" 分析权限数据成功!`);
52
60
  const logicPageResourceDtoList = await genPermissionData(app);
53
- const releaseFrontends = app.frontends.map((frontend) => ({
61
+ const allFrontends = getFrontendsByTypes(app?.frontendTypes);
62
+ const releaseFrontends = allFrontends.map((frontend: Frontend) => ({
54
63
  name: frontend.name,
55
64
  type: frontend.type,
56
65
  path: frontend.path,
@@ -247,8 +256,10 @@ async function getNaslAnnotatedJSON(app: App, opt: ReleaseData) {
247
256
  }
248
257
  // 如果是发布,就排除 views,导出源码就不排除
249
258
  if (opt.realRelease) {
250
- NaslAnnotatedJSON.frontends.forEach((frontend: Frontend) => {
251
- delete (frontend as any).views;
259
+ NaslAnnotatedJSON.frontendTypes.forEach((frontendType: FrontendType) => {
260
+ frontendType.frontends.forEach((frontend: Frontend) => {
261
+ delete (frontend as any).views;
262
+ });
252
263
  });
253
264
  }
254
265
 
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  Logic,
3
3
  View,
4
+ BusinessComponent,
4
5
  BaseNode,
5
6
  CallLogic,
6
7
  ViewElement,
@@ -9,6 +10,7 @@ import {
9
10
  App,
10
11
  Entity,
11
12
  Module,
13
+ FrontendType,
12
14
  Frontend,
13
15
  BindStyle,
14
16
  BindDirective,
@@ -52,7 +54,7 @@ async function findViewLogicReferences(logic: Logic, vis: Set<Logic> = new Set()
52
54
  const usageMap: Map<BaseNode, Usage> = await findUsage(logic);
53
55
  const usages: Usage[] = [];
54
56
  usageMap.forEach((usage: Usage, node: BaseNode) => {
55
- if (node instanceof Frontend) usages.push(usage);
57
+ if (node instanceof FrontendType) usages.push(usage);
56
58
  });
57
59
 
58
60
  async function dfs(usage: Usage) {
@@ -82,17 +84,17 @@ async function findUIReferences(logic: Logic) {
82
84
  const usageMap: Map<BaseNode, Usage> = await findUsage(logic);
83
85
  const usages: Usage[] = [];
84
86
  usageMap.forEach((usage: Usage, node: BaseNode) => {
85
- if (node instanceof Frontend) usages.push(usage);
87
+ if (node instanceof FrontendType) usages.push(usage);
86
88
  });
87
89
 
88
- const res: Array<View | ViewElement | Frontend> = [];
90
+ const res: Array<View | BusinessComponent | ViewElement | Frontend | FrontendType> = [];
89
91
  function dfs(usage: Usage, parent: Usage = null) {
90
92
  if (
91
93
  (usage.node instanceof BindEvent ||
92
94
  usage.node instanceof BindAttribute ||
93
95
  usage.node instanceof BindStyle ||
94
96
  usage.node instanceof BindDirective) &&
95
- (parent.node instanceof View || parent.node instanceof ViewElement || parent.node instanceof Frontend)
97
+ (parent.node instanceof View || parent.node instanceof BusinessComponent || parent.node instanceof ViewElement || parent.node instanceof Frontend || parent.node instanceof FrontendType)
96
98
  )
97
99
  res.push(parent.node);
98
100
 
@@ -107,7 +109,7 @@ async function findUIReferences(logic: Logic) {
107
109
  return res;
108
110
  }
109
111
 
110
- function findResourcesOfUI(view: View | ViewElement | Frontend) {
112
+ function findResourcesOfUI(view: View | BusinessComponent | ViewElement | Frontend | FrontendType) {
111
113
  const res: ResourceNode[] = [];
112
114
  let node: BaseNode = view;
113
115
  while (node) {
@@ -159,7 +161,7 @@ async function findResourcesOfLogic(logic: Logic, uploaders: Map<string, ViewEle
159
161
  const logics = await findViewLogicReferences(logic);
160
162
  logics.push(logic);
161
163
 
162
- let UIs: Array<View | ViewElement | Frontend> = [];
164
+ let UIs: Array<View | BusinessComponent | ViewElement | Frontend | FrontendType> = [];
163
165
  for (const logic of logics) {
164
166
  UIs = UIs.concat(await findUIReferences(logic));
165
167
  }
@@ -355,7 +355,7 @@ export function transformTSCode(tsCode: string, contextLogicName: string, type?:
355
355
  const viewName = nsArr.pop();
356
356
 
357
357
  return new naslTypes.Destination({
358
- viewNamespace: `app.frontends.pc.views${nsArr.map((item) => `.${item}.views`).join('')}`, // viewNamespace
358
+ viewNamespace: `app.frontendTypes.pc.frontends.pc.views${nsArr.map((item) => `.${item}.views`).join('')}`, // viewNamespace
359
359
  viewName, // viewName
360
360
  arguments: node.arguments.slice(1).map((arg) => new naslTypes.Argument({
361
361
  expression: transformLogicNode(arg),
@@ -64,7 +64,7 @@ BaseNode.prototype.findReadOnlyLogicUsage = function () {
64
64
  } else if (this.getAncestor('Connector')) {
65
65
  // 如果是连接器下的操作还是用它本身去查找引用
66
66
  targetNode = this;
67
- }else {
67
+ } else {
68
68
  const sourceMap = this.parentNode.sourceMap;
69
69
  for (const item of sourceMap) {
70
70
  const logic = item[0] as Logic;
@@ -243,20 +243,20 @@ BaseNode.prototype.removeBindEntityPropertyViewEelment = async function removeBi
243
243
 
244
244
  /** 删除连接器 */
245
245
  function delConnection(node: Connection) {
246
- const app = node.rootNode as App;
247
- app.emit('collect:start', {
248
- actionMsg: '删除连接器',
246
+ const app = node.rootNode as App;
247
+ app.emit('collect:start', {
248
+ actionMsg: '删除连接器',
249
+ });
250
+ if (node.connector?.connectorKind === 'kafka') {
251
+ // 删除相关的触发器
252
+ app.triggerLaunchers.forEach((launcher) => {
253
+ if ((launcher as MsgTriggerLauncher).calleeConnectionName === node.name) {
254
+ launcher.delete();
255
+ }
249
256
  });
250
- if (node.connector?.connectorKind === 'kafka') {
251
- // 删除相关的触发器
252
- app.triggerLaunchers.forEach((launcher) => {
253
- if ((launcher as MsgTriggerLauncher).calleeConnectionName === node.name) {
254
- launcher.delete();
255
- }
256
- });
257
- }
258
- node.delete();
259
- app.emit('collect:end');
257
+ }
258
+ node.delete();
259
+ app.emit('collect:end');
260
260
  }
261
261
 
262
262
  /**
@@ -271,12 +271,14 @@ BaseNode.prototype.prepareDelete = async function prepareDelete(cb?: Function) {
271
271
  const naslServer = (app as any).naslServer as NaslServer;
272
272
  const node = this;
273
273
  let refsList = await naslServer._isHaveRef(node);
274
- // 删除的时候过滤一把组件删除提示
275
- refsList = refsList.filter(
276
- (item) =>
277
- // 因为ui组件本身会多渲染一次,就先过滤一个
278
- !item.lineText.includes(': nasl.ui.')
279
- );
274
+ if (this.concept === 'ViewElement') {
275
+ // 删除的时候过滤一把组件删除提示
276
+ refsList = refsList.filter(
277
+ (item, index) =>
278
+ // 因为ui组件本身会多渲染一次,就先过滤一个
279
+ index !== 0
280
+ );
281
+ }
280
282
  // delete的弹框展示
281
283
  const confirmParms = {
282
284
  actionType: 'delete',
@@ -14,6 +14,9 @@ import {
14
14
  ViewElement,
15
15
  getStdlibNamespace,
16
16
  EnumItem,
17
+ BusinessComponent,
18
+ View,
19
+ FrontendType,
17
20
  } from '..';
18
21
  import { process2LogicNamespace } from './process2LogicNamespace';
19
22
  import { moduleToLogicNamesapce } from './getExtensionModules';
@@ -104,6 +107,56 @@ export async function getLogics(node: CallLogic | BindEvent | Identifier | Logic
104
107
  return getLogicsSync(node, needAllLogic)
105
108
  }
106
109
 
110
+ // 获取页面元素上的方法
111
+ function getElementsMethods(likeComponent: View | BusinessComponent, parentNodeNames: string[]) {
112
+ // 获取组件逻辑, 获取传入属性的子集
113
+ const elements: Array<ViewElement> = [];
114
+ likeComponent.elementsMethods(likeComponent.elements, elements, parentNodeNames);
115
+ // 获取端类型
116
+ const frontendType = likeComponent.getAncestor('FrontendType') as FrontendType;
117
+ // 端下的业务组件
118
+ const businessComponents = frontendType?.businessComponents;
119
+ // 获取app
120
+ const app = likeComponent.getAncestor('App');
121
+ const viewElements: Array<Namespace> = [];
122
+ elements.forEach((item) => {
123
+ let businessComponent;
124
+ if (item.tag.startsWith('bs-')) {
125
+ businessComponent = businessComponents.find((businessComponent) => {
126
+ return `bs-${businessComponent?.name}` === item.tag;
127
+ });
128
+ }
129
+ let eleLogis;
130
+ if (businessComponent) {
131
+ eleLogis = businessComponent.logics?.filter((logic) => {
132
+ return logic.isPublic;
133
+ });
134
+ } else {
135
+ const itemTag = toHump(item.tag);
136
+ const naslServer = (app as any).naslServer;
137
+ const elementsLogic = naslServer.elementsLogic;
138
+ const elementsLogicName = itemTag;
139
+ eleLogis = elementsLogic[elementsLogicName];
140
+ }
141
+ // 看是不是有已经有有参数的函数了
142
+ if (Array.isArray(eleLogis) && eleLogis.length) {
143
+ let path = `elements.${toHump(item.name)}.logics`;
144
+ if (businessComponent) {
145
+ path = `elements.${toHump(item.name)}`;
146
+ }
147
+ const viewElement = new Namespace({
148
+ title: toHump(item.name),
149
+ logics: eleLogis.map((item: Logic) => Logic.from(item.toJSON())),
150
+ path,
151
+ originConcept: 'ViewElement',
152
+ });
153
+ viewElement.expanded = false;
154
+ viewElements.push(viewElement);
155
+ }
156
+ });
157
+ return viewElements;
158
+ }
159
+
107
160
  export function getLogicsSync(node: CallLogic | BindEvent | Identifier | Logic, needAllLogic: boolean = true) {
108
161
  const app = node?.rootNode as App;
109
162
  if (node?.concept === 'CallLogic' || node?.concept === 'BindEvent' || node?.concept === 'Logic') {
@@ -206,39 +259,24 @@ export function getLogicsSync(node: CallLogic | BindEvent | Identifier | Logic,
206
259
  expanded: false,
207
260
  });
208
261
 
209
- if (node.view && node.view.logics) {
262
+ // 类组件节点
263
+ const likeComponent: View | BusinessComponent = node.view || node.getAncestor('BusinessComponent') as BusinessComponent;
264
+ if (likeComponent?.logics) {
210
265
  // 遍历node的parentNode,获取viewElement层级节点
211
266
  const parentNodeNames: Array<string> = [];
212
267
  getViewElementPath(node.parentNode, parentNodeNames);
213
268
  // 获取组件逻辑, 获取传入属性的子集
214
- const elements: Array<ViewElement> = [];
215
- node.view.elementsMethods(node.view.elements, elements, parentNodeNames);
216
- const viewElements: Array<Namespace> = [];
217
- elements.forEach((item) => {
218
- const itemTag = toHump(item.tag);
219
- const app = node.getAncestor('App');
220
- const naslServer = (app as any).naslServer;
221
- const elementsLogic = naslServer.elementsLogic;
222
- const elementsLogicName = itemTag;
223
- const eleLogis = elementsLogic[elementsLogicName];
224
- // 看是不是有已经有有参数的函数了
225
- if (Array.isArray(eleLogis) && eleLogis.length) {
226
- const viewElement = new Namespace({
227
- title: toHump(item.name),
228
- logics: eleLogis.map((item: Logic) => Logic.from(item.toJSON())),
229
- path: `elements.${toHump(item.name)}.logics`,
230
- originConcept: 'ViewElement',
231
- });
232
- viewElement.expanded = false;
233
- viewElements.push(viewElement);
234
- }
235
- });
269
+ const viewElements: Namespace[] = getElementsMethods(likeComponent, parentNodeNames);
270
+ const titleMap = {
271
+ View: '页面逻辑',
272
+ BusinessComponent: '业务组件逻辑',
273
+ };
236
274
  // 增加页面逻辑
237
275
  const tree = new Namespace({
238
276
  name: 'category',
239
- path: `${node.view.getNamespace()}.${node.view.name}.logics`,
240
- title: '页面逻辑',
241
- logics: node.view.logics,
277
+ path: `${likeComponent.getNamespace()}.${likeComponent.name}.logics`,
278
+ title: titleMap[likeComponent.concept],
279
+ logics: likeComponent.logics,
242
280
  children: viewElements,
243
281
  });
244
282
  tree.expanded = false;
@@ -264,19 +302,19 @@ export function getLogicsSync(node: CallLogic | BindEvent | Identifier | Logic,
264
302
  node?.frontend?.type === 'h5'
265
303
  ? filteredBrowserLogics.filter((item) => ['getDistance', 'getLocation', 'getIsMiniApp'].includes(item.name))
266
304
  : filteredBrowserLogics.filter(
267
- (item) =>
268
- ![
269
- 'getDistance',
270
- 'getLocation',
271
- 'getIsMiniApp',
272
- 'navigateToUserInfo',
273
- 'getWeChatHeadImg',
274
- 'getWeChatNickName',
275
- 'getWeChatPhone',
276
- 'getWeChatOpenid',
277
- 'navigateToUserPhone',
278
- ].includes(item.name)
279
- ),
305
+ (item) =>
306
+ ![
307
+ 'getDistance',
308
+ 'getLocation',
309
+ 'getIsMiniApp',
310
+ 'navigateToUserInfo',
311
+ 'getWeChatHeadImg',
312
+ 'getWeChatNickName',
313
+ 'getWeChatPhone',
314
+ 'getWeChatOpenid',
315
+ 'navigateToUserPhone',
316
+ ].includes(item.name)
317
+ ),
280
318
  expanded: false,
281
319
  }),
282
320
  new Namespace({
@@ -343,7 +381,7 @@ export function getLogicsSync(node: CallLogic | BindEvent | Identifier | Logic,
343
381
  title: '微信',
344
382
  logics: getStdlibNamespace()
345
383
  .findChild('browser')
346
- .logics.filter((item) => ['navigateToUserInfo', 'getWeChatHeadImg', 'getWeChatNickName', 'getWeChatOpenid','navigateToUserPhone','getWeChatPhone'].includes(item.name)),
384
+ .logics.filter((item) => ['navigateToUserInfo', 'getWeChatHeadImg', 'getWeChatNickName', 'getWeChatOpenid', 'navigateToUserPhone', 'getWeChatPhone'].includes(item.name)),
347
385
  expanded: false,
348
386
  })
349
387
  );
@@ -363,7 +401,7 @@ export function getLogicsSync(node: CallLogic | BindEvent | Identifier | Logic,
363
401
  // if (!item.enable) {
364
402
  // return;
365
403
  // }
366
- const fed = item.frontends.find((item) => item.type === node?.frontend?.type);
404
+ const fed = item.frontends.find((item) => item.type === (node?.getAncestor('FrontendType') as FrontendType)?.kind);
367
405
  if (fed?.logics.length > 0) {
368
406
  systemTree.children.push(
369
407
  new Namespace({
@@ -11,6 +11,7 @@ import {
11
11
  LogicItem,
12
12
  Frontend,
13
13
  View,
14
+ BusinessComponent,
14
15
  types,
15
16
  ViewElement,
16
17
  PAGE_COMPONENT_INCLUDE_TAG_MAP,
@@ -206,7 +207,7 @@ function getCurrentLogic(
206
207
  node.parentNode instanceof BindAttribute &&
207
208
  (node.parentNode.name === 'data-source' || node.parentNode.name === 'check-file' || node.parentNode.name === 'can-dragable-handler' || node.parentNode.name === 'can-dropin-handler'))
208
209
  ) {
209
- const { view } = node;
210
+ const view = node.view || node.getAncestor('BusinessComponent') as BusinessComponent;
210
211
  const viewLogics = view.logics;
211
212
  const logicVariable = viewLogics.map((item) => {
212
213
  const newLogic: LiteralDefination = {
@@ -258,6 +259,10 @@ export async function getMemberIdentifier(node: types.SyntaxNode) {
258
259
  // 获取页面组件
259
260
  const pageComponents = await getPageComponentsIdentifier(node);
260
261
  result.push({ name: '页面组件', children: pageComponents, expanded: true, icon: 'category' });
262
+ } else if ((node as Identifier).getAncestor('BusinessComponent')) {
263
+ // 获取页面组件
264
+ const pageComponents = await getPageComponentsIdentifier(node);
265
+ result.push({ name: '组件元素', children: pageComponents, expanded: true, icon: 'category' });
261
266
  } else if (!(node as Identifier).frontend && (node as any).concept !== 'BackendVariable') {
262
267
  // 端事件里既不能调用前端变量 也不能调用后端变量
263
268
  const BackEndglobalVariable = getBackendVariablesIdentifier(node);
@@ -324,6 +329,7 @@ export async function getVariableIdentifier(node: types.SyntaxNode): Promise<Com
324
329
  });
325
330
  }
326
331
  completionData = formatVariableData(nextCompletion, node);
332
+
327
333
  return completionData;
328
334
  }
329
335
 
@@ -267,7 +267,7 @@ export function syncMemberExpression(elem: ProcessElement | Process, callback: (
267
267
  }
268
268
  });
269
269
  }
270
- if (el.type === 'ExclusiveGateway' || el.type === 'AutoTask') {
270
+ if (['ExclusiveGateway', 'AutoTask', 'InclusiveGateway'].includes(el.type)) {
271
271
  travelDown(el.logic, (node) => {
272
272
  if (node instanceof MemberExpression) {
273
273
  callback(node);
@@ -435,7 +435,7 @@ export function getProcessVariableSuggestions(node: LogicItem, abandonConstant:
435
435
  ],
436
436
  });
437
437
  processVariables.icon = 'Process';
438
- if (processElem.type === 'ExclusiveGateway') {
438
+ if (['ExclusiveGateway', 'InclusiveGateway'].includes(processElem.type)) {
439
439
  const scopeVariable = new CompletionProperty({
440
440
  name: processElem.name,
441
441
  value: processElem.name,
@@ -589,7 +589,7 @@ export function getProcessVariableSuggestionsAll(node: ProcessElement, exitConst
589
589
  });
590
590
  processVariables.expanded = true;
591
591
  processVariables.icon = 'Process';
592
- if (processElem.type === 'ExclusiveGateway') {
592
+ if (['ExclusiveGateway', 'AutoTask', 'InclusiveGateway'].includes(processElem.type)) {
593
593
  const scopeVariable = new CompletionProperty({
594
594
  name: processElem.name,
595
595
  value: processElem.name,