@eclipse-glsp/server 1.1.0-next.dc6b980.47 → 1.1.0-next.de91dcd.60

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 (350) 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 +4 -4
  10. package/lib/browser/launch/worker-server-launcher.d.ts.map +1 -1
  11. package/lib/browser/launch/worker-server-launcher.js +6 -13
  12. package/lib/browser/launch/worker-server-launcher.js.map +1 -1
  13. package/lib/common/actions/action-dispatcher.js +2 -3
  14. package/lib/common/actions/action-dispatcher.js.map +1 -1
  15. package/lib/common/actions/action-handler-registry.js +4 -6
  16. package/lib/common/actions/action-handler-registry.js.map +1 -1
  17. package/lib/common/actions/client-action-handler.d.ts +1 -2
  18. package/lib/common/actions/client-action-handler.d.ts.map +1 -1
  19. package/lib/common/actions/client-action-handler.js +19 -5
  20. package/lib/common/actions/client-action-handler.js.map +1 -1
  21. package/lib/common/actions/global-action-provider.js +2 -3
  22. package/lib/common/actions/global-action-provider.js.map +1 -1
  23. package/lib/common/command/command-stack.d.ts +16 -1
  24. package/lib/common/command/command-stack.d.ts.map +1 -1
  25. package/lib/common/command/command-stack.js +2 -18
  26. package/lib/common/command/command-stack.js.map +1 -1
  27. package/lib/common/command/command.js +1 -1
  28. package/lib/common/command/command.js.map +1 -1
  29. package/lib/common/command/undo-redo-action-handler.js +2 -3
  30. package/lib/common/command/undo-redo-action-handler.js.map +1 -1
  31. package/lib/common/di/binding-target.d.ts.map +1 -1
  32. package/lib/common/di/binding-target.js +3 -2
  33. package/lib/common/di/binding-target.js.map +1 -1
  34. package/lib/common/di/client-session-module.d.ts +1 -1
  35. package/lib/common/di/client-session-module.d.ts.map +1 -1
  36. package/lib/common/di/client-session-module.js +2 -2
  37. package/lib/common/di/client-session-module.js.map +1 -1
  38. package/lib/common/di/diagram-module.d.ts +3 -0
  39. package/lib/common/di/diagram-module.d.ts.map +1 -1
  40. package/lib/common/di/diagram-module.js +14 -5
  41. package/lib/common/di/diagram-module.js.map +1 -1
  42. package/lib/common/di/glsp-module.d.ts +3 -1
  43. package/lib/common/di/glsp-module.d.ts.map +1 -1
  44. package/lib/common/di/glsp-module.js +2 -18
  45. package/lib/common/di/glsp-module.js.map +1 -1
  46. package/lib/common/di/multi-binding.d.ts +19 -4
  47. package/lib/common/di/multi-binding.d.ts.map +1 -1
  48. package/lib/common/di/multi-binding.js.map +1 -1
  49. package/lib/common/di/server-module.d.ts +1 -6
  50. package/lib/common/di/server-module.d.ts.map +1 -1
  51. package/lib/common/di/server-module.js +21 -17
  52. package/lib/common/di/server-module.js.map +1 -1
  53. package/lib/common/diagram/diagram-configuration.js +1 -1
  54. package/lib/common/diagram/diagram-configuration.js.map +1 -1
  55. package/lib/common/diagram/request-type-hints-action-handler.js +2 -3
  56. package/lib/common/diagram/request-type-hints-action-handler.js.map +1 -1
  57. package/lib/common/features/clipboard/request-clipboard-data-action-handler.js +2 -3
  58. package/lib/common/features/clipboard/request-clipboard-data-action-handler.js.map +1 -1
  59. package/lib/common/features/contextactions/command-palette-action-provider.js +2 -3
  60. package/lib/common/features/contextactions/command-palette-action-provider.js.map +1 -1
  61. package/lib/common/features/contextactions/context-actions-provider-registry.js +2 -3
  62. package/lib/common/features/contextactions/context-actions-provider-registry.js.map +1 -1
  63. package/lib/common/features/contextactions/context-menu-item-provider.js +2 -3
  64. package/lib/common/features/contextactions/context-menu-item-provider.js.map +1 -1
  65. package/lib/common/features/contextactions/request-context-actions-handler.js +2 -3
  66. package/lib/common/features/contextactions/request-context-actions-handler.js.map +1 -1
  67. package/lib/common/features/contextactions/tool-palette-item-provider.js +4 -6
  68. package/lib/common/features/contextactions/tool-palette-item-provider.js.map +1 -1
  69. package/lib/common/features/directediting/context-edit-validator-registry.js +2 -3
  70. package/lib/common/features/directediting/context-edit-validator-registry.js.map +1 -1
  71. package/lib/common/features/directediting/label-edit-validator.js +2 -3
  72. package/lib/common/features/directediting/label-edit-validator.js.map +1 -1
  73. package/lib/common/features/directediting/request-edit-validation-handler.js +2 -3
  74. package/lib/common/features/directediting/request-edit-validation-handler.js.map +1 -1
  75. package/lib/common/features/layout/computed-bounds-action-handler.js +2 -3
  76. package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -1
  77. package/lib/common/features/layout/layout-operation-handler.js +2 -3
  78. package/lib/common/features/layout/layout-operation-handler.js.map +1 -1
  79. package/lib/common/features/model/gmodel-factory.js +2 -3
  80. package/lib/common/features/model/gmodel-factory.js.map +1 -1
  81. package/lib/common/features/model/gmodel-index.js +2 -3
  82. package/lib/common/features/model/gmodel-index.js.map +1 -1
  83. package/lib/common/features/model/gmodel-serializer.js +2 -3
  84. package/lib/common/features/model/gmodel-serializer.js.map +1 -1
  85. package/lib/common/features/model/model-state.js +2 -3
  86. package/lib/common/features/model/model-state.js.map +1 -1
  87. package/lib/common/features/model/model-submission-handler.d.ts +2 -0
  88. package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
  89. package/lib/common/features/model/model-submission-handler.js +12 -3
  90. package/lib/common/features/model/model-submission-handler.js.map +1 -1
  91. package/lib/common/features/model/request-model-action-handler.d.ts +4 -6
  92. package/lib/common/features/model/request-model-action-handler.d.ts.map +1 -1
  93. package/lib/common/features/model/request-model-action-handler.js +16 -14
  94. package/lib/common/features/model/request-model-action-handler.js.map +1 -1
  95. package/lib/common/features/model/save-model-action-handler.js +2 -3
  96. package/lib/common/features/model/save-model-action-handler.js.map +1 -1
  97. package/lib/common/features/navigation/navigation-target-provider-registry.js +2 -3
  98. package/lib/common/features/navigation/navigation-target-provider-registry.js.map +1 -1
  99. package/lib/common/features/navigation/navigation-target-resolver.js +2 -3
  100. package/lib/common/features/navigation/navigation-target-resolver.js.map +1 -1
  101. package/lib/common/features/navigation/request-navigation-targets-action-handler.js +2 -3
  102. package/lib/common/features/navigation/request-navigation-targets-action-handler.js.map +1 -1
  103. package/lib/common/features/navigation/resolve-navigation-targets-action-handler.js +2 -3
  104. package/lib/common/features/navigation/resolve-navigation-targets-action-handler.js.map +1 -1
  105. package/lib/common/features/popup/request-popup-model-action-handler.js +2 -3
  106. package/lib/common/features/popup/request-popup-model-action-handler.js.map +1 -1
  107. package/lib/common/features/progress/progress-service.d.ts +44 -0
  108. package/lib/common/features/progress/progress-service.d.ts.map +1 -0
  109. package/lib/common/{protocol/glsp-client-proxy.js → features/progress/progress-service.js} +19 -22
  110. package/lib/common/features/progress/progress-service.js.map +1 -0
  111. package/lib/common/features/validation/model-validator.d.ts +47 -2
  112. package/lib/common/features/validation/model-validator.d.ts.map +1 -1
  113. package/lib/common/features/validation/model-validator.js +79 -1
  114. package/lib/common/features/validation/model-validator.js.map +1 -1
  115. package/lib/common/features/validation/request-markers-handler.d.ts +15 -0
  116. package/lib/common/features/validation/request-markers-handler.d.ts.map +1 -1
  117. package/lib/common/features/validation/request-markers-handler.js +5 -12
  118. package/lib/common/features/validation/request-markers-handler.js.map +1 -1
  119. package/lib/common/gmodel/apply-label-edit-operation-handler.js +2 -3
  120. package/lib/common/gmodel/apply-label-edit-operation-handler.js.map +1 -1
  121. package/lib/common/gmodel/change-bounds-operation-handler.js +2 -3
  122. package/lib/common/gmodel/change-bounds-operation-handler.js.map +1 -1
  123. package/lib/common/gmodel/change-routing-points-operation-handler.js +2 -3
  124. package/lib/common/gmodel/change-routing-points-operation-handler.js.map +1 -1
  125. package/lib/common/gmodel/cut-operation-handler.js +2 -3
  126. package/lib/common/gmodel/cut-operation-handler.js.map +1 -1
  127. package/lib/common/gmodel/delete-operation-handler.js +2 -3
  128. package/lib/common/gmodel/delete-operation-handler.js.map +1 -1
  129. package/lib/common/gmodel/gmodel-create-edge-operation-handler.js +2 -3
  130. package/lib/common/gmodel/gmodel-create-edge-operation-handler.js.map +1 -1
  131. package/lib/common/gmodel/gmodel-create-node-operation-handler.js +2 -3
  132. package/lib/common/gmodel/gmodel-create-node-operation-handler.js.map +1 -1
  133. package/lib/common/gmodel/gmodel-diagram-module.js +2 -3
  134. package/lib/common/gmodel/gmodel-diagram-module.js.map +1 -1
  135. package/lib/common/gmodel/gmodel-operation-handler.js +1 -1
  136. package/lib/common/gmodel/gmodel-operation-handler.js.map +1 -1
  137. package/lib/common/gmodel/paste-operation-handler.js +2 -3
  138. package/lib/common/gmodel/paste-operation-handler.js.map +1 -1
  139. package/lib/common/gmodel/reconnect-edge-operation-handler.js +2 -3
  140. package/lib/common/gmodel/reconnect-edge-operation-handler.js.map +1 -1
  141. package/lib/common/index.d.ts +1 -2
  142. package/lib/common/index.d.ts.map +1 -1
  143. package/lib/common/index.js +1 -2
  144. package/lib/common/index.js.map +1 -1
  145. package/lib/common/launch/glsp-server-launcher.d.ts +1 -1
  146. package/lib/common/launch/glsp-server-launcher.d.ts.map +1 -1
  147. package/lib/common/launch/glsp-server-launcher.js +4 -5
  148. package/lib/common/launch/glsp-server-launcher.js.map +1 -1
  149. package/lib/common/launch/jsonrpc-server-launcher.d.ts +38 -0
  150. package/lib/common/launch/jsonrpc-server-launcher.d.ts.map +1 -0
  151. package/lib/common/launch/jsonrpc-server-launcher.js +83 -0
  152. package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -0
  153. package/lib/common/operations/compound-operation-handler.js +6 -12
  154. package/lib/common/operations/compound-operation-handler.js.map +1 -1
  155. package/lib/common/operations/create-operation-handler.js +1 -1
  156. package/lib/common/operations/create-operation-handler.js.map +1 -1
  157. package/lib/common/operations/operation-action-handler.js +2 -3
  158. package/lib/common/operations/operation-action-handler.js.map +1 -1
  159. package/lib/common/operations/operation-handler-registry.js +4 -6
  160. package/lib/common/operations/operation-handler-registry.js.map +1 -1
  161. package/lib/common/operations/operation-handler.js +2 -3
  162. package/lib/common/operations/operation-handler.js.map +1 -1
  163. package/lib/common/protocol/glsp-server.d.ts +4 -104
  164. package/lib/common/protocol/glsp-server.d.ts.map +1 -1
  165. package/lib/common/protocol/glsp-server.js +15 -23
  166. package/lib/common/protocol/glsp-server.js.map +1 -1
  167. package/lib/common/session/client-session-factory.d.ts +1 -2
  168. package/lib/common/session/client-session-factory.d.ts.map +1 -1
  169. package/lib/common/session/client-session-factory.js +19 -5
  170. package/lib/common/session/client-session-factory.js.map +1 -1
  171. package/lib/common/session/client-session-manager.d.ts +1 -3
  172. package/lib/common/session/client-session-manager.d.ts.map +1 -1
  173. package/lib/common/session/client-session-manager.js +2 -3
  174. package/lib/common/session/client-session-manager.js.map +1 -1
  175. package/lib/common/utils/args-util.js +2 -2
  176. package/lib/common/utils/args-util.js.map +1 -1
  177. package/lib/{browser/di → common/utils}/console-logger.d.ts +7 -1
  178. package/lib/common/utils/console-logger.d.ts.map +1 -0
  179. package/lib/{browser/di → common/utils}/console-logger.js +27 -10
  180. package/lib/common/utils/console-logger.js.map +1 -0
  181. package/lib/common/utils/logger.d.ts +21 -0
  182. package/lib/common/utils/logger.d.ts.map +1 -1
  183. package/lib/common/utils/logger.js +16 -5
  184. package/lib/common/utils/logger.js.map +1 -1
  185. package/lib/common/utils/registry.js +4 -6
  186. package/lib/common/utils/registry.js.map +1 -1
  187. package/lib/node/abstract-json-model-storage.js +2 -3
  188. package/lib/node/abstract-json-model-storage.js.map +1 -1
  189. package/lib/node/di/app-module.d.ts +2 -2
  190. package/lib/node/di/app-module.d.ts.map +1 -1
  191. package/lib/node/di/app-module.js +10 -35
  192. package/lib/node/di/app-module.js.map +1 -1
  193. package/lib/node/gmodel/gmodel-storage.js +2 -3
  194. package/lib/node/gmodel/gmodel-storage.js.map +1 -1
  195. package/lib/node/launch/cli-parser.d.ts +2 -3
  196. package/lib/node/launch/cli-parser.d.ts.map +1 -1
  197. package/lib/node/launch/cli-parser.js.map +1 -1
  198. package/lib/node/launch/socket-server-launcher.d.ts +2 -23
  199. package/lib/node/launch/socket-server-launcher.d.ts.map +1 -1
  200. package/lib/node/launch/socket-server-launcher.js +9 -30
  201. package/lib/node/launch/socket-server-launcher.js.map +1 -1
  202. package/lib/node/launch/websocket-server-launcher.d.ts +2 -8
  203. package/lib/node/launch/websocket-server-launcher.d.ts.map +1 -1
  204. package/lib/node/launch/websocket-server-launcher.js +5 -30
  205. package/lib/node/launch/websocket-server-launcher.js.map +1 -1
  206. package/package.json +6 -4
  207. package/src/browser/di/app-module.ts +4 -32
  208. package/src/browser/index.ts +0 -1
  209. package/src/browser/launch/worker-server-launcher.ts +7 -13
  210. package/src/common/actions/client-action-handler.ts +1 -2
  211. package/src/common/command/command-stack.ts +1 -1
  212. package/src/common/di/binding-target.ts +1 -0
  213. package/src/common/di/client-session-module.ts +1 -1
  214. package/src/common/di/diagram-module.ts +20 -7
  215. package/src/common/di/glsp-module.ts +3 -1
  216. package/src/common/di/multi-binding.ts +4 -5
  217. package/src/common/di/server-module.ts +6 -21
  218. package/src/common/features/model/model-submission-handler.ts +12 -0
  219. package/src/common/features/model/request-model-action-handler.ts +16 -15
  220. package/src/common/features/progress/progress-service.ts +74 -0
  221. package/src/common/features/validation/model-validator.ts +75 -3
  222. package/src/common/features/validation/request-markers-handler.ts +4 -10
  223. package/src/common/index.ts +1 -2
  224. package/src/common/launch/glsp-server-launcher.ts +2 -2
  225. package/src/common/launch/jsonrpc-server-launcher.ts +95 -0
  226. package/src/common/protocol/glsp-server.spec.ts +7 -4
  227. package/src/common/protocol/glsp-server.ts +17 -132
  228. package/src/common/session/client-session-factory.spec.ts +1 -1
  229. package/src/common/session/client-session-factory.ts +1 -2
  230. package/src/common/session/client-session-manager.ts +1 -3
  231. package/src/common/test/mock-util.ts +5 -5
  232. package/src/common/utils/args-util.ts +1 -1
  233. package/src/{browser/di → common/utils}/console-logger.ts +19 -1
  234. package/src/common/utils/logger.ts +17 -1
  235. package/src/node/di/app-module.ts +4 -13
  236. package/src/node/launch/cli-parser.ts +2 -3
  237. package/src/node/launch/socket-server-launcher.spec.ts +6 -0
  238. package/src/node/launch/socket-server-launcher.ts +8 -30
  239. package/src/node/launch/websocket-server-launcher.ts +5 -31
  240. package/lib/browser/di/console-logger.d.ts.map +0 -1
  241. package/lib/browser/di/console-logger.js.map +0 -1
  242. package/lib/common/actions/action-dispatcher.spec.d.ts +0 -2
  243. package/lib/common/actions/action-dispatcher.spec.d.ts.map +0 -1
  244. package/lib/common/actions/action-dispatcher.spec.js +0 -264
  245. package/lib/common/actions/action-dispatcher.spec.js.map +0 -1
  246. package/lib/common/actions/action-handler-registry.spec.d.ts +0 -2
  247. package/lib/common/actions/action-handler-registry.spec.d.ts.map +0 -1
  248. package/lib/common/actions/action-handler-registry.spec.js +0 -50
  249. package/lib/common/actions/action-handler-registry.spec.js.map +0 -1
  250. package/lib/common/actions/global-action-provider.spec.d.ts +0 -2
  251. package/lib/common/actions/global-action-provider.spec.d.ts.map +0 -1
  252. package/lib/common/actions/global-action-provider.spec.js +0 -70
  253. package/lib/common/actions/global-action-provider.spec.js.map +0 -1
  254. package/lib/common/command/command-stack.spec.d.ts +0 -2
  255. package/lib/common/command/command-stack.spec.d.ts.map +0 -1
  256. package/lib/common/command/command-stack.spec.js +0 -207
  257. package/lib/common/command/command-stack.spec.js.map +0 -1
  258. package/lib/common/command/command.spec.d.ts +0 -2
  259. package/lib/common/command/command.spec.d.ts.map +0 -1
  260. package/lib/common/command/command.spec.js +0 -86
  261. package/lib/common/command/command.spec.js.map +0 -1
  262. package/lib/common/command/recording-command.spec.d.ts +0 -17
  263. package/lib/common/command/recording-command.spec.d.ts.map +0 -1
  264. package/lib/common/command/recording-command.spec.js +0 -62
  265. package/lib/common/command/recording-command.spec.js.map +0 -1
  266. package/lib/common/di/binding-target.spec.d.ts +0 -2
  267. package/lib/common/di/binding-target.spec.d.ts.map +0 -1
  268. package/lib/common/di/binding-target.spec.js +0 -121
  269. package/lib/common/di/binding-target.spec.js.map +0 -1
  270. package/lib/common/di/multi-bindings.spec.d.ts +0 -2
  271. package/lib/common/di/multi-bindings.spec.d.ts.map +0 -1
  272. package/lib/common/di/multi-bindings.spec.js +0 -137
  273. package/lib/common/di/multi-bindings.spec.js.map +0 -1
  274. package/lib/common/diagram/request-type-hints-action-handler.spec.d.ts +0 -2
  275. package/lib/common/diagram/request-type-hints-action-handler.spec.d.ts.map +0 -1
  276. package/lib/common/diagram/request-type-hints-action-handler.spec.js +0 -57
  277. package/lib/common/diagram/request-type-hints-action-handler.spec.js.map +0 -1
  278. package/lib/common/features/contextactions/context-actions-provider-registry.spec.d.ts +0 -2
  279. package/lib/common/features/contextactions/context-actions-provider-registry.spec.d.ts.map +0 -1
  280. package/lib/common/features/contextactions/context-actions-provider-registry.spec.js +0 -34
  281. package/lib/common/features/contextactions/context-actions-provider-registry.spec.js.map +0 -1
  282. package/lib/common/features/contextactions/request-context-actions-handler.spec.d.ts +0 -2
  283. package/lib/common/features/contextactions/request-context-actions-handler.spec.d.ts.map +0 -1
  284. package/lib/common/features/contextactions/request-context-actions-handler.spec.js +0 -63
  285. package/lib/common/features/contextactions/request-context-actions-handler.spec.js.map +0 -1
  286. package/lib/common/features/contextactions/tool-palette-item-provider.spec.d.ts +0 -2
  287. package/lib/common/features/contextactions/tool-palette-item-provider.spec.d.ts.map +0 -1
  288. package/lib/common/features/contextactions/tool-palette-item-provider.spec.js +0 -48
  289. package/lib/common/features/contextactions/tool-palette-item-provider.spec.js.map +0 -1
  290. package/lib/common/features/directediting/context-edit-validator-registry.spec.d.ts +0 -2
  291. package/lib/common/features/directediting/context-edit-validator-registry.spec.d.ts.map +0 -1
  292. package/lib/common/features/directediting/context-edit-validator-registry.spec.js +0 -44
  293. package/lib/common/features/directediting/context-edit-validator-registry.spec.js.map +0 -1
  294. package/lib/common/features/directediting/request-edit-validation-handler.spec.d.ts +0 -2
  295. package/lib/common/features/directediting/request-edit-validation-handler.spec.d.ts.map +0 -1
  296. package/lib/common/features/directediting/request-edit-validation-handler.spec.js +0 -97
  297. package/lib/common/features/directediting/request-edit-validation-handler.spec.js.map +0 -1
  298. package/lib/common/features/model/gmodel-serializer.spec.d.ts +0 -2
  299. package/lib/common/features/model/gmodel-serializer.spec.d.ts.map +0 -1
  300. package/lib/common/features/model/gmodel-serializer.spec.js +0 -124
  301. package/lib/common/features/model/gmodel-serializer.spec.js.map +0 -1
  302. package/lib/common/operations/operation-handler-registry.spec.d.ts +0 -2
  303. package/lib/common/operations/operation-handler-registry.spec.d.ts.map +0 -1
  304. package/lib/common/operations/operation-handler-registry.spec.js +0 -50
  305. package/lib/common/operations/operation-handler-registry.spec.js.map +0 -1
  306. package/lib/common/protocol/glsp-client-proxy.d.ts +0 -45
  307. package/lib/common/protocol/glsp-client-proxy.d.ts.map +0 -1
  308. package/lib/common/protocol/glsp-client-proxy.js.map +0 -1
  309. package/lib/common/protocol/glsp-server-listener.d.ts +0 -37
  310. package/lib/common/protocol/glsp-server-listener.d.ts.map +0 -1
  311. package/lib/common/protocol/glsp-server-listener.js +0 -5
  312. package/lib/common/protocol/glsp-server-listener.js.map +0 -1
  313. package/lib/common/protocol/glsp-server.spec.d.ts +0 -2
  314. package/lib/common/protocol/glsp-server.spec.d.ts.map +0 -1
  315. package/lib/common/protocol/glsp-server.spec.js +0 -119
  316. package/lib/common/protocol/glsp-server.spec.js.map +0 -1
  317. package/lib/common/session/client-session-factory.spec.d.ts +0 -2
  318. package/lib/common/session/client-session-factory.spec.d.ts.map +0 -1
  319. package/lib/common/session/client-session-factory.spec.js +0 -56
  320. package/lib/common/session/client-session-factory.spec.js.map +0 -1
  321. package/lib/common/session/client-session-manager.spec.d.ts +0 -2
  322. package/lib/common/session/client-session-manager.spec.d.ts.map +0 -1
  323. package/lib/common/session/client-session-manager.spec.js +0 -74
  324. package/lib/common/session/client-session-manager.spec.js.map +0 -1
  325. package/lib/common/test/mock-util.d.ts +0 -123
  326. package/lib/common/test/mock-util.d.ts.map +0 -1
  327. package/lib/common/test/mock-util.js +0 -216
  328. package/lib/common/test/mock-util.js.map +0 -1
  329. package/lib/common/utils/promise-queue.spec.d.ts +0 -2
  330. package/lib/common/utils/promise-queue.spec.d.ts.map +0 -1
  331. package/lib/common/utils/promise-queue.spec.js +0 -117
  332. package/lib/common/utils/promise-queue.spec.js.map +0 -1
  333. package/lib/common/utils/registry.spec.d.ts +0 -2
  334. package/lib/common/utils/registry.spec.d.ts.map +0 -1
  335. package/lib/common/utils/registry.spec.js +0 -199
  336. package/lib/common/utils/registry.spec.js.map +0 -1
  337. package/lib/node/launch/cli-parser.spec.d.ts +0 -2
  338. package/lib/node/launch/cli-parser.spec.d.ts.map +0 -1
  339. package/lib/node/launch/cli-parser.spec.js +0 -56
  340. package/lib/node/launch/cli-parser.spec.js.map +0 -1
  341. package/lib/node/launch/socket-cli-parser.spec.d.ts +0 -2
  342. package/lib/node/launch/socket-cli-parser.spec.d.ts.map +0 -1
  343. package/lib/node/launch/socket-cli-parser.spec.js +0 -66
  344. package/lib/node/launch/socket-cli-parser.spec.js.map +0 -1
  345. package/lib/node/launch/socket-server-launcher.spec.d.ts +0 -17
  346. package/lib/node/launch/socket-server-launcher.spec.d.ts.map +0 -1
  347. package/lib/node/launch/socket-server-launcher.spec.js +0 -70
  348. package/lib/node/launch/socket-server-launcher.spec.js.map +0 -1
  349. package/src/common/protocol/glsp-client-proxy.ts +0 -65
  350. package/src/common/protocol/glsp-server-listener.ts +0 -39
