@eclipse-glsp/server 1.1.0-next.3d7585d.42 → 1.1.0-next.42963d6.55

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 (365) hide show
  1. package/lib/browser/di/app-module.d.ts +2 -7
  2. package/lib/browser/di/app-module.d.ts.map +1 -1
  3. package/lib/browser/di/app-module.js +5 -30
  4. package/lib/browser/di/app-module.js.map +1 -1
  5. package/lib/browser/index.d.ts +0 -1
  6. package/lib/browser/index.d.ts.map +1 -1
  7. package/lib/browser/index.js +0 -1
  8. package/lib/browser/index.js.map +1 -1
  9. package/lib/browser/launch/worker-server-launcher.d.ts +11 -8
  10. package/lib/browser/launch/worker-server-launcher.d.ts.map +1 -1
  11. package/lib/browser/launch/worker-server-launcher.js +13 -21
  12. package/lib/browser/launch/worker-server-launcher.js.map +1 -1
  13. package/lib/common/actions/client-action-handler.d.ts +1 -2
  14. package/lib/common/actions/client-action-handler.d.ts.map +1 -1
  15. package/lib/common/actions/client-action-handler.js +17 -2
  16. package/lib/common/actions/client-action-handler.js.map +1 -1
  17. package/lib/common/command/command-stack.d.ts +60 -14
  18. package/lib/common/command/command-stack.d.ts.map +1 -1
  19. package/lib/common/command/command-stack.js +78 -24
  20. package/lib/common/command/command-stack.js.map +1 -1
  21. package/lib/common/command/command.d.ts +34 -7
  22. package/lib/common/command/command.d.ts.map +1 -1
  23. package/lib/common/command/command.js +73 -0
  24. package/lib/common/command/command.js.map +1 -1
  25. package/lib/common/command/recording-command.d.ts +75 -0
  26. package/lib/common/command/recording-command.d.ts.map +1 -0
  27. package/lib/common/command/recording-command.js +99 -0
  28. package/lib/common/command/recording-command.js.map +1 -0
  29. package/lib/common/command/undo-redo-action-handler.d.ts +28 -0
  30. package/lib/common/command/undo-redo-action-handler.d.ts.map +1 -0
  31. package/lib/common/command/undo-redo-action-handler.js +72 -0
  32. package/lib/common/command/undo-redo-action-handler.js.map +1 -0
  33. package/lib/common/di/client-session-module.d.ts +1 -1
  34. package/lib/common/di/client-session-module.d.ts.map +1 -1
  35. package/lib/common/di/client-session-module.js +2 -2
  36. package/lib/common/di/client-session-module.js.map +1 -1
  37. package/lib/common/di/diagram-module.d.ts +3 -0
  38. package/lib/common/di/diagram-module.d.ts.map +1 -1
  39. package/lib/common/di/diagram-module.js +12 -0
  40. package/lib/common/di/diagram-module.js.map +1 -1
  41. package/lib/common/di/glsp-module.d.ts +3 -1
  42. package/lib/common/di/glsp-module.d.ts.map +1 -1
  43. package/lib/common/di/glsp-module.js +0 -15
  44. package/lib/common/di/glsp-module.js.map +1 -1
  45. package/lib/common/di/multi-binding.d.ts +19 -4
  46. package/lib/common/di/multi-binding.d.ts.map +1 -1
  47. package/lib/common/di/multi-binding.js.map +1 -1
  48. package/lib/common/di/server-module.d.ts +1 -6
  49. package/lib/common/di/server-module.d.ts.map +1 -1
  50. package/lib/common/di/server-module.js +21 -17
  51. package/lib/common/di/server-module.js.map +1 -1
  52. package/lib/common/features/contextactions/tool-palette-item-provider.d.ts +1 -1
  53. package/lib/common/features/contextactions/tool-palette-item-provider.d.ts.map +1 -1
  54. package/lib/common/features/contextactions/tool-palette-item-provider.js +2 -4
  55. package/lib/common/features/contextactions/tool-palette-item-provider.js.map +1 -1
  56. package/lib/common/{gmodel → features/layout}/computed-bounds-action-handler.d.ts +8 -3
  57. package/lib/common/features/layout/computed-bounds-action-handler.d.ts.map +1 -0
  58. package/lib/common/{gmodel → features/layout}/computed-bounds-action-handler.js +9 -4
  59. package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -0
  60. package/lib/common/features/layout/layout-operation-handler.d.ts +12 -3
  61. package/lib/common/features/layout/layout-operation-handler.d.ts.map +1 -1
  62. package/lib/common/features/layout/layout-operation-handler.js +26 -10
  63. package/lib/common/features/layout/layout-operation-handler.js.map +1 -1
  64. package/lib/common/features/model/model-state.d.ts +0 -2
  65. package/lib/common/features/model/model-state.d.ts.map +1 -1
  66. package/lib/common/features/model/model-state.js +0 -1
  67. package/lib/common/features/model/model-state.js.map +1 -1
  68. package/lib/common/features/model/model-submission-handler.d.ts +2 -0
  69. package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
  70. package/lib/common/features/model/model-submission-handler.js +7 -2
  71. package/lib/common/features/model/model-submission-handler.js.map +1 -1
  72. package/lib/common/features/model/save-model-action-handler.d.ts +2 -2
  73. package/lib/common/features/model/save-model-action-handler.d.ts.map +1 -1
  74. package/lib/common/features/model/save-model-action-handler.js +5 -5
  75. package/lib/common/features/model/save-model-action-handler.js.map +1 -1
  76. package/lib/common/gmodel/apply-label-edit-operation-handler.d.ts +4 -5
  77. package/lib/common/gmodel/apply-label-edit-operation-handler.d.ts.map +1 -1
  78. package/lib/common/gmodel/apply-label-edit-operation-handler.js +12 -21
  79. package/lib/common/gmodel/apply-label-edit-operation-handler.js.map +1 -1
  80. package/lib/common/gmodel/change-bounds-operation-handler.d.ts +9 -6
  81. package/lib/common/gmodel/change-bounds-operation-handler.d.ts.map +1 -1
  82. package/lib/common/gmodel/change-bounds-operation-handler.js +14 -14
  83. package/lib/common/gmodel/change-bounds-operation-handler.js.map +1 -1
  84. package/lib/common/gmodel/change-routing-points-operation-handler.d.ts +5 -5
  85. package/lib/common/gmodel/change-routing-points-operation-handler.d.ts.map +1 -1
  86. package/lib/common/gmodel/change-routing-points-operation-handler.js +11 -14
  87. package/lib/common/gmodel/change-routing-points-operation-handler.js.map +1 -1
  88. package/lib/common/{operations → gmodel}/cut-operation-handler.d.ts +5 -4
  89. package/lib/common/gmodel/cut-operation-handler.d.ts.map +1 -0
  90. package/lib/common/{operations → gmodel}/cut-operation-handler.js +13 -11
  91. package/lib/common/gmodel/cut-operation-handler.js.map +1 -0
  92. package/lib/common/gmodel/delete-operation-handler.d.ts +6 -6
  93. package/lib/common/gmodel/delete-operation-handler.d.ts.map +1 -1
  94. package/lib/common/gmodel/delete-operation-handler.js +13 -10
  95. package/lib/common/gmodel/delete-operation-handler.js.map +1 -1
  96. package/lib/common/gmodel/gmodel-create-edge-operation-handler.d.ts +11 -7
  97. package/lib/common/gmodel/gmodel-create-edge-operation-handler.d.ts.map +1 -1
  98. package/lib/common/gmodel/gmodel-create-edge-operation-handler.js +12 -13
  99. package/lib/common/gmodel/gmodel-create-edge-operation-handler.js.map +1 -1
  100. package/lib/common/gmodel/gmodel-create-node-operation-handler.d.ts +32 -5
  101. package/lib/common/gmodel/gmodel-create-node-operation-handler.d.ts.map +1 -1
  102. package/lib/common/gmodel/gmodel-create-node-operation-handler.js +45 -3
  103. package/lib/common/gmodel/gmodel-create-node-operation-handler.js.map +1 -1
  104. package/lib/common/gmodel/gmodel-diagram-module.d.ts +8 -8
  105. package/lib/common/gmodel/gmodel-diagram-module.d.ts.map +1 -1
  106. package/lib/common/gmodel/gmodel-diagram-module.js +15 -21
  107. package/lib/common/gmodel/gmodel-diagram-module.js.map +1 -1
  108. package/lib/{node/launch/socket-server-launcher.spec.d.ts → common/gmodel/gmodel-operation-handler.d.ts} +9 -3
  109. package/lib/common/gmodel/gmodel-operation-handler.d.ts.map +1 -0
  110. package/lib/common/{protocol/glsp-client-proxy.js → gmodel/gmodel-operation-handler.js} +25 -35
  111. package/lib/common/gmodel/gmodel-operation-handler.js.map +1 -0
  112. package/lib/common/gmodel/index.d.ts +2 -1
  113. package/lib/common/gmodel/index.d.ts.map +1 -1
  114. package/lib/common/gmodel/index.js +2 -1
  115. package/lib/common/gmodel/index.js.map +1 -1
  116. package/lib/common/gmodel/paste-operation-handler.d.ts +7 -6
  117. package/lib/common/gmodel/paste-operation-handler.d.ts.map +1 -1
  118. package/lib/common/gmodel/paste-operation-handler.js +20 -15
  119. package/lib/common/gmodel/paste-operation-handler.js.map +1 -1
  120. package/lib/common/gmodel/reconnect-edge-operation-handler.d.ts +5 -5
  121. package/lib/common/gmodel/reconnect-edge-operation-handler.d.ts.map +1 -1
  122. package/lib/common/gmodel/reconnect-edge-operation-handler.js +11 -14
  123. package/lib/common/gmodel/reconnect-edge-operation-handler.js.map +1 -1
  124. package/lib/common/index.d.ts +5 -3
  125. package/lib/common/index.d.ts.map +1 -1
  126. package/lib/common/index.js +5 -3
  127. package/lib/common/index.js.map +1 -1
  128. package/lib/common/launch/glsp-server-launcher.d.ts +8 -7
  129. package/lib/common/launch/glsp-server-launcher.d.ts.map +1 -1
  130. package/lib/common/launch/glsp-server-launcher.js +27 -4
  131. package/lib/common/launch/glsp-server-launcher.js.map +1 -1
  132. package/lib/common/launch/jsonrpc-server-launcher.d.ts +38 -0
  133. package/lib/common/launch/jsonrpc-server-launcher.d.ts.map +1 -0
  134. package/lib/common/launch/jsonrpc-server-launcher.js +84 -0
  135. package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -0
  136. package/lib/common/operations/compound-operation-handler.d.ts +5 -5
  137. package/lib/common/operations/compound-operation-handler.d.ts.map +1 -1
  138. package/lib/common/operations/compound-operation-handler.js +37 -9
  139. package/lib/common/operations/compound-operation-handler.js.map +1 -1
  140. package/lib/common/operations/create-operation-handler.d.ts +8 -40
  141. package/lib/common/operations/create-operation-handler.d.ts.map +1 -1
  142. package/lib/common/operations/create-operation-handler.js +26 -85
  143. package/lib/common/operations/create-operation-handler.js.map +1 -1
  144. package/lib/common/operations/operation-action-handler.d.ts +10 -1
  145. package/lib/common/operations/operation-action-handler.d.ts.map +1 -1
  146. package/lib/common/operations/operation-action-handler.js +37 -22
  147. package/lib/common/operations/operation-action-handler.js.map +1 -1
  148. package/lib/common/operations/operation-handler-registry.d.ts +11 -2
  149. package/lib/common/operations/operation-handler-registry.d.ts.map +1 -1
  150. package/lib/common/operations/operation-handler-registry.js +31 -2
  151. package/lib/common/operations/operation-handler-registry.js.map +1 -1
  152. package/lib/common/operations/operation-handler.d.ts +28 -11
  153. package/lib/common/operations/operation-handler.d.ts.map +1 -1
  154. package/lib/common/operations/operation-handler.js +50 -1
  155. package/lib/common/operations/operation-handler.js.map +1 -1
  156. package/lib/common/protocol/glsp-server.d.ts +4 -104
  157. package/lib/common/protocol/glsp-server.d.ts.map +1 -1
  158. package/lib/common/protocol/glsp-server.js +13 -20
  159. package/lib/common/protocol/glsp-server.js.map +1 -1
  160. package/lib/common/session/client-session-factory.d.ts +1 -2
  161. package/lib/common/session/client-session-factory.d.ts.map +1 -1
  162. package/lib/common/session/client-session-factory.js +17 -2
  163. package/lib/common/session/client-session-factory.js.map +1 -1
  164. package/lib/common/session/client-session-manager.d.ts +1 -3
  165. package/lib/common/session/client-session-manager.d.ts.map +1 -1
  166. package/lib/common/session/client-session-manager.js.map +1 -1
  167. package/lib/{browser/di → common/utils}/console-logger.d.ts +7 -1
  168. package/lib/common/utils/console-logger.d.ts.map +1 -0
  169. package/lib/{browser/di → common/utils}/console-logger.js +26 -8
  170. package/lib/common/utils/console-logger.js.map +1 -0
  171. package/lib/common/utils/layout-util.d.ts +1 -1
  172. package/lib/common/utils/layout-util.d.ts.map +1 -1
  173. package/lib/common/utils/layout-util.js +3 -3
  174. package/lib/common/utils/layout-util.js.map +1 -1
  175. package/lib/common/utils/logger.d.ts +21 -0
  176. package/lib/common/utils/logger.d.ts.map +1 -1
  177. package/lib/common/utils/logger.js +12 -1
  178. package/lib/common/utils/logger.js.map +1 -1
  179. package/lib/node/di/app-module.d.ts +2 -2
  180. package/lib/node/di/app-module.d.ts.map +1 -1
  181. package/lib/node/di/app-module.js +10 -35
  182. package/lib/node/di/app-module.js.map +1 -1
  183. package/lib/node/index.d.ts +1 -0
  184. package/lib/node/index.d.ts.map +1 -1
  185. package/lib/node/index.js +1 -0
  186. package/lib/node/index.js.map +1 -1
  187. package/lib/node/launch/cli-parser.d.ts +2 -3
  188. package/lib/node/launch/cli-parser.d.ts.map +1 -1
  189. package/lib/node/launch/cli-parser.js.map +1 -1
  190. package/lib/node/launch/socket-cli-parser.js +1 -1
  191. package/lib/node/launch/socket-cli-parser.js.map +1 -1
  192. package/lib/node/launch/socket-server-launcher.d.ts +4 -24
  193. package/lib/node/launch/socket-server-launcher.d.ts.map +1 -1
  194. package/lib/node/launch/socket-server-launcher.js +15 -34
  195. package/lib/node/launch/socket-server-launcher.js.map +1 -1
  196. package/lib/node/launch/websocket-server-launcher.d.ts +53 -0
  197. package/lib/node/launch/websocket-server-launcher.d.ts.map +1 -0
  198. package/lib/node/launch/websocket-server-launcher.js +121 -0
  199. package/lib/node/launch/websocket-server-launcher.js.map +1 -0
  200. package/package.json +8 -5
  201. package/src/browser/di/app-module.ts +4 -32
  202. package/src/browser/index.ts +0 -1
  203. package/src/browser/launch/worker-server-launcher.ts +20 -22
  204. package/src/common/actions/client-action-handler.ts +1 -2
  205. package/src/common/command/command-stack.spec.ts +239 -0
  206. package/src/common/command/command-stack.ts +106 -20
  207. package/src/common/command/command.spec.ts +92 -0
  208. package/src/common/command/command.ts +96 -7
  209. package/src/common/command/recording-command.spec.ts +74 -0
  210. package/src/common/command/recording-command.ts +119 -0
  211. package/src/common/command/undo-redo-action-handler.ts +57 -0
  212. package/src/common/di/client-session-module.ts +1 -1
  213. package/src/common/di/diagram-module.ts +13 -0
  214. package/src/common/di/glsp-module.ts +3 -1
  215. package/src/common/di/multi-binding.ts +4 -5
  216. package/src/common/di/server-module.ts +6 -21
  217. package/src/common/features/contextactions/tool-palette-item-provider.ts +2 -4
  218. package/src/common/{gmodel → features/layout}/computed-bounds-action-handler.ts +10 -5
  219. package/src/common/features/layout/layout-operation-handler.ts +26 -11
  220. package/src/common/features/model/model-state.ts +0 -3
  221. package/src/common/features/model/model-submission-handler.ts +6 -2
  222. package/src/common/features/model/save-model-action-handler.ts +5 -6
  223. package/src/common/gmodel/apply-label-edit-operation-handler.ts +13 -15
  224. package/src/common/gmodel/change-bounds-operation-handler.ts +12 -8
  225. package/src/common/gmodel/change-routing-points-operation-handler.ts +8 -7
  226. package/src/common/{operations → gmodel}/cut-operation-handler.ts +9 -8
  227. package/src/common/gmodel/delete-operation-handler.ts +16 -10
  228. package/src/common/gmodel/gmodel-create-edge-operation-handler.ts +16 -10
  229. package/src/common/gmodel/gmodel-create-node-operation-handler.ts +54 -6
  230. package/src/common/gmodel/gmodel-diagram-module.ts +22 -27
  231. package/src/common/gmodel/gmodel-operation-handler.ts +31 -0
  232. package/src/common/gmodel/index.ts +2 -1
  233. package/src/common/gmodel/paste-operation-handler.ts +19 -11
  234. package/src/common/gmodel/reconnect-edge-operation-handler.ts +8 -7
  235. package/src/common/index.ts +5 -3
  236. package/src/common/launch/glsp-server-launcher.ts +15 -9
  237. package/src/common/launch/jsonrpc-server-launcher.ts +95 -0
  238. package/src/common/operations/compound-operation-handler.ts +14 -12
  239. package/src/common/operations/create-operation-handler.ts +17 -74
  240. package/src/common/operations/operation-action-handler.ts +51 -27
  241. package/src/common/operations/operation-handler-registry.ts +18 -3
  242. package/src/common/operations/operation-handler.ts +38 -13
  243. package/src/common/protocol/glsp-server.spec.ts +7 -4
  244. package/src/common/protocol/glsp-server.ts +17 -132
  245. package/src/common/session/client-session-factory.spec.ts +1 -1
  246. package/src/common/session/client-session-factory.ts +1 -2
  247. package/src/common/session/client-session-manager.ts +1 -3
  248. package/src/common/test/mock-util.ts +47 -41
  249. package/src/{browser/di → common/utils}/console-logger.ts +19 -1
  250. package/src/common/utils/layout-util.ts +1 -1
  251. package/src/common/utils/logger.ts +16 -1
  252. package/src/node/di/app-module.ts +4 -13
  253. package/src/node/index.ts +1 -0
  254. package/src/node/launch/cli-parser.ts +2 -3
  255. package/src/node/launch/socket-cli-parser.ts +1 -1
  256. package/src/node/launch/socket-server-launcher.spec.ts +6 -0
  257. package/src/node/launch/socket-server-launcher.ts +19 -35
  258. package/src/node/launch/websocket-server-launcher.ts +138 -0
  259. package/lib/browser/di/console-logger.d.ts.map +0 -1
  260. package/lib/browser/di/console-logger.js.map +0 -1
  261. package/lib/common/actions/action-dispatcher.spec.d.ts +0 -2
  262. package/lib/common/actions/action-dispatcher.spec.d.ts.map +0 -1
  263. package/lib/common/actions/action-dispatcher.spec.js +0 -264
  264. package/lib/common/actions/action-dispatcher.spec.js.map +0 -1
  265. package/lib/common/actions/action-handler-registry.spec.d.ts +0 -2
  266. package/lib/common/actions/action-handler-registry.spec.d.ts.map +0 -1
  267. package/lib/common/actions/action-handler-registry.spec.js +0 -50
  268. package/lib/common/actions/action-handler-registry.spec.js.map +0 -1
  269. package/lib/common/actions/global-action-provider.spec.d.ts +0 -2
  270. package/lib/common/actions/global-action-provider.spec.d.ts.map +0 -1
  271. package/lib/common/actions/global-action-provider.spec.js +0 -70
  272. package/lib/common/actions/global-action-provider.spec.js.map +0 -1
  273. package/lib/common/di/binding-target.spec.d.ts +0 -2
  274. package/lib/common/di/binding-target.spec.d.ts.map +0 -1
  275. package/lib/common/di/binding-target.spec.js +0 -121
  276. package/lib/common/di/binding-target.spec.js.map +0 -1
  277. package/lib/common/di/multi-bindings.spec.d.ts +0 -2
  278. package/lib/common/di/multi-bindings.spec.d.ts.map +0 -1
  279. package/lib/common/di/multi-bindings.spec.js +0 -137
  280. package/lib/common/di/multi-bindings.spec.js.map +0 -1
  281. package/lib/common/diagram/request-type-hints-action-handler.spec.d.ts +0 -2
  282. package/lib/common/diagram/request-type-hints-action-handler.spec.d.ts.map +0 -1
  283. package/lib/common/diagram/request-type-hints-action-handler.spec.js +0 -57
  284. package/lib/common/diagram/request-type-hints-action-handler.spec.js.map +0 -1
  285. package/lib/common/features/contextactions/context-actions-provider-registry.spec.d.ts +0 -2
  286. package/lib/common/features/contextactions/context-actions-provider-registry.spec.d.ts.map +0 -1
  287. package/lib/common/features/contextactions/context-actions-provider-registry.spec.js +0 -34
  288. package/lib/common/features/contextactions/context-actions-provider-registry.spec.js.map +0 -1
  289. package/lib/common/features/contextactions/request-context-actions-handler.spec.d.ts +0 -2
  290. package/lib/common/features/contextactions/request-context-actions-handler.spec.d.ts.map +0 -1
  291. package/lib/common/features/contextactions/request-context-actions-handler.spec.js +0 -63
  292. package/lib/common/features/contextactions/request-context-actions-handler.spec.js.map +0 -1
  293. package/lib/common/features/contextactions/tool-palette-item-provider.spec.d.ts +0 -2
  294. package/lib/common/features/contextactions/tool-palette-item-provider.spec.d.ts.map +0 -1
  295. package/lib/common/features/contextactions/tool-palette-item-provider.spec.js +0 -48
  296. package/lib/common/features/contextactions/tool-palette-item-provider.spec.js.map +0 -1
  297. package/lib/common/features/directediting/context-edit-validator-registry.spec.d.ts +0 -2
  298. package/lib/common/features/directediting/context-edit-validator-registry.spec.d.ts.map +0 -1
  299. package/lib/common/features/directediting/context-edit-validator-registry.spec.js +0 -44
  300. package/lib/common/features/directediting/context-edit-validator-registry.spec.js.map +0 -1
  301. package/lib/common/features/directediting/request-edit-validation-handler.spec.d.ts +0 -2
  302. package/lib/common/features/directediting/request-edit-validation-handler.spec.d.ts.map +0 -1
  303. package/lib/common/features/directediting/request-edit-validation-handler.spec.js +0 -97
  304. package/lib/common/features/directediting/request-edit-validation-handler.spec.js.map +0 -1
  305. package/lib/common/features/model/gmodel-serializer.spec.d.ts +0 -2
  306. package/lib/common/features/model/gmodel-serializer.spec.d.ts.map +0 -1
  307. package/lib/common/features/model/gmodel-serializer.spec.js +0 -124
  308. package/lib/common/features/model/gmodel-serializer.spec.js.map +0 -1
  309. package/lib/common/gmodel/apply-label-edit-operation-handler.spec.d.ts +0 -2
  310. package/lib/common/gmodel/apply-label-edit-operation-handler.spec.d.ts.map +0 -1
  311. package/lib/common/gmodel/apply-label-edit-operation-handler.spec.js +0 -38
  312. package/lib/common/gmodel/apply-label-edit-operation-handler.spec.js.map +0 -1
  313. package/lib/common/gmodel/computed-bounds-action-handler.d.ts.map +0 -1
  314. package/lib/common/gmodel/computed-bounds-action-handler.js.map +0 -1
  315. package/lib/common/operations/cut-operation-handler.d.ts.map +0 -1
  316. package/lib/common/operations/cut-operation-handler.js.map +0 -1
  317. package/lib/common/operations/operation-handler-registry.spec.d.ts +0 -2
  318. package/lib/common/operations/operation-handler-registry.spec.d.ts.map +0 -1
  319. package/lib/common/operations/operation-handler-registry.spec.js +0 -50
  320. package/lib/common/operations/operation-handler-registry.spec.js.map +0 -1
  321. package/lib/common/protocol/glsp-client-proxy.d.ts +0 -45
  322. package/lib/common/protocol/glsp-client-proxy.d.ts.map +0 -1
  323. package/lib/common/protocol/glsp-client-proxy.js.map +0 -1
  324. package/lib/common/protocol/glsp-server-listener.d.ts +0 -37
  325. package/lib/common/protocol/glsp-server-listener.d.ts.map +0 -1
  326. package/lib/common/protocol/glsp-server-listener.js +0 -5
  327. package/lib/common/protocol/glsp-server-listener.js.map +0 -1
  328. package/lib/common/protocol/glsp-server.spec.d.ts +0 -2
  329. package/lib/common/protocol/glsp-server.spec.d.ts.map +0 -1
  330. package/lib/common/protocol/glsp-server.spec.js +0 -119
  331. package/lib/common/protocol/glsp-server.spec.js.map +0 -1
  332. package/lib/common/session/client-session-factory.spec.d.ts +0 -2
  333. package/lib/common/session/client-session-factory.spec.d.ts.map +0 -1
  334. package/lib/common/session/client-session-factory.spec.js +0 -56
  335. package/lib/common/session/client-session-factory.spec.js.map +0 -1
  336. package/lib/common/session/client-session-manager.spec.d.ts +0 -2
  337. package/lib/common/session/client-session-manager.spec.d.ts.map +0 -1
  338. package/lib/common/session/client-session-manager.spec.js +0 -74
  339. package/lib/common/session/client-session-manager.spec.js.map +0 -1
  340. package/lib/common/test/mock-util.d.ts +0 -110
  341. package/lib/common/test/mock-util.d.ts.map +0 -1
  342. package/lib/common/test/mock-util.js +0 -211
  343. package/lib/common/test/mock-util.js.map +0 -1
  344. package/lib/common/utils/promise-queue.spec.d.ts +0 -2
  345. package/lib/common/utils/promise-queue.spec.d.ts.map +0 -1
  346. package/lib/common/utils/promise-queue.spec.js +0 -117
  347. package/lib/common/utils/promise-queue.spec.js.map +0 -1
  348. package/lib/common/utils/registry.spec.d.ts +0 -2
  349. package/lib/common/utils/registry.spec.d.ts.map +0 -1
  350. package/lib/common/utils/registry.spec.js +0 -199
  351. package/lib/common/utils/registry.spec.js.map +0 -1
  352. package/lib/node/launch/cli-parser.spec.d.ts +0 -2
  353. package/lib/node/launch/cli-parser.spec.d.ts.map +0 -1
  354. package/lib/node/launch/cli-parser.spec.js +0 -56
  355. package/lib/node/launch/cli-parser.spec.js.map +0 -1
  356. package/lib/node/launch/socket-cli-parser.spec.d.ts +0 -2
  357. package/lib/node/launch/socket-cli-parser.spec.d.ts.map +0 -1
  358. package/lib/node/launch/socket-cli-parser.spec.js +0 -66
  359. package/lib/node/launch/socket-cli-parser.spec.js.map +0 -1
  360. package/lib/node/launch/socket-server-launcher.spec.d.ts.map +0 -1
  361. package/lib/node/launch/socket-server-launcher.spec.js +0 -70
  362. package/lib/node/launch/socket-server-launcher.spec.js.map +0 -1
  363. package/src/common/gmodel/apply-label-edit-operation-handler.spec.ts +0 -40
  364. package/src/common/protocol/glsp-client-proxy.ts +0 -65
  365. package/src/common/protocol/glsp-server-listener.ts +0 -39
