@lcap/nasl 3.4.0-alpha.2 → 3.4.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/out/common/BaseNode.d.ts +14 -11
  2. package/out/common/BaseNode.js +72 -52
  3. package/out/common/BaseNode.js.map +1 -1
  4. package/out/concepts/Anchor__.js +3 -1
  5. package/out/concepts/Anchor__.js.map +1 -1
  6. package/out/concepts/AnonymousFunction__.js +10 -3
  7. package/out/concepts/AnonymousFunction__.js.map +1 -1
  8. package/out/concepts/App__.js +69 -18
  9. package/out/concepts/App__.js.map +1 -1
  10. package/out/concepts/Argument__.js +3 -1
  11. package/out/concepts/Argument__.js.map +1 -1
  12. package/out/concepts/Assignee__.js +18 -5
  13. package/out/concepts/Assignee__.js.map +1 -1
  14. package/out/concepts/AssignmentLine__.js +6 -2
  15. package/out/concepts/AssignmentLine__.js.map +1 -1
  16. package/out/concepts/Assignment__.js +6 -2
  17. package/out/concepts/Assignment__.js.map +1 -1
  18. package/out/concepts/Attribute__.js +3 -1
  19. package/out/concepts/Attribute__.js.map +1 -1
  20. package/out/concepts/AuthLogicForCallInterface__.js +4 -1
  21. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  22. package/out/concepts/AuthLogic__.js.map +1 -1
  23. package/out/concepts/BackendVariable__.js +3 -1
  24. package/out/concepts/BackendVariable__.js.map +1 -1
  25. package/out/concepts/Backend__.js +4 -1
  26. package/out/concepts/Backend__.js.map +1 -1
  27. package/out/concepts/BatchAssignment__.js +11 -3
  28. package/out/concepts/BatchAssignment__.js.map +1 -1
  29. package/out/concepts/BinaryExpression__.js +6 -2
  30. package/out/concepts/BinaryExpression__.js.map +1 -1
  31. package/out/concepts/BindAttribute__.js +20 -6
  32. package/out/concepts/BindAttribute__.js.map +1 -1
  33. package/out/concepts/BindDirective__.js +7 -2
  34. package/out/concepts/BindDirective__.js.map +1 -1
  35. package/out/concepts/BindEvent__.js +8 -2
  36. package/out/concepts/BindEvent__.js.map +1 -1
  37. package/out/concepts/BindStyle__.js +7 -2
  38. package/out/concepts/BindStyle__.js.map +1 -1
  39. package/out/concepts/CallAuthInterface__.js +4 -1
  40. package/out/concepts/CallAuthInterface__.js.map +1 -1
  41. package/out/concepts/CallFunction__.js +8 -2
  42. package/out/concepts/CallFunction__.js.map +1 -1
  43. package/out/concepts/CallInterface__.d.ts +2 -1
  44. package/out/concepts/CallInterface__.js +51 -13
  45. package/out/concepts/CallInterface__.js.map +1 -1
  46. package/out/concepts/CallLogic__.js +11 -3
  47. package/out/concepts/CallLogic__.js.map +1 -1
  48. package/out/concepts/CallQueryComponent__.js +34 -10
  49. package/out/concepts/CallQueryComponent__.js.map +1 -1
  50. package/out/concepts/CompletionProperty__.js +3 -1
  51. package/out/concepts/CompletionProperty__.js.map +1 -1
  52. package/out/concepts/ConfigGroup__.js +4 -1
  53. package/out/concepts/ConfigGroup__.js.map +1 -1
  54. package/out/concepts/ConfigProperty__.js +4 -1
  55. package/out/concepts/ConfigProperty__.js.map +1 -1
  56. package/out/concepts/Configuration__.js +4 -1
  57. package/out/concepts/Configuration__.js.map +1 -1
  58. package/out/concepts/Connection__.js +4 -1
  59. package/out/concepts/Connection__.js.map +1 -1
  60. package/out/concepts/Connector__.js +26 -7
  61. package/out/concepts/Connector__.js.map +1 -1
  62. package/out/concepts/Constant__.js +3 -1
  63. package/out/concepts/Constant__.js.map +1 -1
  64. package/out/concepts/DataSource__.js +4 -1
  65. package/out/concepts/DataSource__.js.map +1 -1
  66. package/out/concepts/Destination__.js +7 -2
  67. package/out/concepts/Destination__.js.map +1 -1
  68. package/out/concepts/EntityIndex__.js +3 -1
  69. package/out/concepts/EntityIndex__.js.map +1 -1
  70. package/out/concepts/EntityProperty__.js +9 -3
  71. package/out/concepts/EntityProperty__.js.map +1 -1
  72. package/out/concepts/Entity__.js +8 -2
  73. package/out/concepts/Entity__.js.map +1 -1
  74. package/out/concepts/Enum__.js +4 -1
  75. package/out/concepts/Enum__.js.map +1 -1
  76. package/out/concepts/Event__.js +4 -1
  77. package/out/concepts/Event__.js.map +1 -1
  78. package/out/concepts/ExternalDestination__.js +6 -2
  79. package/out/concepts/ExternalDestination__.js.map +1 -1
  80. package/out/concepts/ForEachStatement__.js +19 -6
  81. package/out/concepts/ForEachStatement__.js.map +1 -1
  82. package/out/concepts/FrontendLibrary__.js +8 -2
  83. package/out/concepts/FrontendLibrary__.js.map +1 -1
  84. package/out/concepts/Frontend__.js +19 -5
  85. package/out/concepts/Frontend__.js.map +1 -1
  86. package/out/concepts/Function__.js +19 -5
  87. package/out/concepts/Function__.js.map +1 -1
  88. package/out/concepts/IfStatement__.js +11 -3
  89. package/out/concepts/IfStatement__.js.map +1 -1
  90. package/out/concepts/Integration__.js +7 -2
  91. package/out/concepts/Integration__.js.map +1 -1
  92. package/out/concepts/InterfaceParam__.js +3 -1
  93. package/out/concepts/InterfaceParam__.js.map +1 -1
  94. package/out/concepts/Interface__.js +11 -3
  95. package/out/concepts/Interface__.js.map +1 -1
  96. package/out/concepts/Logic__.js +46 -46
  97. package/out/concepts/Logic__.js.map +1 -1
  98. package/out/concepts/MatchCase__.js +8 -2
  99. package/out/concepts/MatchCase__.js.map +1 -1
  100. package/out/concepts/Match__.js +7 -2
  101. package/out/concepts/Match__.js.map +1 -1
  102. package/out/concepts/MemberExpression__.js +6 -2
  103. package/out/concepts/MemberExpression__.js.map +1 -1
  104. package/out/concepts/Module__.js +55 -14
  105. package/out/concepts/Module__.js.map +1 -1
  106. package/out/concepts/MsgTriggerEvent__.js +4 -1
  107. package/out/concepts/MsgTriggerEvent__.js.map +1 -1
  108. package/out/concepts/MsgTriggerLauncher__.js +4 -1
  109. package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
  110. package/out/concepts/Namespace__.js +48 -12
  111. package/out/concepts/Namespace__.js.map +1 -1
  112. package/out/concepts/NewComposite__.js +15 -4
  113. package/out/concepts/NewComposite__.js.map +1 -1
  114. package/out/concepts/NewList__.js +7 -2
  115. package/out/concepts/NewList__.js.map +1 -1
  116. package/out/concepts/NewMap__.js +11 -3
  117. package/out/concepts/NewMap__.js.map +1 -1
  118. package/out/concepts/NumericLiteral__.js +3 -1
  119. package/out/concepts/NumericLiteral__.js.map +1 -1
  120. package/out/concepts/OqlQueryComponent__.js +3 -1
  121. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  122. package/out/concepts/OverriddenLogic__.js +28 -8
  123. package/out/concepts/OverriddenLogic__.js.map +1 -1
  124. package/out/concepts/Param__.js +3 -1
  125. package/out/concepts/Param__.js.map +1 -1
  126. package/out/concepts/ProcessComponent__.js +8 -2
  127. package/out/concepts/ProcessComponent__.js.map +1 -1
  128. package/out/concepts/ProcessElement__.js +30 -8
  129. package/out/concepts/ProcessElement__.js.map +1 -1
  130. package/out/concepts/ProcessOutcomes__.js +3 -1
  131. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  132. package/out/concepts/Process__.js +20 -5
  133. package/out/concepts/Process__.js.map +1 -1
  134. package/out/concepts/QueryAggregateExpression__.js +3 -1
  135. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  136. package/out/concepts/QueryFromExpression__.js +4 -1
  137. package/out/concepts/QueryFromExpression__.js.map +1 -1
  138. package/out/concepts/QueryGroupByExpression__.js +3 -1
  139. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  140. package/out/concepts/QueryJoinExpression__.js +8 -2
  141. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  142. package/out/concepts/QueryLimitExpression__.js +6 -2
  143. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  144. package/out/concepts/QueryOrderByExpression__.js +6 -2
  145. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  146. package/out/concepts/QuerySelectExpression__.js +4 -1
  147. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  148. package/out/concepts/Return__.js +3 -1
  149. package/out/concepts/Return__.js.map +1 -1
  150. package/out/concepts/SelectMembers__.js +7 -2
  151. package/out/concepts/SelectMembers__.js.map +1 -1
  152. package/out/concepts/Slot__.js +3 -1
  153. package/out/concepts/Slot__.js.map +1 -1
  154. package/out/concepts/SqlQueryComponent__.js +3 -1
  155. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  156. package/out/concepts/StringInterpolation__.js +4 -1
  157. package/out/concepts/StringInterpolation__.js.map +1 -1
  158. package/out/concepts/StructureProperty__.js +3 -1
  159. package/out/concepts/StructureProperty__.js.map +1 -1
  160. package/out/concepts/Structure__.js +8 -2
  161. package/out/concepts/Structure__.js.map +1 -1
  162. package/out/concepts/SwitchCase__.js +7 -2
  163. package/out/concepts/SwitchCase__.js.map +1 -1
  164. package/out/concepts/SwitchStatement__.js +4 -1
  165. package/out/concepts/SwitchStatement__.js.map +1 -1
  166. package/out/concepts/TriggerEvent__.js +4 -1
  167. package/out/concepts/TriggerEvent__.js.map +1 -1
  168. package/out/concepts/TypeAnnotation__.js +12 -3
  169. package/out/concepts/TypeAnnotation__.js.map +1 -1
  170. package/out/concepts/UnaryExpression__.js +3 -1
  171. package/out/concepts/UnaryExpression__.js.map +1 -1
  172. package/out/concepts/ValidationRule__.js +10 -3
  173. package/out/concepts/ValidationRule__.js.map +1 -1
  174. package/out/concepts/Variable__.js +3 -1
  175. package/out/concepts/Variable__.js.map +1 -1
  176. package/out/concepts/ViewComponent__.js +24 -6
  177. package/out/concepts/ViewComponent__.js.map +1 -1
  178. package/out/concepts/ViewElement__.js +24 -7
  179. package/out/concepts/ViewElement__.js.map +1 -1
  180. package/out/concepts/View__.js +27 -7
  181. package/out/concepts/View__.js.map +1 -1
  182. package/out/concepts/WhileStatement__.js +7 -2
  183. package/out/concepts/WhileStatement__.js.map +1 -1
  184. package/out/concepts/types__.d.ts +2 -3
  185. package/out/decorators/index.d.ts +3 -3
  186. package/out/decorators/index.js +3 -1
  187. package/out/decorators/index.js.map +1 -1
  188. package/out/natural/genNaturalTS.js +1 -1
  189. package/out/natural/genNaturalTS.js.map +1 -1
  190. package/out/server/formatTsUtils.d.ts +3 -3
  191. package/out/server/getMemberIdentifier.d.ts +4 -4
  192. package/out/server/naslServer.d.ts +1 -1
  193. package/out/server/naslServer.js +4 -2
  194. package/out/server/naslServer.js.map +1 -1
  195. package/out/translator/utils.js +24 -28
  196. package/out/translator/utils.js.map +1 -1
  197. package/package.json +1 -1
  198. package/src/common/BaseNode.ts +92 -68
  199. package/src/concepts/Anchor__.ts +3 -1
  200. package/src/concepts/AnonymousFunction__.ts +10 -3
  201. package/src/concepts/App__.ts +69 -18
  202. package/src/concepts/Argument__.ts +3 -1
  203. package/src/concepts/Assignee__.ts +18 -5
  204. package/src/concepts/AssignmentLine__.ts +6 -2
  205. package/src/concepts/Assignment__.ts +6 -2
  206. package/src/concepts/Attribute__.ts +3 -1
  207. package/src/concepts/AuthLogicForCallInterface__.ts +4 -1
  208. package/src/concepts/AuthLogic__.ts +3 -0
  209. package/src/concepts/BackendVariable__.ts +3 -1
  210. package/src/concepts/Backend__.ts +4 -1
  211. package/src/concepts/BatchAssignment__.ts +11 -3
  212. package/src/concepts/BinaryExpression__.ts +6 -2
  213. package/src/concepts/BindAttribute__.ts +20 -7
  214. package/src/concepts/BindDirective__.ts +7 -2
  215. package/src/concepts/BindEvent__.ts +8 -2
  216. package/src/concepts/BindStyle__.ts +7 -2
  217. package/src/concepts/CallAuthInterface__.ts +4 -1
  218. package/src/concepts/CallFunction__.ts +8 -2
  219. package/src/concepts/CallInterface__.ts +49 -14
  220. package/src/concepts/CallLogic__.ts +11 -3
  221. package/src/concepts/CallQueryComponent__.ts +34 -10
  222. package/src/concepts/CompletionProperty__.ts +3 -1
  223. package/src/concepts/ConfigGroup__.ts +4 -1
  224. package/src/concepts/ConfigProperty__.ts +4 -1
  225. package/src/concepts/Configuration__.ts +4 -1
  226. package/src/concepts/Connection__.ts +4 -1
  227. package/src/concepts/Connector__.ts +26 -7
  228. package/src/concepts/Constant__.ts +3 -1
  229. package/src/concepts/DataSource__.ts +4 -1
  230. package/src/concepts/Destination__.ts +7 -2
  231. package/src/concepts/EntityIndex__.ts +3 -1
  232. package/src/concepts/EntityProperty__.ts +9 -3
  233. package/src/concepts/Entity__.ts +8 -2
  234. package/src/concepts/Enum__.ts +4 -1
  235. package/src/concepts/Event__.ts +4 -1
  236. package/src/concepts/ExternalDestination__.ts +6 -2
  237. package/src/concepts/ForEachStatement__.ts +19 -6
  238. package/src/concepts/FrontendLibrary__.ts +8 -2
  239. package/src/concepts/Frontend__.ts +19 -5
  240. package/src/concepts/Function__.ts +19 -5
  241. package/src/concepts/IfStatement__.ts +11 -3
  242. package/src/concepts/Integration__.ts +7 -2
  243. package/src/concepts/InterfaceParam__.ts +3 -1
  244. package/src/concepts/Interface__.ts +11 -3
  245. package/src/concepts/Logic__.ts +62 -57
  246. package/src/concepts/MatchCase__.ts +8 -2
  247. package/src/concepts/Match__.ts +7 -2
  248. package/src/concepts/MemberExpression__.ts +6 -2
  249. package/src/concepts/Module__.ts +55 -14
  250. package/src/concepts/MsgTriggerEvent__.ts +4 -1
  251. package/src/concepts/MsgTriggerLauncher__.ts +4 -1
  252. package/src/concepts/Namespace__.ts +48 -12
  253. package/src/concepts/NewComposite__.ts +15 -4
  254. package/src/concepts/NewList__.ts +7 -2
  255. package/src/concepts/NewMap__.ts +11 -3
  256. package/src/concepts/NumericLiteral__.ts +3 -1
  257. package/src/concepts/OqlQueryComponent__.ts +3 -1
  258. package/src/concepts/OverriddenLogic__.ts +28 -8
  259. package/src/concepts/Param__.ts +3 -1
  260. package/src/concepts/ProcessComponent__.ts +8 -2
  261. package/src/concepts/ProcessElement__.ts +30 -8
  262. package/src/concepts/ProcessOutcomes__.ts +3 -1
  263. package/src/concepts/Process__.ts +20 -5
  264. package/src/concepts/QueryAggregateExpression__.ts +3 -1
  265. package/src/concepts/QueryFromExpression__.ts +4 -1
  266. package/src/concepts/QueryGroupByExpression__.ts +3 -1
  267. package/src/concepts/QueryJoinExpression__.ts +8 -2
  268. package/src/concepts/QueryLimitExpression__.ts +6 -2
  269. package/src/concepts/QueryOrderByExpression__.ts +6 -2
  270. package/src/concepts/QuerySelectExpression__.ts +4 -1
  271. package/src/concepts/Return__.ts +3 -1
  272. package/src/concepts/SelectMembers__.ts +7 -2
  273. package/src/concepts/Slot__.ts +3 -1
  274. package/src/concepts/SqlQueryComponent__.ts +3 -1
  275. package/src/concepts/StringInterpolation__.ts +4 -1
  276. package/src/concepts/StructureProperty__.ts +3 -1
  277. package/src/concepts/Structure__.ts +8 -2
  278. package/src/concepts/SwitchCase__.ts +7 -2
  279. package/src/concepts/SwitchStatement__.ts +4 -1
  280. package/src/concepts/TriggerEvent__.ts +4 -1
  281. package/src/concepts/TypeAnnotation__.ts +13 -4
  282. package/src/concepts/UnaryExpression__.ts +3 -1
  283. package/src/concepts/ValidationRule__.ts +10 -3
  284. package/src/concepts/Variable__.ts +3 -1
  285. package/src/concepts/ViewComponent__.ts +24 -6
  286. package/src/concepts/ViewElement__.ts +92 -72
  287. package/src/concepts/View__.ts +27 -7
  288. package/src/concepts/WhileStatement__.ts +7 -2
  289. package/src/concepts/types__.ts +2 -4
  290. package/src/decorators/index.ts +7 -5
  291. package/src/natural/genNaturalTS.ts +1 -1
  292. package/src/server/formatTsUtils.ts +8 -8
  293. package/src/server/getMemberIdentifier.ts +4 -4
  294. package/src/server/naslServer.ts +4 -4
  295. package/src/service/storage/init.ts +2 -2
  296. package/src/translator/utils.ts +7 -9
