Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@eclipse-glsp/server

eclipse-glsp6.1k(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)2.4.0TypeScript support: included

A js server framework for Eclipse GLSP

eclipse, graphics, diagram, modeling, visualization, glsp, diagram editor

readme

GLSP Server Build Status

Contains the code for the Typescript-based framework to create GLSP server components. The implementation of this server is aligned with the default Java based GLSP Server.

The server consists of three components:

The main target environment is node, nevertheless, all components are implemented in an ismorphic fashion and also provide an entrypoint to target browser environments (e.g. running the server in a web worker)

Build

Install dependencies and build via

yarn

Only build via

yarn build

Lint packages via

yarn lint

or do all of the above via

yarn all

Testing

Unit tests

To execute all available test suits use:

yarn test

It's also possible to execute and debug a single test file in VSCode/Theia via the File explorer. Simply select a test file (*.spec.ts), then go to the Run & Debug View (Ctrl+Shift+D), select the 'Run current test" launch config and start debugging (Ctrl+F11)

Workflow Diagram Example

The workflow diagram is a consistent example provided by all GLSP components. The example implements a simple flow chart diagram editor with different types of nodes and edges (see screenshot below). The example can be used to try out different GLSP features, as well as several available integrations with IDE platforms (Theia, VSCode, Eclipse, Standalone). As the example is fully open source, you can also use it as a blueprint for a custom implementation of a GLSP diagram editor. See our project website for an overview of the workflow example and all components implementing it.

https://user-images.githubusercontent.com/588090/154459938-849ca684-11b3-472c-8a59-98ea6cb0b4c1.mp4

How to start the Workflow Diagram example?

To see the diagram in action, you need to choose and launch one diagram client, see here for an overview of available clients.

Please look at the workflow example guides in the repository linked above to get more information on building and running the respective GLSP clients.

Launch Workflow Example Server

Socket

To launch the server for TCP sockets use:

yarn start

This starts a server that is listening on port 5007 for incoming client requests.

To debug you can use the Debug workflow example GLSP Server launch configuration. To test the server you have to connect a workflow GLSP client that supports JSON-RPC via socket. We recommend to use the client provided by the glsp-integration.

Websocket

To launch the server for WebSockets use:

yarn start:websocket

This starts a server that is listening on the ws://localhost:8081/workflow endpoint for incoming client requests.

To debug you can use the Debug workflow example GLSP Server (Websocket) launch configuration. To test the server you have to connect a workflow GLSP client that supports JSON-RPC via WebSocket. We recommend to use the standalone example provided by glsp-client.

More information

For more information, please visit the Eclipse GLSP Umbrella repository and the Eclipse GLSP Website. If you have questions, please raise them in the discussions and have a look at our communication and support options.

changelog

Eclipse GLSP Server Changelog

v2.4.0 - 04/04/2025

Changes

  • [layout] Fix a bug regarding the application of routing point information in ComputedBoundsActionHandler #103
  • [gmodel] Cancel pending progress reporters in RequestModelActionHandler if an error occurred #104
  • [operation] Improve OperationActionHandler to ensure that a new model is only submitted after actual changes #105
  • [server] Ensure correct log level logging for ConsoleLogger #106
  • [server] Avoid configuration of winston logger if logging is disabled via options #107

Potentially breaking changes

v2.3.0 - 23/12/2024

Changes

  • [api] Update align default type mappings with the client-side types #97
  • [workflow] Fix a but in the WorkflowEdgeCreationChecker that prevented creation of weighted edges #98
  • [model] Refactor ModelSubmissionHandler to use async live validation by default #99

Potentially breaking changes

v2.2.1 - 22/07/2024

Changes

  • [layout] Ensure that model is updated correctly when using automatic server layout #74
  • [gmodel] Add proper undefined/null handling in GModel builder functions #76
  • [launch] Improve Winston-Logger implementation to properly handle non-serializable objects #82
  • [layout] Ensure that including ElkLayoutEngine engine does not error in browser-only server implementations #83
  • [gmodel] Introduce new Resizable interface that is implemented by all GShapeElements and allows per-element definition of resize handle locations #84
  • [action] Ensure that actions queued with dispatchAfterNextUpdate are also dispatched after the initial SetModelAction #88

Potentially Breaking Changes

  • [protocol] Removed local definition of GIssueMarker and reuse it from @eclipse-glsp/protocol instead #88
    • => GIssueMarker is now an interface instead of a class

v2.1.0 - 25/01/2024

  • [operation] Add support for defining ghost elements/templates in CreateNodeOperationHandler's #65
  • [launch] Use "127.0.0.1" as default host to avoid potential IP v4/v6 connection issues #67
  • [gmodel] Fix a bug in GModelDeleteOperationHandler that prevented deletion of multiple selected elements #68

v2.0.0 - 14/10/2023