@@ -14,7 +14,8 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
  import { GModelElement } from '@eclipse-glsp/graph';
17
- import { Marker, MaybePromise } from '@eclipse-glsp/protocol';
17
+ import { Marker, MarkersReason, MaybePromise } from '@eclipse-glsp/protocol';
18
+ import { injectable } from 'inversify';
18
19
 
19
20
  export const ModelValidator = Symbol('ModelValidator');
20
21
 
@@ -28,7 +29,78 @@ export interface ModelValidator {
28
29
  * Validates the given list of {@link GModelElement}s and returns a list of {@link Marker}s.
29
30
  *
30
31
  * @param elements The list of {@link GModelElement} to validate.
31
- * @returns A list of {@link Marker}s for the validated {@link GModelElement}s.
32
+ * @param reason The reason for a validation request, such as "batch" or "live" validation.
33
+ * @return A list of {@link Marker}s for the validated {@link GModelElement}s.
32
34
  */
33
- validate(elements: GModelElement[]): MaybePromise<Marker[]>;
35
+ validate(elements: GModelElement[], reason?: string): MaybePromise<Marker[]>;
36
+ }
37
+
38
+ @injectable()
39
+ export abstract class AbstractModelValidator implements ModelValidator {
40
+ validate(elements: GModelElement[], reason: string): Marker[] {
41
+ const markers: Marker[] = [];
42
+ for (const element of elements) {
43
+ if (MarkersReason.LIVE === reason) {
44
+ markers.push(...this.doLiveValidation(element));
45
+ } else if (MarkersReason.BATCH === reason) {
46
+ markers.push(...this.doBatchValidation(element));
47
+ } else {
48
+ markers.push(...this.doValidationForCustomReason(element));
49
+ }
50
+ if (element.children) {
51
+ markers.push(...this.validate(element.children, reason));
52
+ }
53
+ }
54
+ return markers;
55
+ }
56
+
57
+ /**
58
+ * Perform the live validation rules for the given <code>element</code>.
59
+ *
60
+ * This will be invoked on start and after each operation for all elements.
61
+ * Thus, the validation should be rather inexpensive.
62
+ * There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
63
+ * this method for all children anyway.
64
+ *
65
+ * @param element The element to validate.
66
+ * @return A list of {@link Marker}s for the validated {@link GModelElement}.
67
+ */
68
+ doLiveValidation(element: GModelElement): Marker[] {
69
+ return [];
70
+ }
71
+
72
+ /**
73
+ * Perform the batch validation rules for the given <code>element</code>.
74
+ *
75
+ * <p>
76
+ * This will be invoked on demand by the client.
77
+ * Thus, the validation can include more expensive validation rules.
78
+ * There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
79
+ * this method for all children anyway.
80
+ * </p>
81
+ *
82
+ * @param element The element to validate.
83
+ * @return A list of {@link Marker}s for the validated {@link GModelElement}.
84
+ */
85
+ doBatchValidation(element: GModelElement): Marker[] {
86
+ return [];
87
+ }
88
+
89
+ /**
90
+ * Perform a validation for a custom <code>reason</code> with the given <code>element</code>.
91
+ *
92
+ * <p>
93
+ * GLSP editors may add custom reasons for triggering a validation, other than <code>live</code> and
94
+ * <code>batch</code>.
95
+ * Validation requests that are not live or batch validations will be handled by this method.
96
+ * There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
97
+ * this method for all children anyway.
98
+ * </p>
99
+ *
100
+ * @param element The element to validate.
101
+ * @return A list of {@link Marker}s for the validated {@link GModelElement}.
102
+ */
103
+ doValidationForCustomReason(element: GModelElement): Marker[] {
104
+ return [];
105
+ }
34
106
  }
