@eclipse-glsp-examples/workflow-server-bundled 2.4.0-next.118 → 2.4.0-next.120

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-glsp-examples/workflow-server-bundled",
3
- "version": "2.4.0-next.118+079fa99",
3
+ "version": "2.4.0-next.120+867d5a7",
4
4
  "description": "GLSP node server for the workflow example (bundled)",
5
5
  "keywords": [
6
6
  "eclipse",
@@ -49,5 +49,5 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "079fa991b7f977b842a10fee0e4337a8346c5b7d"
52
+ "gitHead": "867d5a7e4136544e79983e45438f0a4ae051d221"
53
53
  }
@@ -64553,7 +64553,22 @@ let GModelChangeBoundsOperationHandler = class GModelChangeBoundsOperationHandle
64553
64553
  this.operationType = protocol_1.ChangeBoundsOperation.KIND;
64554
64554
  }
64555
64555
  createCommand(operation) {
64556
- return this.commandOf(() => this.executeChangeBounds(operation));
64556
+ const newBounds = operation.newBounds.filter(element => this.hasChanged(element));
64557
+ if (newBounds.length === 0) {
64558
+ return undefined;
64559
+ }
64560
+ return this.commandOf(() => this.executeChangeBounds({ ...operation, newBounds }));
64561
+ }
64562
+ hasChanged(element) {
64563
+ const knownElement = this.modelState.index.find(element.elementId);
64564
+ if (!knownElement || !(0, graph_1.isGBoundsAware)(knownElement)) {
64565
+ return true;
64566
+ }
64567
+ const sizeChanged = knownElement.size ? !protocol_1.Dimension.equals(knownElement.size, element.newSize) : true;
64568
+ if (sizeChanged) {
64569
+ return true;
64570
+ }
64571
+ return knownElement.position && element.newPosition ? !protocol_1.Point.equals(knownElement.position, element.newPosition) : true;
64557
64572
  }
64558
64573
  executeChangeBounds(operation) {
64559
64574
  for (const element of operation.newBounds) {
@@ -64621,9 +64636,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
64621
64636
  };
64622
64637
  Object.defineProperty(exports, "__esModule", ({ value: true }));
64623
64638
  exports.GModelChangeRoutingPointsOperationHandler = void 0;
64639
+ const graph_1 = __webpack_require__(/*! @eclipse-glsp/graph */ "../../packages/graph/lib/index.js");
64624
64640
  const protocol_1 = __webpack_require__(/*! @eclipse-glsp/protocol */ "../../node_modules/@eclipse-glsp/protocol/lib/index.js");
64625
64641
  const inversify_1 = __webpack_require__(/*! inversify */ "../../node_modules/inversify/lib/cjs/index.js");
64626
- const glsp_server_error_1 = __webpack_require__(/*! ../utils/glsp-server-error */ "../../packages/server/lib/common/utils/glsp-server-error.js");
64627
64642
  const layout_util_1 = __webpack_require__(/*! ../utils/layout-util */ "../../packages/server/lib/common/utils/layout-util.js");
64628
64643
  const gmodel_operation_handler_1 = __webpack_require__(/*! ./gmodel-operation-handler */ "../../packages/server/lib/common/gmodel/gmodel-operation-handler.js");
64629
64644
  let GModelChangeRoutingPointsOperationHandler = class GModelChangeRoutingPointsOperationHandler extends gmodel_operation_handler_1.GModelOperationHandler {
@@ -64632,12 +64647,26 @@ let GModelChangeRoutingPointsOperationHandler = class GModelChangeRoutingPointsO
64632
64647
  this.operationType = protocol_1.ChangeRoutingPointsOperation.KIND;
64633
64648
  }
64634
64649
  createCommand(operation) {
64635
- return this.commandOf(() => this.executeChangeRoutingPoints(operation));
64650
+ const newRoutingPoints = operation.newRoutingPoints.filter(newRoutingPoints => this.hasChanged(newRoutingPoints));
64651
+ if (newRoutingPoints.length === 0) {
64652
+ return undefined;
64653
+ }
64654
+ return this.commandOf(() => this.executeChangeRoutingPoints({ ...operation, newRoutingPoints }));
64636
64655
  }
64637
- executeChangeRoutingPoints(operation) {
64638
- if (!operation.newRoutingPoints) {
64639
- throw new glsp_server_error_1.GLSPServerError('Incomplete change routingPoints action');
64656
+ hasChanged(element) {
64657
+ var _a;
64658
+ const knownElement = this.modelState.index.findByClass(element.elementId, graph_1.GEdge);
64659
+ if (!knownElement || knownElement.routingPoints.length !== ((_a = element.newRoutingPoints) === null || _a === void 0 ? void 0 : _a.length)) {
64660
+ return true;
64640
64661
  }
64662
+ for (let i = 0; i < knownElement.routingPoints.length; i++) {
64663
+ if (!protocol_1.Point.equals(knownElement.routingPoints[i], element.newRoutingPoints[i])) {
64664
+ return true;
64665
+ }
64666
+ }
64667
+ return false;
64668
+ }
64669
+ executeChangeRoutingPoints(operation) {
64641
64670
  const index = this.modelState.index;
64642
64671
  operation.newRoutingPoints.forEach(routingPoints => (0, layout_util_1.applyRoutingPoints)(routingPoints, index));
64643
64672
  }
@@ -65775,7 +65804,7 @@ let CompoundOperationHandler = class CompoundOperationHandler extends operation_
65775
65804
  commands.push(command);
65776
65805
  }
65777
65806
  }
65778
- return new command_1.CompoundCommand(commands);
65807
+ return commands.length > 0 ? new command_1.CompoundCommand(commands) : undefined;
65779
65808
  }
