@eclipse-glsp/server 1.1.0-next.44bd1e0.43 → 1.1.0-next.d07c15f.51

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 (174) 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 +22 -6
  18. package/lib/common/command/command-stack.d.ts.map +1 -1
  19. package/lib/common/command/command-stack.js +6 -21
  20. package/lib/common/command/command-stack.js.map +1 -1
  21. package/lib/common/command/command-stack.spec.js +31 -31
  22. package/lib/common/command/command-stack.spec.js.map +1 -1
  23. package/lib/common/command/command.d.ts +7 -6
  24. package/lib/common/command/command.d.ts.map +1 -1
  25. package/lib/common/command/command.js +19 -15
  26. package/lib/common/command/command.js.map +1 -1
  27. package/lib/common/command/command.spec.js +8 -8
  28. package/lib/common/command/command.spec.js.map +1 -1
  29. package/lib/common/command/recording-command.d.ts +15 -15
  30. package/lib/common/command/recording-command.d.ts.map +1 -1
  31. package/lib/common/command/recording-command.js +10 -10
  32. package/lib/common/command/recording-command.js.map +1 -1
  33. package/lib/common/command/recording-command.spec.js +8 -8
  34. package/lib/common/command/recording-command.spec.js.map +1 -1
  35. package/lib/common/command/undo-redo-action-handler.d.ts +2 -2
  36. package/lib/common/command/undo-redo-action-handler.d.ts.map +1 -1
  37. package/lib/common/command/undo-redo-action-handler.js +4 -4
  38. package/lib/common/command/undo-redo-action-handler.js.map +1 -1
  39. package/lib/common/di/client-session-module.d.ts +1 -1
  40. package/lib/common/di/client-session-module.d.ts.map +1 -1
  41. package/lib/common/di/client-session-module.js +2 -2
  42. package/lib/common/di/client-session-module.js.map +1 -1
  43. package/lib/common/di/glsp-module.d.ts +3 -1
  44. package/lib/common/di/glsp-module.d.ts.map +1 -1
  45. package/lib/common/di/glsp-module.js +0 -15
  46. package/lib/common/di/glsp-module.js.map +1 -1
  47. package/lib/common/di/multi-binding.d.ts +19 -4
  48. package/lib/common/di/multi-binding.d.ts.map +1 -1
  49. package/lib/common/di/multi-binding.js.map +1 -1
  50. package/lib/common/di/server-module.d.ts +1 -6
  51. package/lib/common/di/server-module.d.ts.map +1 -1
  52. package/lib/common/di/server-module.js +21 -17
  53. package/lib/common/di/server-module.js.map +1 -1
  54. package/lib/common/features/layout/computed-bounds-action-handler.js +1 -1
  55. package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -1
  56. package/lib/common/index.d.ts +4 -3
  57. package/lib/common/index.d.ts.map +1 -1
  58. package/lib/common/index.js +4 -3
  59. package/lib/common/index.js.map +1 -1
  60. package/lib/common/launch/glsp-server-launcher.d.ts +8 -7
  61. package/lib/common/launch/glsp-server-launcher.d.ts.map +1 -1
  62. package/lib/common/launch/glsp-server-launcher.js +27 -4
  63. package/lib/common/launch/glsp-server-launcher.js.map +1 -1
  64. package/lib/common/launch/jsonrpc-server-launcher.d.ts +38 -0
  65. package/lib/common/launch/jsonrpc-server-launcher.d.ts.map +1 -0
  66. package/lib/common/launch/jsonrpc-server-launcher.js +84 -0
  67. package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -0
  68. package/lib/common/operations/operation-action-handler.d.ts +1 -1
  69. package/lib/common/operations/operation-action-handler.d.ts.map +1 -1
  70. package/lib/common/operations/operation-action-handler.js +3 -3
  71. package/lib/common/operations/operation-action-handler.js.map +1 -1
  72. package/lib/common/protocol/glsp-server.d.ts +4 -104
  73. package/lib/common/protocol/glsp-server.d.ts.map +1 -1
  74. package/lib/common/protocol/glsp-server.js +13 -20
  75. package/lib/common/protocol/glsp-server.js.map +1 -1
  76. package/lib/common/protocol/glsp-server.spec.js +18 -5
  77. package/lib/common/protocol/glsp-server.spec.js.map +1 -1
  78. package/lib/common/session/client-session-factory.d.ts +1 -2
  79. package/lib/common/session/client-session-factory.d.ts.map +1 -1
  80. package/lib/common/session/client-session-factory.js +17 -2
  81. package/lib/common/session/client-session-factory.js.map +1 -1
  82. package/lib/common/session/client-session-factory.spec.js +2 -2
  83. package/lib/common/session/client-session-factory.spec.js.map +1 -1
  84. package/lib/common/session/client-session-manager.d.ts +1 -3
  85. package/lib/common/session/client-session-manager.d.ts.map +1 -1
  86. package/lib/common/session/client-session-manager.js.map +1 -1
  87. package/lib/common/test/mock-util.d.ts +9 -6
  88. package/lib/common/test/mock-util.d.ts.map +1 -1
  89. package/lib/common/test/mock-util.js +23 -1
  90. package/lib/common/test/mock-util.js.map +1 -1
  91. package/lib/{browser/di → common/utils}/console-logger.d.ts +7 -1
  92. package/lib/common/utils/console-logger.d.ts.map +1 -0
  93. package/lib/{browser/di → common/utils}/console-logger.js +26 -8
  94. package/lib/common/utils/console-logger.js.map +1 -0
  95. package/lib/common/utils/layout-util.d.ts +1 -1
  96. package/lib/common/utils/layout-util.d.ts.map +1 -1
  97. package/lib/common/utils/layout-util.js +3 -3
  98. package/lib/common/utils/layout-util.js.map +1 -1
  99. package/lib/common/utils/logger.d.ts +21 -0
  100. package/lib/common/utils/logger.d.ts.map +1 -1
  101. package/lib/common/utils/logger.js +12 -1
  102. package/lib/common/utils/logger.js.map +1 -1
  103. package/lib/node/di/app-module.d.ts +2 -2
  104. package/lib/node/di/app-module.d.ts.map +1 -1
  105. package/lib/node/di/app-module.js +10 -35
  106. package/lib/node/di/app-module.js.map +1 -1
  107. package/lib/node/index.d.ts +1 -0
  108. package/lib/node/index.d.ts.map +1 -1
  109. package/lib/node/index.js +1 -0
  110. package/lib/node/index.js.map +1 -1
  111. package/lib/node/launch/cli-parser.d.ts +2 -3
  112. package/lib/node/launch/cli-parser.d.ts.map +1 -1
  113. package/lib/node/launch/cli-parser.js.map +1 -1
  114. package/lib/node/launch/socket-cli-parser.js +1 -1
  115. package/lib/node/launch/socket-cli-parser.js.map +1 -1
  116. package/lib/node/launch/socket-server-launcher.d.ts +4 -24
  117. package/lib/node/launch/socket-server-launcher.d.ts.map +1 -1
  118. package/lib/node/launch/socket-server-launcher.js +15 -34
  119. package/lib/node/launch/socket-server-launcher.js.map +1 -1
  120. package/lib/node/launch/socket-server-launcher.spec.js +5 -0
  121. package/lib/node/launch/socket-server-launcher.spec.js.map +1 -1
  122. package/lib/node/launch/websocket-server-launcher.d.ts +53 -0
  123. package/lib/node/launch/websocket-server-launcher.d.ts.map +1 -0
  124. package/lib/node/launch/websocket-server-launcher.js +121 -0
  125. package/lib/node/launch/websocket-server-launcher.js.map +1 -0
  126. package/package.json +7 -5
  127. package/src/browser/di/app-module.ts +4 -32
  128. package/src/browser/index.ts +0 -1
  129. package/src/browser/launch/worker-server-launcher.ts +20 -22
  130. package/src/common/actions/client-action-handler.ts +1 -2
  131. package/src/common/command/command-stack.spec.ts +32 -32
  132. package/src/common/command/command-stack.ts +10 -9
  133. package/src/common/command/command.spec.ts +9 -10
  134. package/src/common/command/command.ts +23 -19
  135. package/src/common/command/recording-command.spec.ts +8 -8
  136. package/src/common/command/recording-command.ts +19 -19
  137. package/src/common/command/undo-redo-action-handler.ts +4 -4
  138. package/src/common/di/client-session-module.ts +1 -1
  139. package/src/common/di/glsp-module.ts +3 -1
  140. package/src/common/di/multi-binding.ts +4 -5
  141. package/src/common/di/server-module.ts +6 -21
  142. package/src/common/features/layout/computed-bounds-action-handler.ts +2 -2
  143. package/src/common/index.ts +4 -3
  144. package/src/common/launch/glsp-server-launcher.ts +15 -9
  145. package/src/common/launch/jsonrpc-server-launcher.ts +95 -0
  146. package/src/common/operations/operation-action-handler.ts +3 -3
  147. package/src/common/protocol/glsp-server.spec.ts +7 -4
  148. package/src/common/protocol/glsp-server.ts +17 -132
  149. package/src/common/session/client-session-factory.spec.ts +1 -1
  150. package/src/common/session/client-session-factory.ts +1 -2
  151. package/src/common/session/client-session-manager.ts +1 -3
  152. package/src/common/test/mock-util.ts +26 -5
  153. package/src/{browser/di → common/utils}/console-logger.ts +19 -1
  154. package/src/common/utils/layout-util.ts +1 -1
  155. package/src/common/utils/logger.ts +16 -1
  156. package/src/node/di/app-module.ts +4 -13
  157. package/src/node/index.ts +1 -0
  158. package/src/node/launch/cli-parser.ts +2 -3
  159. package/src/node/launch/socket-cli-parser.ts +1 -1
  160. package/src/node/launch/socket-server-launcher.spec.ts +6 -0
  161. package/src/node/launch/socket-server-launcher.ts +19 -35
  162. package/src/node/launch/websocket-server-launcher.ts +138 -0
  163. package/lib/browser/di/console-logger.d.ts.map +0 -1
  164. package/lib/browser/di/console-logger.js.map +0 -1
  165. package/lib/common/protocol/glsp-client-proxy.d.ts +0 -45
  166. package/lib/common/protocol/glsp-client-proxy.d.ts.map +0 -1
  167. package/lib/common/protocol/glsp-client-proxy.js +0 -53
  168. package/lib/common/protocol/glsp-client-proxy.js.map +0 -1
  169. package/lib/common/protocol/glsp-server-listener.d.ts +0 -37
  170. package/lib/common/protocol/glsp-server-listener.d.ts.map +0 -1
  171. package/lib/common/protocol/glsp-server-listener.js +0 -5
  172. package/lib/common/protocol/glsp-server-listener.js.map +0 -1
  173. package/src/common/protocol/glsp-client-proxy.ts +0 -65
  174. package/src/common/protocol/glsp-server-listener.ts +0 -39
