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