65780
65809
  };
65781
65810
  exports.CompoundOperationHandler = CompoundOperationHandler;
@@ -66048,8 +66077,9 @@ let OperationActionHandler = OperationActionHandler_1 = class OperationActionHan
66048
66077
  const command = await handler.execute(operation);
66049
66078
  if (command) {
66050
66079
  await this.executeCommand(command);
66080
+ return this.submitModel();
66051
66081
  }
66052
- return this.modelSubmissionHandler.submitModel('operation');
66082
+ return [];
66053
66083
  }
66054
66084
  async executeCommand(command) {
66055
66085
  return this.commandStack.execute(command);
@@ -66967,42 +66997,45 @@ let ConsoleLogger = class ConsoleLogger extends logger_1.Logger {
66967
66997
  }
66968
66998
  info(message, ...params) {
66969
66999
  if (logger_1.LogLevel.info <= this.logLevel) {
66970
- console.info(this.logMessage(message, params));
67000
+ console.info(this.logMessage(logger_1.LogLevel.info, message, ...params));
66971
67001
  }
66972
67002
  }
66973
67003
  warn(message, ...params) {
66974
67004
  if (logger_1.LogLevel.warn <= this.logLevel) {
66975
- console.warn(this.logMessage(message, params));
67005
+ console.warn(this.logMessage(logger_1.LogLevel.warn, message, ...params));
66976
67006
  }
66977
67007
  }
66978
67008
  error(message, ...params) {
66979
67009
  if (logger_1.LogLevel.error <= this.logLevel) {
66980
- console.error(this.logMessage(message, params));
67010
+ console.error(this.logMessage(logger_1.LogLevel.error, message, ...params));
66981
67011
  }
66982
67012
  }
66983
67013
  debug(message, ...params) {
66984
67014
  if (logger_1.LogLevel.debug <= this.logLevel) {
66985
- console.debug(this.logMessage(message, params));
67015
+ console.debug(this.logMessage(logger_1.LogLevel.debug, message, ...params));
66986
67016
  }
66987
67017
  }
66988
- logMessage(message, ...params) {
66989
- const timestamp = new Date().toLocaleTimeString();
66990
- const caller = this.caller ? `[${this.caller}]` : '';
66991
- const additional = this.logAdditionals(...params);
66992
- return `${timestamp} ${this.logLevel} - ${caller} ${message} ${additional}`;
67018
+ logMessage(level, message, ...params) {
67019
+ return `${this.logTimestamp()} ${(0, logger_1.asLogLevel)(level)} - ${this.logCaller()} ${message} ${this.logAdditionals(...params)}`;
67020
+ }
67021
+ logCaller() {
67022
+ return this.caller ? `[${this.caller}]` : '';
67023
+ }
67024
+ logTimestamp() {
67025
+ return new Date().toLocaleTimeString();
66993
67026
  }
66994
67027
  logAdditionals(...params) {
66995
- if (!params || params.length === 0) {
66996
- return '';
66997
- }
66998
- return params.map(param => this.stringify(param)).join(',\n');
67028
+ return !params || params.length === 0 ? '' : params.map(param => this.stringify(param)).join(this.logAdditionalsSeparator());
67029
+ }
67030
+ logAdditionalsSeparator() {
67031
+ return ',\n';
66999
67032
  }
67000
67033
  stringify(param) {
67001
- if (param instanceof Error) {
67002
- return `${param.message}
67003
- ${param.stack || ''}`;
67004
- }
67005
- return JSON.stringify(param, undefined, 4);
67034
+ return param instanceof Error ? this.stringifyError(param) : JSON.stringify(param, undefined, 4);
67035
+ }
67036
+ stringifyError(error) {
67037
+ return `${error.message}
67038
+ ${error.stack || ''}`;
67006
67039
  }
67007
67040
  };
67008
67041
  exports.ConsoleLogger = ConsoleLogger;