@eclipse-glsp/server 1.1.0-RC07 → 1.1.0-RC09
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/lib/browser/di/app-module.d.ts +2 -7
- package/lib/browser/di/app-module.d.ts.map +1 -1
- package/lib/browser/di/app-module.js +5 -30
- package/lib/browser/di/app-module.js.map +1 -1
- package/lib/browser/index.d.ts +0 -1
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +0 -1
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/launch/worker-server-launcher.d.ts +4 -4
- package/lib/browser/launch/worker-server-launcher.d.ts.map +1 -1
- package/lib/browser/launch/worker-server-launcher.js +5 -11
- package/lib/browser/launch/worker-server-launcher.js.map +1 -1
- package/lib/common/actions/client-action-handler.d.ts +1 -2
- package/lib/common/actions/client-action-handler.d.ts.map +1 -1
- package/lib/common/actions/client-action-handler.js +17 -2
- package/lib/common/actions/client-action-handler.js.map +1 -1
- package/lib/common/command/command-stack.d.ts +16 -1
- package/lib/common/command/command-stack.d.ts.map +1 -1
- package/lib/common/command/command-stack.js +0 -15
- package/lib/common/command/command-stack.js.map +1 -1
- package/lib/common/di/client-session-module.d.ts +1 -1
- package/lib/common/di/client-session-module.d.ts.map +1 -1
- package/lib/common/di/client-session-module.js +2 -2
- package/lib/common/di/client-session-module.js.map +1 -1
- package/lib/common/di/glsp-module.d.ts +3 -1
- package/lib/common/di/glsp-module.d.ts.map +1 -1
- package/lib/common/di/glsp-module.js +0 -15
- package/lib/common/di/glsp-module.js.map +1 -1
- package/lib/common/di/multi-binding.d.ts +19 -4
- package/lib/common/di/multi-binding.d.ts.map +1 -1
- package/lib/common/di/multi-binding.js.map +1 -1
- package/lib/common/di/server-module.d.ts +1 -6
- package/lib/common/di/server-module.d.ts.map +1 -1
- package/lib/common/di/server-module.js +21 -17
- package/lib/common/di/server-module.js.map +1 -1
- package/lib/common/index.d.ts +1 -2
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +1 -2
- package/lib/common/index.js.map +1 -1
- package/lib/common/launch/glsp-server-launcher.d.ts +1 -1
- package/lib/common/launch/glsp-server-launcher.d.ts.map +1 -1
- package/lib/common/launch/glsp-server-launcher.js +2 -2
- package/lib/common/launch/glsp-server-launcher.js.map +1 -1
- package/lib/common/launch/jsonrpc-server-launcher.d.ts +38 -0
- package/lib/common/launch/jsonrpc-server-launcher.d.ts.map +1 -0
- package/lib/common/launch/jsonrpc-server-launcher.js +84 -0
- package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -0
- package/lib/common/protocol/glsp-server.d.ts +4 -104
- package/lib/common/protocol/glsp-server.d.ts.map +1 -1
- package/lib/common/protocol/glsp-server.js +13 -20
- package/lib/common/protocol/glsp-server.js.map +1 -1
- package/lib/common/session/client-session-factory.d.ts +1 -2
- package/lib/common/session/client-session-factory.d.ts.map +1 -1
- package/lib/common/session/client-session-factory.js +17 -2
- package/lib/common/session/client-session-factory.js.map +1 -1
- package/lib/common/session/client-session-manager.d.ts +1 -3
- package/lib/common/session/client-session-manager.d.ts.map +1 -1
- package/lib/common/session/client-session-manager.js.map +1 -1
- package/lib/{browser/di → common/utils}/console-logger.d.ts +7 -1
- package/lib/common/utils/console-logger.d.ts.map +1 -0
- package/lib/{browser/di → common/utils}/console-logger.js +26 -8
- package/lib/common/utils/console-logger.js.map +1 -0
- package/lib/common/utils/logger.d.ts +21 -0
- package/lib/common/utils/logger.d.ts.map +1 -1
- package/lib/common/utils/logger.js +12 -1
- package/lib/common/utils/logger.js.map +1 -1
- package/lib/node/di/app-module.d.ts +2 -2
- package/lib/node/di/app-module.d.ts.map +1 -1
- package/lib/node/di/app-module.js +10 -35
- package/lib/node/di/app-module.js.map +1 -1
- package/lib/node/launch/cli-parser.d.ts +2 -3
- package/lib/node/launch/cli-parser.d.ts.map +1 -1
- package/lib/node/launch/cli-parser.js.map +1 -1
- package/lib/node/launch/socket-cli-parser.js +1 -1
- package/lib/node/launch/socket-cli-parser.js.map +1 -1
- package/lib/node/launch/socket-server-launcher.d.ts +2 -23
- package/lib/node/launch/socket-server-launcher.d.ts.map +1 -1
- package/lib/node/launch/socket-server-launcher.js +8 -28
- package/lib/node/launch/socket-server-launcher.js.map +1 -1
- package/lib/node/launch/websocket-server-launcher.d.ts +2 -8
- package/lib/node/launch/websocket-server-launcher.d.ts.map +1 -1
- package/lib/node/launch/websocket-server-launcher.js +4 -28
- package/lib/node/launch/websocket-server-launcher.js.map +1 -1
- package/package.json +4 -4
- package/src/browser/di/app-module.ts +4 -32
- package/src/browser/index.ts +0 -1
- package/src/browser/launch/worker-server-launcher.ts +7 -13
- package/src/common/actions/client-action-handler.ts +1 -2
- package/src/common/command/command-stack.ts +1 -1
- package/src/common/di/client-session-module.ts +1 -1
- package/src/common/di/glsp-module.ts +3 -1
- package/src/common/di/multi-binding.ts +4 -5
- package/src/common/di/server-module.ts +6 -21
- package/src/common/index.ts +1 -2
- package/src/common/launch/glsp-server-launcher.ts +2 -2
- package/src/common/launch/jsonrpc-server-launcher.ts +95 -0
- package/src/common/protocol/glsp-server.spec.ts +7 -4
- package/src/common/protocol/glsp-server.ts +17 -132
- package/src/common/session/client-session-factory.spec.ts +1 -1
- package/src/common/session/client-session-factory.ts +1 -2
- package/src/common/session/client-session-manager.ts +1 -3
- package/src/common/test/mock-util.ts +5 -5
- package/src/{browser/di → common/utils}/console-logger.ts +19 -1
- package/src/common/utils/logger.ts +16 -1
- package/src/node/di/app-module.ts +4 -13
- package/src/node/launch/cli-parser.ts +2 -3
- package/src/node/launch/socket-cli-parser.ts +1 -1
- package/src/node/launch/socket-server-launcher.spec.ts +6 -0
- package/src/node/launch/socket-server-launcher.ts +8 -30
- package/src/node/launch/websocket-server-launcher.ts +5 -31
- package/lib/browser/di/console-logger.d.ts.map +0 -1
- package/lib/browser/di/console-logger.js.map +0 -1
- package/lib/common/actions/action-dispatcher.spec.d.ts +0 -2
- package/lib/common/actions/action-dispatcher.spec.d.ts.map +0 -1
- package/lib/common/actions/action-dispatcher.spec.js +0 -264
- package/lib/common/actions/action-dispatcher.spec.js.map +0 -1
- package/lib/common/actions/action-handler-registry.spec.d.ts +0 -2
- package/lib/common/actions/action-handler-registry.spec.d.ts.map +0 -1
- package/lib/common/actions/action-handler-registry.spec.js +0 -50
- package/lib/common/actions/action-handler-registry.spec.js.map +0 -1
- package/lib/common/actions/global-action-provider.spec.d.ts +0 -2
- package/lib/common/actions/global-action-provider.spec.d.ts.map +0 -1
- package/lib/common/actions/global-action-provider.spec.js +0 -70
- package/lib/common/actions/global-action-provider.spec.js.map +0 -1
- package/lib/common/command/command-stack.spec.d.ts +0 -2
- package/lib/common/command/command-stack.spec.d.ts.map +0 -1
- package/lib/common/command/command-stack.spec.js +0 -207
- package/lib/common/command/command-stack.spec.js.map +0 -1
- package/lib/common/command/command.spec.d.ts +0 -2
- package/lib/common/command/command.spec.d.ts.map +0 -1
- package/lib/common/command/command.spec.js +0 -86
- package/lib/common/command/command.spec.js.map +0 -1
- package/lib/common/command/recording-command.spec.d.ts +0 -17
- package/lib/common/command/recording-command.spec.d.ts.map +0 -1
- package/lib/common/command/recording-command.spec.js +0 -62
- package/lib/common/command/recording-command.spec.js.map +0 -1
- package/lib/common/di/binding-target.spec.d.ts +0 -2
- package/lib/common/di/binding-target.spec.d.ts.map +0 -1
- package/lib/common/di/binding-target.spec.js +0 -121
- package/lib/common/di/binding-target.spec.js.map +0 -1
- package/lib/common/di/multi-bindings.spec.d.ts +0 -2
- package/lib/common/di/multi-bindings.spec.d.ts.map +0 -1
- package/lib/common/di/multi-bindings.spec.js +0 -137
- package/lib/common/di/multi-bindings.spec.js.map +0 -1
- package/lib/common/diagram/request-type-hints-action-handler.spec.d.ts +0 -2
- package/lib/common/diagram/request-type-hints-action-handler.spec.d.ts.map +0 -1
- package/lib/common/diagram/request-type-hints-action-handler.spec.js +0 -57
- package/lib/common/diagram/request-type-hints-action-handler.spec.js.map +0 -1
- package/lib/common/features/contextactions/context-actions-provider-registry.spec.d.ts +0 -2
- package/lib/common/features/contextactions/context-actions-provider-registry.spec.d.ts.map +0 -1
- package/lib/common/features/contextactions/context-actions-provider-registry.spec.js +0 -34
- package/lib/common/features/contextactions/context-actions-provider-registry.spec.js.map +0 -1
- package/lib/common/features/contextactions/request-context-actions-handler.spec.d.ts +0 -2
- package/lib/common/features/contextactions/request-context-actions-handler.spec.d.ts.map +0 -1
- package/lib/common/features/contextactions/request-context-actions-handler.spec.js +0 -63
- package/lib/common/features/contextactions/request-context-actions-handler.spec.js.map +0 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.spec.d.ts +0 -2
- package/lib/common/features/contextactions/tool-palette-item-provider.spec.d.ts.map +0 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.spec.js +0 -48
- package/lib/common/features/contextactions/tool-palette-item-provider.spec.js.map +0 -1
- package/lib/common/features/directediting/context-edit-validator-registry.spec.d.ts +0 -2
- package/lib/common/features/directediting/context-edit-validator-registry.spec.d.ts.map +0 -1
- package/lib/common/features/directediting/context-edit-validator-registry.spec.js +0 -44
- package/lib/common/features/directediting/context-edit-validator-registry.spec.js.map +0 -1
- package/lib/common/features/directediting/request-edit-validation-handler.spec.d.ts +0 -2
- package/lib/common/features/directediting/request-edit-validation-handler.spec.d.ts.map +0 -1
- package/lib/common/features/directediting/request-edit-validation-handler.spec.js +0 -97
- package/lib/common/features/directediting/request-edit-validation-handler.spec.js.map +0 -1
- package/lib/common/features/model/gmodel-serializer.spec.d.ts +0 -2
- package/lib/common/features/model/gmodel-serializer.spec.d.ts.map +0 -1
- package/lib/common/features/model/gmodel-serializer.spec.js +0 -124
- package/lib/common/features/model/gmodel-serializer.spec.js.map +0 -1
- package/lib/common/operations/operation-handler-registry.spec.d.ts +0 -2
- package/lib/common/operations/operation-handler-registry.spec.d.ts.map +0 -1
- package/lib/common/operations/operation-handler-registry.spec.js +0 -50
- package/lib/common/operations/operation-handler-registry.spec.js.map +0 -1
- package/lib/common/protocol/glsp-client-proxy.d.ts +0 -45
- package/lib/common/protocol/glsp-client-proxy.d.ts.map +0 -1
- package/lib/common/protocol/glsp-client-proxy.js +0 -53
- package/lib/common/protocol/glsp-client-proxy.js.map +0 -1
- package/lib/common/protocol/glsp-server-listener.d.ts +0 -37
- package/lib/common/protocol/glsp-server-listener.d.ts.map +0 -1
- package/lib/common/protocol/glsp-server-listener.js +0 -5
- package/lib/common/protocol/glsp-server-listener.js.map +0 -1
- package/lib/common/protocol/glsp-server.spec.d.ts +0 -2
- package/lib/common/protocol/glsp-server.spec.d.ts.map +0 -1
- package/lib/common/protocol/glsp-server.spec.js +0 -119
- package/lib/common/protocol/glsp-server.spec.js.map +0 -1
- package/lib/common/session/client-session-factory.spec.d.ts +0 -2
- package/lib/common/session/client-session-factory.spec.d.ts.map +0 -1
- package/lib/common/session/client-session-factory.spec.js +0 -56
- package/lib/common/session/client-session-factory.spec.js.map +0 -1
- package/lib/common/session/client-session-manager.spec.d.ts +0 -2
- package/lib/common/session/client-session-manager.spec.d.ts.map +0 -1
- package/lib/common/session/client-session-manager.spec.js +0 -74
- package/lib/common/session/client-session-manager.spec.js.map +0 -1
- package/lib/common/test/mock-util.d.ts +0 -123
- package/lib/common/test/mock-util.d.ts.map +0 -1
- package/lib/common/test/mock-util.js +0 -216
- package/lib/common/test/mock-util.js.map +0 -1
- package/lib/common/utils/promise-queue.spec.d.ts +0 -2
- package/lib/common/utils/promise-queue.spec.d.ts.map +0 -1
- package/lib/common/utils/promise-queue.spec.js +0 -117
- package/lib/common/utils/promise-queue.spec.js.map +0 -1
- package/lib/common/utils/registry.spec.d.ts +0 -2
- package/lib/common/utils/registry.spec.d.ts.map +0 -1
- package/lib/common/utils/registry.spec.js +0 -199
- package/lib/common/utils/registry.spec.js.map +0 -1
- package/lib/node/launch/cli-parser.spec.d.ts +0 -2
- package/lib/node/launch/cli-parser.spec.d.ts.map +0 -1
- package/lib/node/launch/cli-parser.spec.js +0 -56
- package/lib/node/launch/cli-parser.spec.js.map +0 -1
- package/lib/node/launch/socket-cli-parser.spec.d.ts +0 -2
- package/lib/node/launch/socket-cli-parser.spec.d.ts.map +0 -1
- package/lib/node/launch/socket-cli-parser.spec.js +0 -66
- package/lib/node/launch/socket-cli-parser.spec.js.map +0 -1
- package/lib/node/launch/socket-server-launcher.spec.d.ts +0 -17
- package/lib/node/launch/socket-server-launcher.spec.d.ts.map +0 -1
- package/lib/node/launch/socket-server-launcher.spec.js +0 -70
- package/lib/node/launch/socket-server-launcher.spec.js.map +0 -1
- package/src/common/protocol/glsp-client-proxy.ts +0 -65
- package/src/common/protocol/glsp-server-listener.ts +0 -39
|
@@ -13,11 +13,11 @@
|
|
|
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 { expect } from 'chai';
|
|
17
18
|
import { Container, ContainerModule } from 'inversify';
|
|
18
19
|
import { ActionDispatcher } from '../actions/action-dispatcher';
|
|
19
20
|
import { DiagramModules, InjectionContainer } from '../di/service-identifiers';
|
|
20
|
-
import { GLSPClientProxy } from '../protocol/glsp-client-proxy';
|
|
21
21
|
import * as mock from '../test/mock-util';
|
|
22
22
|
import { GLSPServerError } from '../utils/glsp-server-error';
|
|
23
23
|
import { Logger } from '../utils/logger';
|
|
@@ -13,12 +13,11 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { InitializeClientSessionParameters } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { GLSPClientProxy, InitializeClientSessionParameters } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { Container, ContainerModule, inject, injectable } from 'inversify';
|
|
18
18
|
import { ActionDispatcher } from '../actions/action-dispatcher';
|
|
19
19
|
import { createClientSessionModule } from '../di/client-session-module';
|
|
20
20
|
import { DiagramModules, InjectionContainer } from '../di/service-identifiers';
|
|
21
|
-
import { GLSPClientProxy } from '../protocol/glsp-client-proxy';
|
|
22
21
|
import { GLSPServerError } from '../utils/glsp-server-error';
|
|
23
22
|
import { ClientSession, DefaultClientSession } from './client-session';
|
|
24
23
|
import { ClientSessionInitializer } from './client-session-initializer';
|
|
@@ -13,10 +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 { InitializeClientSessionParameters, remove } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { GLSPServer, GLSPServerListener, InitializeClientSessionParameters, remove } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { inject, injectable } from 'inversify';
|
|
18
|
-
import { GLSPServer } from '../protocol/glsp-server';
|
|
19
|
-
import { GLSPServerListener } from '../protocol/glsp-server-listener';
|
|
20
18
|
import { GLSPServerError } from '../utils/glsp-server-error';
|
|
21
19
|
import { ClientSession } from './client-session';
|
|
22
20
|
import { ClientSessionFactory } from './client-session-factory';
|
|
@@ -23,6 +23,9 @@ import {
|
|
|
23
23
|
Args,
|
|
24
24
|
CreateNodeOperation,
|
|
25
25
|
EdgeTypeHint,
|
|
26
|
+
GLSPClientProxy,
|
|
27
|
+
GLSPServer,
|
|
28
|
+
GLSPServerListener,
|
|
26
29
|
InitializeClientSessionParameters,
|
|
27
30
|
MaybeArray,
|
|
28
31
|
MaybePromise,
|
|
@@ -41,15 +44,12 @@ import { DiagramConfiguration, ServerLayoutKind } from '../diagram/diagram-confi
|
|
|
41
44
|
import { ContextEditValidator } from '../features/directediting/context-edit-validator';
|
|
42
45
|
import { LabelEditValidator } from '../features/directediting/label-edit-validator';
|
|
43
46
|
import { GModelCreateEdgeOperationHandler, GModelCreateNodeOperationHandler } from '../gmodel/index';
|
|
44
|
-
import { JsonRpcGLSPClientProxy } from '../protocol/glsp-client-proxy';
|
|
45
|
-
import { GLSPServer } from '../protocol/glsp-server';
|
|
46
|
-
import { GLSPServerListener } from '../protocol/glsp-server-listener';
|
|
47
47
|
import { ClientSession } from '../session/client-session';
|
|
48
48
|
import { ClientSessionFactory } from '../session/client-session-factory';
|
|
49
49
|
import { ClientSessionInitializer } from '../session/client-session-initializer';
|
|
50
50
|
import { ClientSessionListener } from '../session/client-session-listener';
|
|
51
51
|
import { ClientSessionManager } from '../session/client-session-manager';
|
|
52
|
-
import {
|
|
52
|
+
import { LogLevel, Logger } from '../utils/logger';
|
|
53
53
|
|
|
54
54
|
export async function delay(ms: number): Promise<void> {
|
|
55
55
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
@@ -194,7 +194,7 @@ export class StubClientSessionListener implements ClientSessionListener {
|
|
|
194
194
|
sessionDisposed(clientSession: ClientSession): void {}
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
export class StubGLSPClientProxy implements
|
|
197
|
+
export class StubGLSPClientProxy implements GLSPClientProxy {
|
|
198
198
|
connect(connection: MessageConnection): void {}
|
|
199
199
|
|
|
200
200
|
process(message: ActionMessage<Action>): void {}
|
|
@@ -14,9 +14,14 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
+
import { BindingContext } from '@eclipse-glsp/protocol';
|
|
17
18
|
import { injectable } from 'inversify';
|
|
18
|
-
import { Logger,
|
|
19
|
+
import { LogLevel, Logger, LoggerConfigOptions, LoggerFactory, NullLogger, getRequestParentName } from './logger';
|
|
19
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Simple logger implementation that forwards logging calls to the `console` and
|
|
23
|
+
* can be used in both the browser and node context.
|
|
24
|
+
*/
|
|
20
25
|
@injectable()
|
|
21
26
|
export class ConsoleLogger extends Logger {
|
|
22
27
|
constructor(public logLevel: LogLevel = LogLevel.none, public caller?: string) {
|
|
@@ -69,3 +74,16 @@ export class ConsoleLogger extends Logger {
|
|
|
69
74
|
return JSON.stringify(param, undefined, 4);
|
|
70
75
|
}
|
|
71
76
|
}
|
|
77
|
+
|
|
78
|
+
export function configureConsoleLogger<T extends LoggerConfigOptions>(context: BindingContext, options: T): void {
|
|
79
|
+
if (!options.consoleLog) {
|
|
80
|
+
context.bind(Logger).to(NullLogger).inSingletonScope();
|
|
81
|
+
} else {
|
|
82
|
+
context.bind(Logger).toDynamicValue(ctx => new ConsoleLogger(options.logLevel, getRequestParentName(ctx)));
|
|
83
|
+
}
|
|
84
|
+
context.bind(LoggerFactory).toFactory(dynamicContext => (caller: string) => {
|
|
85
|
+
const logger = dynamicContext.container.get(Logger);
|
|
86
|
+
logger.caller = caller;
|
|
87
|
+
return logger;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { injectable } from 'inversify';
|
|
16
|
+
import { injectable, interfaces } from 'inversify';
|
|
17
17
|
|
|
18
18
|
@injectable()
|
|
19
19
|
export abstract class Logger {
|
|
@@ -70,3 +70,18 @@ export function asLogLevel(level: string | number): LogLevel | undefined {
|
|
|
70
70
|
}
|
|
71
71
|
return undefined;
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
export interface LoggerConfigOptions {
|
|
75
|
+
consoleLog?: boolean;
|
|
76
|
+
logLevel?: LogLevel;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function getRequestParentName(context: interfaces.Context): string | undefined {
|
|
80
|
+
if (context.currentRequest.parentRequest) {
|
|
81
|
+
const bindings = context.currentRequest.parentRequest.bindings;
|
|
82
|
+
if (bindings.length > 0) {
|
|
83
|
+
return bindings[0].implementationType?.name;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
16
|
+
import { BindingContext } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { ContainerModule } from 'inversify';
|
|
17
18
|
import * as winston from 'winston';
|
|
18
|
-
import { InjectionContainer, Logger, LoggerFactory,
|
|
19
|
+
import { InjectionContainer, LogLevel, Logger, LoggerFactory, getRequestParentName } from '../../common';
|
|
19
20
|
import { LaunchOptions } from '../launch/cli-parser';
|
|
20
21
|
import { WinstonLogger } from './winston-logger';
|
|
21
22
|
|
|
@@ -68,7 +69,7 @@ export function createWinstonInstance<T extends LaunchOptions>(options: T): wins
|
|
|
68
69
|
* @param baseLoggerCreator The underling global {@link winston.Logger} instance.
|
|
69
70
|
*/
|
|
70
71
|
export function configureWinstonLogger<T extends LaunchOptions>(
|
|
71
|
-
context:
|
|
72
|
+
context: BindingContext,
|
|
72
73
|
options: T,
|
|
73
74
|
rebind = true,
|
|
74
75
|
baseLoggerCreator: (launchOptions: T) => winston.Logger = createWinstonInstance
|
|
@@ -90,13 +91,3 @@ export function configureWinstonLogger<T extends LaunchOptions>(
|
|
|
90
91
|
return logger;
|
|
91
92
|
});
|
|
92
93
|
}
|
|
93
|
-
|
|
94
|
-
function getRequestParentName(context: interfaces.Context): string | undefined {
|
|
95
|
-
if (context.currentRequest.parentRequest) {
|
|
96
|
-
const bindings = context.currentRequest.parentRequest.bindings;
|
|
97
|
-
if (bindings.length > 0) {
|
|
98
|
-
return bindings[0].implementationType?.name;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return undefined;
|
|
102
|
-
}
|
|
@@ -16,13 +16,12 @@
|
|
|
16
16
|
import * as cmd from 'commander';
|
|
17
17
|
import * as fs from 'fs-extra';
|
|
18
18
|
import * as path from 'path';
|
|
19
|
-
import {
|
|
19
|
+
import { LogLevel, LoggerConfigOptions, asLogLevel } from '../../common/utils/logger';
|
|
20
20
|
|
|
21
|
-
export interface LaunchOptions {
|
|
21
|
+
export interface LaunchOptions extends LoggerConfigOptions {
|
|
22
22
|
logLevel: LogLevel;
|
|
23
23
|
logDir?: string;
|
|
24
24
|
fileLog: boolean;
|
|
25
|
-
consoleLog: boolean;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
export interface CliParser<O extends LaunchOptions = LaunchOptions> {
|
|
@@ -14,9 +14,12 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
+
import { GLSPServer } from '@eclipse-glsp/protocol';
|
|
17
18
|
import { expect } from 'chai';
|
|
18
19
|
import { Container } from 'inversify';
|
|
19
20
|
import * as net from 'net';
|
|
21
|
+
import * as sinon from 'sinon';
|
|
22
|
+
import { DefaultGLSPServer } from '../../common/protocol/glsp-server';
|
|
20
23
|
import { createAppModule } from '../di/app-module';
|
|
21
24
|
import { defaultSocketLaunchOptions } from './socket-cli-parser';
|
|
22
25
|
import { SocketServerLauncher } from './socket-server-launcher';
|
|
@@ -24,7 +27,10 @@ const severPort = 5008;
|
|
|
24
27
|
describe('test SocketServerLauncher', () => {
|
|
25
28
|
it('starts and stops', async () => {
|
|
26
29
|
const appContainer = new Container();
|
|
30
|
+
const serverStub = sinon.createStubInstance(DefaultGLSPServer);
|
|
27
31
|
appContainer.load(createAppModule(defaultSocketLaunchOptions));
|
|
32
|
+
|
|
33
|
+
appContainer.bind(GLSPServer).toConstantValue(serverStub);
|
|
28
34
|
const launcher = appContainer.resolve(SocketServerLauncher);
|
|
29
35
|
launcher.start({ port: severPort });
|
|
30
36
|
const sockStart = new net.Socket();
|
|
@@ -13,36 +13,35 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
16
|
+
import { Disposable } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { inject, injectable } from 'inversify';
|
|
17
18
|
import * as net from 'net';
|
|
18
19
|
import * as jsonrpc from 'vscode-jsonrpc/node';
|
|
19
|
-
import {
|
|
20
|
-
import { GLSPServerLauncher } from '../../common/launch/glsp-server-launcher';
|
|
21
|
-
import { GLSPServer, JsonRpcGLSPServer } from '../../common/protocol/glsp-server';
|
|
20
|
+
import { JsonRpcGLSPServerLauncher } from '../../common/launch/jsonrpc-server-launcher';
|
|
22
21
|
import { Logger } from '../../common/utils/logger';
|
|
23
22
|
|
|
24
23
|
export const START_UP_COMPLETE_MSG = '[GLSP-Server]:Startup completed. Accepting requests on port:';
|
|
25
24
|
|
|
26
25
|
@injectable()
|
|
27
|
-
export class SocketServerLauncher extends
|
|
26
|
+
export class SocketServerLauncher extends JsonRpcGLSPServerLauncher<net.TcpSocketConnectOpts> {
|
|
28
27
|
@inject(Logger) protected override logger: Logger;
|
|
29
28
|
|
|
30
|
-
protected currentConnections: jsonrpc.MessageConnection[] = [];
|
|
31
|
-
protected startupCompleteMessage = START_UP_COMPLETE_MSG;
|
|
32
29
|
protected netServer: net.Server;
|
|
33
30
|
|
|
34
31
|
constructor() {
|
|
35
32
|
super();
|
|
36
33
|
this.toDispose.push(
|
|
37
34
|
Disposable.create(() => {
|
|
38
|
-
this.currentConnections.forEach(connection => connection.dispose());
|
|
39
35
|
this.netServer.close();
|
|
40
36
|
})
|
|
41
37
|
);
|
|
42
38
|
}
|
|
43
39
|
|
|
44
40
|
protected run(opts: net.TcpSocketConnectOpts): Promise<void> {
|
|
45
|
-
this.netServer = net.createServer(socket =>
|
|
41
|
+
this.netServer = net.createServer(socket => {
|
|
42
|
+
const connection = this.createConnection(socket);
|
|
43
|
+
this.createServerInstance(connection);
|
|
44
|
+
});
|
|
46
45
|
|
|
47
46
|
this.netServer.listen(opts.port, opts.host);
|
|
48
47
|
this.netServer.on('listening', () => {
|
|
@@ -69,27 +68,6 @@ export class SocketServerLauncher extends GLSPServerLauncher<net.TcpSocketConnec
|
|
|
69
68
|
});
|
|
70
69
|
}
|
|
71
70
|
|
|
72
|
-
protected async createClientConnection(socket: net.Socket): Promise<void> {
|
|
73
|
-
const container = this.createContainer();
|
|
74
|
-
const connection = this.createConnection(socket);
|
|
75
|
-
this.currentConnections.push(connection);
|
|
76
|
-
const glspServer = container.get<JsonRpcGLSPServer>(JsonRpcGLSPServer);
|
|
77
|
-
glspServer.connect(connection);
|
|
78
|
-
this.logger.info(`Starting GLSP server connection for client: '${socket.localAddress}'`);
|
|
79
|
-
connection.listen();
|
|
80
|
-
connection.onDispose(() => this.disposeClientConnection(container, glspServer));
|
|
81
|
-
socket.on('close', () => this.disposeClientConnection(container, glspServer));
|
|
82
|
-
return new Promise((resolve, rejects) => {
|
|
83
|
-
connection.onClose(() => resolve(undefined));
|
|
84
|
-
connection.onError(error => rejects(error));
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
protected disposeClientConnection(container: Container, glspServer: GLSPServer): void {
|
|
89
|
-
glspServer.shutdown();
|
|
90
|
-
container.unbindAll();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
71
|
protected createConnection(socket: net.Socket): jsonrpc.MessageConnection {
|
|
94
72
|
return jsonrpc.createMessageConnection(new jsonrpc.SocketMessageReader(socket), new jsonrpc.SocketMessageWriter(socket), console);
|
|
95
73
|
}
|
|
@@ -16,14 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
import { createWebSocketConnection, Disposable, MaybePromise, WebSocketWrapper } from '@eclipse-glsp/protocol';
|
|
18
18
|
import * as http from 'http';
|
|
19
|
-
import {
|
|
19
|
+
import { inject, injectable } from 'inversify';
|
|
20
20
|
import * as net from 'net';
|
|
21
21
|
import * as jsonrpc from 'vscode-jsonrpc';
|
|
22
22
|
import { Server, WebSocket } from 'ws';
|
|
23
|
-
import {
|
|
24
|
-
import { GLSPServer, JsonRpcGLSPServer } from '../../common/protocol/glsp-server';
|
|
23
|
+
import { JsonRpcGLSPServerLauncher } from '../../common/launch/jsonrpc-server-launcher';
|
|
25
24
|
import { Logger } from '../../common/utils/logger';
|
|
26
|
-
import { START_UP_COMPLETE_MSG } from './socket-server-launcher';
|
|
27
25
|
|
|
28
26
|
export interface WebSocketServerOptions {
|
|
29
27
|
host?: string;
|
|
@@ -46,19 +44,16 @@ export interface WebsocketConnectionData {
|
|
|
46
44
|
const STATUS_UPGRADE_REQUIRED = 426;
|
|
47
45
|
|
|
48
46
|
@injectable()
|
|
49
|
-
export class WebSocketServerLauncher extends
|
|
47
|
+
export class WebSocketServerLauncher extends JsonRpcGLSPServerLauncher<WebSocketServerOptions> {
|
|
50
48
|
@inject(Logger)
|
|
51
49
|
protected override logger: Logger;
|
|
52
50
|
|
|
53
51
|
protected server: Server;
|
|
54
|
-
protected startupCompleteMessage = START_UP_COMPLETE_MSG;
|
|
55
|
-
protected currentConnections: jsonrpc.MessageConnection[] = [];
|
|
56
52
|
|
|
57
53
|
constructor() {
|
|
58
54
|
super();
|
|
59
55
|
this.toDispose.push(
|
|
60
56
|
Disposable.create(() => {
|
|
61
|
-
this.currentConnections.forEach(connection => connection.dispose());
|
|
62
57
|
this.server.close();
|
|
63
58
|
})
|
|
64
59
|
);
|
|
@@ -72,7 +67,8 @@ export class WebSocketServerLauncher extends GLSPServerLauncher<WebSocketServerO
|
|
|
72
67
|
console.log(this.startupCompleteMessage.concat(resolvedOptions.port.toString()));
|
|
73
68
|
|
|
74
69
|
this.server.on('connection', (ws, req) => {
|
|
75
|
-
this.
|
|
70
|
+
const connection = this.createConnection(ws);
|
|
71
|
+
this.createServerInstance(connection);
|
|
76
72
|
});
|
|
77
73
|
|
|
78
74
|
return new Promise((resolve, reject) => {
|
|
@@ -81,28 +77,6 @@ export class WebSocketServerLauncher extends GLSPServerLauncher<WebSocketServerO
|
|
|
81
77
|
});
|
|
82
78
|
}
|
|
83
79
|
|
|
84
|
-
protected async createClientConnection(socket: WebSocket): Promise<void> {
|
|
85
|
-
const container = this.createContainer();
|
|
86
|
-
const connection = this.createConnection(socket);
|
|
87
|
-
this.currentConnections.push(connection);
|
|
88
|
-
const glspServer = container.get<JsonRpcGLSPServer>(JsonRpcGLSPServer);
|
|
89
|
-
glspServer.connect(connection);
|
|
90
|
-
this.logger.info('Starting GLSP server connection');
|
|
91
|
-
connection.listen();
|
|
92
|
-
connection.onDispose(() => this.disposeClientConnection(container, glspServer));
|
|
93
|
-
socket.on('close', () => this.disposeClientConnection(container, glspServer));
|
|
94
|
-
connection.onClose(() => console.log('GOD dam'));
|
|
95
|
-
return new Promise((resolve, rejects) => {
|
|
96
|
-
connection.onClose(() => resolve(undefined));
|
|
97
|
-
connection.onError(error => rejects(error));
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
protected disposeClientConnection(container: Container, glspServer: GLSPServer): void {
|
|
102
|
-
glspServer.shutdown();
|
|
103
|
-
container.unbindAll();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
80
|
protected createConnection(socket: WebSocket): jsonrpc.MessageConnection {
|
|
107
81
|
return createWebSocketConnection(wrapWebSocket(socket));
|
|
108
82
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"console-logger.d.ts","sourceRoot":"","sources":["../../../src/browser/di/console-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAGlF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEtD,qBACa,aAAc,SAAQ,MAAM;IAClB,QAAQ,EAAE,QAAQ;IAAyB,MAAM,CAAC;gBAAlD,QAAQ,GAAE,QAAwB,EAAS,MAAM,CAAC,oBAAQ;IAI7E,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI;IAM7C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MA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CAAC;SACzB;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAA;AAlDY,aAAa;IADzB,IAAA,sBAAU,GAAE;;GACA,aAAa,CAkDzB;AAlDY,sCAAa"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-dispatcher.spec.d.ts","sourceRoot":"","sources":["../../../src/common/actions/action-dispatcher.spec.ts"],"names":[],"mappings":""}
|