@lcap/nasl 3.8.2-beta.2 → 3.8.2-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/.mocharc.js +1 -0
  2. package/out/common/BaseNode.d.ts +19 -3
  3. package/out/common/BaseNode.js +85 -7
  4. package/out/common/BaseNode.js.map +1 -1
  5. package/out/concepts/AbstractInterface__.js.map +1 -1
  6. package/out/concepts/Annotation__.js +1 -1
  7. package/out/concepts/Annotation__.js.map +1 -1
  8. package/out/concepts/App__.d.ts +3 -0
  9. package/out/concepts/App__.js +964 -4
  10. package/out/concepts/App__.js.map +1 -1
  11. package/out/concepts/Argument__.js +3 -3
  12. package/out/concepts/Argument__.js.map +1 -1
  13. package/out/concepts/BatchAssignment__.d.ts +1 -1
  14. package/out/concepts/BatchAssignment__.js +3 -3
  15. package/out/concepts/BatchAssignment__.js.map +1 -1
  16. package/out/concepts/BindAttribute__.js +5 -6
  17. package/out/concepts/BindAttribute__.js.map +1 -1
  18. package/out/concepts/BindDirective__.js +3 -4
  19. package/out/concepts/BindDirective__.js.map +1 -1
  20. package/out/concepts/BusinessComponent__.d.ts +2 -0
  21. package/out/concepts/BusinessComponent__.js +48 -0
  22. package/out/concepts/BusinessComponent__.js.map +1 -1
  23. package/out/concepts/BusinessLogic__.d.ts +1 -0
  24. package/out/concepts/BusinessLogic__.js +10 -0
  25. package/out/concepts/BusinessLogic__.js.map +1 -1
  26. package/out/concepts/CallEvent__.d.ts +2 -0
  27. package/out/concepts/CallEvent__.js +75 -0
  28. package/out/concepts/CallEvent__.js.map +1 -1
  29. package/out/concepts/CallInterface__.d.ts +1 -0
  30. package/out/concepts/CallInterface__.js +26 -15
  31. package/out/concepts/CallInterface__.js.map +1 -1
  32. package/out/concepts/CallLogic__.d.ts +4 -0
  33. package/out/concepts/CallLogic__.js +61 -5
  34. package/out/concepts/CallLogic__.js.map +1 -1
  35. package/out/concepts/Entity__.d.ts +3 -3
  36. package/out/concepts/Entity__.js +4 -0
  37. package/out/concepts/Entity__.js.map +1 -1
  38. package/out/concepts/Event__.d.ts +2 -0
  39. package/out/concepts/Event__.js +30 -0
  40. package/out/concepts/Event__.js.map +1 -1
  41. package/out/concepts/FrontendType__.d.ts +2 -0
  42. package/out/concepts/FrontendType__.js +32 -0
  43. package/out/concepts/FrontendType__.js.map +1 -1
  44. package/out/concepts/Frontend__.d.ts +2 -0
  45. package/out/concepts/Frontend__.js +48 -0
  46. package/out/concepts/Frontend__.js.map +1 -1
  47. package/out/concepts/IfStatement__.js +6 -6
  48. package/out/concepts/IfStatement__.js.map +1 -1
  49. package/out/concepts/InterfaceParam__.d.ts +1 -0
  50. package/out/concepts/InterfaceParam__.js +23 -4
  51. package/out/concepts/InterfaceParam__.js.map +1 -1
  52. package/out/concepts/Interface__.d.ts +2 -1
  53. package/out/concepts/Interface__.js +29 -5
  54. package/out/concepts/Interface__.js.map +1 -1
  55. package/out/concepts/JSBlock__.d.ts +1 -0
  56. package/out/concepts/JSBlock__.js +6 -0
  57. package/out/concepts/JSBlock__.js.map +1 -1
  58. package/out/concepts/LogicDeclaration__.d.ts +1 -0
  59. package/out/concepts/LogicDeclaration__.js +58 -7
  60. package/out/concepts/LogicDeclaration__.js.map +1 -1
  61. package/out/concepts/Logic__.js +43 -24
  62. package/out/concepts/Logic__.js.map +1 -1
  63. package/out/concepts/MatchCase__.js +1 -2
  64. package/out/concepts/MatchCase__.js.map +1 -1
  65. package/out/concepts/Match__.js +3 -18
  66. package/out/concepts/Match__.js.map +1 -1
  67. package/out/concepts/MemberExpression__.js +1 -1
  68. package/out/concepts/MemberExpression__.js.map +1 -1
  69. package/out/concepts/Module__.d.ts +2 -0
  70. package/out/concepts/Module__.js +64 -0
  71. package/out/concepts/Module__.js.map +1 -1
  72. package/out/concepts/NewComposite__.d.ts +1 -1
  73. package/out/concepts/NewComposite__.js +3 -3
  74. package/out/concepts/NewComposite__.js.map +1 -1
  75. package/out/concepts/NullLiteral__.js +6 -0
  76. package/out/concepts/NullLiteral__.js.map +1 -1
  77. package/out/concepts/Paginate__.d.ts +1 -0
  78. package/out/concepts/Paginate__.js +15 -7
  79. package/out/concepts/Paginate__.js.map +1 -1
  80. package/out/concepts/QueryFromExpression__.js +2 -2
  81. package/out/concepts/QueryFromExpression__.js.map +1 -1
  82. package/out/concepts/StringLiteral__.js +3 -4
  83. package/out/concepts/StringLiteral__.js.map +1 -1
  84. package/out/concepts/TypeAnnotation__.js +1 -0
  85. package/out/concepts/TypeAnnotation__.js.map +1 -1
  86. package/out/concepts/ViewElement__.d.ts +2 -0
  87. package/out/concepts/ViewElement__.js +10 -7
  88. package/out/concepts/ViewElement__.js.map +1 -1
  89. package/out/concepts/View__.d.ts +1 -0
  90. package/out/concepts/View__.js +55 -1
  91. package/out/concepts/View__.js.map +1 -1
  92. package/out/generator/genBundleFiles.js +61 -51
  93. package/out/generator/genBundleFiles.js.map +1 -1
  94. package/out/generator/genHash.d.ts +2 -2
  95. package/out/generator/genHash.js +30 -30
  96. package/out/generator/genHash.js.map +1 -1
  97. package/out/generator/permission.d.ts +8 -1
  98. package/out/generator/permission.js +321 -23
  99. package/out/generator/permission.js.map +1 -1
  100. package/out/generator/release-body/body.d.ts +4 -0
  101. package/out/generator/release-body/body.js +20 -6
  102. package/out/generator/release-body/body.js.map +1 -1
  103. package/out/generator/release-body/data.js +6 -2
  104. package/out/generator/release-body/data.js.map +1 -1
  105. package/out/generator/release-body/index.d.ts +1 -0
  106. package/out/generator/release-body/index.js +1 -0
  107. package/out/generator/release-body/index.js.map +1 -1
  108. package/out/generator/release-body/utils.js +3 -3
  109. package/out/generator/release-body/utils.js.map +1 -1
  110. package/out/generator/release-body/validation.js +2 -2
  111. package/out/generator/release-body/validation.js.map +1 -1
  112. package/out/index.d.ts +1 -1
  113. package/out/index.js.map +1 -1
  114. package/out/natural/genNaturalTS.d.ts +2 -2
  115. package/out/natural/genNaturalTS.js +5 -5
  116. package/out/natural/genNaturalTS.js.map +1 -1
  117. package/out/natural/getContext/index.d.ts +1 -1
  118. package/out/natural/getContext/index.js +15 -9
  119. package/out/natural/getContext/index.js.map +1 -1
  120. package/out/natural/transformTS2UI.js +26 -10
  121. package/out/natural/transformTS2UI.js.map +1 -1
  122. package/out/natural/transformTSCode.js +26 -10
  123. package/out/natural/transformTSCode.js.map +1 -1
  124. package/out/server/entity2LogicNamespace.d.ts +2 -2
  125. package/out/server/entity2LogicNamespace.js +321 -310
  126. package/out/server/entity2LogicNamespace.js.map +1 -1
  127. package/out/server/extendBaseNode.js +29 -18
  128. package/out/server/extendBaseNode.js.map +1 -1
  129. package/out/server/naslServer.d.ts +1 -1
  130. package/out/server/naslServer.js +35 -21
  131. package/out/server/naslServer.js.map +1 -1
  132. package/out/server/translator.js +12 -0
  133. package/out/server/translator.js.map +1 -1
  134. package/out/service/storage/init.d.ts +2 -0
  135. package/out/service/storage/init.js +20 -1
  136. package/out/service/storage/init.js.map +1 -1
  137. package/out/templator/genCreateBlock.js +3 -3
  138. package/out/templator/genCreateBlock.js.map +1 -1
  139. package/out/templator/genCurdEditMultipleKeyBlock.js +2 -2
  140. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  141. package/out/templator/genCurdMultipleKeyBlock.js +4 -4
  142. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  143. package/out/templator/genEditTableBlock.js +1 -1
  144. package/out/templator/genEditTableBlock.js.map +1 -1
  145. package/out/templator/genGetBlock.js.map +1 -1
  146. package/out/templator/genGridViewBlock.js.map +1 -1
  147. package/out/templator/genSelectBlock.js.map +1 -1
  148. package/out/templator/genTableBlock.js.map +1 -1
  149. package/out/templator/genUpdateBlock.js +3 -3
  150. package/out/templator/genUpdateBlock.js.map +1 -1
  151. package/out/templator/utils.js +1 -1
  152. package/out/templator/utils.js.map +1 -1
  153. package/package.json +5 -5
  154. package/sandbox/stdlib/nasl.util.ts +4 -1
  155. package/src/common/BaseNode.ts +91 -11
  156. package/src/concepts/AbstractInterface__.ts +1 -0
  157. package/src/concepts/Annotation__.ts +1 -1
  158. package/src/concepts/App__.ts +104 -4
  159. package/src/concepts/Argument__.ts +3 -3
  160. package/src/concepts/BatchAssignment__.ts +3 -3
  161. package/src/concepts/BindAttribute__.ts +5 -6
  162. package/src/concepts/BindDirective__.ts +3 -4
  163. package/src/concepts/BusinessComponent__.ts +54 -1
  164. package/src/concepts/BusinessLogic__.ts +10 -1
  165. package/src/concepts/CallEvent__.ts +66 -0
  166. package/src/concepts/CallInterface__.ts +21 -9
  167. package/src/concepts/CallLogic__.ts +61 -5
  168. package/src/concepts/Entity__.ts +7 -1
  169. package/src/concepts/Event__.ts +32 -0
  170. package/src/concepts/FrontendType__.ts +34 -1
  171. package/src/concepts/Frontend__.ts +51 -0
  172. package/src/concepts/IfStatement__.ts +6 -6
  173. package/src/concepts/InterfaceParam__.ts +23 -4
  174. package/src/concepts/Interface__.ts +29 -5
  175. package/src/concepts/JSBlock__.ts +5 -0
  176. package/src/concepts/LogicDeclaration__.ts +65 -7
  177. package/src/concepts/Logic__.ts +45 -27
  178. package/src/concepts/MatchCase__.ts +1 -2
  179. package/src/concepts/Match__.ts +3 -21
  180. package/src/concepts/MemberExpression__.ts +1 -1
  181. package/src/concepts/Module__.ts +75 -0
  182. package/src/concepts/NewComposite__.ts +3 -3
  183. package/src/concepts/NullLiteral__.ts +7 -0
  184. package/src/concepts/Paginate__.ts +14 -7
  185. package/src/concepts/QueryFromExpression__.ts +2 -2
  186. package/src/concepts/StringLiteral__.ts +3 -4
  187. package/src/concepts/TypeAnnotation__.ts +1 -0
  188. package/src/concepts/ViewElement__.ts +11 -7
  189. package/src/concepts/View__.ts +56 -1
  190. package/src/generator/genBundleFiles.ts +67 -54
  191. package/src/generator/genHash.ts +32 -6
  192. package/src/generator/permission.ts +333 -23
  193. package/src/generator/release-body/body.ts +31 -12
  194. package/src/generator/release-body/data.ts +7 -2
  195. package/src/generator/release-body/index.ts +1 -0
  196. package/src/generator/release-body/utils.ts +3 -3
  197. package/src/generator/release-body/validation.ts +1 -1
  198. package/src/index.ts +13 -1
  199. package/src/natural/genNaturalTS.ts +5 -2
  200. package/src/natural/getContext/index.ts +17 -11
  201. package/src/natural/transformTS2UI.ts +25 -10
  202. package/src/natural/transformTSCode.ts +25 -10
  203. package/src/server/entity2LogicNamespace.ts +13 -1
  204. package/src/server/extendBaseNode.ts +32 -22
  205. package/src/server/naslServer.ts +45 -28
  206. package/src/server/translator.ts +15 -0
  207. package/src/service/storage/init.ts +26 -0
  208. package/src/templator/genCreateBlock.ts +4 -4
  209. package/src/templator/genCurdEditMultipleKeyBlock.ts +2 -2
  210. package/src/templator/genCurdMultipleKeyBlock.ts +7 -7
  211. package/src/templator/genEditTableBlock.ts +4 -4
  212. package/src/templator/genGetBlock.ts +1 -1
  213. package/src/templator/genGridViewBlock.ts +2 -2
  214. package/src/templator/genSelectBlock.ts +3 -3
  215. package/src/templator/genTableBlock.ts +2 -2
  216. package/src/templator/genUpdateBlock.ts +6 -6
  217. package/src/templator/utils.ts +1 -1
  218. package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +1 -1
  219. package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +1 -1
  220. package/test/concepts/string-literal/__snapshots__/toVue.spec.ts.snap +1 -1
  221. package/test/concepts/view-element/__snapshots__/toEmbeddedTS.spec.ts.snap +75 -75
  222. package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +6 -2
