@eclipse-glsp-examples/workflow-server 1.1.0-next.44aae0c.44 → 1.1.0-next.452eba9.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.
@@ -0,0 +1,50 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 STMicroelectronics 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
+ export * from './graph-extension';
18
+ export * from './handler/create-activity-node-handler';
19
+ export * from './handler/create-automated-task-handler';
20
+ export * from './handler/create-category-handler';
21
+ export * from './handler/create-decision-node-handler';
22
+ export * from './handler/create-edge-handler';
23
+ export * from './handler/create-fork-node-handler';
24
+ export * from './handler/create-fork-or-join-node-handler';
25
+ export * from './handler/create-join-node-handler';
26
+ export * from './handler/create-manual-task-handler';
27
+ export * from './handler/create-merge-node-handler';
28
+ export * from './handler/create-task-handler';
29
+ export * from './handler/create-weighted-edge-handler';
30
+ export * from './handler/create-workflow-node-operation-handler';
31
+ export * from './handler/grid-snapper';
32
+ export * from './index';
33
+ export * from './labeledit/workflow-label-edit-validator';
34
+ export * from './layout/workflow-layout-configurator';
35
+ export * from './marker/workflow-model-validator';
36
+ export * from './model/workflow-navigation-target-resolver';
37
+ export * from './provider/abstract-next-or-previous-navigation-target-provider';
38
+ export * from './provider/next-node-navigation-target-provider';
39
+ export * from './provider/node-documentation-navigation-target-provider';
40
+ export * from './provider/previous-node-navigation-target-provider';
41
+ export * from './provider/workflow-command-palette-action-provider';
42
+ export * from './provider/workflow-context-menu-item-provider';
43
+ export * from './taskedit/edit-task-operation-handler';
44
+ export * from './taskedit/task-edit-context-provider';
45
+ export * from './taskedit/task-edit-validator';
46
+ export * from './util/model-types';
47
+ export * from './workflow-diagram-configuration';
48
+ export * from './workflow-diagram-module';
49
+ export * from './workflow-glsp-server';
50
+ export * from './workflow-popup-factory';
package/src/node/app.ts CHANGED
@@ -13,38 +13,33 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
+ import 'reflect-metadata';
17
+
16
18
  import { configureELKLayoutModule } from '@eclipse-glsp/layout-elk';
17
- import {
18
- createAppModule,
19
- createSocketCliParser,
20
- GModelStorage,
21
- Logger,
22
- LoggerFactory,
23
- SocketServerLauncher
24
- } from '@eclipse-glsp/server/node';
19
+ import { createAppModule, GModelStorage, SocketServerLauncher, WebSocketServerLauncher } from '@eclipse-glsp/server/node';
25
20
  import { Container } from 'inversify';
21
+
26
22
  import { WorkflowLayoutConfigurator } from '../common/layout/workflow-layout-configurator';
27
23
  import { WorkflowDiagramModule, WorkflowServerModule } from '../common/workflow-diagram-module';
24
+ import { createWorkflowCliParser } from './workflow-cli-parser';
28
25
 
29
- export async function launch(argv?: string[]): Promise<void> {
30
- let logger: Logger | undefined;
31
- try {
32
- const options = createSocketCliParser().parse(argv);
33
- const appContainer = new Container();
34
- appContainer.load(createAppModule(options));
26
+ async function launch(argv?: string[]): Promise<void> {
27
+ const options = createWorkflowCliParser().parse(argv);
28
+ const appContainer = new Container();
29
+ appContainer.load(createAppModule(options));
35
30
 
36
- logger = appContainer.get<LoggerFactory>(LoggerFactory)('WorkflowServerApp');
37
- const launcher = appContainer.resolve(SocketServerLauncher);
38
- const elkLayoutModule = configureELKLayoutModule({ algorithms: ['layered'], layoutConfigurator: WorkflowLayoutConfigurator });
39
- const serverModule = new WorkflowServerModule().configureDiagramModule(
40
- new WorkflowDiagramModule(() => GModelStorage),
41
- elkLayoutModule
42
- );
31
+ const elkLayoutModule = configureELKLayoutModule({ algorithms: ['layered'], layoutConfigurator: WorkflowLayoutConfigurator });
32
+ const serverModule = new WorkflowServerModule().configureDiagramModule(new WorkflowDiagramModule(() => GModelStorage), elkLayoutModule);
43
33
 
34
+ if (options.webSocket) {
35
+ const launcher = appContainer.resolve(WebSocketServerLauncher);
36
+ launcher.configure(serverModule);
37
+ launcher.start({ port: options.port, host: options.host, path: 'workflow' });
38
+ } else {
39
+ const launcher = appContainer.resolve(SocketServerLauncher);
44
40
  launcher.configure(serverModule);
45
-
46
41
  launcher.start({ port: options.port, host: options.host });
47
- } catch (error) {
48
- (logger ?? console).error('Error in workflow server launcher:', error);
49
42
  }
50
43
  }
44
+
45
+ launch(process.argv).catch(error => console.error('Error in workflow server launcher:', error));
package/src/node/index.ts CHANGED
@@ -13,7 +13,5 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import 'reflect-metadata';
17
- import { launch } from './app';
18
-
19
- launch(process.argv);
16
+ export * from '../common/index';
17
+ export * from './workflow-cli-parser';
@@ -0,0 +1,29 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2022-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 { CliParser, createSocketCliParser, defaultSocketLaunchOptions, SocketLaunchOptions } from '@eclipse-glsp/server/node';
18
+
19
+ export interface WorkflowLaunchOptions extends SocketLaunchOptions {
20
+ webSocket: boolean;
21
+ }
22
+
23
+ export function createWorkflowCliParser<O extends WorkflowLaunchOptions = WorkflowLaunchOptions>(
24
+ defaultOptions: WorkflowLaunchOptions = { webSocket: false, ...defaultSocketLaunchOptions }
25
+ ): CliParser<O> {
26
+ const parser = createSocketCliParser<O>(defaultOptions);
27
+ parser.command.option('-w , --webSocket', 'Flag to use websocket launcher instead of default launcher', false);
28
+ return parser;
29
+ }