@eclipse-glsp/server 1.1.0-RC05 → 1.1.0-next.385269d.45

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 (53) hide show
  1. package/lib/common/command/command-stack.d.ts +7 -6
  2. package/lib/common/command/command-stack.d.ts.map +1 -1
  3. package/lib/common/command/command-stack.js +6 -6
  4. package/lib/common/command/command-stack.js.map +1 -1
  5. package/lib/common/command/command-stack.spec.js +31 -31
  6. package/lib/common/command/command-stack.spec.js.map +1 -1
  7. package/lib/common/command/command.d.ts +7 -6
  8. package/lib/common/command/command.d.ts.map +1 -1
  9. package/lib/common/command/command.js +19 -15
  10. package/lib/common/command/command.js.map +1 -1
  11. package/lib/common/command/command.spec.js +8 -8
  12. package/lib/common/command/command.spec.js.map +1 -1
  13. package/lib/common/command/recording-command.d.ts +15 -15
  14. package/lib/common/command/recording-command.d.ts.map +1 -1
  15. package/lib/common/command/recording-command.js +10 -10
  16. package/lib/common/command/recording-command.js.map +1 -1
  17. package/lib/common/command/recording-command.spec.js +8 -8
  18. package/lib/common/command/recording-command.spec.js.map +1 -1
  19. package/lib/common/command/undo-redo-action-handler.d.ts +2 -2
  20. package/lib/common/command/undo-redo-action-handler.d.ts.map +1 -1
  21. package/lib/common/command/undo-redo-action-handler.js +4 -4
  22. package/lib/common/command/undo-redo-action-handler.js.map +1 -1
  23. package/lib/common/features/layout/computed-bounds-action-handler.js +1 -1
  24. package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -1
  25. package/lib/common/index.d.ts +3 -1
  26. package/lib/common/index.d.ts.map +1 -1
  27. package/lib/common/index.js +3 -1
  28. package/lib/common/index.js.map +1 -1
  29. package/lib/common/operations/operation-action-handler.d.ts +1 -1
  30. package/lib/common/operations/operation-action-handler.d.ts.map +1 -1
  31. package/lib/common/operations/operation-action-handler.js +3 -3
  32. package/lib/common/operations/operation-action-handler.js.map +1 -1
  33. package/lib/common/test/mock-util.d.ts +7 -1
  34. package/lib/common/test/mock-util.d.ts.map +1 -1
  35. package/lib/common/test/mock-util.js +23 -1
  36. package/lib/common/test/mock-util.js.map +1 -1
  37. package/lib/common/utils/layout-util.d.ts +1 -1
  38. package/lib/common/utils/layout-util.d.ts.map +1 -1
  39. package/lib/common/utils/layout-util.js +3 -3
  40. package/lib/common/utils/layout-util.js.map +1 -1
  41. package/package.json +4 -4
  42. package/src/common/command/command-stack.spec.ts +32 -32
  43. package/src/common/command/command-stack.ts +10 -9
  44. package/src/common/command/command.spec.ts +9 -10
  45. package/src/common/command/command.ts +23 -19
  46. package/src/common/command/recording-command.spec.ts +8 -8
  47. package/src/common/command/recording-command.ts +19 -19
  48. package/src/common/command/undo-redo-action-handler.ts +4 -4
  49. package/src/common/features/layout/computed-bounds-action-handler.ts +2 -2
  50. package/src/common/index.ts +3 -1
  51. package/src/common/operations/operation-action-handler.ts +3 -3
  52. package/src/common/test/mock-util.ts +21 -0
  53. package/src/common/utils/layout-util.ts +1 -1
@@ -25,11 +25,13 @@ import {
25
25
  EdgeTypeHint,
26
26
  InitializeClientSessionParameters,
27
27
  MaybeArray,
28
+ MaybePromise,
28
29
  Point,
29
30
  RequestEditValidationAction,
30
31
  ShapeTypeHint,
31
32
  ValidationStatus
32
33
  } from '@eclipse-glsp/protocol';
34
+ import { expect } from 'chai';
33
35
  import { Container } from 'inversify';
34
36
  import { MessageConnection } from 'vscode-jsonrpc';
35
37
  import { ActionDispatcher } from '../actions/action-dispatcher';
@@ -53,6 +55,25 @@ export async function delay(ms: number): Promise<void> {
53
55
  return new Promise(resolve => setTimeout(resolve, ms));
54
56
  }
55
57
 
58
+ /**
59
+ * Consumes a maybe async function and checks for error
60
+ * @param method - The function to check
61
+ * @param message - Optional message to match with error message
62
+ */
63
+ export async function expectToThrowAsync(toEvaluate: () => MaybePromise<void>, message?: string): Promise<void> {
64
+ let err: Error | undefined = undefined;
65
+ try {
66
+ await toEvaluate();
67
+ } catch (error: any) {
68
+ err = error;
69
+ }
70
+ if (message) {
71
+ expect(err?.message).to.be.equal(message);
72
+ } else {
73
+ expect(err).to.be.an('Error');
74
+ }
75
+ }
76
+
56
77
  export function createClientSession(
57
78
  id: string,
58
79
  diagramType: string,
@@ -27,7 +27,7 @@ import { getOrThrow, GLSPServerError } from './glsp-server-error';
27
27
  * @param index The model index.
28
28
  * @returns The changed element.
29
29
  */
30
- export function applyBounds(bounds: ElementAndBounds, index: GModelIndex): GBoundsAware | undefined {
30
+ export function applyElementAndBounds(bounds: ElementAndBounds, index: GModelIndex): GBoundsAware | undefined {
31
31
  const element = getOrThrow(index.get(bounds.elementId), 'Model element not found! ID: ' + bounds.elementId);
32
32
  if (isGBoundsAware(element)) {
33
33
  if (bounds.newPosition !== undefined) {