@@ -13,8 +13,7 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { GGraph } from '@eclipse-glsp/graph';
17
- import { Action, Marker, RequestMarkersAction, SetMarkersAction } from '@eclipse-glsp/protocol';
16
+ import { Action, MarkersReason, RequestMarkersAction, SetMarkersAction } from '@eclipse-glsp/protocol';
18
17
  import { inject, injectable, optional } from 'inversify';
19
18
  import { ActionHandler } from '../../actions/action-handler';
20
19
  import { GLSPServerError } from '../../utils/glsp-server-error';
@@ -38,14 +37,9 @@ export class RequestMarkersHandler implements ActionHandler {
38
37
  elementIDs = [this.modelState.root.id];
39
38
  }
40
39
 
41
- let markers: Marker[] = [];
42
- const currentModelIndex = this.modelState.index;
43
- for (const elementID of elementIDs) {
44
- const modelElement = currentModelIndex.findByClass(elementID, GGraph);
45
- if (modelElement) {
46
- markers = markers.concat(await this.validator.validate([modelElement]));
47
- }
48
- }
40
+ const modelElements = this.modelState.index.getAll(elementIDs);
41
+ const markers = await this.validator.validate(modelElements, action.reason ?? MarkersReason.BATCH);
42
+
49
43
  return [SetMarkersAction.create(markers)];