@@ -15,6 +15,8 @@
15
15
  ********************************************************************************/
16
16
  import { Action, MaybePromise, Operation } from '@eclipse-glsp/protocol';
17
17
  import { ActionHandler } from '../actions/action-handler';
18
+ import { Command } from '../command/command';
19
+ import { CommandStack } from '../command/command-stack';
18
20
  import { ModelState } from '../features/model/model-state';
19
21
  import { ModelSubmissionHandler } from '../features/model/model-submission-handler';
20
22
  import { OperationHandler } from './operation-handler';
@@ -24,10 +26,17 @@ export declare class OperationActionHandler implements ActionHandler {
24
26
  protected operationHandlerRegistry: OperationHandlerRegistry;
25
27
  protected modelSubmissionHandler: ModelSubmissionHandler;
26
28
  protected modelState: ModelState;
29
+ protected commandStack: CommandStack;
27
30
  constructor(actionKinds: string[]);
28
31
  execute(action: Operation): MaybePromise<Action[]>;
29
- executeHandler(operation: Operation, handler: OperationHandler): Promise<Action[]>;
32
+ protected executeOperation(operation: Operation): MaybePromise<Action[]>;
33
+ protected executeHandler(operation: Operation, handler: OperationHandler): Promise<Action[]>;
34
+ protected executeCommand(command: Command): Promise<void>;
35
+ protected submitModel(): MaybePromise<Action[]>;
30
36
  handles(action: Action): boolean;
37
+ /**
38
+ * @Deprecated Use {@link OperationHandlerRegistry#getOperationHandler(Operation) instead}.
39
+ */
31
40
  static getOperationHandler(operation: Operation, registry: OperationHandlerRegistry): OperationHandler | undefined;
32
41
  }