@@ -11,14 +11,12 @@ exports.indent = indent;
11
11
  * 创建编译器状态
12
12
  */
13
13
  function createCompilerState(startCode = '', options) {
14
- const state = Object.assign({
15
- position: {
14
+ const state = { position: {
16
15
  line: 0,
17
16
  character: 0,
18
17
  offset: 0,
19
18
  },
20
- tabSize: 0,
21
- }, options);
19
+ tabSize: 0, ...options };
22
20
  if (!state.sourceMap)
23
21
  state.sourceMap = new Map();
24
22
  return shiftState(state, startCode);
@@ -28,7 +26,7 @@ exports.createCompilerState = createCompilerState;
28
26
  * 根据代码移动位置
29
27
  */
30
28
  function shiftPosition(pos, code = '') {
31
- const res = Object.assign({}, pos);
29
+ const res = { ...pos };
32
30
  if (code) {
33
31
  const arr = code.split('\n');
34
32
  res.offset += code.length;
@@ -47,7 +45,7 @@ exports.shiftPosition = shiftPosition;
47
45
  * 根据代码移动状态
48
46
  */
49
47
  function shiftState(state, code, options) {
50
- state = Object.assign({}, state);
48
+ state = { ...state };
51
49
  state.position = shiftPosition(state.position, code);
52
50
  Object.assign(state, options); // 优先 options
53
51
  return Object.freeze(state);
@@ -69,31 +67,29 @@ function withSourceMap() {
69
67
  catch (err) { }
70
68
  if (!state) {
71
69
  // 没有状态不生成 SourceMap
72
- return oldMethod.call(this);
70
+ return oldMethod.call(this, state, ...args);
71
+ }
72
+ // state = Object.freeze(Object.assign({
73
+ // position: { line: 0, character: 0, offset: 0 },
74
+ // tabSize: 0,
75
+ // }, state));
76
+ let before = '';
77
+ if (!state.inline) {
78
+ before = (0, exports.indent)((state?.tabSize || 0));
79
+ state = shiftState(state, before);
73
80
  }
74
81
  else {
75
- // state = Object.freeze(Object.assign({
76
- // position: { line: 0, character: 0, offset: 0 },
77
- // tabSize: 0,
78
- // }, state));
79
- let before = '';
80
- if (!state.inline) {
81
- before = (0, exports.indent)((state?.tabSize || 0));
82
- state = shiftState(state, before);
83
- }
84
- else {
85
- state = shiftState(state, before, {
86
- inline: undefined,
87
- });
88
- }
89
- // 调用真实方法, 可能有剩余参数
90
- const code = oldMethod.call(this, state, ...args);
91
- state.sourceMap?.set(this, Object.freeze({
92
- start: state.position,
93
- end: shiftPosition(state.position, code),
94
- }));
95
- return before + code;
82
+ state = shiftState(state, before, {
83
+ inline: undefined,
84
+ });
96
85
  }
86
+ // 调用真实方法, 可能有剩余参数
87
+ const code = oldMethod.call(this, state, ...args);
88
+ state.sourceMap?.set(this, Object.freeze({
89
+ start: state.position,
90
+ end: shiftPosition(state.position, code),
91
+ }));
92
+ return before + code;
97
93
  };
98
94
  return descriptor;
99
95
  };
@@ -1 +1 @@
1
- {"version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;YAClB,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;YAElD,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;gBACvC,KAAK,EAAE,KAAK,CAAC,QAAQ;gBACrB,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC;aACzC,CAAC,CAAC,CAAC;YAEJ,OAAO,MAAM,GAAG,IAAI,CAAC;QAEzB,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AA3CD,sCA2CC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lcap/nasl",
3
3
  "description": "NetEase Application Specific Language",
4
- "version": "3.4.0-alpha.2",
4
+ "version": "3.4.0-beta.1",
5
5
  "author": "Forrest <rainforest92@126.com>",
6
6
  "scripts": {
7
7
  "clear": "rimraf ./out",
@@ -11,7 +11,7 @@ import { Diagnostic } from '../manager/diagnostic';
11
11
 
12
12
  import { sentryMonitorNaslNode } from '../sentry';
13
13
  import operations from '../breakpoint/shared/operations';
14
- import type { SynatxNode, SynatxNodeConcept, ViewElement, TypeAnnotation, App, Namespace } from '../concepts';
14
+ import type { SyntaxNode, SyntaxNodeConcept, ViewElement, TypeAnnotation, App, Namespace } from '../concepts';
15
15
 
16
16
  // 确保属性都是定义过的
17
17
  function ensureDefined(object: any, concept: string) {
@@ -129,7 +129,7 @@ export class BaseNode extends EventEmitter {
129
129
  * 父节点
130
130
  */
131
131
  @circular()
132
- parentNode: SynatxNode = null;
132
+ parentNode: SyntaxNode = null;
133
133
 
134
134
  parentKey: string = '';
135
135
 
@@ -400,9 +400,9 @@ export class BaseNode extends EventEmitter {
400
400
  }
401
401
  }
402
402
 
403
- createNode({ parentNode, parentKey, index }: { parentNode: SynatxNode; parentKey: string; index: number }) {
403
+ createNode({ parentNode, parentKey, index }: { parentNode: SyntaxNode; parentKey: string; index: number }) {
404
404
  if (parentNode) {
405
- const property = parentNode[parentKey as keyof SynatxNode];
405
+ const property = parentNode[parentKey as keyof SyntaxNode];
406
406
  if (Array.isArray(property) && index !== -1) {
407
407
  property.splice(index, 0, this);
408
408
  } else {
@@ -534,73 +534,97 @@ export class BaseNode extends EventEmitter {
534
534
  */
535
535
  update({ field, ...object }: any) {
536
536
  const path = this.getNodePath(false);
537
+ // 更新前的旧的对象
537
538
  const oldObject: any = {};
539
+ // 更新后的新对象
540
+ const newObject: any = {};
538
541
  for (const key in object) {
539
542
  if (key === 'concept') {
540
543
  continue;
541
544
  }
542
-
543
545
  if (Object.prototype.hasOwnProperty.call(object, key)) {
544
- const oldProperty = (this as any)[key] ?? null;
545
- oldObject[key] = oldProperty;
546
- if (Array.isArray(oldProperty)) {
547
- oldObject[key] = oldProperty.map((item) => {
546
+ // 旧对象收集
547
+ this.collectOldObject(oldObject, key);
548
+ // 新对象收集
549
+ this.collectNewObject(newObject, object, key);
550
+ }
551
+ }
552
+
553
+ // 更新实例上的属性
554
+ this.updateInstance(object);
555
+
556
+ if (process.env.NODE_ENV === 'development') {
557
+ console.log('更新节点', 'path', path, 'oldObject', oldObject, 'newObject', newObject);
558
+ }
559
+ this.emit('update', {
560
+ action: 'update',
561
+ path,
562
+ object: newObject,
563
+ oldObject,
564
+ field,
565
+ });
566
+ }
567
+
568
+ // 旧对象收集
569
+ collectOldObject(oldObject: any, key: string) {
570
+ const oldProperty = (this as any)[key] ?? null;
571
+ oldObject[key] = oldProperty;
572
+ if (Array.isArray(oldProperty)) {
573
+ oldObject[key] = oldProperty.map((item) => {
548
574
  let propertyItem = item ?? null;
549
575
  if (item instanceof BaseNode) {
550
- propertyItem = item.toJSON();
551
- }
552
- return propertyItem;
553
- });
554
- } else if (oldProperty instanceof BaseNode) {
555
- oldObject[key] = oldProperty.toJSON();
556
- }
557
- const property = object[key] ?? null;
558
- (this as any)[key] = property;
559
- const objectRefCtor = getConceptConstructor(property?.concept);
560
- if (Array.isArray(property)) {
561
- (this as any)[key] = property.map((item) => {
562
- let propertyItem = item ?? null;
563
- const propertyObjectRefCtor = getConceptConstructor(item?.concept);
564
- if (propertyObjectRefCtor?.from) {
565
- propertyItem = (propertyObjectRefCtor as any).from(item, this, key);
576
+ propertyItem = item.toJSON();
566
577
  }
567
578
  return propertyItem;
568
- });
569
- } else if (objectRefCtor?.from) {
570
- (this as any)[key] = (objectRefCtor as any).from(property, this, key);
571
- }
572
- }
579
+ });
580
+ } else if (oldProperty instanceof BaseNode) {
581
+ oldObject[key] = oldProperty.toJSON();
573
582
  }
574
- const newObject: any = {};
583
+ }
584
+
585
+ // 新对象收集
586
+ collectNewObject(newObject: any, object: any, key: string) {
575
587
  const propertyMap = getConceptPropertyMap(this.concept ?? this.constructor.name);
576
- for (const key in object) {
577
- const property = propertyMap.get(key);
578
- if (property) {
588
+ const property = propertyMap.get(key);
589
+ if (property) {
579
590
  const objProperty = object[key] ?? null;
580
591
  const propertyConcept = property?.objectRef;
581
592
  if (propertyConcept) {
582
- if (Array.isArray(objProperty)) {
593
+ if (Array.isArray(objProperty)) {
583
594
  newObject[key] = objProperty.map((objItem: any) => {
584
- return ensureDefined(objItem, propertyConcept);
595
+ return ensureDefined(objItem, propertyConcept);
585
596
  });
586
- } else {
597
+ } else {
587
598
  newObject[key] = ensureDefined(objProperty, propertyConcept);
588
- }
599
+ }
589
600
  } else {
590
- newObject[key] = objProperty;
601
+ newObject[key] = objProperty;
591
602
  }
592
- }
593
603
  }
594
- if (process.env.NODE_ENV === 'development') {
595
- console.log('更新节点', 'path', path, 'oldObject', oldObject, 'newObject', newObject);
604
+ }
605
+
606
+ // 更新实例上的属性
607
+ updateInstance(object: any) {
608
+ for (const key in object) {
609
+ if (key === 'concept') {
610
+ continue;
611
+ }
612
+ const property = object[key] ?? null;
613
+ (this as any)[key] = property;
614
+ const objectRefCtor = getConceptConstructor(property?.concept);
615
+ if (Array.isArray(property)) {
616
+ (this as any)[key] = property.map((item) => {
617
+ let propertyItem = item ?? null;
618
+ const propertyObjectRefCtor = getConceptConstructor(item?.concept);
619
+ if (propertyObjectRefCtor?.from) {
620
+ propertyItem = (propertyObjectRefCtor as any).from(item, this, key);
621
+ }
622
+ return propertyItem;
623
+ });
624
+ } else if (objectRefCtor?.from) {
625
+ (this as any)[key] = (objectRefCtor as any).from(property, this, key);
626
+ }
596
627
  }
597
- this.emit('update', {
598
- action: 'update',
599
- path,
600
- object: newObject,
601
- oldObject,
602
- field,
603
- });
604
628
  }
605
629
 
606
630
  _delete(): Params {
@@ -699,13 +723,13 @@ export class BaseNode extends EventEmitter {
699
723
  /**
700
724
  * 上层节点
701
725
  */
702
- get upperNode(): SynatxNode {
726
+ get upperNode(): SyntaxNode {
703
727
  // eslint-disable-next-line consistent-this
704
728
  let _upperNode: BaseNode = this;
705
729
  while (!!_upperNode && _upperNode.concept === this.concept) {
706
730
  _upperNode = _upperNode.parentNode;
707
731
  }
708
- return _upperNode as SynatxNode;
732
+ return _upperNode as SyntaxNode;
709
733
  }
710
734
 
711
735
  /**
@@ -718,9 +742,9 @@ export class BaseNode extends EventEmitter {
718
742
  /**
719
743
  * 获取祖先节点
720
744
  */
721
- getAncestor(concept: SynatxNode['concept']): SynatxNode;
722
- getAncestor<Node extends SynatxNode>(concept: Node['concept']): Node;
723
- getAncestor<Node extends SynatxNode = SynatxNode>(concept: SynatxNode['concept']): Node {
745
+ getAncestor(concept: SyntaxNode['concept']): SyntaxNode;
746
+ getAncestor<Node extends SyntaxNode>(concept: Node['concept']): Node;
747
+ getAncestor<Node extends SyntaxNode = SyntaxNode>(concept: SyntaxNode['concept']): Node {
724
748
  let { upperNode } = this;
725
749
  while (upperNode && upperNode.concept && upperNode.concept !== concept) {
726
750
  upperNode = upperNode.upperNode;
@@ -782,7 +806,7 @@ export class BaseNode extends EventEmitter {
782
806
  instantiate(source: any, parentNode: BaseNode, parentKey: string) {
783
807
  if (source instanceof BaseNode) {
784
808
  if (!source.parentNode || !source.parentKey) {
785
- source.parentNode = parentNode as SynatxNode;
809
+ source.parentNode = parentNode as SyntaxNode;
786
810
  source.parentKey = parentKey;
787
811
  }
788
812
  return source;
@@ -1109,8 +1133,8 @@ export class BaseNode extends EventEmitter {
1109
1133
  return {};
1110
1134
  }
1111
1135
 
1112
- public traverseChildren(cb: (ele: SynatxNode) => void): void {
1113
- function traverse(node: SynatxNode) {
1136
+ public traverseChildren(cb: (ele: SyntaxNode) => void): void {
1137
+ function traverse(node: SyntaxNode) {
1114
1138
  cb(node);
1115
1139
 
1116
1140
  const propertyMap = getConceptPropertyMap(node?.concept);
@@ -1119,12 +1143,12 @@ export class BaseNode extends EventEmitter {
1119
1143
  for (const property of propertyMap.keys()) {
1120
1144
  const child = node[property as keyof BaseNode];
1121
1145
  if (!child) continue;
1122
- else if (Array.isArray(child)) child.forEach((node: SynatxNode) => traverse(node));
1146
+ else if (Array.isArray(child)) child.forEach((node: SyntaxNode) => traverse(node));
1123
1147
  else traverse(child);
1124
1148
  }
1125
1149
  }
1126
1150
 
1127
- traverse(this as unknown as SynatxNode);
1151
+ traverse(this as unknown as SyntaxNode);
1128
1152
  }
1129
1153
 
1130
1154
  /**
@@ -1218,7 +1242,7 @@ export class BaseNode extends EventEmitter {
1218
1242
  /**
1219
1243
  * 使用新的 concept 在当前节点生成新的数据
1220
1244
  */
1221
- changeConceptNode(concept: SynatxNodeConcept) {
1245
+ changeConceptNode(concept: SyntaxNodeConcept) {
1222
1246
  return new Proxy(this, {
1223
1247
  get(target, p: keyof BaseNode, receiver) {
1224
1248
  if (p === 'concept') {
@@ -1231,20 +1255,20 @@ export class BaseNode extends EventEmitter {
1231
1255
  }
1232
1256
 
1233
1257
  /** 收集所有节点 */
1234
- collectNodes(): SynatxNode[];
1258
+ collectNodes(): SyntaxNode[];
1235
1259
  /** 收集特定类型的子节点 */
1236
- collectNodes(concept: SynatxNodeConcept): SynatxNode[];
1260
+ collectNodes(concept: SyntaxNodeConcept): SyntaxNode[];
1237
1261
  /** 收集断言返回`true`的子节点 */
1238
- collectNodes(pre: (node: SynatxNode) => boolean): SynatxNode[];
1239
- collectNodes(input?: SynatxNodeConcept | ((node: SynatxNode) => boolean)) {
1262
+ collectNodes(pre: (node: SyntaxNode) => boolean): SyntaxNode[];
1263
+ collectNodes(input?: SyntaxNodeConcept | ((node: SyntaxNode) => boolean)) {
1240
1264
  const pre =
1241
1265
  typeof input === 'undefined'
1242
- ? (node: SynatxNode) => typeof node.concept === 'string'
1266
+ ? (node: SyntaxNode) => typeof node.concept === 'string'
1243
1267
  : typeof input === 'string'
1244
- ? (node: SynatxNode) => node.concept === input
1268
+ ? (node: SyntaxNode) => node.concept === input
1245
1269
  : input;
1246
- const nodes: SynatxNode[] = [];
1247
- const self = this as unknown as SynatxNode;
1270
+ const nodes: SyntaxNode[] = [];
1271
+ const self = this as unknown as SyntaxNode;
1248
1272
 
1249
1273
  if (pre(self)) {
1250
1274
  nodes.push(self);
@@ -32,7 +32,9 @@ export class Anchor extends LogicItem {
32
32
  /**
33
33
  * 参数值
34
34
  */
35
- @property('LogicItem')
35
+ @property({
36
+ objectRef: 'LogicItem',
37
+ })
36
38
  // @ts-ignore
37
39
  expression!: LogicItem;
38
40
 
@@ -50,20 +50,27 @@ export class AnonymousFunction extends LogicItem {
50
50
  /**
51
51
  * 输入参数列表
52
52
  */
53
- @property('Param')
53
+ @property({
54
+ objectRef: 'Param',
55
+ isArray: true,
56
+ })
54
57
  params: Array<Param> = [];
55
58
 
56
59
  /**
57
60
  * 逻辑项
58
61
  */
59
- @property('LogicItem')
62
+ @property({
63
+ objectRef: 'LogicItem',
64
+ })
60
65
  // @ts-ignore
61
66
  body!: LogicItem;
62
67
 
63
68
  /**
64
69
  * 类型
65
70
  */
66
- @property('TypeAnnotation')
71
+ @property({
72
+ objectRef: 'TypeAnnotation',
73
+ })
67
74
  // @ts-ignore
68
75
  typeAnnotation!: TypeAnnotation;
69
76
 
@@ -131,110 +131,161 @@ export class App extends BaseNode {
131
131
  /**
132
132
  * 数据源列表
133
133
  */
134
- @property('DataSource')
134
+ @property({
135
+ objectRef: 'DataSource',
136
+ isArray: true,
137
+ })
135
138
  dataSources: Array<DataSource> = [];
136
139
 
137
140
  /**
138
141
  * 数据结构列表
139
142
  */
140
- @property('Structure')
143
+ @property({
144
+ objectRef: 'Structure',
145
+ isArray: true,
146
+ })
141
147
  structures: Array<Structure> = [];
142
148
 
143
149
  /**
144
150
  * 枚举列表
145
151
  */
146
- @property('Enum')
152
+ @property({
153
+ objectRef: 'Enum',
154
+ isArray: true,
155
+ })
147
156
  enums: Array<Enum> = [];
148
157
 
149
158
  /**
150
159
  * 逻辑列表
151
160
  */
152
- @property('Logic')
161
+ @property({
162
+ objectRef: 'Logic',
163
+ isArray: true,
164
+ })
153
165
  logics: Array<Logic> = [];
154
166
 
155
167
  /**
156
168
  * 覆写逻辑列表
157
169
  */
158
- @property('OverriddenLogic')
170
+ @property({
171
+ objectRef: 'OverriddenLogic',
172
+ isArray: true,
173
+ })
159
174
  overriddenLogics: Array<OverriddenLogic> = [];
160
175
 
161
176
  /**
162
177
  * interfaces
163
178
  */
164
- @property('Interface | AuthInterface')
179
+ @property({
180
+ objectRef: 'Interface | AuthInterface',
181
+ isArray: true,
182
+ })
165
183
  interfaces: Array<Interface | AuthInterface> = [];
166
184
 
167
185
  /**
168
186
  * 前端列表
169
187
  */
170
- @property('Frontend')
188
+ @property({
189
+ objectRef: 'Frontend',
190
+ isArray: true,
191
+ })
171
192
  frontends: Array<Frontend> = [];
172
193
 
173
194
  /**
174
195
  * 后端
175
196
  */
176
- @property('Backend')
197
+ @property({
198
+ objectRef: 'Backend',
199
+ })
177
200
  backend: Backend = new Backend();
178
201
 
179
202
  /**
180
203
  * 流程列表
181
204
  */
182
- @property('Process')
205
+ @property({
206
+ objectRef: 'Process',
207
+ isArray: true,
208
+ })
183
209
  processes: Array<Process> = [];
184
210
 
185
211
  /**
186
212
  * 角色列表
187
213
  */
188
- @property('Role')
214
+ @property({
215
+ objectRef: 'Role',
216
+ isArray: true,
217
+ })
189
218
  roles: Array<Role> = [];
190
219
 
191
220
  /**
192
221
  * 配置管理
193
222
  */
194
- @property('Configuration')
223
+ @property({
224
+ objectRef: 'Configuration',
225
+ })
195
226
  configuration: Configuration = new Configuration();
196
227
 
197
228
  /**
198
229
  * 扩展模块列表
199
230
  */
200
- @property('Module | Connector')
231
+ @property({
232
+ objectRef: 'Module | Connector',
233
+ isArray: true,
234
+ })
201
235
  dependencies: Array<Module | Connector> = [];
202
236
 
203
237
  /**
204
238
  * 接口应用列表(兼容老版)
205
239
  */
206
- @property('Module')
240
+ @property({
241
+ objectRef: 'Module',
242
+ isArray: true,
243
+ })
207
244
  interfaceDependencies: Array<Module> = [];
208
245
 
209
246
  /**
210
247
  * 集成
211
248
  */
212
- @property('Integration')
249
+ @property({
250
+ objectRef: 'Integration',
251
+ })
213
252
  // @ts-ignore
214
253
  integration!: Integration;
215
254
 
216
255
  /**
217
256
  * 暴露接口的接口鉴权
218
257
  */
219
- @property('AuthLogic')
258
+ @property({
259
+ objectRef: 'AuthLogic',
260
+ isArray: true,
261
+ })
220
262
  authLogics: Array<AuthLogic> = [];
221
263
 
222
264
  /**
223
265
  * 调用接口的鉴权模板
224
266
  */
225
- @property('AuthLogicForCallInterface')
267
+ @property({
268
+ objectRef: 'AuthLogicForCallInterface',
269
+ isArray: true,
270
+ })
226
271
  authLogicsForCallInterface: Array<AuthLogicForCallInterface> = [];
227
272
 
228
273
  /**
229
274
  * 连接
230
275
  */
231
- @property('Connection')
276
+ @property({
277
+ objectRef: 'Connection',
278
+ isArray: true,
279
+ })
232
280
  connections: Array<Connection> = [];
233
281
 
234
282
  /**
235
283
  * 触发器启动器
236
284
  */
237
- @property('TriggerLauncher')
285
+ @property({
286
+ objectRef: 'TriggerLauncher',
287
+ isArray: true,
288
+ })
238
289
  triggerLaunchers: Array<TriggerLauncher> = [];
239
290
 
240
291
  /**
@@ -50,7 +50,9 @@ export class Argument extends LogicItem {
50
50
  /**
51
51
  * 参数值
52
52
  */
53
- @property('LogicItem')
53
+ @property({
54
+ objectRef: 'LogicItem',
55
+ })
54
56
  // @ts-ignore
55
57
  expression!: LogicItem;
56
58
 
@@ -33,31 +33,44 @@ export class Assignee extends LogicItem {
33
33
  /**
34
34
  * 绑定用户
35
35
  */
36
- @property()
36
+ @property({
37
+ isArray: true,
38
+ })
37
39
  users: Array<string> = [];
38
40
 
39
41
  /**
40
42
  * 动态用户
41
43
  */
42
- @property('LogicItem')
44
+ @property({
45
+ objectRef: 'LogicItem',
46
+ isArray: true,
47
+ })
43
48
  dynamicUsers: Array<LogicItem> = [];
44
49
 
45
50
  /**
46
51
  * 绑定角色
47
52
  */
48
- @property()
53
+ @property({
54
+ isArray: true,
55
+ })
49
56
  roles: Array<string> = [];
50
57
 
51
58
  /**
52
59
  * 动态角色
53
60
  */
54
- @property('LogicItem')
61
+ @property({
62
+ objectRef: 'LogicItem',
63
+ isArray: true,
64
+ })
55
65
  dynamicRoles: Array<LogicItem> = [];
56
66
 
57
67
  /**
58
68
  * 逻辑用户
59
69
  */
60
- @property('Logic')
70
+ @property({
71
+ objectRef: 'Logic',
72
+ isArray: true,
73
+ })
61
74
  logicUsers: Array<Logic> = [];
62
75
 
63
76
  /**