@@ -15,7 +15,7 @@
15
15
  ********************************************************************************/
16
16
  import { expect } from 'chai';
17
17
  import * as sinon from 'sinon';
18
- import { StubCommand } from '../test/mock-util';
18
+ import { expectToThrowAsync, StubCommand } from '../test/mock-util';
19
19
  import { CompoundCommand } from './command';
20
20
 
21
21
  describe('CompoundCommand', () => {
@@ -32,18 +32,18 @@ describe('CompoundCommand', () => {
32
32
  });
33
33
 
34
34
  describe('execute', () => {
35
- it('Should execute the subcommands in order', () => {
36
- compoundCommand.execute();
35
+ it('Should execute the subcommands in order', async () => {
36
+ await compoundCommand.execute();
37
37
  expect(command1.execute.calledOnce).to.be.true;
38
38
  expect(command2.execute.calledOnce).to.be.true;
39
39
  expect(command3.execute.calledOnce).to.be.true;
40
40
  expect(command1.execute.calledBefore(command2.execute)).to.be.true;
41
41
  expect(command2.execute.calledBefore(command3.execute)).to.be.true;
42
42
  });
43
- it('Should undo partially executed subcommands in case of an error', () => {
43
+ it('Should undo partially executed subcommands in case of an error', async () => {
44
44
  command3.execute.throwsException();
45
45
 
46
- expect(() => compoundCommand.execute()).to.throw();
46
+ await expectToThrowAsync(() => compoundCommand.execute());
47
47
 
48
48
  expect(command1.execute.calledOnce).to.be.true;
49
49
  expect(command2.execute.calledOnce).to.be.true;
@@ -54,8 +54,8 @@ describe('CompoundCommand', () => {
54
54
  });
55
55
 
56
56
  describe('undo', () => {
57
- it('Should undo the subcommands in reverse order', () => {
58
- compoundCommand.undo();
57
+ it('Should undo the subcommands in reverse order', async () => {
58
+ await compoundCommand.undo();
59
59
  expect(command1.undo.calledOnce).to.be.true;
60
60
  expect(command2.undo.calledOnce).to.be.true;
61
61
  expect(command3.undo.calledOnce).to.be.true;
@@ -63,10 +63,9 @@ describe('CompoundCommand', () => {
63
63
  expect(command2.undo.calledAfter(command3.undo)).to.be.true;
64
64
  });
65
65
 
66
- it('Should redo partially undone subcommands in case of an error', () => {
66
+ it('Should redo partially undone subcommands in case of an error', async () => {
67
67
  command1.undo.throwsException();
68
-
69
- expect(() => compoundCommand.undo()).to.throw();
68
+ await expectToThrowAsync(() => compoundCommand.undo());
70
69
 
71
70
  expect(command1.undo.calledOnce).to.be.true;
72
71
  expect(command2.undo.calledOnce).to.be.true;
@@ -14,7 +14,7 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
- import { flatPush, MaybeArray } from '@eclipse-glsp/protocol';
17
+ import { flatPush, MaybeArray, MaybePromise } from '@eclipse-glsp/protocol';
18
18
 
19
19
  /**
20
20
  * A command implements a specific modification of the source model, which can be applied by invoking `execute()`.
@@ -30,19 +30,19 @@ export interface Command {
30
30
  /**
31
31
  * Performs the command activity required for the effect (e.g. source model change).
32
32
  */
33
- execute(): void;
33
+ execute(): MaybePromise<void>;
34
34
 
35
35
  /**
36
36
  * Performs the command activity required to `undo` the effects of a preceding `execute` (or `redo`).
37
37
  * The effect, if any, of calling `undo` before `execute` or `redo` have been called, is undefined.
38
38
  */
39
- undo(): void;
39
+ undo(): MaybePromise<void>;
40
40
 
41
41
  /**
42
42
  * Performs the command activity required to `redo` the effect after undoing the effect.
43
43
  * The effect, if any, of calling `redo` before `undo` is called is undefined.
44
44
  */
45
- redo(): void;
45
+ redo(): MaybePromise<void>;
46
46
 
47
47
  /**
48
48
  * Returns whether the command can be undone.
@@ -71,18 +71,18 @@ export class CompoundCommand implements Command {
71
71
  flatPush(this.commands, commands);
72
72
  }
73
73
 
74
- execute(): void {
74
+ async execute(): Promise<void> {
75
75
  const alreadyExecuted: Command[] = [];
76
76
 
77
77
  try {
78
- this.commands.forEach(command => {
79
- command.execute();
78
+ for (const command of this.commands) {
79
+ await command.execute();
80
80
  alreadyExecuted.unshift(command);
81
- });
81
+ }
82
82
  } catch (err) {
83
83
  for (const command of alreadyExecuted) {
84
84
  if (Command.canUndo(command)) {
85
- command.undo();
85
+ await command.undo();
86
86
  } else {
87
87
  break;
88
88
  }
@@ -91,29 +91,33 @@ export class CompoundCommand implements Command {
91
91
  }
92
92
  }
93
93
 
94
- undo(): void {
94
+ async undo(): Promise<void> {
95
95
  const alreadyUndone: Command[] = [];
96
96
  try {
97
- [...this.commands].reverse().forEach(command => {
98
- command.undo();
97
+ for (const command of [...this.commands].reverse()) {
98
+ await command.undo();
99
99
  alreadyUndone.unshift(command);
100
- });
100
+ }
101
101
  } catch (err) {
102
- alreadyUndone.forEach(command => command.redo());
102
+ for (const command of alreadyUndone) {
103
+ await command.redo();
104
+ }
103
105
  throw err;
104
106
  }
105
107
  }
106
108
 
107
- redo(): void {
109
+ async redo(): Promise<void> {
108
110
  const alreadyRedone: Command[] = [];
109
111
 
110
112
  try {
111
- this.commands.forEach(command => {
112
- command.redo();
113
+ for (const command of this.commands) {
114
+ await command.redo();
113
115
  alreadyRedone.unshift(command);
114
- });
116
+ }
115
117
  } catch (err) {
116
- alreadyRedone.forEach(command => command.undo());
118
+ for (const command of alreadyRedone) {
119
+ await command.undo();
120
+ }
117
121
  throw err;
118
122
  }
119
123
  }
@@ -39,36 +39,36 @@ describe('RecordingCommand', () => {
39
39
  beforeState = JSON.parse(JSON.stringify(jsonObject));
40
40
  });
41
41
 
42
- it('should be undoable after execution', () => {
42
+ it('should be undoable after execution', async () => {
43
43
  // eslint-disable-next-line @typescript-eslint/no-empty-function
44
44
  const command = new RecordingCommand(jsonObject, () => {});
45
45
  expect(command.canUndo()).to.be.false;
46
- command.execute();
46
+ await command.execute();
47
47
  expect(command.canUndo()).to.be.true;
48
48
  });
49
49
 
50
- it('should restore the pre execution state when undo is called', () => {
50
+ it('should restore the pre execution state when undo is called', async () => {
51
51
  const command = new RecordingCommand(jsonObject, () => {
52
52
  jsonObject.string = 'bar';
53
53
  jsonObject.flag = false;
54
54
  jsonObject.maybe = { hello: 'world' };
55
55
  });
56
- command.execute();
56
+ await command.execute();
57
57
  expect(jsonObject).to.not.be.deep.equals(beforeState);
58
- command.undo();
58
+ await command.undo();
59
59
  expect(jsonObject).to.be.deep.equals(beforeState);
60
60
  });
61
61
 
62
- it('should restore the post execution state when redo is called', () => {
62
+ it('should restore the post execution state when redo is called', async () => {
63
63
  const command = new RecordingCommand(jsonObject, () => {
64
64
  jsonObject.string = 'bar';
65
65
  jsonObject.flag = false;
66
66
  jsonObject.maybe = { hello: 'world' };
67
67
  });
68
- command.execute();
68
+ await command.execute();
69
69
  const afterState = JSON.parse(JSON.stringify(jsonObject));
70
70
  jsonObject = JSON.parse(JSON.stringify(afterState));
71
- command.redo();
71
+ await command.redo();
72
72
  expect(jsonObject).to.be.deep.equals(afterState);
73
73
  });
74
74
  });
@@ -15,7 +15,7 @@
15
15
  ********************************************************************************/
16
16
 
17
17
  import { GModelRootSchema } from '@eclipse-glsp/graph';
18
- import { AnyObject } from '@eclipse-glsp/protocol';
18
+ import { AnyObject, MaybePromise } from '@eclipse-glsp/protocol';
19
19
  import * as jsonPatch from 'fast-json-patch';
20
20
  import { GModelSerializer } from '../features/model/gmodel-serializer';
21
21
  import { ModelState } from '../features/model/model-state';
@@ -28,10 +28,10 @@ export abstract class AbstractRecordingCommand<JsonObject extends AnyObject> imp
28
28
  protected undoPatch?: jsonPatch.Operation[];
29
29
  protected redoPatch?: jsonPatch.Operation[];
30
30
 
31
- execute(): void {
32
- const beforeState = this.deepClone(this.getJsonObject());
33
- this.doExecute();
34
- const afterState = this.getJsonObject();
31
+ async execute(): Promise<void> {
32
+ const beforeState = this.deepClone(await this.getJsonObject());
33
+ await this.doExecute();
34
+ const afterState = await this.getJsonObject();
35
35
  this.undoPatch = jsonPatch.compare(afterState, beforeState);
36
36
  this.redoPatch = jsonPatch.compare(beforeState, afterState);
37
37
  }
@@ -41,14 +41,14 @@ export abstract class AbstractRecordingCommand<JsonObject extends AnyObject> imp
41
41
  * right after {@link AbstractRecordingCommand.doExecute} to derive the undo & redo patches.
42
42
  * @returns The current state of the JSON object
43
43
  */
44
- protected abstract getJsonObject(): JsonObject;
44
+ protected abstract getJsonObject(): MaybePromise<JsonObject>;
45
45
 
46
46
  /**
47
47
  * The actual execution i.e. series of changes applied to the JSOn object that should be captured.
48
48
  */
49
- protected abstract doExecute(): void;
49
+ protected abstract doExecute(): MaybePromise<void>;
50
50
 
51
- protected applyPatch(object: JsonObject, patch: jsonPatch.Operation[]): void {
51
+ protected applyPatch(object: JsonObject, patch: jsonPatch.Operation[]): MaybePromise<void> {
52
52
  jsonPatch.applyPatch(object, patch, false, true);
53
53
  }
54
54
 
@@ -62,15 +62,15 @@ export abstract class AbstractRecordingCommand<JsonObject extends AnyObject> imp
62
62
  return jsonPatch.deepClone(object);
63
63
  }
64
64
 
65
- undo(): void {
65
+ async undo(): Promise<void> {
66
66
  if (this.undoPatch) {
67
- this.applyPatch(this.getJsonObject(), this.undoPatch);
67
+ return this.applyPatch(await this.getJsonObject(), this.undoPatch);
68
68
  }
69
69
  }
70
70
 
71
- redo(): void {
71
+ async redo(): Promise<void> {
72
72
  if (this.redoPatch) {
73
- this.applyPatch(this.getJsonObject(), this.redoPatch);
73
+ return this.applyPatch(await this.getJsonObject(), this.redoPatch);
74
74
  }
75
75
  }
76
76
 
@@ -84,11 +84,11 @@ export abstract class AbstractRecordingCommand<JsonObject extends AnyObject> imp
84
84
  * the the given `doExecute` function.
85
85
  */
86
86
  export class RecordingCommand<JsonObject extends AnyObject = AnyObject> extends AbstractRecordingCommand<JsonObject> {
87
- constructor(protected jsonObject: JsonObject, protected doExecute: () => void) {
87
+ constructor(protected jsonObject: JsonObject, protected doExecute: () => MaybePromise<void>) {
88
88
  super();
89
89
  }
90
90
 
91
- protected getJsonObject(): JsonObject {
91
+ protected getJsonObject(): MaybePromise<JsonObject> {
92
92
  return this.jsonObject;
93
93
  }
94
94
  }
@@ -98,20 +98,20 @@ export class RecordingCommand<JsonObject extends AnyObject = AnyObject> extends
98
98
  * to the `GModelRoot` ({@link ModelState.root}) during the given `doExecute` function
99
99
  */
100
100
  export class GModelRecordingCommand extends AbstractRecordingCommand<GModelRootSchema> {
101
- constructor(protected modelState: ModelState, protected serializer: GModelSerializer, protected doExecute: () => void) {
101
+ constructor(protected modelState: ModelState, protected serializer: GModelSerializer, protected doExecute: () => MaybePromise<void>) {
102
102
  super();
103
103
  }
104
104
 
105
- override execute(): void {
106
- super.execute();
105
+ override async execute(): Promise<void> {
106
+ await super.execute();
107
107
  this.modelState.index.indexRoot(this.modelState.root);
108
108
  }
109
109
 
110
- protected getJsonObject(): GModelRootSchema {
110
+ protected getJsonObject(): MaybePromise<GModelRootSchema> {
111
111
  return this.serializer.createSchema(this.modelState.root);
112
112
  }
113
113
 
114
- protected override applyPatch(rootSchema: GModelRootSchema, patch: jsonPatch.Operation[]): void {
114
+ protected override applyPatch(rootSchema: GModelRootSchema, patch: jsonPatch.Operation[]): MaybePromise<void> {
115
115
  super.applyPatch(rootSchema, patch);
116
116
  const newRoot = this.serializer.createRoot(rootSchema);
117
117
  this.modelState.updateRoot(newRoot);
@@ -39,17 +39,17 @@ export class UndoRedoActionHandler implements ActionHandler {
39
39
  return [];
40
40
  }
41
41
 
42
- protected undo(): MaybePromise<Action[]> {
42
+ protected async undo(): Promise<Action[]> {
43
43
  if (this.commandStack.canUndo()) {
44
- this.commandStack.undo();
44
+ await this.commandStack.undo();
45
45
  return this.modelSubmissionHandler.submitModel('undo');
46
46
  }
47
47
  return [];
48
48
  }
49
49
 
50
- protected redo(): MaybePromise<Action[]> {
50
+ protected async redo(): Promise<Action[]> {
51
51
  if (this.commandStack.canRedo()) {
52
- this.commandStack.redo();
52
+ await this.commandStack.redo();
53
53
  return this.modelSubmissionHandler.submitModel('redo');
54
54
  }
55
55
  return [];
@@ -13,8 +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 { GLSPClientProxy } from '@eclipse-glsp/protocol';
16
17
  import { ContainerModule } from 'inversify';
17
- import { GLSPClientProxy } from '../protocol/glsp-client-proxy';
18
18
  import { ClientId } from './service-identifiers';
19
19
 
20
20
  export function createClientSessionModule(clientId: string, glspClient: GLSPClientProxy): ContainerModule {
@@ -13,12 +13,14 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
+ import { BindingContext } from '@eclipse-glsp/protocol';
16
17
  import { ContainerModule, injectable, interfaces } from 'inversify';
17
18
  import { AbstractMultiBinding } from './multi-binding';
18
19
 
19
20
  /**
20
21
  * A wrapper interface to get access to the binding related functions
21
22
  * for a inversify container.
23
+ * @deprecated Use `BindingContext` from `@eclipse-glsp/protocol` instead
22
24
  */
23
25
  export interface ModuleContext {
24
26
  bind: interfaces.Bind;
@@ -34,7 +36,7 @@ export interface ModuleContext {
34
36
  export abstract class GLSPModule extends ContainerModule {
35
37
  public static CLIENT_ACTIONS = 'ClientActions';
36
38
 
37
- protected context: ModuleContext;
39
+ protected context: BindingContext;
38
40
 
39
41
  constructor() {
40
42
  super((bind, unbind, isBound, rebind) => {
@@ -13,9 +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 { distinctAdd, flatPush, MaybeArray, remove } from '@eclipse-glsp/protocol';
16
+ import { BindingContext, distinctAdd, flatPush, MaybeArray, remove } from '@eclipse-glsp/protocol';
17
17
  import { applyBindingTarget, BindingTarget } from './binding-target';
18
- import { ModuleContext } from './glsp-module';
19
18
 
20
19
  /**
21
20
  * A helper class used in `GLSPModules` to ease the configuration of multi-injected service identifiers.
@@ -29,7 +28,7 @@ export abstract class AbstractMultiBinding<T> {
29
28
 
30
29
  constructor(readonly identifier: string | symbol) {}
31
30
 
32
- abstract applyBindings(context: ModuleContext): void;
31
+ abstract applyBindings(context: BindingContext): void;
33
32
 
34
33
  add(newBinding: T): void {
35
34
  distinctAdd(this.bindings, newBinding);
@@ -71,7 +70,7 @@ export abstract class AbstractMultiBinding<T> {
71
70
  * @typeparam T the base type of {@link BindingTarget}.
72
71
  */
73
72
  export class MultiBinding<T> extends AbstractMultiBinding<BindingTarget<T>> {
74
- applyBindings(context: ModuleContext): void {
73
+ applyBindings(context: BindingContext): void {
75
74
  this.bindings.forEach(binding => applyBindingTarget(context, this.identifier, binding));
76
75
  }
77
76
  }
@@ -83,7 +82,7 @@ export class MultiBinding<T> extends AbstractMultiBinding<BindingTarget<T>> {
83
82
  * * @typeparam T the type of the instances
84
83
  */
85
84
  export class InstanceMultiBinding<T> extends AbstractMultiBinding<T> {
86
- applyBindings(context: ModuleContext): void {
85
+ applyBindings(context: BindingContext): void {
87
86
  context.bind(this.identifier).toConstantValue(this.bindings);
88
87
  }
89
88
  }
@@ -13,14 +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 { GLSPServer, GLSPServerListener } from '@eclipse-glsp/protocol';
16
17
  import { ContainerModule, interfaces } from 'inversify';
17
18
  import { DefaultGlobalActionProvider, GlobalActionProvider } from '../actions/global-action-provider';
18
- import { DefaultGLSPClientProxy, GLSPClientProxy, JsonRpcGLSPClientProxy } from '../protocol/glsp-client-proxy';
19
- import { DefaultGLSPServer, GLSPServer, JsonRpcGLSPServer } from '../protocol/glsp-server';
20
- import { GLSPServerListener } from '../protocol/glsp-server-listener';
19
+ import { DefaultGLSPServer } from '../protocol/glsp-server';
21
20
  import { ClientSessionFactory, DefaultClientSessionFactory } from '../session/client-session-factory';
22
21
  import { ClientSessionManager, DefaultClientSessionManager } from '../session/client-session-manager';
23
- import { applyBindingTarget, BindingTarget } from './binding-target';
22
+ import { BindingTarget, applyBindingTarget } from './binding-target';
24
23
  import { DiagramModule } from './diagram-module';
25
24
  import { GLSPModule } from './glsp-module';
26
25
  import { MultiBinding } from './multi-binding';
@@ -74,7 +73,6 @@ export class ServerModule extends GLSPModule {
74
73
  applyBindingTarget(context, DiagramModules, this.bindDiagramModules());
75
74
 
76
75
  applyBindingTarget(context, GLSPServer, this.bindGLSPServer()).inSingletonScope();
77
- applyBindingTarget(context, JsonRpcGLSPServer, this.bindJsonRpcGLSPServer());
78
76
  applyBindingTarget(context, ClientSessionFactory, this.bindClientSessionFactory()).inSingletonScope();
79
77
  applyBindingTarget(context, ClientSessionManager, this.bindClientSessionManager()).inSingletonScope();
80
78
  this.configureMultiBinding(new MultiBinding<GLSPServerListener>(GLSPServerListener), binding =>
@@ -83,10 +81,9 @@ export class ServerModule extends GLSPModule {
83
81
 
84
82
  applyBindingTarget(context, GlobalActionProvider, this.bindGlobalActionProvider()).inSingletonScope();
85
83
 
86
- applyBindingTarget(context, InjectionContainer, this.bindInjectionContainer());
87
-
88
- applyBindingTarget(context, GLSPClientProxy, this.bindGLSPClientProxy()).inSingletonScope();
89
- applyBindingTarget(context, JsonRpcGLSPClientProxy, this.bindJsonRpcGLSPClientProxy());
84
+ if (!isBound(InjectionContainer)) {
85
+ applyBindingTarget(context, InjectionContainer, this.bindInjectionContainer());
86
+ }
90
87
  }
91
88
 
92
89
  protected bindDiagramModules(): BindingTarget<Map<string, ContainerModule[]>> {
@@ -97,10 +94,6 @@ export class ServerModule extends GLSPModule {
97
94
  return DefaultGLSPServer;
98
95
  }
99
96
 
100
- protected bindJsonRpcGLSPServer(): BindingTarget<JsonRpcGLSPServer> {
101
- return { service: GLSPServer };
102
- }
103
-
104
97
  protected bindClientSessionFactory(): BindingTarget<ClientSessionFactory> {
105
98
  return DefaultClientSessionFactory;
106
99
  }
@@ -117,14 +110,6 @@ export class ServerModule extends GLSPModule {
117
110
  return { dynamicValue: context => context.container };
118
111
  }
119
112
 
120
- protected bindGLSPClientProxy(): BindingTarget<GLSPClientProxy> {
121
- return DefaultGLSPClientProxy;
122
- }
123
-
124
- protected bindJsonRpcGLSPClientProxy(): BindingTarget<JsonRpcGLSPClientProxy> {
125
- return { service: GLSPClientProxy };
126
- }
127
-
128
113
  protected configureGLSPServerListeners(binding: MultiBinding<GLSPServerListener>): void {
129
114
  binding.add({ service: ClientSessionManager });
130
115
  }
@@ -17,7 +17,7 @@ import { GModelRoot } from '@eclipse-glsp/graph';
17
17
  import { Action, ComputedBoundsAction, MaybePromise } from '@eclipse-glsp/protocol';
18
18
  import { inject, injectable } from 'inversify';
19
19
  import { ActionHandler } from '../../actions/action-handler';
20
- import { applyAlignment, applyBounds, applyRoute } from '../../utils/layout-util';
20
+ import { applyAlignment, applyElementAndBounds, applyRoute } from '../../utils/layout-util';
21
21
  import { ModelState } from '../model/model-state';
22
22
  import { ModelSubmissionHandler } from '../model/model-submission-handler';
23
23
 
@@ -47,7 +47,7 @@ export class ComputedBoundsActionHandler implements ActionHandler {
47
47
 
48
48
  protected applyBounds(root: GModelRoot, action: ComputedBoundsAction): void {
49
49
  const index = this.modelState.index;
50
- action.bounds.forEach(bounds => applyBounds(bounds, index));
50
+ action.bounds.forEach(bounds => applyElementAndBounds(bounds, index));
51
51
  (action.alignments ?? []).forEach(alignment => applyAlignment(alignment, index));
52
52
  (action.routes ?? []).forEach(route => applyRoute(route, index));
53
53
  }
@@ -23,6 +23,8 @@ export * from './actions/client-action-handler';
23
23
  export * from './actions/global-action-provider';
24
24
  export * from './command/command';
25
25
  export * from './command/command-stack';
26
+ export * from './command/recording-command';
27
+ export * from './command/undo-redo-action-handler';
26
28
  export * from './di/binding-target';
27
29
  export * from './di/client-session-module';
28
30
  export * from './di/diagram-module';
@@ -65,7 +67,6 @@ export * from './features/popup/popup-model-factory';
65
67
  export * from './features/popup/request-popup-model-action-handler';
66
68
  export * from './features/validation/model-validator';
67
69
  export * from './features/validation/request-markers-handler';
68
- export * from './gmodel/cut-operation-handler';
69
70
  export * from './gmodel/index';
70
71
  export * from './launch/glsp-server-launcher';
71
72
  export * from './operations/compound-operation-handler';
@@ -73,9 +74,7 @@ export * from './operations/create-operation-handler';
73
74
  export * from './operations/operation-action-handler';
74
75
  export * from './operations/operation-handler';
75
76
  export * from './operations/operation-handler-registry';
76
- export * from './protocol/glsp-client-proxy';
77
77
  export * from './protocol/glsp-server';
78
- export * from './protocol/glsp-server-listener';
79
78
  export * from './session/client-session';
80
79
  export * from './session/client-session-factory';
81
80
  export * from './session/client-session-initializer';
@@ -83,7 +82,9 @@ export * from './session/client-session-listener';
83
82
  export * from './session/client-session-manager';
84
83
  export * from './utils/args-util';
85
84
  export * from './utils/client-options-util';
85
+ export * from './utils/console-logger';
86
86
  export * from './utils/glsp-server-error';
87
+ export * from './utils/layout-util';
87
88
  export * from './utils/logger';
88
89
  export * from './utils/promise-queue';
89
90
  export * from './utils/registry';
@@ -13,20 +13,19 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { MaybePromise } from '@eclipse-glsp/protocol';
16
+ import { Disposable, DisposableCollection, MaybePromise } from '@eclipse-glsp/protocol';
17
17
  import { Container, ContainerModule, inject, injectable, optional } from 'inversify';
18
18
  import { ServerModule } from '../di/server-module';
19
19
  import { InjectionContainer } from '../di/service-identifiers';
20
20
  import { Logger } from '../utils/logger';
21
21
 
22
- export const START_UP_COMPLETE_MSG = '[GLSP-Server]:Startup completed';
23
-
24
22
  @injectable()
25
- export abstract class GLSPServerLauncher<T = undefined> {
23
+ export abstract class GLSPServerLauncher<T> implements Disposable {
26
24
  @inject(Logger) protected logger: Logger;
27
25
 
28
26
  protected _modules: ContainerModule[] = [];
29
27
  protected running: boolean;
28
+ protected toDispose = new DisposableCollection();
30
29
 
31
30
  @inject(InjectionContainer) @optional() protected parentContainer?: Container;
32
31
 
@@ -34,13 +33,13 @@ export abstract class GLSPServerLauncher<T = undefined> {
34
33
  this._modules.push(serverModule, ...additionalModules);
35
34
  }
36
35
 
37
- createContainer(): Container {
36
+ createContainer(...additionalModules: ContainerModule[]): Container {
38
37
  const container = this.parentContainer ? this.parentContainer.createChild() : new Container();
39
- container.load(...this._modules);
38
+ container.load(...this._modules, ...additionalModules);
40
39
  return container;
41
40
  }
42
41
 
43
- start(startParams?: T): MaybePromise<void> {
42
+ start(startParams: T): MaybePromise<void> {
44
43
  if (!this.running) {
45
44
  this.running = true;
46
45
  return this.run(startParams);
@@ -48,10 +47,11 @@ export abstract class GLSPServerLauncher<T = undefined> {
48
47
  this.logger.warn('Could not start launcher. Launcher is already running!');
49
48
  }
50
49
 
51
- protected abstract run(startParams?: T): MaybePromise<void>;
50
+ protected abstract run(startParams: T): MaybePromise<void>;
52
51
 
53
52
  shutdown(): MaybePromise<void> {
54
53
  if (this.running) {
54
+ this.logger.info('Shutdown GLSPServerLauncher');
55
55
  const result = this.stop();
56
56
  this.running = false;
57
57
  return result;
@@ -59,7 +59,13 @@ export abstract class GLSPServerLauncher<T = undefined> {
59
59
  this.logger.warn('Could not stop launcher. Launcher is not running!');
60
60
  }
61
61
 
62
- protected abstract stop(): MaybePromise<void>;
62
+ protected stop(): MaybePromise<void> {
63
+ this.dispose();
64
+ }
65
+
66
+ dispose(): void {
67
+ this.toDispose.dispose();
68
+ }
63
69
 
64
70
  get modules(): ContainerModule[] {
65
71
  if (!this._modules) {