50
44
  }
51
45
  }
@@ -74,9 +74,7 @@ export * from './operations/create-operation-handler';
74
74
  export * from './operations/operation-action-handler';
75
75
  export * from './operations/operation-handler';
76
76
  export * from './operations/operation-handler-registry';
77
- export * from './protocol/glsp-client-proxy';
78
77
  export * from './protocol/glsp-server';
79
- export * from './protocol/glsp-server-listener';
80
78
  export * from './session/client-session';
81
79
  export * from './session/client-session-factory';
82
80
  export * from './session/client-session-initializer';
@@ -84,6 +82,7 @@ export * from './session/client-session-listener';
84
82
  export * from './session/client-session-manager';
85
83
  export * from './utils/args-util';
86
84
  export * from './utils/client-options-util';
85
+ export * from './utils/console-logger';
87
86
  export * from './utils/glsp-server-error';
88
87
  export * from './utils/layout-util';
89
88
  export * from './utils/logger';
@@ -33,9 +33,9 @@ export abstract class GLSPServerLauncher<T> implements Disposable {
33
33
  this._modules.push(serverModule, ...additionalModules);
34
34
  }
35
35
 
36
- createContainer(): Container {
36
+ createContainer(...additionalModules: ContainerModule[]): Container {
37
37
  const container = this.parentContainer ? this.parentContainer.createChild() : new Container();
38
- container.load(...this._modules);
38
+ container.load(...this._modules, ...additionalModules);
39
39
  return container;
40
40
  }
41
41
 
@@ -0,0 +1,95 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import {
18
+ Disposable,
19
+ GLSPClientProxy,
20
+ GLSPServer,
21
+ JsonrpcClientProxy,
22
+ JsonrpcGLSPClient,
23
+ configureClientConnection
24
+ } from '@eclipse-glsp/protocol';
25
+ import { Container, ContainerModule, inject, injectable } from 'inversify';
26
+ import * as jsonrpc from 'vscode-jsonrpc';
27
+ import { Logger } from '../utils/logger';
28
+ import { GLSPServerLauncher } from './glsp-server-launcher';
29
+
30
+ export const START_UP_COMPLETE_MSG = '[GLSP-Server]:Startup completed. Accepting requests on port:';
31
+
32
+ export interface JsonRpcServerInstance {
33
+ server: GLSPServer;
34
+ clientConnection: jsonrpc.MessageConnection;
35
+ container: Container;
36
+ }
37
+
38
+ @injectable()
39
+ export abstract class JsonRpcGLSPServerLauncher<T> extends GLSPServerLauncher<T> {
40
+ @inject(Logger)
41
+ protected override logger: Logger;
42
+
43
+ protected serverInstances = new Map<jsonrpc.MessageConnection, JsonRpcServerInstance>();
44
+ protected startupCompleteMessage = START_UP_COMPLETE_MSG;
45
+
46
+ constructor() {
47
+ super();
48
+ this.toDispose.push(
49
+ Disposable.create(() => {
50
+ this.serverInstances.forEach(instance => this.disposeServerInstance(instance));
51
+ })
52
+ );
53
+ }
54
+
55
+ protected disposeServerInstance(instance: JsonRpcServerInstance): void {
56
+ this.serverInstances.delete(instance.clientConnection);
57
+ instance.server.shutdown();
58
+ instance.container.unbindAll();
59
+ instance.clientConnection.dispose();
60
+ }
61
+
62
+ protected createServerInstance(clientConnection: jsonrpc.MessageConnection): void {
63
+ const container = this.createContainer(this.createJsonRpcModule(clientConnection));
64
+ const server = container.get<GLSPServer>(GLSPServer);
65
+ const instance = { container, clientConnection, server };
66
+ this.serverInstances.set(clientConnection, instance);
67
+ this.configureClientConnection(instance);
68
+ }
69
+
70
+ protected createJsonRpcModule(clientConnection: jsonrpc.MessageConnection): ContainerModule {
71
+ return new ContainerModule(bind => {
72
+ bind(GLSPClientProxy).toDynamicValue(ctx => {
73
+ const proxy = ctx.container.resolve(JsonrpcClientProxy);
74
+ proxy.initialize(clientConnection);
75
+ return proxy;
76
+ });
77
+ });
78
+ }
79
+
80
+ protected configureClientConnection(serverInstance: JsonRpcServerInstance): void {
81
+ configureClientConnection(serverInstance.clientConnection, serverInstance.server);
82
+
83
+ serverInstance.clientConnection.onNotification(JsonrpcGLSPClient.ShutdownNotification, () =>
84
+ this.disposeServerInstance(serverInstance)
85
+ );
86
+
87
+ this.logger.info('Starting GLSP server connection');
88
+ }
89
+
90
+ protected createClientProxy(serverInstance: JsonRpcServerInstance): GLSPClientProxy {
91
+ const proxy = serverInstance.container.resolve(JsonrpcClientProxy);
92
+ proxy.initialize(serverInstance.clientConnection);
93
+ return proxy;
94
+ }
95
+ }
@@ -13,7 +13,13 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { DisposeClientSessionParameters, InitializeClientSessionParameters, InitializeParameters } from '@eclipse-glsp/protocol';
16
+ import {
17
+ DisposeClientSessionParameters,
18
+ GLSPClientProxy,
19
+ GLSPServerListener,
20
+ InitializeClientSessionParameters,
21
+ InitializeParameters
22
+ } from '@eclipse-glsp/protocol';
17
23
  import { expect } from 'chai';
18
24
  import { Container, ContainerModule } from 'inversify';
19
25
  import * as sinon from 'sinon';
@@ -21,9 +27,7 @@ import { GlobalActionProvider } from '../actions/global-action-provider';
21
27
  import { ClientSessionManager } from '../session/client-session-manager';
22
28
  import * as mock from '../test/mock-util';
23
29
  import { Logger } from '../utils/logger';
24
- import { GLSPClientProxy, JsonRpcGLSPClientProxy } from './glsp-client-proxy';
25
30
  import { DefaultGLSPServer } from './glsp-server';
26
- import { GLSPServerListener } from './glsp-server-listener';
27
31
  import assert = require('assert');
28
32
 
29
33
  describe('test DefaultGLSPServer', () => {
@@ -48,7 +52,6 @@ describe('test DefaultGLSPServer', () => {
48
52
  new ContainerModule(bind => {
49
53
  bind(Logger).toConstantValue(new mock.StubLogger());
50
54
  bind(GLSPClientProxy).toConstantValue(new mock.StubGLSPClientProxy());
51
- bind(JsonRpcGLSPClientProxy).toConstantValue(new mock.StubGLSPClientProxy());
52
55
  bind(ClientSessionManager).toConstantValue(sessionManager);
53
56
  bind(GlobalActionProvider).toConstantValue({ clientActionKinds: new Map<string, string[]>(), serverActionKinds });
54
57
  bind(GLSPServerListener).toConstantValue(listener1);
@@ -18,134 +18,26 @@ import {
18
18
  Args,
19
19
  DisposeClientSessionParameters,
20
20
  distinctAdd,
21
+ GLSPClientProxy,
22
+ GLSPServer,
23
+ GLSPServerListener,
21
24
  InitializeClientSessionParameters,
22
25
  InitializeParameters,
23
26
  InitializeResult,
24
- JsonrpcGLSPClient,
25
27
  MaybePromise,
26
28
  remove,
27
29
  ServerActions,
28
30
  ServerMessageAction
29
31
  } from '@eclipse-glsp/protocol';
30
32
  import { inject, injectable, multiInject, optional } from 'inversify';
31
- import * as jsonrpc from 'vscode-jsonrpc';
32
- import { MessageConnection } from 'vscode-jsonrpc';
33
33
  import { GlobalActionProvider } from '../actions/global-action-provider';
34
34
  import { ClientSession } from '../session/client-session';
35
35
  import { ClientSessionManager } from '../session/client-session-manager';
36
36
  import { GLSPServerError } from '../utils/glsp-server-error';
37
37
  import { Logger } from '../utils/logger';
38
- import { JsonRpcGLSPClientProxy } from './glsp-client-proxy';
39
- import { GLSPServerListener } from './glsp-server-listener';
40
-
41
- export const GLSPServer = Symbol('GLSPServer');
42
-
43
- /**
44
- * Interface for implementations of a server component using json-rpc for client-server communication.
45
- * Based on the specification of the Graphical Language Server Protocol:
46
- * https://github.com/eclipse-glsp/glsp/blob/master/PROTOCOL.md
47
- */
48
- export interface GLSPServer {
49
- /**
50
- *
51
- * The `initialize` request has to be the first request from the client to the server. Until the server has responded
52
- * with an {@link InitializeResult} no other request or notification can be handled and is expected to throw an
53
- * error. A client is uniquely identified by an `applicationId` and has to specify on which `protocolVersion` it is
54
- * based on. In addition, custom arguments can be provided in the `args` map to allow for custom initialization
55
- * behavior on the server.
56
- *
57
- * After successfully initialization all {@link GLSPServerListener}s are notified via the
58
- * {@link GLSPServerListener.serverInitialized} method.
59
- *
60
- * @param params the {@link InitializeParameters}.
61
- * @returns A promise of the {@link InitializeResult} .
62
- *
63
- * @throws {@link Error} Subsequent initialize requests return the {@link InitializeResult} of the initial request
64
- * if the given application id and protocol version are matching, otherwise the promise rejects with an error.
65
- *
66
- */
67
- initialize(params: InitializeParameters): Promise<InitializeResult>;
68
-
69
- /**
70
- * The `initializeClientSession` request is sent to the server whenever a new graphical representation (diagram) is
71
- * created. Each individual diagram on the client side counts as one session and has to provide a unique
72
- * `clientSessionId` and its `diagramType`. In addition, custom arguments can be provided in the `args` map to allow
73
- * for custom initialization behavior on the server. Subsequent `initializeClientSession` requests for the same
74
- * client id and diagram type are expected to resolve successfully but don't have an actual effect because the
75
- * corresponding client session is already initialized.
76
- *
77
- * @param params the {@link InitializeClientSessionParameters}.
78
- * @returns A promise that completes when the initialization was successful.
79
- */
80
- initializeClientSession(params: InitializeClientSessionParameters): Promise<void>;
81
-
82
- /**
83
- * The 'DisposeClientSession' request is sent to the server when a graphical representation (diagram) is no longer
84
- * needed, e.g. the tab containing the diagram widget has been closed. The session is identified by its unique
85
- * `clientSessionId`. In addition, custom arguments can be provided in the `args` map to allow for custom dispose
86
- * behavior on the server.
87
- *
88
- * @param params the {@link DisposeClientSessionParameters}.
89
- * @returns A `void` promise that completes if the disposal was successful.
90
- *
91
- */
92
- disposeClientSession(params: DisposeClientSessionParameters): Promise<void>;
93
-
94
- /**
95
- * A `process` notification is sent from the client to server when the server should handle i.e. process a specific
96
- * {@link ActionMessage}. Any communication that is performed between initialization and shutdown is handled by
97
- * sending action messages, either from the client to the server or from the server to the client. This is the core
98
- * part of the Graphical Language Server Protocol.
99
- *
100
- * @param message The {@link ActionMessage} that should be processed.
101
- */
102
- process(message: ActionMessage): void;
103
-
104
- /**
105
- * The `shutdown` notification is sent from the client to the server if the client disconnects from the server (e.g.
106
- * the client application has been closed).
107
- * This gives the server a chance to clean up and dispose any resources dedicated to the client and its sessions.
108
- * All {@link GLSPServerListener}s are notified via the {@link GLSPServerListener.serverShutDown} method.
109
- * Afterwards the server instance is considered to be disposed and can no longer be used for handling requests.
110
- *
111
- */
112
- shutdown(): void;
113
-
114
- /**
115
- * Register a new {@link GLSPServerListener}.
116
- *
117
- * @param listener The listener that should be registered.
118
- * @returns `true` if the listener was registered successfully, `false` otherwise (e.g. listener is already
119
- * registered).
120
- */
121
- addListener(listener: GLSPServerListener): boolean;
122
-
123
- /**
124
- * Unregister a {@link GLSPServerListener}.
125
- *
126
- * @param listener The listener that should be removed
127
- * @returns 'true' if the listener was unregistered successfully, `false` otherwise (e.g. listener is was not
128
- * registered in the first place).
129
- */
130
- removeListener(listener: GLSPServerListener): boolean;
131
-
132
- /**
133
- * get a {@link ClientSession}.
134
- *
135
- * @param sessionId The id of the session to get
136
- * @returns The either the ClientSession or undefined, if no ClientSession was found for the given id.
137
- */
138
- getClientSession(sessionId: string): ClientSession | undefined;
139
- }
140
-
141
- export const JsonRpcGLSPServer = Symbol('JsonRpcGLSPServer');
142
-
143
- export interface JsonRpcGLSPServer extends GLSPServer {
144
- connect(connection: jsonrpc.MessageConnection): void;
145
- }
146
38
 
147
39
  @injectable()
148
- export class DefaultGLSPServer implements JsonRpcGLSPServer {
40
+ export class DefaultGLSPServer implements GLSPServer {
149
41
  public static readonly PROTOCOL_VERSION = '1.0.0';
150
42
 
151
43
  @inject(Logger)
@@ -157,8 +49,9 @@ export class DefaultGLSPServer implements JsonRpcGLSPServer {
157
49
  @inject(GlobalActionProvider)
158
50
  protected actionProvider: GlobalActionProvider;
159
51
 
160
- @inject(JsonRpcGLSPClientProxy)
161
- protected glspClient: JsonRpcGLSPClientProxy;
52
+ @inject(GLSPClientProxy)
53
+ @optional()
54
+ protected glspClientProxy?: GLSPClientProxy;
162
55
 
163
56
  protected initializeResult?: InitializeResult;
164
57
 
@@ -172,18 +65,6 @@ export class DefaultGLSPServer implements JsonRpcGLSPServer {
172
65
  serverListeners.forEach(listener => this.addListener(listener));
173
66
  }
174
67
 
175
- protected setupJsonRpc(connection: MessageConnection): void {
176
- connection.onRequest(JsonrpcGLSPClient.InitializeRequest.method, (params: InitializeParameters) => this.initialize(params));
177
- connection.onRequest(JsonrpcGLSPClient.InitializeClientSessionRequest, (params: InitializeClientSessionParameters) =>
178
- this.initializeClientSession(params)
179
- );
180
- connection.onRequest(JsonrpcGLSPClient.DisposeClientSessionRequest, (params: DisposeClientSessionParameters) =>
181
- this.disposeClientSession(params)
182
- );
183
- connection.onNotification(JsonrpcGLSPClient.ActionMessageNotification, message => this.process(message));
184
- connection.onNotification(JsonrpcGLSPClient.ShutdownNotification, () => this.shutdown());
185
- }
186
-
187
68
  protected validateProtocolVersion(params: InitializeParameters): void {
188
69
  if (params.protocolVersion !== DefaultGLSPServer.PROTOCOL_VERSION) {
189
70
  throw new Error(
@@ -237,6 +118,7 @@ export class DefaultGLSPServer implements JsonRpcGLSPServer {
237
118
  this.validateServerInitialized();
238
119
 
239
120
  const session = this.sessionManager.getOrCreateClientSession(params);
121
+
240
122
  this.clientSessions.set(params.clientSessionId, session);
241
123
  return this.handleInitializeClientSessionArgs(params.args);
242
124
  }
@@ -281,7 +163,15 @@ export class DefaultGLSPServer implements JsonRpcGLSPServer {
281
163
  errorMsg = reason.message;
282
164
  }
283
165
  const errorAction = ServerMessageAction.create(errorMsg, { severity: 'ERROR', details });
284
- this.glspClient.process({ clientId: message.clientId, action: errorAction });
166
+ this.sendToClient({ clientId: message.clientId, action: errorAction });
167
+ }
168
+
169
+ protected sendToClient(message: ActionMessage): void {
170
+ if (this.glspClientProxy) {
171
+ this.glspClientProxy.process(message);
172
+ return;
173
+ }
174
+ throw new Error("Could not send message to client. No 'GLSPClientProxy' is connected");
285
175
  }
286
176
 
287
177
  getClientSession(sessionId: string): ClientSession | undefined {
@@ -295,11 +185,6 @@ export class DefaultGLSPServer implements JsonRpcGLSPServer {
295
185
  this.initializeResult = undefined;
296
186
  }
297
187
 
298
- public connect(connection: jsonrpc.MessageConnection): void {
299
- this.setupJsonRpc(connection);
300
- this.glspClient.connect(connection);
301
- }
302
-
303
188
  protected isInitialized(): boolean {
304
189
  return this.initializeResult !== undefined;
305
190
  }
@@ -13,11 +13,11 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
+ import { GLSPClientProxy } from '@eclipse-glsp/protocol';
16
17
  import { expect } from 'chai';
17
18
  import { Container, ContainerModule } from 'inversify';
18
19
  import { ActionDispatcher } from '../actions/action-dispatcher';
19
20
  import { DiagramModules, InjectionContainer } from '../di/service-identifiers';
20
- import { GLSPClientProxy } from '../protocol/glsp-client-proxy';
21
21
  import * as mock from '../test/mock-util';
22
22
  import { GLSPServerError } from '../utils/glsp-server-error';
23
23
  import { Logger } from '../utils/logger';
@@ -13,12 +13,11 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { InitializeClientSessionParameters } from '@eclipse-glsp/protocol';
16
+ import { GLSPClientProxy, InitializeClientSessionParameters } from '@eclipse-glsp/protocol';
17
17
  import { Container, ContainerModule, inject, injectable } from 'inversify';
18
18
  import { ActionDispatcher } from '../actions/action-dispatcher';
19
19
  import { createClientSessionModule } from '../di/client-session-module';
20
20
  import { DiagramModules, InjectionContainer } from '../di/service-identifiers';
21
- import { GLSPClientProxy } from '../protocol/glsp-client-proxy';
22
21
  import { GLSPServerError } from '../utils/glsp-server-error';
23
22
  import { ClientSession, DefaultClientSession } from './client-session';
24
23
  import { ClientSessionInitializer } from './client-session-initializer';
@@ -13,10 +13,8 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { InitializeClientSessionParameters, remove } from '@eclipse-glsp/protocol';
16
+ import { GLSPServer, GLSPServerListener, InitializeClientSessionParameters, remove } from '@eclipse-glsp/protocol';
17
17
  import { inject, injectable } from 'inversify';
18
- import { GLSPServer } from '../protocol/glsp-server';
19
- import { GLSPServerListener } from '../protocol/glsp-server-listener';
20
18
  import { GLSPServerError } from '../utils/glsp-server-error';
21
19
  import { ClientSession } from './client-session';
22
20
  import { ClientSessionFactory } from './client-session-factory';
@@ -23,6 +23,9 @@ import {
23
23
  Args,
24
24
  CreateNodeOperation,
25
25
  EdgeTypeHint,
26
+ GLSPClientProxy,
27
+ GLSPServer,
28
+ GLSPServerListener,
26
29
  InitializeClientSessionParameters,
27
30
  MaybeArray,
28
31
  MaybePromise,
@@ -41,15 +44,12 @@ import { DiagramConfiguration, ServerLayoutKind } from '../diagram/diagram-confi
41
44
  import { ContextEditValidator } from '../features/directediting/context-edit-validator';
42
45
  import { LabelEditValidator } from '../features/directediting/label-edit-validator';
43
46
  import { GModelCreateEdgeOperationHandler, GModelCreateNodeOperationHandler } from '../gmodel/index';
44
- import { JsonRpcGLSPClientProxy } from '../protocol/glsp-client-proxy';
45
- import { GLSPServer } from '../protocol/glsp-server';
46
- import { GLSPServerListener } from '../protocol/glsp-server-listener';
47
47
  import { ClientSession } from '../session/client-session';
48
48
  import { ClientSessionFactory } from '../session/client-session-factory';
49
49
  import { ClientSessionInitializer } from '../session/client-session-initializer';
50
50
  import { ClientSessionListener } from '../session/client-session-listener';
51
51
  import { ClientSessionManager } from '../session/client-session-manager';
52
- import { Logger, LogLevel } from '../utils/logger';
52
+ import { LogLevel, Logger } from '../utils/logger';
53
53
 
54
54
  export async function delay(ms: number): Promise<void> {
55
55
  return new Promise(resolve => setTimeout(resolve, ms));
@@ -194,7 +194,7 @@ export class StubClientSessionListener implements ClientSessionListener {
194
194
  sessionDisposed(clientSession: ClientSession): void {}
195
195
  }
196
196
 
197
- export class StubGLSPClientProxy implements JsonRpcGLSPClientProxy {
197
+ export class StubGLSPClientProxy implements GLSPClientProxy {
198
198
  connect(connection: MessageConnection): void {}
199
199
 
200
200
  process(message: ActionMessage<Action>): void {}
@@ -48,7 +48,7 @@ export namespace ArgsUtil {
48
48
  }
49
49
 
50
50
  return {
51
- [KEY_RADIUS_TOP_RIGHT]: topLeft,
51
+ [KEY_RADIUS_TOP_LEFT]: topLeft,
52
52
  [KEY_RADIUS_BOTTOM_LEFT]: bottomLeft,
53
53
  [KEY_RADIUS_BOTTOM_RIGHT]: bottomRight,
54
54
  [KEY_RADIUS_TOP_RIGHT]: topRight
@@ -14,9 +14,14 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
+ import { BindingContext } from '@eclipse-glsp/protocol';
17
18
  import { injectable } from 'inversify';
18
- import { Logger, LogLevel } from '../../common/index';
19
+ import { LogLevel, Logger, LoggerConfigOptions, LoggerFactory, NullLogger, getRequestParentName } from './logger';
19
20
 
21
+ /**
22
+ * Simple logger implementation that forwards logging calls to the `console` and
23
+ * can be used in both the browser and node context.
24
+ */
20
25
  @injectable()
21
26
  export class ConsoleLogger extends Logger {
22
27
  constructor(public logLevel: LogLevel = LogLevel.none, public caller?: string) {
@@ -69,3 +74,16 @@ export class ConsoleLogger extends Logger {
69
74
  return JSON.stringify(param, undefined, 4);
70
75
  }
71
76
  }
77
+
78
+ export function configureConsoleLogger<T extends LoggerConfigOptions>(context: BindingContext, options: T): void {
79
+ if (!options.consoleLog) {
80
+ context.bind(Logger).to(NullLogger).inSingletonScope();
81
+ } else {
82
+ context.bind(Logger).toDynamicValue(ctx => new ConsoleLogger(options.logLevel, getRequestParentName(ctx)));
83
+ }
84
+ context.bind(LoggerFactory).toFactory(dynamicContext => (caller: string) => {
85
+ const logger = dynamicContext.container.get(Logger);
86
+ logger.caller = caller;
87
+ return logger;
88
+ });
89
+ }
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { injectable } from 'inversify';
16
+ import { injectable, interfaces } from 'inversify';
17
17
 
18
18
  @injectable()
19
19
  export abstract class Logger {
@@ -70,3 +70,19 @@ export function asLogLevel(level: string | number): LogLevel | undefined {
70
70
  }
71
71
  return undefined;
72
72
  }
73
+
74
+ export interface LoggerConfigOptions {
75
+ consoleLog?: boolean;
76
+ logLevel?: LogLevel;
77
+ }
78
+
79
+ export function getRequestParentName(context: interfaces.Context): string | undefined {
80
+ if (context.currentRequest.parentRequest) {
81
+ const bindings = context.currentRequest.parentRequest.bindings;
82
+ if (bindings.length > 0) {
83
+ const binding = bindings[0] as interfaces.Binding<{ name?: string }>;
84
+ return binding.implementationType?.name;
85
+ }
86
+ }
87
+ return undefined;
88
+ }