Changes

  • [elk] Fix a bug in the GLSElkLayoutEngine that skipped layouting of certain edges #23 - Contributed on behalf of STMicroelectronics
  • [launch] The message sent after successful startup now also contains the effective socket port #30 - Contributed on behalf of STMicroelectronics
  • [launch] Fix a bug that caused the server to not properly dispose all resources when shutdown was called #33 - Contributed on behalf of STMicroelectronics
  • [diagram] Fix a bug to ensure that the copy&paste feature is working properly #35
  • [api] Ensure that all Promises and MaybePromises have proper rejection handling #36- Contributed on behalf of STMicroelectronics
  • [launch] Add a launcher component for starting WebSocket based GLSP servers #41
  • [validation] Add explicit support and API for live and batch validation #43
  • [launch] Launcher components now auto allocate a free port if the port argument is 0 #42
  • [server] Add support for server progress reporting #52
  • [diagram] Add support for handling reconnection requests to RequestModelActionHandler #54
  • [server] Update AbstractJsonModelStorage to ensure that Windows file paths are properly converted #55
  • [deps] Remove unneeded dependency to fs-extra #56
  • [diagram] Provide generic reusable base operation handlers for JSON-based source models #59
  • [diagram] Add support for dynamic edge type hints
    • Provide EdgeCreationChecker API. Adopters can implement this to handle dynamic edge creation validation requests. #60
  • [model] Introduce new GForeignObjectElement + builder class #61

Breaking Changes

  • [graph] Align GGraph model with newest changes from glsp-server #22 - Contributed on behalf of STMicroelectronics
    • Renamed interfaces:
      • EdgePlacement -> GEdgePlacement (affected classes: GEdgeLayoutable, GLabel)
      • GLayoutContainer -> GLayouting (affected classes: GCompartment, GGraph, GNode)
      • GShapePreRenderedElement -> GShapedPreRenderedElement
  • [deps] Update minimum requirements for Node to >=16.11.0 #32
  • [api] Restructure @eclipse-glsp/server-node package to provide entry points for both node and browser-only environments #37
    • The package has been renamed to @eclipse-glsp/server. This change affects all import namespaces.
    • New namespaces for environment specific code:
      • @eclipse-glsp/server/node
      • @eclipse-glsp/server/browser
  • [operation] Implement Command API and rework OperationHandler to provide an optional command instead of direct execution to allow more execution control (including undo & redo support) #38 #59
    • This includes major breaking changes across the whole API:
      • OperationHandler has been refactored from an interface to a common abstract base class. The execute method now has to return a MaybePromise<Command|undefined>
      • Refactor CreateOperationHandler to an interface instead of a class
      • Rename the services and handlers of the direct GModel library => consistent use of GModel prefix
      • The ModelState interface no longer has an isDirty flag. Dirty state is now handled by the CommandStack
  • [server] Default port has changed from 5007 (and 8081 for websocket) to 0, which implies autoassignment by the OS #42
  • [server] Refactored GLSPServer and GLSPServerLauncher API #44 - Contributed on behalf of STMicroelectronics
    • Server type definitions are now consumed from @eclipse-glsp/protocol
    • GLSPServer implementation is no longer relies on json-rpc implementation details.
    • JSON-RPC setup is now done with JsonRpcGLSPServerLauncher
  • [api] Provide CommandStack API to support undo/redo of model changes #38 #39 - Contributed on behalf of STMicroelectronics
    • ModelState no longer has a isDirty property
    • Breaking refactor of OperationHandler API
  • [deps] Update to inversify 6.x and Typescript 5.x. #48
    • GLSP uses a synchronous inversify context this means with inversify 6.x decorator methods (e.g. @postConstruct) with asynchronous results are no longer supported
  • [api] Revise model loading and client action handling #57 #58
    • Refactor ModelSubmissionHandler to enable handling of RequestModelAction as proper request action
      • Introduce a submitInitialModel method that is called by the RequestModelActionHandler
    • Remove configureClientActions from DiagramModule as client actions are now implicitly configured via InitializeClientSession request
    • Remove ClientActionHandler and replace with ClientActionForwarder
    • Rename ServerStatusAction -> StatusAction and ServerMessageAction -> MessageAction

v1.0.0 - 30/06/2022

Inception of the Node GLSP Server. This project provides the Node based server component for the Eclipse Graphical Language Platform (GLSP). The implementation of this server is aligned with the default Java based GLSP Server. The initial implementation was contributed on behalf of STMicroelectronics. The following list composes changes that have been made since the initial implementation.

Changes (since the initial contribution )

  • [core] Implement dispatchOnNextUpdate method that enables queuing of actions that should be dispatched after the next graphical model update. #1 - Contributed on behalf of STMicroelectronics
  • [diagram] Implement LayoutEngine API for server-side autolayouting & provide an integration package for layout engines based on ELK. #2 #5 - Contributed on behalf of STMicroelectronics

Breaking Changes

  • [model] Source model refactorings #11
    • ModelSourceLoaderSourceModelStorage
    • Added method to SourceModelStorage
  • [model] Refactor ModelState API #20
    • Introduce updateRoot method
    • DefaultModelState => make root setter protected
  • [gmodel] Refactor & Move all base & helper classes for the direct GModel usecase into own gmodel-lib subdirectory #16