@@ -2,357 +2,368 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.entityToTreeFragment = exports.entity2LogicNamespace = void 0;
4
4
  const __1 = require("..");
5
+ const entityNsMap = new Map();
5
6
  function entity2LogicNamespace(entity) {
6
- const { properties } = entity;
7
- const keys = properties.filter((item) => item.primaryKey);
8
- const params = keys.map((item) => new __1.Param({ name: item.name, typeAnnotation: __1.TypeAnnotation.createPrimitive(item.typeAnnotation.typeName) }));
9
- const batchDeleteParams = keys.length > 1
10
- ? [
11
- new __1.Param({
12
- name: 'body',
13
- typeAnnotation: __1.TypeAnnotation.createGeneric('List', {
14
- typeArguments: [
15
- __1.TypeAnnotation.from({
16
- typeKind: 'reference',
17
- typeNamespace: entity.getNamespace(),
18
- typeName: entity.name,
7
+ let nsInfo = entityNsMap.get(entity);
8
+ if (!nsInfo) {
9
+ nsInfo = {
10
+ contentUniqueKey: entity.contentUniqueKey
11
+ };
12
+ entityNsMap.set(entity, nsInfo);
13
+ }
14
+ if (!nsInfo.ns || nsInfo.contentUniqueKey !== entity.contentUniqueKey) {
15
+ const { properties } = entity;
16
+ const keys = properties.filter((item) => item.primaryKey);
17
+ const params = keys.map((item) => new __1.Param({ name: item.name, typeAnnotation: __1.TypeAnnotation.createPrimitive(item.typeAnnotation.typeName) }));
18
+ const batchDeleteParams = keys.length > 1
19
+ ? [
20
+ new __1.Param({
21
+ name: 'body',
22
+ typeAnnotation: __1.TypeAnnotation.createGeneric('List', {
23
+ typeArguments: [
24
+ __1.TypeAnnotation.from({
25
+ typeKind: 'reference',
26
+ typeNamespace: entity.getNamespace(),
27
+ typeName: entity.name,
28
+ }),
29
+ ],
30
+ }),
31
+ }),
32
+ ]
33
+ : [
34
+ new __1.Param({
35
+ name: 'body',
36
+ typeAnnotation: __1.TypeAnnotation.createGeneric('List', {
37
+ typeArguments: [__1.TypeAnnotation.createPrimitive(keys?.[0]?.typeAnnotation.typeName)],
38
+ }),
39
+ }),
40
+ ];
41
+ const ns = new __1.Namespace({
42
+ name: entity.name,
43
+ logics: [
44
+ new __1.Logic({
45
+ name: 'get',
46
+ description: '根据id查询数据记录',
47
+ params,
48
+ returns: [
49
+ new __1.Return({
50
+ name: 'result',
51
+ typeAnnotation: new __1.TypeAnnotation({
52
+ typeKind: 'reference',
53
+ typeNamespace: entity.getNamespace(),
54
+ typeName: entity.name,
55
+ }),
19
56
  }),
20
57
  ],
58
+ body: [],
21
59
  }),
22
- }),
23
- ]
24
- : [
25
- new __1.Param({
26
- name: 'body',
27
- typeAnnotation: __1.TypeAnnotation.createGeneric('List', {
28
- typeArguments: [__1.TypeAnnotation.createPrimitive(keys?.[0]?.typeAnnotation.typeName)],
60
+ new __1.Logic({
61
+ name: 'create',
62
+ description: '根据body创建一条数据记录',
63
+ params: [
64
+ new __1.Param({
65
+ name: 'body',
66
+ typeAnnotation: new __1.TypeAnnotation({
67
+ typeKind: 'reference',
68
+ typeNamespace: entity.getNamespace(),
69
+ typeName: entity.name,
70
+ }),
71
+ }),
72
+ ],
73
+ returns: [
74
+ new __1.Return({
75
+ name: 'result',
76
+ typeAnnotation: new __1.TypeAnnotation({
77
+ typeKind: 'reference',
78
+ typeNamespace: entity.getNamespace(),
79
+ typeName: entity.name,
80
+ }),
81
+ }),
82
+ ],
83
+ body: [],
29
84
  }),
30
- }),
31
- ];
32
- const ns = new __1.Namespace({
33
- name: entity.name,
34
- logics: [
35
- new __1.Logic({
36
- name: 'get',
37
- description: '根据id查询数据记录',
38
- params,
39
- returns: [
40
- new __1.Return({
41
- name: 'result',
42
- typeAnnotation: new __1.TypeAnnotation({
43
- typeKind: 'reference',
44
- typeNamespace: entity.getNamespace(),
45
- typeName: entity.name,
85
+ new __1.Logic({
86
+ name: 'update',
87
+ description: '根据body的id,将body所有属性更新到数据记录',
88
+ params: [
89
+ new __1.Param({
90
+ name: 'body',
91
+ typeAnnotation: new __1.TypeAnnotation({
92
+ typeKind: 'reference',
93
+ typeNamespace: entity.getNamespace(),
94
+ typeName: entity.name,
95
+ }),
46
96
  }),
47
- }),
48
- ],
49
- body: [],
50
- }),
51
- new __1.Logic({
52
- name: 'create',
53
- description: '根据body创建一条数据记录',
54
- params: [
55
- new __1.Param({
56
- name: 'body',
57
- typeAnnotation: new __1.TypeAnnotation({
58
- typeKind: 'reference',
59
- typeNamespace: entity.getNamespace(),
60
- typeName: entity.name,
97
+ new __1.Param({
98
+ name: 'properties',
99
+ defaultExpression: new __1.AnonymousFunction({
100
+ description: '',
101
+ params: [
102
+ new __1.Param({
103
+ name: 'item',
104
+ typeAnnotation: new __1.TypeAnnotation({
105
+ typeKind: 'reference',
106
+ typeNamespace: entity.getNamespace(),
107
+ typeName: entity.name,
108
+ }),
109
+ }),
110
+ ],
111
+ body: new __1.NewList({
112
+ concept: 'NewList',
113
+ }),
114
+ }),
61
115
  }),
62
- }),
63
- ],
64
- returns: [
65
- new __1.Return({
66
- name: 'result',
67
- typeAnnotation: new __1.TypeAnnotation({
68
- typeKind: 'reference',
69
- typeNamespace: entity.getNamespace(),
70
- typeName: entity.name,
116
+ ],
117
+ returns: [
118
+ new __1.Return({
119
+ name: 'result',
120
+ typeAnnotation: new __1.TypeAnnotation({
121
+ typeKind: 'reference',
122
+ typeNamespace: entity.getNamespace(),
123
+ typeName: entity.name,
124
+ }),
71
125
  }),
72
- }),
73
- ],
74
- body: [],
75
- }),
76
- new __1.Logic({
77
- name: 'update',
78
- description: '根据body的id,将body所有属性更新到数据记录',
79
- params: [
80
- new __1.Param({
81
- name: 'body',
82
- typeAnnotation: new __1.TypeAnnotation({
83
- typeKind: 'reference',
84
- typeNamespace: entity.getNamespace(),
85
- typeName: entity.name,
126
+ ],
127
+ body: [],
128
+ }),
129
+ new __1.Logic({
130
+ name: 'delete',
131
+ description: '根据id删除数据记录',
132
+ params,
133
+ body: [],
134
+ }),
135
+ new __1.Logic({
136
+ name: 'createOrUpdate',
137
+ description: '当body中id查询为空则创建数据记录,id查询不为空则更新',
138
+ params: [
139
+ new __1.Param({
140
+ name: 'body',
141
+ typeAnnotation: new __1.TypeAnnotation({
142
+ typeKind: 'reference',
143
+ typeNamespace: entity.getNamespace(),
144
+ typeName: entity.name,
145
+ }),
86
146
  }),
87
- }),
88
- new __1.Param({
89
- name: 'properties',
90
- defaultExpression: new __1.AnonymousFunction({
91
- description: '',
92
- params: [
93
- new __1.Param({
94
- name: 'item',
95
- typeAnnotation: new __1.TypeAnnotation({
96
- typeKind: 'reference',
97
- typeNamespace: entity.getNamespace(),
98
- typeName: entity.name,
147
+ ],
148
+ body: [],
149
+ returns: [
150
+ new __1.Return({
151
+ name: 'result',
152
+ typeAnnotation: new __1.TypeAnnotation({
153
+ typeKind: 'reference',
154
+ typeNamespace: entity.getNamespace(),
155
+ typeName: entity.name,
156
+ }),
157
+ }),
158
+ ],
159
+ }),
160
+ new __1.Logic({
161
+ name: 'updateBy',
162
+ description: '根据条件,将body除id外所有属性更新到数据记录',
163
+ params: [
164
+ new __1.Param({
165
+ name: 'filter',
166
+ defaultExpression: new __1.Function({
167
+ name: 'filter',
168
+ description: '',
169
+ params: [
170
+ // 实体的 updateBy、deleteBy 方法的 filter 参数后端要求使用 _ 变量名,类型为本实体
171
+ new __1.Param({
172
+ name: '_',
173
+ typeAnnotation: new __1.TypeAnnotation({
174
+ typeKind: 'reference',
175
+ typeNamespace: entity.getNamespace(),
176
+ typeName: entity.name,
177
+ }),
99
178
  }),
100
- }),
101
- ],
102
- body: new __1.NewList({
103
- concept: 'NewList',
179
+ ],
180
+ returns: [
181
+ new __1.Return({
182
+ typeAnnotation: __1.TypeAnnotation.createPrimitive('Boolean'),
183
+ }),
184
+ ],
104
185
  }),
105
186
  }),
106
- }),
107
- ],
108
- returns: [
109
- new __1.Return({
110
- name: 'result',
111
- typeAnnotation: new __1.TypeAnnotation({
112
- typeKind: 'reference',
113
- typeNamespace: entity.getNamespace(),
114
- typeName: entity.name,
187
+ new __1.Param({
188
+ name: 'body',
189
+ typeAnnotation: new __1.TypeAnnotation({
190
+ typeKind: 'reference',
191
+ typeNamespace: entity.getNamespace(),
192
+ typeName: entity.name,
193
+ }),
115
194
  }),
116
- }),
117
- ],
118
- body: [],
119
- }),
120
- new __1.Logic({
121
- name: 'delete',
122
- description: '根据id删除数据记录',
123
- params,
124
- body: [],
125
- }),
126
- new __1.Logic({
127
- name: 'createOrUpdate',
128
- description: '当body中id查询为空则创建数据记录,id查询不为空则更新',
129
- params: [
130
- new __1.Param({
131
- name: 'body',
132
- typeAnnotation: new __1.TypeAnnotation({
133
- typeKind: 'reference',
134
- typeNamespace: entity.getNamespace(),
135
- typeName: entity.name,
195
+ new __1.Param({
196
+ name: 'properties',
197
+ defaultExpression: new __1.AnonymousFunction({
198
+ description: '',
199
+ params: [
200
+ new __1.Param({
201
+ name: 'item',
202
+ typeAnnotation: new __1.TypeAnnotation({
203
+ typeKind: 'reference',
204
+ typeNamespace: entity.getNamespace(),
205
+ typeName: entity.name,
206
+ }),
207
+ }),
208
+ ],
209
+ body: new __1.NewList({
210
+ concept: 'NewList',
211
+ }),
212
+ }),
136
213
  }),
137
- }),
138
- ],
139
- body: [],
140
- returns: [
141
- new __1.Return({
142
- name: 'result',
143
- typeAnnotation: new __1.TypeAnnotation({
144
- typeKind: 'reference',
145
- typeNamespace: entity.getNamespace(),
146
- typeName: entity.name,
214
+ ],
215
+ returns: [
216
+ new __1.Return({
217
+ name: 'result',
218
+ typeAnnotation: __1.TypeAnnotation.createPrimitive('Long'),
147
219
  }),
148
- }),
149
- ],
150
- }),
151
- new __1.Logic({
152
- name: 'updateBy',
153
- description: '根据条件,将body除id外所有属性更新到数据记录',
154
- params: [
155
- new __1.Param({
156
- name: 'filter',
157
- defaultExpression: new __1.Function({
220
+ ],
221
+ body: [],
222
+ }),
223
+ new __1.Logic({
224
+ name: 'deleteBy',
225
+ description: '根据条件删除数据记录',
226
+ params: [
227
+ new __1.Param({
158
228
  name: 'filter',
159
- description: '',
160
- params: [
161
- // 实体的 updateBy、deleteBy 方法的 filter 参数后端要求使用 _ 变量名,类型为本实体
162
- new __1.Param({
163
- name: '_',
164
- typeAnnotation: new __1.TypeAnnotation({
229
+ defaultExpression: new __1.Function({
230
+ name: 'filter',
231
+ description: '',
232
+ params: [
233
+ // 实体的 updateBy、deleteBy 方法的 filter 参数后端要求使用 _ 变量名,类型为本实体
234
+ new __1.Param({
235
+ name: '_',
236
+ typeAnnotation: new __1.TypeAnnotation({
237
+ typeKind: 'reference',
238
+ typeNamespace: entity.getNamespace(),
239
+ typeName: entity.name,
240
+ }),
241
+ }),
242
+ ],
243
+ returns: [
244
+ new __1.Return({
245
+ typeAnnotation: __1.TypeAnnotation.createPrimitive('Boolean'),
246
+ }),
247
+ ],
248
+ }),
249
+ }),
250
+ ],
251
+ body: [],
252
+ }),
253
+ new __1.Logic({
254
+ name: 'batchCreate',
255
+ description: '批量创建数据记录',
256
+ params: [
257
+ new __1.Param({
258
+ name: 'body',
259
+ typeAnnotation: __1.TypeAnnotation.createGeneric('List', {
260
+ typeArguments: [
261
+ __1.TypeAnnotation.from({
165
262
  typeKind: 'reference',
166
263
  typeNamespace: entity.getNamespace(),
167
264
  typeName: entity.name,
168
265
  }),
169
- }),
170
- ],
171
- returns: [
172
- new __1.Return({
173
- typeAnnotation: __1.TypeAnnotation.createPrimitive('Boolean'),
174
- }),
175
- ],
176
- }),
177
- }),
178
- new __1.Param({
179
- name: 'body',
180
- typeAnnotation: new __1.TypeAnnotation({
181
- typeKind: 'reference',
182
- typeNamespace: entity.getNamespace(),
183
- typeName: entity.name,
266
+ ],
267
+ }),
184
268
  }),
185
- }),
186
- new __1.Param({
187
- name: 'properties',
188
- defaultExpression: new __1.AnonymousFunction({
189
- description: '',
190
- params: [
191
- new __1.Param({
192
- name: 'item',
193
- typeAnnotation: new __1.TypeAnnotation({
269
+ ],
270
+ returns: [
271
+ new __1.Return({
272
+ name: 'result',
273
+ typeAnnotation: __1.TypeAnnotation.createGeneric('List', {
274
+ typeArguments: [
275
+ __1.TypeAnnotation.from({
194
276
  typeKind: 'reference',
195
277
  typeNamespace: entity.getNamespace(),
196
278
  typeName: entity.name,
197
279
  }),
198
- }),
199
- ],
200
- body: new __1.NewList({
201
- concept: 'NewList',
280
+ ],
202
281
  }),
203
282
  }),
204
- }),
205
- ],
206
- returns: [
207
- new __1.Return({
208
- name: 'result',
209
- typeAnnotation: __1.TypeAnnotation.createPrimitive('Long'),
210
- }),
211
- ],
212
- body: [],
213
- }),
214
- new __1.Logic({
215
- name: 'deleteBy',
216
- description: '根据条件删除数据记录',
217
- params: [
218
- new __1.Param({
219
- name: 'filter',
220
- defaultExpression: new __1.Function({
221
- name: 'filter',
222
- description: '',
223
- params: [
224
- // 实体的 updateBy、deleteBy 方法的 filter 参数后端要求使用 _ 变量名,类型为本实体
225
- new __1.Param({
226
- name: '_',
227
- typeAnnotation: new __1.TypeAnnotation({
283
+ ],
284
+ body: [],
285
+ }),
286
+ new __1.Logic({
287
+ name: 'batchUpdate',
288
+ description: '批量更新数据记录,更新策略为全部更新',
289
+ params: [
290
+ new __1.Param({
291
+ name: 'body',
292
+ typeAnnotation: __1.TypeAnnotation.createGeneric('List', {
293
+ typeArguments: [
294
+ __1.TypeAnnotation.from({
228
295
  typeKind: 'reference',
229
296
  typeNamespace: entity.getNamespace(),
230
297
  typeName: entity.name,
231
298
  }),
232
- }),
233
- ],
234
- returns: [
235
- new __1.Return({
236
- typeAnnotation: __1.TypeAnnotation.createPrimitive('Boolean'),
237
- }),
238
- ],
239
- }),
240
- }),
241
- ],
242
- body: [],
243
- }),
244
- new __1.Logic({
245
- name: 'batchCreate',
246
- description: '批量创建数据记录',
247
- params: [
248
- new __1.Param({
249
- name: 'body',
250
- typeAnnotation: __1.TypeAnnotation.createGeneric('List', {
251
- typeArguments: [
252
- __1.TypeAnnotation.from({
253
- typeKind: 'reference',
254
- typeNamespace: entity.getNamespace(),
255
- typeName: entity.name,
256
- }),
257
- ],
258
- }),
259
- }),
260
- ],
261
- returns: [
262
- new __1.Return({
263
- name: 'result',
264
- typeAnnotation: __1.TypeAnnotation.createGeneric('List', {
265
- typeArguments: [
266
- __1.TypeAnnotation.from({
267
- typeKind: 'reference',
268
- typeNamespace: entity.getNamespace(),
269
- typeName: entity.name,
270
- }),
271
- ],
299
+ ],
300
+ }),
272
301
  }),
273
- }),
274
- ],
275
- body: [],
276
- }),
277
- new __1.Logic({
278
- name: 'batchUpdate',
279
- description: '批量更新数据记录,更新策略为全部更新',
280
- params: [
281
- new __1.Param({
282
- name: 'body',
283
- typeAnnotation: __1.TypeAnnotation.createGeneric('List', {
284
- typeArguments: [
285
- __1.TypeAnnotation.from({
286
- typeKind: 'reference',
287
- typeNamespace: entity.getNamespace(),
288
- typeName: entity.name,
302
+ new __1.Param({
303
+ name: 'properties',
304
+ defaultExpression: new __1.AnonymousFunction({
305
+ description: '',
306
+ params: [
307
+ new __1.Param({
308
+ name: 'item',
309
+ typeAnnotation: new __1.TypeAnnotation({
310
+ typeKind: 'reference',
311
+ typeNamespace: entity.getNamespace(),
312
+ typeName: entity.name,
313
+ }),
314
+ }),
315
+ ],
316
+ body: new __1.NewList({
317
+ concept: 'NewList',
289
318
  }),
290
- ],
319
+ }),
291
320
  }),
292
- }),
293
- new __1.Param({
294
- name: 'properties',
295
- defaultExpression: new __1.AnonymousFunction({
296
- description: '',
297
- params: [
298
- new __1.Param({
299
- name: 'item',
300
- typeAnnotation: new __1.TypeAnnotation({
321
+ ],
322
+ returns: [
323
+ new __1.Return({
324
+ name: 'result',
325
+ typeAnnotation: __1.TypeAnnotation.createGeneric('List', {
326
+ typeArguments: [
327
+ __1.TypeAnnotation.from({
301
328
  typeKind: 'reference',
302
329
  typeNamespace: entity.getNamespace(),
303
330
  typeName: entity.name,
304
331
  }),
305
- }),
306
- ],
307
- body: new __1.NewList({
308
- concept: 'NewList',
332
+ ],
309
333
  }),
310
334
  }),
311
- }),
312
- ],
313
- returns: [
314
- new __1.Return({
315
- name: 'result',
316
- typeAnnotation: __1.TypeAnnotation.createGeneric('List', {
317
- typeArguments: [
318
- __1.TypeAnnotation.from({
319
- typeKind: 'reference',
320
- typeNamespace: entity.getNamespace(),
321
- typeName: entity.name,
322
- }),
323
- ],
335
+ ],
336
+ body: [],
337
+ }),
338
+ new __1.Logic({
339
+ name: 'batchDelete',
340
+ description: '批量删除数据记录',
341
+ params: batchDeleteParams,
342
+ body: [],
343
+ }),
344
+ new __1.Logic({
345
+ name: 'import',
346
+ description: '导入数据记录,需要配合文件上传组件使用',
347
+ params: [
348
+ new __1.Param({
349
+ name: 'body',
350
+ typeAnnotation: __1.TypeAnnotation.createPrimitive('Binary'),
324
351
  }),
325
- }),
326
- ],
327
- body: [],
328
- }),
329
- new __1.Logic({
330
- name: 'batchDelete',
331
- description: '批量删除数据记录',
332
- params: batchDeleteParams,
333
- body: [],
334
- }),
335
- new __1.Logic({
336
- name: 'import',
337
- description: '导入数据记录,需要配合文件上传组件使用',
338
- params: [
339
- new __1.Param({
340
- name: 'body',
341
- typeAnnotation: __1.TypeAnnotation.createPrimitive('Binary'),
342
- }),
343
- ],
344
- returns: [
345
- new __1.Return({
346
- name: 'result',
347
- typeAnnotation: __1.TypeAnnotation.createPrimitive('String'),
348
- }),
349
- ],
350
- body: [],
351
- }),
352
- ],
353
- });
354
- ns.parentNode = entity;
355
- return ns;
352
+ ],
353
+ returns: [
354
+ new __1.Return({
355
+ name: 'result',
356
+ typeAnnotation: __1.TypeAnnotation.createPrimitive('String'),
357
+ }),
358
+ ],
359
+ body: [],
360
+ }),
361
+ ],
362
+ });
363
+ ns.parentNode = entity;
364
+ nsInfo.ns = ns;
365
+ }
366
+ return nsInfo.ns;
356
367
  }
357
368
  exports.entity2LogicNamespace = entity2LogicNamespace;
358
369
  function entityToTreeFragment(entity) {