33
42
  //# sourceMappingURL=operation-action-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation-action-handler.d.ts","sourceRoot":"","sources":["../../../src/common/operations/operation-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAmB,YAAY,EAAE,SAAS,EAAuB,MAAM,wBAAwB,CAAC;AAE/G,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,qBACa,sBAAuB,YAAW,aAAa;IAKxB,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE;IAJ5B,SAAS,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;IAC/D,SAAS,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IACrE,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;gBAEZ,WAAW,EAAE,MAAM,EAAE;IAE9D,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;IAiB5C,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IASxF,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAOhC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,wBAAwB,GAAG,gBAAgB,GAAG,SAAS;CAGrH"}
1
+ {"version":3,"file":"operation-action-handler.d.ts","sourceRoot":"","sources":["../../../src/common/operations/operation-action-handler.ts"],"names":[],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M,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,wBAAwB,GAAG,gBAAgB,GAAG,SAAS;CAGrH"}
@@ -31,46 +31,57 @@ exports.OperationActionHandler = void 0;
31
31
  ********************************************************************************/
32
32
  const protocol_1 = require("@eclipse-glsp/protocol");
33
33
  const inversify_1 = require("inversify");
34
+ const command_stack_1 = require("../command/command-stack");
34
35
  const service_identifiers_1 = require("../di/service-identifiers");
35
36
  const model_state_1 = require("../features/model/model-state");
36
37
  const model_submission_handler_1 = require("../features/model/model-submission-handler");
38
+ const glsp_server_error_1 = require("../utils/glsp-server-error");
37
39
  const operation_handler_registry_1 = require("./operation-handler-registry");
38
40
  let OperationActionHandler = OperationActionHandler_1 = class OperationActionHandler {
39
41
  constructor(actionKinds) {
40
42
  this.actionKinds = actionKinds;
41
43
  }
42
44
  execute(action) {
43
- if (this.handles(action)) {
44
- if (this.modelState.isReadonly) {
45
- return [
46
- protocol_1.ServerMessageAction.create(`Server is in readonly-mode! Could not execute operation: ${action.kind}`, {
47
- severity: 'WARNING'
48
- })
49
- ];
50
- }
51
- const operationHandler = OperationActionHandler_1.getOperationHandler(action, this.operationHandlerRegistry);
52
- if (operationHandler) {
53
- return this.executeHandler(action, operationHandler);
54
- }
45
+ if (!this.handles(action)) {
46
+ throw new glsp_server_error_1.GLSPServerError(`Unhandled operation kind: ${action.kind}`);
47
+ }
48
+ if (this.modelState.isReadonly) {
49
+ return [
50
+ protocol_1.ServerMessageAction.create(`Server is in readonly-mode! Could not execute operation: ${action.kind}`, {
51
+ severity: 'WARNING'
52
+ })
53
+ ];
54
+ }
55
+ return this.executeOperation(action);
56
+ }
57
+ executeOperation(operation) {
58
+ const operationHandler = OperationActionHandler_1.getOperationHandler(operation, this.operationHandlerRegistry);
59
+ if (operationHandler) {
60
+ return this.executeHandler(operation, operationHandler);
55
61
  }
56
62
  return [];
57
63
  }
58
64
  async executeHandler(operation, handler) {
59
- // TODO: Create GModelRecordingCommand;
60
- await handler.execute(operation);
61
- this.modelState.index.indexRoot(this.modelState.root);
62
- this.modelState.isDirty = true;
63
- // TODO: this.modelState.execute(command)
65
+ const command = await handler.execute(operation);
66
+ if (command) {
67
+ await this.executeCommand(command);
68
+ }
69
+ return this.modelSubmissionHandler.submitModel('operation');
70
+ }
71
+ async executeCommand(command) {
72
+ return this.commandStack.execute(command);
73
+ }
74
+ submitModel() {
64
75
  return this.modelSubmissionHandler.submitModel('operation');
65
76
  }
66
77
  handles(action) {
67
- if (this.actionKinds.includes(action.kind)) {
68
- return true;
69
- }
70
- return false;
78
+ return this.actionKinds.includes(action.kind);
71
79
  }
80
+ /**
81
+ * @Deprecated Use {@link OperationHandlerRegistry#getOperationHandler(Operation) instead}.
82
+ */
72
83
  static getOperationHandler(operation, registry) {
73
- return protocol_1.CreateOperation.is(operation) ? registry.get(`${operation.kind}_${operation.elementTypeId}`) : registry.get(operation.kind);
84
+ return registry.getOperationHandler(operation);
74
85
  }
75
86
  };
76
87
  __decorate([
@@ -85,6 +96,10 @@ __decorate([
85
96
  (0, inversify_1.inject)(model_state_1.ModelState),
86
97
  __metadata("design:type", Object)
87
98
  ], OperationActionHandler.prototype, "modelState", void 0);
99
+ __decorate([
100
+ (0, inversify_1.inject)(command_stack_1.CommandStack),
101
+ __metadata("design:type", Object)
102
+ ], OperationActionHandler.prototype, "commandStack", void 0);
88
103
  OperationActionHandler = OperationActionHandler_1 = __decorate([
89
104
  (0, inversify_1.injectable)(),
90
105
  __param(0, (0, inversify_1.inject)(service_identifiers_1.Operations)),
@@ -1 +1 @@
1
- {"version":3,"file":"operation-action-handler.js","sourceRoot":"","sources":["../../../src/common/operations/operation-action-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAA+G;AAC/G,yCAA+C;AAE/C,mEAAuD;AACvD,+DAA2D;AAC3D,yFAAoF;AAEpF,6EAAwE;AAGjE,IAAM,sBAAsB,8BAA5B,MAAM,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AC,QAAQ,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACvI,CAAC;CACJ,CAAA;AA1CG;IAAC,IAAA,kBAAM,EAAC,qDAAwB,CAAC;8BAAqC,qDAAwB;wEAAC;AAC/F;IAAC,IAAA,kBAAM,EAAC,iDAAsB,CAAC;8BAAmC,iDAAsB;sEAAC;AACzF;IAAC,IAAA,kBAAM,EAAC,wBAAU,CAAC;;0DAAkC;AAH5C,sBAAsB;IADlC,IAAA,sBAAU,GAAE;IAMI,WAAA,IAAA,kBAAM,EAAC,gCAAU,CAAC,CAAA;;GALtB,sBAAsB,CA2ClC;AA3CY,wDAAsB"}
1
+ {"version":3,"file":"operation-action-handler.js","sourceRoot":"","sources":["../../../src/common/operations/operation-action-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAA8F;AAC9F,yCAA+C;AAG/C,4DAAwD;AACxD,mEAAuD;AACvD,+DAA2D;AAC3D,yFAAoF;AACpF,kEAA6D;AAE7D,6EAAwE;AAGjE,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAa/B,YAAyC,WAAqB;QAArB,gBAAW,GAAX,WAAW,CAAU;IAAG,CAAC;IAElE,OAAO,CAAC,MAAiB;QACrB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACvB,MAAM,IAAI,mCAAe,CAAC,6BAA6B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;SACzE;QACD,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE;YAC5B,OAAO;gBACH,8BAAmB,CAAC,MAAM,CAAC,4DAA4D,MAAM,CAAC,IAAI,EAAE,EAAE;oBAClG,QAAQ,EAAE,SAAS;iBACtB,CAAC;aACL,CAAC;SACL;Q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AAC,IAAA,kBAAM,EAAC,wBAAU,CAAC;;0DACc;AAEjC;IAAC,IAAA,kBAAM,EAAC,4BAAY,CAAC;;4DACgB;AAX5B,sBAAsB;IADlC,IAAA,sBAAU,GAAE;IAcI,WAAA,IAAA,kBAAM,EAAC,gCAAU,CAAC,CAAA;;GAbtB,sBAAsB,CAgElC;AAhEY,wDAAsB"}
@@ -13,17 +13,26 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { Args } from '@eclipse-glsp/protocol';
16
+ import { Args, MaybePromise, Operation } from '@eclipse-glsp/protocol';
17
+ import { Command } from '../command/command';
17
18
  import { ClientSessionInitializer } from '../session/client-session-initializer';
18
19
  import { Registry } from '../utils/registry';
19
20
  import { OperationHandler, OperationHandlerConstructor, OperationHandlerFactory } from './operation-handler';
20
21
  export declare class OperationHandlerRegistry extends Registry<string, OperationHandler> {
21
22
  registerHandler(handler: OperationHandler): boolean;
23
+ getOperationHandler(operation: Operation): OperationHandler | undefined;
24
+ /**
25
+ * Returns the matching command for the given operation.
26
+ *
27
+ * @param operation operation
28
+ * @return the matching command for the given operation
29
+ */
30
+ getExecutableCommand(operation: Operation): MaybePromise<Command | undefined>;
22
31
  }
23
32
  export declare class OperationHandlerRegistryInitializer implements ClientSessionInitializer {
24
33
  protected factory: OperationHandlerFactory;
25
34
  protected handlerConstructors: OperationHandlerConstructor[];
26
35
  protected registry: OperationHandlerRegistry;
27
- initialize(args?: Args): void;
36
+ initialize(_args?: Args): void;
28
37
  }
29
38
  //# sourceMappingURL=operation-handler-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation-handler-registry.d.ts","sourceRoot":"","sources":["../../../src/common/operations/operation-handler-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,OAAO,EAAE,wBAAwB,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,GAAG,SAAS,CAAC;CAGhF;AAED,qBACa,mCAAoC,YAAW,wBAAwB;IAEhF,SAAS,CAAC,OAAO,EAAE,uBAAuB,CAAC;IAI3C,SAAS,CAAC,mBAAmB,EAAE,2BAA2B,EAAE,CAAM;IAGlE,SAAS,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAE7C,UAAU,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI;CAIjC"}
@@ -10,13 +10,29 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.OperationHandlerRegistryInitializer = exports.OperationHandlerRegistry = void 0;
13
+ /********************************************************************************
14
+ * Copyright (c) 2022-2023 STMicroelectronics and others.
15
+ *
16
+ * This program and the accompanying materials are made available under the
17
+ * terms of the Eclipse Public License v. 2.0 which is available at
18
+ * http://www.eclipse.org/legal/epl-2.0.
19
+ *
20
+ * This Source Code may also be made available under the following Secondary
21
+ * Licenses when the conditions for such availability set forth in the Eclipse
22
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
23
+ * with the GNU Classpath Exception which is available at
24
+ * https://www.gnu.org/software/classpath/license.html.
25
+ *
26
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
27
+ ********************************************************************************/
28
+ const protocol_1 = require("@eclipse-glsp/protocol");
13
29
  const inversify_1 = require("inversify");
14
30
  const registry_1 = require("../utils/registry");
15
31
  const create_operation_handler_1 = require("./create-operation-handler");
16
32
  const operation_handler_1 = require("./operation-handler");
17
33
  let OperationHandlerRegistry = class OperationHandlerRegistry extends registry_1.Registry {
18
34
  registerHandler(handler) {
19
- if (handler instanceof create_operation_handler_1.CreateOperationHandler) {
35
+ if (create_operation_handler_1.CreateOperationHandler.is(handler)) {
20
36
  handler.elementTypeIds.forEach(typeId => this.register(`${handler.operationType}_${typeId}`, handler));
21
37
  return true;
22
38
  }
@@ -24,6 +40,19 @@ let OperationHandlerRegistry = class OperationHandlerRegistry extends registry_1
24
40
  return this.register(handler.operationType, handler);
25
41
  }
26
42
  }
43
+ getOperationHandler(operation) {
44
+ return protocol_1.CreateOperation.is(operation) ? this.get(`${operation.kind}_${operation.elementTypeId}`) : this.get(operation.kind);
45
+ }
46
+ /**
47
+ * Returns the matching command for the given operation.
48
+ *
49
+ * @param operation operation
50
+ * @return the matching command for the given operation
51
+ */
52
+ getExecutableCommand(operation) {
53
+ var _a;
54
+ return (_a = this.getOperationHandler(operation)) === null || _a === void 0 ? void 0 : _a.createCommand(operation);
55
+ }
27
56
  };
28
57
  OperationHandlerRegistry = __decorate([
29
58
  (0, inversify_1.injectable)()
@@ -33,7 +62,7 @@ let OperationHandlerRegistryInitializer = class OperationHandlerRegistryInitiali
33
62
  constructor() {
34
63
  this.handlerConstructors = [];
35
64
  }
36
- initialize(args) {
65
+ initialize(_args) {
37
66
  const handlers = this.handlerConstructors.map(constructor => this.factory(constructor));
38
67
  handlers.forEach(handler => this.registry.registerHandler(handler));
39
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"operation-handler-registry.js","sourceRoot":"","sources":["../../../src/common/operations/operation-handler-registry.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,yCAAyD;AAEzD,gDAA6C;AAC7C,yEAAoE;AACpE,2DAA6G;AAGtG,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,mBAAkC;IAC5E,eAAe,CAAC,OAAyB;QACrC,IAAI,OAAO,YAAY,iDAAsB,EAAE;YAC3C,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,aAAa,IAAI,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;YACvG,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;SACxD;IACL,CAAC;CACJ,CAAA;AATY,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CASpC;AATY,4DAAwB;AAY9B,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IAAzC;QAMO,wBAAmB,GAAkC,EAAE,CAAC;IAStE,CAAC;IAJG,UAAU,CAAC,IAAW;QAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;QACxF,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IACxE,CAAC;CACJ,CAAA;AAdG;IAAC,IAAA,kBAAM,EAAC,2CAAuB,CAAC;;oEACW;AAE3C;IAAC,IAAA,kBAAM,EAAC,+CAA2B,CAAC;IACnC,IAAA,oBAAQ,GAAE;;gFACuD;AAElE;IAAC,IAAA,kBAAM,EAAC,wBAAwB,CAAC;8BACb,wBAAwB;qEAAC;AATpC,mCAAmC;IAD/C,IAAA,sBAAU,GAAE;GACA,mCAAmC,CAe/C;AAfY,kFAAmC"}
1
+ {"version":3,"file":"operation-handler-registry.js","sourceRoot":"","sources":["../../../src/common/operations/operation-handler-registry.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAwF;AACxF,yCAAyD;AAGzD,gDAA6C;AAC7C,yEAAoE;AACpE,2DAA6G;AAGtG,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,mBAAkC;IAC5E,eAAe,CAAC,OAAyB;QACrC,IAAI,iDAAsB,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE;YACpC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,aAAa,IAAI,MAAM,E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wBAAwB,CAAC;8BACb,wBAAwB;qEAAC;AATpC,mCAAmC;IAD/C,IAAA,sBAAU,GAAE;GACA,mCAAmC,CAe/C;AAfY,kFAAmC"}
@@ -15,33 +15,50 @@
15
15
  ********************************************************************************/
16
16
  import { MaybePromise, Operation } from '@eclipse-glsp/protocol';
17
17
  import { interfaces } from 'inversify';
18
- export declare const OperationHandler: unique symbol;
18
+ import { Command } from '../command/command';
19
+ import { ModelState } from '../features/model/model-state';
19
20
  /**
20
21
  * An operation handler can execute {@link Operation}s of a certain type (subclass).
21
22
  * The operation handler processes the operation in the {@link OperationHandler.execute()} method. The result
22
- * of the execution is an update of the `ModelState` state.
23
- * This update is reversible (undo) and can be reapplied (redo). For basic diagram languages these updates are typically
24
- * applied directly on the `ModelState` using EMF `Command`s and the
25
- * `ModelState.execute()` method. For more complex diagram languages the
26
- * GModel state might be updated indirectly and the operation handler manipulates a custom model representation.
23
+ * of the execution is a {@link Command} that captures the corresponding source model changes.
24
+ * This command can be applied on the `CommandStack` and is reversible (undo) and can be reapplied (redo).
27
25
  *
28
26
  * The `OperationActionHandler` is responsible for retrieving all available (valid) operation handlers for an
29
27
  * operation that is dispatched via `ActionDispatcher`.
30
28
  */
31
- export interface OperationHandler {
29
+ export declare abstract class OperationHandler {
30
+ protected modelState: ModelState;
32
31
  /**
33
32
  * Returns the operation type that can be handled by this operation handler.
34
33
  *
35
34
  * @returns the operation type that can be handled.
36
35
  */
37
- readonly operationType: string;
36
+ abstract operationType: string;
38
37
  readonly label?: string;
39
38
  /**
40
- * Executes the operation handler for the given {@link Operation}.
39
+ * Creates a command that performs the operation in the source model(s). If `undefined` is returned, no update
40
+ * is performed on the model(s).
41
41
  *
42
- * @param operation The operation that should be executed.
42
+ * @param operation The operation to process.
43
+ * @return The created command to be executed on the command stack or `undefined` nothing should be done.
43
44
  */
44
- execute(operation: Operation): MaybePromise<void>;
45
+ abstract createCommand(operation: Operation): MaybePromise<Command | undefined>;
46
+ /**
47
+ * Executes the operation handler for the given {@link Operation} and returns the corresponding {@link Command}.
48
+ * If the given operation cannot be handled by this handler or the handler execution did not result in any changes
49
+ * `undefined` is returned.
50
+ *
51
+ * @param operation The operation that should be executed or empty if nothing should be done.
52
+ * @returns The command capturing the execution changes or `undefined`
53
+ */
54
+ execute(operation: Operation): MaybePromise<Command | undefined>;
55
+ /**
56
+ * Validates whether the given {@link Operation} can be handled by this operation handler.
57
+ *
58
+ * @param operation The operation that should be validated.
59
+ * @returns `true` if the given operation can be handled, `false` otherwise.
60
+ */
61
+ handles(operation: Operation): boolean;
45
62
  }
46
63
  export declare const OperationHandlerConstructor: unique symbol;
47
64
  export type OperationHandlerConstructor = interfaces.Newable<OperationHandler>;
@@ -1 +1 @@
1
- {"version":3,"file":"operation-handler.d.ts","sourceRoot":"","sources":["../../../src/common/operations/operation-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,eAAO,MAAM,gBAAgB,eAA6B,CAAC;AAE3D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,2BAA2B,eAAwC,CAAC;AAEjF,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE/E,eAAO,MAAM,uBAAuB,eAAoC,CAAC;AAEzE,MAAM,MAAM,uBAAuB,GAAG,CAAC,WAAW,EAAE,2BAA2B,KAAK,gBAAgB,CAAC"}
1
+ {"version":3,"file":"operation-handler.d.ts","sourceRoot":"","sources":["../../../src/common/operations/operation-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAsB,UAAU,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;;;;;;;GAQG;AACH,8BACsB,gBAAgB;IAElC,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IAEjC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC;IAE/E;;;;;;;OAOG;IACH,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC;IAIhE;;;;;OAKG;IACH,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;CAGzC;AAED,eAAO,MAAM,2BAA2B,eAAwC,CAAC;AAEjF,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE/E,eAAO,MAAM,uBAAuB,eAAoC,CAAC;AAEzE,MAAM,MAAM,uBAAuB,GAAG,CAAC,WAAW,EAAE,2BAA2B,KAAK,gBAAgB,CAAC"}
@@ -1,7 +1,56 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.OperationHandlerFactory = exports.OperationHandlerConstructor = exports.OperationHandler = void 0;
4
- exports.OperationHandler = Symbol('OperationHandler');
13
+ const inversify_1 = require("inversify");
14
+ const model_state_1 = require("../features/model/model-state");
15
+ /**
16
+ * An operation handler can execute {@link Operation}s of a certain type (subclass).
17
+ * The operation handler processes the operation in the {@link OperationHandler.execute()} method. The result
18
+ * of the execution is a {@link Command} that captures the corresponding source model changes.
19
+ * This command can be applied on the `CommandStack` and is reversible (undo) and can be reapplied (redo).
20
+ *
21
+ * The `OperationActionHandler` is responsible for retrieving all available (valid) operation handlers for an
22
+ * operation that is dispatched via `ActionDispatcher`.
23
+ */
24
+ let OperationHandler = class OperationHandler {
25
+ /**
26
+ * Executes the operation handler for the given {@link Operation} and returns the corresponding {@link Command}.
27
+ * If the given operation cannot be handled by this handler or the handler execution did not result in any changes
28
+ * `undefined` is returned.
29
+ *
30
+ * @param operation The operation that should be executed or empty if nothing should be done.
31
+ * @returns The command capturing the execution changes or `undefined`
32
+ */
33
+ execute(operation) {
34
+ return this.handles(operation) ? this.createCommand(operation) : undefined;
35
+ }
36
+ /**
37
+ * Validates whether the given {@link Operation} can be handled by this operation handler.
38
+ *
39
+ * @param operation The operation that should be validated.
40
+ * @returns `true` if the given operation can be handled, `false` otherwise.
41
+ */
42
+ handles(operation) {
43
+ return this.modelState.root && operation.kind === this.operationType;
44
+ }
45
+ };
46
+ __decorate([
47
+ (0, inversify_1.inject)(model_state_1.ModelState),
48
+ __metadata("design:type", Object)
49
+ ], OperationHandler.prototype, "modelState", void 0);
50
+ OperationHandler = __decorate([
51
+ (0, inversify_1.injectable)()
52
+ ], OperationHandler);
53
+ exports.OperationHandler = OperationHandler;
5
54
  exports.OperationHandlerConstructor = Symbol('OperationHandlerConstructor');
6
55
  exports.OperationHandlerFactory = Symbol('OperationHandlerFactory');
7
56
  //# sourceMappingURL=operation-handler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation-handler.js","sourceRoot":"","sources":["../../../src/common/operations/operation-handler.ts"],"names":[],"mappings":";;;AAkBa,QAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAgC9C,QAAA,2BAA2B,GAAG,MAAM,CAAC,6BAA6B,CAAC,CAAC;AAIpE,QAAA,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC"}
1
+ {"version":3,"file":"operation-handler.js","sourceRoot":"","sources":["../../../src/common/operations/operation-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,yCAA2D;AAE3D,+DAA2D;AAE3D;;;;;;;;GAQG;AAEI,IAAe,gBAAgB,GAA/B,MAAe,gBAAgB;IAsBlC;;;;;;;OAOG;IACH,OAAO,CAAC,SAAoB;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/E,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,SAAoB;QACxB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,aAAa,CAAC;IACzE,CAAC;CACJ,CAAA;AA1CG;IAAC,IAAA,kBAAM,EAAC,wBAAU,CAAC;;oDACc;AAFf,gBAAgB;IADrC,IAAA,sBAAU,GAAE;GACS,gBAAgB,CA2CrC;AA3CqB,4CAAgB;AA6CzB,QAAA,2BAA2B,GAAG,MAAM,CAAC,6BAA6B,CAAC,CAAC;AAIpE,QAAA,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC"}
@@ -13,122 +13,22 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { ActionMessage, Args, DisposeClientSessionParameters, InitializeClientSessionParameters, InitializeParameters, InitializeResult, MaybePromise } from '@eclipse-glsp/protocol';
17
- import * as jsonrpc from 'vscode-jsonrpc';
18
- import { MessageConnection } from 'vscode-jsonrpc';
16
+ import { ActionMessage, Args, DisposeClientSessionParameters, GLSPClientProxy, GLSPServer, GLSPServerListener, InitializeClientSessionParameters, InitializeParameters, InitializeResult, MaybePromise } from '@eclipse-glsp/protocol';
19
17
  import { GlobalActionProvider } from '../actions/global-action-provider';
20
18
  import { ClientSession } from '../session/client-session';
21
19
  import { ClientSessionManager } from '../session/client-session-manager';
22
20
  import { Logger } from '../utils/logger';
23
- import { JsonRpcGLSPClientProxy } from './glsp-client-proxy';
24
- import { GLSPServerListener } from './glsp-server-listener';
25
- export declare const GLSPServer: unique symbol;
26
- /**
27
- * Interface for implementations of a server component using json-rpc for client-server communication.
28
- * Based on the specification of the Graphical Language Server Protocol:
29
- * https://github.com/eclipse-glsp/glsp/blob/master/PROTOCOL.md
30
- */
31
- export interface GLSPServer {
32
- /**
33
- *
34
- * The `initialize` request has to be the first request from the client to the server. Until the server has responded
35
- * with an {@link InitializeResult} no other request or notification can be handled and is expected to throw an
36
- * error. A client is uniquely identified by an `applicationId` and has to specify on which `protocolVersion` it is
37
- * based on. In addition, custom arguments can be provided in the `args` map to allow for custom initialization
38
- * behavior on the server.
39
- *
40
- * After successfully initialization all {@link GLSPServerListener}s are notified via the
41
- * {@link GLSPServerListener.serverInitialized} method.
42
- *
43
- * @param params the {@link InitializeParameters}.
44
- * @returns A promise of the {@link InitializeResult} .
45
- *
46
- * @throws {@link Error} Subsequent initialize requests return the {@link InitializeResult} of the initial request
47
- * if the given application id and protocol version are matching, otherwise the promise rejects with an error.
48
- *
49
- */
50
- initialize(params: InitializeParameters): Promise<InitializeResult>;
51
- /**
52
- * The `initializeClientSession` request is sent to the server whenever a new graphical representation (diagram) is
53
- * created. Each individual diagram on the client side counts as one session and has to provide a unique
54
- * `clientSessionId` and its `diagramType`. In addition, custom arguments can be provided in the `args` map to allow
55
- * for custom initialization behavior on the server. Subsequent `initializeClientSession` requests for the same
56
- * client id and diagram type are expected to resolve successfully but don't have an actual effect because the
57
- * corresponding client session is already initialized.
58
- *
59
- * @param params the {@link InitializeClientSessionParameters}.
60
- * @returns A promise that completes when the initialization was successful.
61
- */
62
- initializeClientSession(params: InitializeClientSessionParameters): Promise<void>;
63
- /**
64
- * The 'DisposeClientSession' request is sent to the server when a graphical representation (diagram) is no longer
65
- * needed, e.g. the tab containing the diagram widget has been closed. The session is identified by its unique
66
- * `clientSessionId`. In addition, custom arguments can be provided in the `args` map to allow for custom dispose
67
- * behavior on the server.
68
- *
69
- * @param params the {@link DisposeClientSessionParameters}.
70
- * @returns A `void` promise that completes if the disposal was successful.
71
- *
72
- */
73
- disposeClientSession(params: DisposeClientSessionParameters): Promise<void>;
74
- /**
75
- * A `process` notification is sent from the client to server when the server should handle i.e. process a specific
76
- * {@link ActionMessage}. Any communication that is performed between initialization and shutdown is handled by
77
- * sending action messages, either from the client to the server or from the server to the client. This is the core
78
- * part of the Graphical Language Server Protocol.
79
- *
80
- * @param message The {@link ActionMessage} that should be processed.
81
- */
82
- process(message: ActionMessage): void;
83
- /**
84
- * The `shutdown` notification is sent from the client to the server if the client disconnects from the server (e.g.
85
- * the client application has been closed).
86
- * This gives the server a chance to clean up and dispose any resources dedicated to the client and its sessions.
87
- * All {@link GLSPServerListener}s are notified via the {@link GLSPServerListener.serverShutDown} method.
88
- * Afterwards the server instance is considered to be disposed and can no longer be used for handling requests.
89
- *
90
- */
91
- shutdown(): void;
92
- /**
93
- * Register a new {@link GLSPServerListener}.
94
- *
95
- * @param listener The listener that should be registered.
96
- * @returns `true` if the listener was registered successfully, `false` otherwise (e.g. listener is already
97
- * registered).
98
- */
99
- addListener(listener: GLSPServerListener): boolean;
100
- /**
101
- * Unregister a {@link GLSPServerListener}.
102
- *
103
- * @param listener The listener that should be removed
104
- * @returns 'true' if the listener was unregistered successfully, `false` otherwise (e.g. listener is was not
105
- * registered in the first place).
106
- */
107
- removeListener(listener: GLSPServerListener): boolean;
108
- /**
109
- * get a {@link ClientSession}.
110
- *
111
- * @param sessionId The id of the session to get
112
- * @returns The either the ClientSession or undefined, if no ClientSession was found for the given id.
113
- */
114
- getClientSession(sessionId: string): ClientSession | undefined;
115
- }
116
- export declare const JsonRpcGLSPServer: unique symbol;
117
- export interface JsonRpcGLSPServer extends GLSPServer {
118
- connect(connection: jsonrpc.MessageConnection): void;
119
- }
120
- export declare class DefaultGLSPServer implements JsonRpcGLSPServer {
21
+ export declare class DefaultGLSPServer implements GLSPServer {
121
22
  static readonly PROTOCOL_VERSION = "1.0.0";
122
23
  protected logger: Logger;
123
24
  protected sessionManager: ClientSessionManager;
124
25
  protected actionProvider: GlobalActionProvider;
125
- protected glspClient: JsonRpcGLSPClientProxy;
26
+ protected glspClientProxy?: GLSPClientProxy;
126
27
  protected initializeResult?: InitializeResult;
127
28
  protected applicationId: string;
128
29
  protected clientSessions: Map<string, ClientSession>;
129
30
  protected serverListeners: GLSPServerListener[];
130
31
  constructor(serverListeners?: GLSPServerListener[]);
131
- protected setupJsonRpc(connection: MessageConnection): void;
132
32
  protected validateProtocolVersion(params: InitializeParameters): void;
133
33
  protected validateServerInitialized(): void;
134
34
  initialize(params: InitializeParameters): Promise<InitializeResult>;
@@ -139,9 +39,9 @@ export declare class DefaultGLSPServer implements JsonRpcGLSPServer {
139
39
  protected handleDisposeClientSessionArgs(args: Args | undefined): Promise<void>;
140
40
  process(message: ActionMessage): void;
141
41
  protected handleProcessError(message: ActionMessage, reason: any): void | PromiseLike<void>;
42
+ protected sendToClient(message: ActionMessage): void;
142
43
  getClientSession(sessionId: string): ClientSession | undefined;
143
44
  shutdown(): void;
144
- connect(connection: jsonrpc.MessageConnection): void;
145
45
  protected isInitialized(): boolean;
146
46
  addListener(listener: GLSPServerListener): boolean;
147
47
  removeListener(listener: GLSPServerListener): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"glsp-server.d.ts","sourceRoot":"","sources":["../../../src/common/protocol/glsp-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,aAAa,EACb,IAAI,EACJ,8BAA8B,EAE9B,iCAAiC,EACjC,oBAAoB,EACpB,gBAAgB,EAEhB,YAAY,EAIf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,eAAO,MAAM,UAAU,eAAuB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACvB;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEpE;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,MAAM,EAAE,iCAAiC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElF;;;;;;;;;OASG;IACH,oBAAoB,CAAC,MAAM,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5E;;;;;;;OAOG;IACH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E,oBAAoB,CAAC,MAAM,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC;cAUxE,8BAA8B,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrF,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAYrC,SAAS,CAAC,kBAAkB,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;IAa3F,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAQpD,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAIvD,QAAQ,IAAI,IAAI;IAOvB,SAAS,CAAC,aAAa,IAAI,OAAO;IAIlC,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO;IAKlD,cAAc,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO;IAKrD,SAAS,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,kBAAkB,GAAG,kBAAkB,EAAE;CAGzF"}
@@ -13,7 +13,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
13
13
  };
14
14
  var DefaultGLSPServer_1;
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.DefaultGLSPServer = exports.JsonRpcGLSPServer = exports.GLSPServer = void 0;
16
+ exports.DefaultGLSPServer = void 0;
17
17
  /********************************************************************************
18
18
  * Copyright (c) 2022-2023 STMicroelectronics and others.
19
19
  *
@@ -35,23 +35,12 @@ const global_action_provider_1 = require("../actions/global-action-provider");
35
35
  const client_session_manager_1 = require("../session/client-session-manager");
36
36
  const glsp_server_error_1 = require("../utils/glsp-server-error");
37
37
  const logger_1 = require("../utils/logger");
38
- const glsp_client_proxy_1 = require("./glsp-client-proxy");
39
- const glsp_server_listener_1 = require("./glsp-server-listener");
40
- exports.GLSPServer = Symbol('GLSPServer');
41
- exports.JsonRpcGLSPServer = Symbol('JsonRpcGLSPServer');
42
38
  let DefaultGLSPServer = DefaultGLSPServer_1 = class DefaultGLSPServer {
43
39
  constructor(serverListeners = []) {
44
40
  this.serverListeners = [];
45
41
  this.clientSessions = new Map();
46
42
  serverListeners.forEach(listener => this.addListener(listener));
47
43
  }
48
- setupJsonRpc(connection) {
49
- connection.onRequest(protocol_1.JsonrpcGLSPClient.InitializeRequest.method, (params) => this.initialize(params));
50
- connection.onRequest(protocol_1.JsonrpcGLSPClient.InitializeClientSessionRequest, (params) => this.initializeClientSession(params));
51
- connection.onRequest(protocol_1.JsonrpcGLSPClient.DisposeClientSessionRequest, (params) => this.disposeClientSession(params));
52
- connection.onNotification(protocol_1.JsonrpcGLSPClient.ActionMessageNotification, message => this.process(message));
53
- connection.onNotification(protocol_1.JsonrpcGLSPClient.ShutdownNotification, () => this.shutdown());
54
- }
55
44
  validateProtocolVersion(params) {
56
45
  if (params.protocolVersion !== DefaultGLSPServer_1.PROTOCOL_VERSION) {
57
46
  throw new Error(
@@ -131,7 +120,14 @@ let DefaultGLSPServer = DefaultGLSPServer_1 = class DefaultGLSPServer {
131
120
  errorMsg = reason.message;
132
121
  }
133
122
  const errorAction = protocol_1.ServerMessageAction.create(errorMsg, { severity: 'ERROR', details });
134
- this.glspClient.process({ clientId: message.clientId, action: errorAction });
123
+ this.sendToClient({ clientId: message.clientId, action: errorAction });
124
+ }
125
+ sendToClient(message) {
126
+ if (this.glspClientProxy) {
127
+ this.glspClientProxy.process(message);
128
+ return;
129
+ }
130
+ throw new Error("Could not send message to client. No 'GLSPClientProxy' is connected");
135
131
  }
136
132
  getClientSession(sessionId) {
137
133
  return this.clientSessions.get(sessionId);
@@ -142,10 +138,6 @@ let DefaultGLSPServer = DefaultGLSPServer_1 = class DefaultGLSPServer {
142
138
  this.clientSessions.clear();
143
139
  this.initializeResult = undefined;
144
140
  }
145
- connect(connection) {
146
- this.setupJsonRpc(connection);
147
- this.glspClient.connect(connection);
148
- }
149
141
  isInitialized() {
150
142
  return this.initializeResult !== undefined;
151
143
  }
@@ -175,12 +167,13 @@ __decorate([
175
167
  __metadata("design:type", Object)
176
168
  ], DefaultGLSPServer.prototype, "actionProvider", void 0);
177
169
  __decorate([
178
- (0, inversify_1.inject)(glsp_client_proxy_1.JsonRpcGLSPClientProxy),
170
+ (0, inversify_1.inject)(protocol_1.GLSPClientProxy),
171
+ (0, inversify_1.optional)(),
179
172
  __metadata("design:type", Object)
180
- ], DefaultGLSPServer.prototype, "glspClient", void 0);
173
+ ], DefaultGLSPServer.prototype, "glspClientProxy", void 0);
181
174
  DefaultGLSPServer = DefaultGLSPServer_1 = __decorate([
182
175
  (0, inversify_1.injectable)(),
183
- __param(0, (0, inversify_1.multiInject)(glsp_server_listener_1.GLSPServerListener)),
176
+ __param(0, (0, inversify_1.multiInject)(protocol_1.GLSPServerListener)),
184
177
  __param(0, (0, inversify_1.optional)()),
185
178
  __metadata("design:paramtypes", [Array])
186
179
  ], DefaultGLSPServer);