@eclipse-glsp/server 1.1.0-next.f0fc2cf.63 → 2.0.0
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/launch/worker-server-launcher.js +2 -1
- package/lib/browser/launch/worker-server-launcher.js.map +1 -1
- package/lib/common/actions/action-dispatcher.d.ts +2 -1
- package/lib/common/actions/action-dispatcher.d.ts.map +1 -1
- package/lib/common/actions/action-dispatcher.js +9 -6
- package/lib/common/actions/action-dispatcher.js.map +1 -1
- package/lib/common/actions/action-handler-registry.js +4 -2
- package/lib/common/actions/action-handler-registry.js.map +1 -1
- package/lib/common/actions/client-action-handler.d.ts +17 -8
- package/lib/common/actions/client-action-handler.d.ts.map +1 -1
- package/lib/common/actions/client-action-handler.js +32 -21
- package/lib/common/actions/client-action-handler.js.map +1 -1
- package/lib/common/actions/global-action-provider.d.ts +6 -21
- package/lib/common/actions/global-action-provider.d.ts.map +1 -1
- package/lib/common/actions/global-action-provider.js +17 -21
- package/lib/common/actions/global-action-provider.js.map +1 -1
- package/lib/common/command/command-stack.js +2 -1
- package/lib/common/command/command-stack.js.map +1 -1
- package/lib/common/command/recording-command.d.ts +9 -15
- package/lib/common/command/recording-command.d.ts.map +1 -1
- package/lib/common/command/recording-command.js +12 -26
- package/lib/common/command/recording-command.js.map +1 -1
- package/lib/common/command/undo-redo-action-handler.js +2 -1
- package/lib/common/command/undo-redo-action-handler.js.map +1 -1
- package/lib/common/di/client-session-module.d.ts +9 -1
- package/lib/common/di/client-session-module.d.ts.map +1 -1
- package/lib/common/di/client-session-module.js +9 -9
- package/lib/common/di/client-session-module.js.map +1 -1
- package/lib/common/di/diagram-module.d.ts +20 -1
- package/lib/common/di/diagram-module.d.ts.map +1 -1
- package/lib/common/di/diagram-module.js +17 -56
- package/lib/common/di/diagram-module.js.map +1 -1
- package/lib/common/di/glsp-module.js +2 -1
- package/lib/common/di/glsp-module.js.map +1 -1
- package/lib/common/di/server-module.d.ts +0 -1
- package/lib/common/di/server-module.d.ts.map +1 -1
- package/lib/common/di/server-module.js +0 -1
- package/lib/common/di/server-module.js.map +1 -1
- package/lib/common/features/clipboard/request-clipboard-data-action-handler.d.ts.map +1 -1
- package/lib/common/features/clipboard/request-clipboard-data-action-handler.js +2 -1
- package/lib/common/features/clipboard/request-clipboard-data-action-handler.js.map +1 -1
- package/lib/common/features/contextactions/command-palette-action-provider.js +2 -1
- package/lib/common/features/contextactions/command-palette-action-provider.js.map +1 -1
- package/lib/common/features/contextactions/context-actions-provider-registry.js +2 -1
- package/lib/common/features/contextactions/context-actions-provider-registry.js.map +1 -1
- package/lib/common/features/contextactions/context-menu-item-provider.js +2 -1
- package/lib/common/features/contextactions/context-menu-item-provider.js.map +1 -1
- package/lib/common/features/contextactions/request-context-actions-handler.js +2 -1
- package/lib/common/features/contextactions/request-context-actions-handler.js.map +1 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.js +4 -2
- package/lib/common/features/contextactions/tool-palette-item-provider.js.map +1 -1
- package/lib/common/features/directediting/context-edit-validator-registry.js +2 -1
- package/lib/common/features/directediting/context-edit-validator-registry.js.map +1 -1
- package/lib/common/features/directediting/label-edit-validator.js +2 -1
- package/lib/common/features/directediting/label-edit-validator.js.map +1 -1
- package/lib/common/features/directediting/request-edit-validation-handler.js +2 -1
- package/lib/common/features/directediting/request-edit-validation-handler.js.map +1 -1
- package/lib/common/features/layout/computed-bounds-action-handler.js +2 -1
- package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -1
- package/lib/common/features/layout/layout-operation-handler.js +2 -1
- package/lib/common/features/layout/layout-operation-handler.js.map +1 -1
- package/lib/common/features/model/gmodel-factory.js +2 -1
- package/lib/common/features/model/gmodel-factory.js.map +1 -1
- package/lib/common/features/model/gmodel-index.js +2 -1
- package/lib/common/features/model/gmodel-index.js.map +1 -1
- package/lib/common/features/model/gmodel-serializer.d.ts +10 -10
- package/lib/common/features/model/gmodel-serializer.d.ts.map +1 -1
- package/lib/common/features/model/gmodel-serializer.js +2 -1
- package/lib/common/features/model/gmodel-serializer.js.map +1 -1
- package/lib/common/features/model/model-state.d.ts.map +1 -1
- package/lib/common/features/model/model-state.js +5 -1
- package/lib/common/features/model/model-state.js.map +1 -1
- package/lib/common/features/model/model-submission-handler.d.ts +28 -3
- package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
- package/lib/common/features/model/model-submission-handler.js +63 -8
- package/lib/common/features/model/model-submission-handler.js.map +1 -1
- package/lib/common/features/model/request-model-action-handler.d.ts.map +1 -1
- package/lib/common/features/model/request-model-action-handler.js +5 -4
- package/lib/common/features/model/request-model-action-handler.js.map +1 -1
- package/lib/common/features/model/save-model-action-handler.js +2 -1
- package/lib/common/features/model/save-model-action-handler.js.map +1 -1
- package/lib/common/features/navigation/navigation-target-provider-registry.js +2 -1
- package/lib/common/features/navigation/navigation-target-provider-registry.js.map +1 -1
- package/lib/common/features/navigation/navigation-target-resolver.js +2 -1
- package/lib/common/features/navigation/navigation-target-resolver.js.map +1 -1
- package/lib/common/features/navigation/request-navigation-targets-action-handler.js +2 -1
- package/lib/common/features/navigation/request-navigation-targets-action-handler.js.map +1 -1
- package/lib/common/features/navigation/resolve-navigation-targets-action-handler.js +2 -1
- package/lib/common/features/navigation/resolve-navigation-targets-action-handler.js.map +1 -1
- package/lib/common/features/popup/request-popup-model-action-handler.js +2 -1
- package/lib/common/features/popup/request-popup-model-action-handler.js.map +1 -1
- package/lib/common/features/progress/progress-service.js +2 -1
- package/lib/common/features/progress/progress-service.js.map +1 -1
- package/lib/common/features/type-hints/edge-creation-checker.d.ts +42 -0
- package/lib/common/features/type-hints/edge-creation-checker.d.ts.map +1 -0
- package/lib/common/features/type-hints/edge-creation-checker.js +20 -0
- package/lib/common/features/type-hints/edge-creation-checker.js.map +1 -0
- package/lib/common/features/type-hints/request-check-edge-action-handler.d.ts +29 -0
- package/lib/common/features/type-hints/request-check-edge-action-handler.d.ts.map +1 -0
- package/lib/common/features/type-hints/request-check-edge-action-handler.js +72 -0
- package/lib/common/features/type-hints/request-check-edge-action-handler.js.map +1 -0
- package/lib/common/{diagram → features/type-hints}/request-type-hints-action-handler.d.ts +2 -3
- package/lib/common/features/type-hints/request-type-hints-action-handler.d.ts.map +1 -0
- package/lib/common/{diagram → features/type-hints}/request-type-hints-action-handler.js +3 -3
- package/lib/common/features/type-hints/request-type-hints-action-handler.js.map +1 -0
- package/lib/common/features/validation/model-validator.js +2 -1
- package/lib/common/features/validation/model-validator.js.map +1 -1
- package/lib/common/features/validation/request-markers-handler.js +2 -1
- package/lib/common/features/validation/request-markers-handler.js.map +1 -1
- package/lib/common/gmodel/apply-label-edit-operation-handler.js +2 -1
- package/lib/common/gmodel/apply-label-edit-operation-handler.js.map +1 -1
- package/lib/common/gmodel/change-bounds-operation-handler.js +2 -1
- package/lib/common/gmodel/change-bounds-operation-handler.js.map +1 -1
- package/lib/common/gmodel/change-routing-points-operation-handler.js +2 -1
- package/lib/common/gmodel/change-routing-points-operation-handler.js.map +1 -1
- package/lib/common/gmodel/cut-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/cut-operation-handler.js +7 -4
- package/lib/common/gmodel/cut-operation-handler.js.map +1 -1
- package/lib/common/gmodel/delete-operation-handler.d.ts +1 -1
- package/lib/common/gmodel/delete-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/delete-operation-handler.js +7 -6
- package/lib/common/gmodel/delete-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.d.ts +3 -3
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.js +2 -1
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-create-node-operation-handler.d.ts +3 -3
- package/lib/common/gmodel/gmodel-create-node-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/gmodel-create-node-operation-handler.js +2 -1
- package/lib/common/gmodel/gmodel-create-node-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-diagram-module.js +2 -1
- package/lib/common/gmodel/gmodel-diagram-module.js.map +1 -1
- package/lib/common/gmodel/paste-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/paste-operation-handler.js +2 -1
- package/lib/common/gmodel/paste-operation-handler.js.map +1 -1
- package/lib/common/gmodel/reconnect-edge-operation-handler.js +2 -1
- package/lib/common/gmodel/reconnect-edge-operation-handler.js.map +1 -1
- package/lib/common/index.d.ts +3 -1
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +3 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/launch/glsp-server-launcher.js +2 -1
- package/lib/common/launch/glsp-server-launcher.js.map +1 -1
- package/lib/common/launch/jsonrpc-server-launcher.js +2 -1
- package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -1
- package/lib/common/operations/compound-operation-handler.d.ts +5 -0
- package/lib/common/operations/compound-operation-handler.d.ts.map +1 -1
- package/lib/common/operations/compound-operation-handler.js +8 -2
- package/lib/common/operations/compound-operation-handler.js.map +1 -1
- package/lib/common/operations/create-operation-handler.d.ts +19 -5
- package/lib/common/operations/create-operation-handler.d.ts.map +1 -1
- package/lib/common/operations/create-operation-handler.js +2 -1
- package/lib/common/operations/create-operation-handler.js.map +1 -1
- package/lib/common/operations/json-operation-handler.d.ts +94 -0
- package/lib/common/operations/json-operation-handler.d.ts.map +1 -0
- package/lib/common/operations/json-operation-handler.js +120 -0
- package/lib/common/operations/json-operation-handler.js.map +1 -0
- package/lib/common/operations/operation-action-handler.d.ts.map +1 -1
- package/lib/common/operations/operation-action-handler.js +3 -2
- package/lib/common/operations/operation-action-handler.js.map +1 -1
- package/lib/common/operations/operation-handler-registry.d.ts +1 -9
- package/lib/common/operations/operation-handler-registry.d.ts.map +1 -1
- package/lib/common/operations/operation-handler-registry.js +4 -12
- package/lib/common/operations/operation-handler-registry.js.map +1 -1
- package/lib/common/operations/operation-handler.d.ts +2 -2
- package/lib/common/operations/operation-handler.d.ts.map +1 -1
- package/lib/common/operations/operation-handler.js +2 -1
- package/lib/common/operations/operation-handler.js.map +1 -1
- package/lib/common/protocol/client-action.d.ts +31 -0
- package/lib/common/protocol/client-action.d.ts.map +1 -0
- package/lib/common/protocol/client-action.js +35 -0
- package/lib/common/protocol/client-action.js.map +1 -0
- package/lib/common/protocol/glsp-server.d.ts +1 -1
- package/lib/common/protocol/glsp-server.d.ts.map +1 -1
- package/lib/common/protocol/glsp-server.js +9 -10
- package/lib/common/protocol/glsp-server.js.map +1 -1
- package/lib/common/session/client-session-factory.js +5 -4
- package/lib/common/session/client-session-factory.js.map +1 -1
- package/lib/common/session/client-session-manager.js +2 -1
- package/lib/common/session/client-session-manager.js.map +1 -1
- package/lib/common/utils/console-logger.js +2 -1
- package/lib/common/utils/console-logger.js.map +1 -1
- package/lib/common/utils/logger.js +2 -1
- package/lib/common/utils/logger.js.map +1 -1
- package/lib/common/utils/promise-queue.d.ts.map +1 -1
- package/lib/common/utils/promise-queue.js +3 -6
- package/lib/common/utils/promise-queue.js.map +1 -1
- package/lib/common/utils/registry.d.ts +3 -1
- package/lib/common/utils/registry.d.ts.map +1 -1
- package/lib/common/utils/registry.js +15 -4
- package/lib/common/utils/registry.js.map +1 -1
- package/lib/node/abstract-json-model-storage.js +2 -1
- package/lib/node/abstract-json-model-storage.js.map +1 -1
- package/lib/node/gmodel/gmodel-storage.d.ts.map +1 -1
- package/lib/node/gmodel/gmodel-storage.js +4 -2
- package/lib/node/gmodel/gmodel-storage.js.map +1 -1
- package/lib/node/launch/socket-server-launcher.js +2 -1
- package/lib/node/launch/socket-server-launcher.js.map +1 -1
- package/lib/node/launch/websocket-server-launcher.js +2 -1
- package/lib/node/launch/websocket-server-launcher.js.map +1 -1
- package/package.json +4 -4
- package/src/common/actions/action-dispatcher.spec.ts +3 -2
- package/src/common/actions/action-dispatcher.ts +8 -5
- package/src/common/actions/client-action-handler.ts +28 -18
- package/src/common/actions/global-action-provider.spec.ts +4 -15
- package/src/common/actions/global-action-provider.ts +21 -25
- package/src/common/command/recording-command.spec.ts +15 -5
- package/src/common/command/recording-command.ts +16 -27
- package/src/common/di/client-session-module.ts +17 -10
- package/src/common/di/diagram-module.ts +23 -75
- package/src/common/di/server-module.ts +0 -1
- package/src/common/features/clipboard/request-clipboard-data-action-handler.ts +3 -3
- package/src/common/features/model/gmodel-serializer.ts +11 -11
- package/src/common/features/model/model-state.ts +3 -0
- package/src/common/features/model/model-submission-handler.ts +52 -7
- package/src/common/features/model/request-model-action-handler.ts +4 -4
- package/src/common/features/type-hints/edge-creation-checker.ts +44 -0
- package/src/common/features/type-hints/request-check-edge-action-handler.ts +62 -0
- package/src/common/{diagram → features/type-hints}/request-type-hints-action-handler.spec.ts +2 -2
- package/src/common/{diagram → features/type-hints}/request-type-hints-action-handler.ts +2 -3
- package/src/common/gmodel/cut-operation-handler.ts +5 -3
- package/src/common/gmodel/delete-operation-handler.ts +6 -5
- package/src/common/gmodel/gmodel-create-edge-operation-handler.ts +3 -3
- package/src/common/gmodel/gmodel-create-node-operation-handler.ts +3 -3
- package/src/common/gmodel/paste-operation-handler.ts +2 -2
- package/src/common/index.ts +3 -1
- package/src/common/operations/compound-operation-handler.ts +6 -1
- package/src/common/operations/create-operation-handler.ts +22 -5
- package/src/common/operations/json-operation-handler.ts +147 -0
- package/src/common/operations/operation-action-handler.ts +2 -2
- package/src/common/operations/operation-handler-registry.ts +1 -12
- package/src/common/operations/operation-handler.ts +2 -2
- package/src/common/protocol/client-action.ts +38 -0
- package/src/common/protocol/glsp-server.spec.ts +11 -10
- package/src/common/protocol/glsp-server.ts +11 -14
- package/src/common/session/client-session-factory.spec.ts +2 -2
- package/src/common/session/client-session-factory.ts +3 -3
- package/src/common/session/client-session-manager.spec.ts +4 -3
- package/src/common/utils/promise-queue.ts +4 -5
- package/src/common/utils/registry.spec.ts +3 -1
- package/src/common/utils/registry.ts +8 -3
- package/src/node/gmodel/gmodel-storage.ts +3 -3
- package/lib/common/diagram/request-type-hints-action-handler.d.ts.map +0 -1
- package/lib/common/diagram/request-type-hints-action-handler.js.map +0 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 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
|
+
import { GModelElement } from '@eclipse-glsp/graph';
|
|
17
|
+
import { AnyObject, CreateEdgeOperation, CreateNodeOperation, MaybePromise, Point, TriggerEdgeCreationAction, TriggerNodeCreationAction } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { Command } from '../command/command';
|
|
19
|
+
import { AbstractRecordingCommand } from '../command/recording-command';
|
|
20
|
+
import { ModelState } from '../features/model/model-state';
|
|
21
|
+
import { CreateEdgeOperationHandler, CreateNodeOperationHandler } from './create-operation-handler';
|
|
22
|
+
import { OperationHandler } from './operation-handler';
|
|
23
|
+
/**
|
|
24
|
+
* Helper interface for {@link ModelState} implementations of diagram languages that use a (serializable) JSON-based source model.
|
|
25
|
+
* Has to be implemented in order to reuse the {@link JsonOperationHandler} API.
|
|
26
|
+
*/
|
|
27
|
+
export interface JsonModelState<JsonObject extends AnyObject = AnyObject> extends ModelState {
|
|
28
|
+
readonly sourceModel: JsonObject;
|
|
29
|
+
updateSourceModel(sourceModel: JsonObject): void;
|
|
30
|
+
}
|
|
31
|
+
export declare namespace JsonModelState {
|
|
32
|
+
function is(modelState: ModelState): modelState is JsonModelState;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Simple base implementation of {@link AbstractRecordingCommand} that allows recording of changes made
|
|
36
|
+
* to the `sourceModel` of the given {@link JsonModelState} during the given `doExecute` function
|
|
37
|
+
*/
|
|
38
|
+
export declare class JsonRecordingCommand<JsonObject extends AnyObject = AnyObject> extends AbstractRecordingCommand<JsonObject> {
|
|
39
|
+
protected modelState: JsonModelState<JsonObject>;
|
|
40
|
+
protected doExecute: () => MaybePromise<void>;
|
|
41
|
+
constructor(modelState: JsonModelState<JsonObject>, doExecute: () => MaybePromise<void>);
|
|
42
|
+
protected getJsonObject(): MaybePromise<JsonObject>;
|
|
43
|
+
protected postChange(newModel: JsonObject): MaybePromise<void>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Reusable {@link OperationHandler} base implementation for diagram languages that use a (serializable) JSON-based source model.
|
|
47
|
+
* To use this class (or its subclasses) the injected {@link ModelState} has to implement the {@link JsonModelState} interface.
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
export declare abstract class JsonOperationHandler extends OperationHandler {
|
|
51
|
+
protected commandOf(runnable: () => void): Command;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Reusable {@link CreateNodeOperationHandler} base implementation for diagram languages that use a (serializable) JSON-based source model.
|
|
55
|
+
*/
|
|
56
|
+
export declare abstract class JsonCreateNodeOperationHandler extends JsonOperationHandler implements CreateNodeOperationHandler {
|
|
57
|
+
abstract elementTypeIds: string[];
|
|
58
|
+
abstract label: string;
|
|
59
|
+
readonly operationType = "createNode";
|
|
60
|
+
abstract createCommand(operation: CreateNodeOperation): MaybePromise<Command | undefined>;
|
|
61
|
+
getTriggerActions(): TriggerNodeCreationAction[];
|
|
62
|
+
/**
|
|
63
|
+
* Return the GModelElement that will contain the newly created node. It is usually
|
|
64
|
+
* the target element ({@link CreateNodeOperation.containerId}), but could also
|
|
65
|
+
* be e.g. an intermediate compartment, or even a different Node.
|
|
66
|
+
*
|
|
67
|
+
* @param operation
|
|
68
|
+
* @return the GModelElement that will contain the newly created node.
|
|
69
|
+
*/
|
|
70
|
+
getContainer(operation: CreateNodeOperation): GModelElement | undefined;
|
|
71
|
+
getLocation(operation: CreateNodeOperation): Point | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves the diagram absolute location and the target container from the given {@link CreateNodeOperation}
|
|
74
|
+
* and converts the absolute location to coordinates relative to the given container.
|
|
75
|
+
* Relative coordinates can only be retrieved if the given container element is part of
|
|
76
|
+
* a hierarchy of {@link GBoundsAware} elements. This means each (recursive) parent element need to
|
|
77
|
+
* implement {@link GBoundsAware}. If that is not the case this method returns `undefined`.
|
|
78
|
+
* @param absoluteLocation The diagram absolute position.
|
|
79
|
+
* @param container The container element.
|
|
80
|
+
* @returns The relative position or `undefined`.
|
|
81
|
+
*/
|
|
82
|
+
getRelativeLocation(operation: CreateNodeOperation): Point | undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Reusable {@link CreateEdgeOperationHandler} base implementation for diagram languages that use a (serializable) JSON-based source model.
|
|
86
|
+
*/
|
|
87
|
+
export declare abstract class JsonCreateEdgeOperationHandler extends JsonOperationHandler implements CreateEdgeOperationHandler {
|
|
88
|
+
abstract elementTypeIds: string[];
|
|
89
|
+
abstract label: string;
|
|
90
|
+
readonly operationType = "createEdge";
|
|
91
|
+
abstract createCommand(operation: CreateEdgeOperation): MaybePromise<Command | undefined>;
|
|
92
|
+
getTriggerActions(): TriggerEdgeCreationAction[];
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=json-operation-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-operation-handler.d.ts","sourceRoot":"","sources":["../../../src/common/operations/json-operation-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF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qB,SAAQ,gBAAgB;IAC/D,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO;CAMrD;AAED;;GAEG;AACH,8BACsB,8BAA+B,SAAQ,oBAAqB,YAAW,0BAA0B;IACnH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;IAClC,SAAkB,KAAK,EAAE,MAAM,CAAC;IAChC,SAAkB,aAAa,gBAA4B;aAEzC,aAAa,CAAC,SAAS,EAAE,mBAAmB,GAAG,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC;IAElG,iBAAiB,IAAI,yBAAyB,EAAE;IAIhD;;;;;;;OAOG;IACH,YAAY,CAAC,SAAS,EAAE,mBAAmB,GAAG,aAAa,GAAG,SAAS;IAKvE,WAAW,CAAC,SAAS,EAAE,mBAAmB,GAAG,KAAK,GAAG,SAAS;IAI9D;;;;;;;;;OASG;IACH,mBAAmB,CAAC,SAAS,EAAE,mBAAmB,GAAG,KAAK,GAAG,SAAS;CAKzE;AAED;;GAEG;AACH,8BACsB,8BAA+B,SAAQ,oBAAqB,YAAW,0BAA0B;IACnH,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;IAClC,SAAkB,KAAK,EAAE,MAAM,CAAC;IAChC,SAAkB,aAAa,gBAA4B;aAEzC,aAAa,CAAC,SAAS,EAAE,mBAAmB,GAAG,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC;IAElG,iBAAiB,IAAI,yBAAyB,EAAE;CAGnD"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.JsonCreateEdgeOperationHandler = exports.JsonCreateNodeOperationHandler = exports.JsonOperationHandler = exports.JsonRecordingCommand = exports.JsonModelState = void 0;
|
|
10
|
+
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
11
|
+
const inversify_1 = require("inversify");
|
|
12
|
+
const recording_command_1 = require("../command/recording-command");
|
|
13
|
+
const layout_util_1 = require("../utils/layout-util");
|
|
14
|
+
const operation_handler_1 = require("./operation-handler");
|
|
15
|
+
var JsonModelState;
|
|
16
|
+
(function (JsonModelState) {
|
|
17
|
+
function is(modelState) {
|
|
18
|
+
return (0, protocol_1.hasObjectProp)(modelState, 'sourceModel') && (0, protocol_1.hasFunctionProp)(modelState, 'updateSourceModel');
|
|
19
|
+
}
|
|
20
|
+
JsonModelState.is = is;
|
|
21
|
+
})(JsonModelState || (exports.JsonModelState = JsonModelState = {}));
|
|
22
|
+
/**
|
|
23
|
+
* Simple base implementation of {@link AbstractRecordingCommand} that allows recording of changes made
|
|
24
|
+
* to the `sourceModel` of the given {@link JsonModelState} during the given `doExecute` function
|
|
25
|
+
*/
|
|
26
|
+
class JsonRecordingCommand extends recording_command_1.AbstractRecordingCommand {
|
|
27
|
+
constructor(modelState, doExecute) {
|
|
28
|
+
super();
|
|
29
|
+
this.modelState = modelState;
|
|
30
|
+
this.doExecute = doExecute;
|
|
31
|
+
}
|
|
32
|
+
getJsonObject() {
|
|
33
|
+
return this.modelState.sourceModel;
|
|
34
|
+
}
|
|
35
|
+
postChange(newModel) {
|
|
36
|
+
this.modelState.updateSourceModel(newModel);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.JsonRecordingCommand = JsonRecordingCommand;
|
|
40
|
+
/**
|
|
41
|
+
* Reusable {@link OperationHandler} base implementation for diagram languages that use a (serializable) JSON-based source model.
|
|
42
|
+
* To use this class (or its subclasses) the injected {@link ModelState} has to implement the {@link JsonModelState} interface.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
let JsonOperationHandler = class JsonOperationHandler extends operation_handler_1.OperationHandler {
|
|
46
|
+
commandOf(runnable) {
|
|
47
|
+
if (!JsonModelState.is(this.modelState)) {
|
|
48
|
+
throw new Error('Cannot create command. The underlying model state does not implement the `JsonModelState` interface');
|
|
49
|
+
}
|
|
50
|
+
return new JsonRecordingCommand(this.modelState, runnable);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
exports.JsonOperationHandler = JsonOperationHandler;
|
|
54
|
+
exports.JsonOperationHandler = JsonOperationHandler = __decorate([
|
|
55
|
+
(0, inversify_1.injectable)()
|
|
56
|
+
], JsonOperationHandler);
|
|
57
|
+
/**
|
|
58
|
+
* Reusable {@link CreateNodeOperationHandler} base implementation for diagram languages that use a (serializable) JSON-based source model.
|
|
59
|
+
*/
|
|
60
|
+
let JsonCreateNodeOperationHandler = class JsonCreateNodeOperationHandler extends JsonOperationHandler {
|
|
61
|
+
constructor() {
|
|
62
|
+
super(...arguments);
|
|
63
|
+
this.operationType = protocol_1.CreateNodeOperation.KIND;
|
|
64
|
+
}
|
|
65
|
+
getTriggerActions() {
|
|
66
|
+
return this.elementTypeIds.map(typeId => protocol_1.TriggerNodeCreationAction.create(typeId));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Return the GModelElement that will contain the newly created node. It is usually
|
|
70
|
+
* the target element ({@link CreateNodeOperation.containerId}), but could also
|
|
71
|
+
* be e.g. an intermediate compartment, or even a different Node.
|
|
72
|
+
*
|
|
73
|
+
* @param operation
|
|
74
|
+
* @return the GModelElement that will contain the newly created node.
|
|
75
|
+
*/
|
|
76
|
+
getContainer(operation) {
|
|
77
|
+
const index = this.modelState.index;
|
|
78
|
+
return operation.containerId ? index.get(operation.containerId) : undefined;
|
|
79
|
+
}
|
|
80
|
+
getLocation(operation) {
|
|
81
|
+
return operation.location;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Retrieves the diagram absolute location and the target container from the given {@link CreateNodeOperation}
|
|
85
|
+
* and converts the absolute location to coordinates relative to the given container.
|
|
86
|
+
* Relative coordinates can only be retrieved if the given container element is part of
|
|
87
|
+
* a hierarchy of {@link GBoundsAware} elements. This means each (recursive) parent element need to
|
|
88
|
+
* implement {@link GBoundsAware}. If that is not the case this method returns `undefined`.
|
|
89
|
+
* @param absoluteLocation The diagram absolute position.
|
|
90
|
+
* @param container The container element.
|
|
91
|
+
* @returns The relative position or `undefined`.
|
|
92
|
+
*/
|
|
93
|
+
getRelativeLocation(operation) {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
const container = (_a = this.getContainer(operation)) !== null && _a !== void 0 ? _a : this.modelState.root;
|
|
96
|
+
const absoluteLocation = (_b = this.getLocation(operation)) !== null && _b !== void 0 ? _b : protocol_1.Point.ORIGIN;
|
|
97
|
+
return (0, layout_util_1.getRelativeLocation)(absoluteLocation, container);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
exports.JsonCreateNodeOperationHandler = JsonCreateNodeOperationHandler;
|
|
101
|
+
exports.JsonCreateNodeOperationHandler = JsonCreateNodeOperationHandler = __decorate([
|
|
102
|
+
(0, inversify_1.injectable)()
|
|
103
|
+
], JsonCreateNodeOperationHandler);
|
|
104
|
+
/**
|
|
105
|
+
* Reusable {@link CreateEdgeOperationHandler} base implementation for diagram languages that use a (serializable) JSON-based source model.
|
|
106
|
+
*/
|
|
107
|
+
let JsonCreateEdgeOperationHandler = class JsonCreateEdgeOperationHandler extends JsonOperationHandler {
|
|
108
|
+
constructor() {
|
|
109
|
+
super(...arguments);
|
|
110
|
+
this.operationType = protocol_1.CreateEdgeOperation.KIND;
|
|
111
|
+
}
|
|
112
|
+
getTriggerActions() {
|
|
113
|
+
return this.elementTypeIds.map(typeId => protocol_1.TriggerEdgeCreationAction.create(typeId));
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
exports.JsonCreateEdgeOperationHandler = JsonCreateEdgeOperationHandler;
|
|
117
|
+
exports.JsonCreateEdgeOperationHandler = JsonCreateEdgeOperationHandler = __decorate([
|
|
118
|
+
(0, inversify_1.injectable)()
|
|
119
|
+
], JsonCreateEdgeOperationHandler);
|
|
120
|
+
//# sourceMappingURL=json-operation-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-operation-handler.js","sourceRoot":"","sources":["../../../src/common/operations/json-operation-handler.ts"],"names":[],"mappings":";;;;;;;;;AAgBA,qDAUgC;AAChC,yCAAuC;AAEvC,oEAAwE;AAExE,sDAA2D;AAE3D,2DAAuD;AAWvD,IAAiB,cAAc,CAI9B;AAJD,WAAiB,cAAc;IAC3B,SAAgB,EAAE,CAAC,UAAsB;QACrC,OAAO,IAAA,wBAAa,EAAC,UAAU,EAAE,aAAa,CAAC,IAAI,IAAA,0BAAe,EAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;IACxG,CAAC;IAFe,iBAAE,KAEjB,CAAA;AACL,CAAC,EAJgB,cAAc,8BAAd,cAAc,QAI9B;AAED;;;GAGG;AACH,MAAa,oBAA+D,SAAQ,4CAAoC;IACpH,YAAsB,UAAsC,EAAY,SAAmC;QACvG,KAAK,EAAE,CAAC;QADU,eAAU,GAAV,UAAU,CAA4B;QAAY,cAAS,GAAT,SAAS,CAA0B;IAE3G,CAAC;IAEkB,aAAa;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;IACvC,CAAC;IAEkB,UAAU,CAAC,QAAoB;QAC9C,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;CACJ;AAZD,oDAYC;AAED;;;;GAIG;AAEI,IAAe,oBAAoB,GAAnC,MAAe,oBAAqB,SAAQ,oCAAgB;IACrD,SAAS,CAAC,QAAoB;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IAC5D,CAAC;CACJ,CAAA;AA3CqB,wEAA8B;yCAA9B,8BAA8B;IADnD,IAAA,sBAAU,GAAE;GACS,8BAA8B,CA2CnD;AAED;;GAEG;AAEI,IAAe,8BAA8B,GAA7C,MAAe,8BAA+B,SAAQ,oBAAoB;IAA1E;;QAGe,kBAAa,GAAG,8BAAmB,CAAC,IAAI,CAAC;IAO/D,CAAC;IAHG,iBAAiB;QACb,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,oCAAyB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACvF,CAAC;CACJ,CAAA;AAVqB,wEAA8B;yCAA9B,8BAA8B;IADnD,IAAA,sBAAU,GAAE;GACS,8BAA8B,CAUnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-action-handler.d.ts","sourceRoot":"","sources":["../../../src/common/operations/operation-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"operation-action-handler.d.ts","sourceRoot":"","sources":["../../../src/common/operations/operation-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,YAAY,EAAiB,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,qBACa,sBAAuB,YAAW,aAAa;IAaxB,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE;IAX9D,SAAS,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;IAG7D,SAAS,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IAGzD,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IAGjC,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;gBAEI,WAAW,EAAE,MAAM,EAAE;IAE9D,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;IAclD,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;cAQxD,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;cAQlF,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/D,SAAS,CAAC,WAAW,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;IAI/C,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAIhC;;OAEG;IAEH,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,wBAAwB,GAAG,gBAAgB,GAAG,SAAS;CAGrH"}
|
|
@@ -37,7 +37,7 @@ const model_state_1 = require("../features/model/model-state");
|
|
|
37
37
|
const model_submission_handler_1 = require("../features/model/model-submission-handler");
|
|
38
38
|
const glsp_server_error_1 = require("../utils/glsp-server-error");
|
|
39
39
|
const operation_handler_registry_1 = require("./operation-handler-registry");
|
|
40
|
-
let OperationActionHandler =
|
|
40
|
+
let OperationActionHandler = OperationActionHandler_1 = class OperationActionHandler {
|
|
41
41
|
constructor(actionKinds) {
|
|
42
42
|
this.actionKinds = actionKinds;
|
|
43
43
|
}
|
|
@@ -47,7 +47,7 @@ let OperationActionHandler = exports.OperationActionHandler = OperationActionHan
|
|
|
47
47
|
}
|
|
48
48
|
if (this.modelState.isReadonly) {
|
|
49
49
|
return [
|
|
50
|
-
protocol_1.
|
|
50
|
+
protocol_1.MessageAction.create(`Server is in readonly-mode! Could not execute operation: ${action.kind}`, {
|
|
51
51
|
severity: 'WARNING'
|
|
52
52
|
})
|
|
53
53
|
];
|
|
@@ -84,6 +84,7 @@ let OperationActionHandler = exports.OperationActionHandler = OperationActionHan
|
|
|
84
84
|
return registry.getOperationHandler(operation);
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
+
exports.OperationActionHandler = OperationActionHandler;
|
|
87
88
|
__decorate([
|
|
88
89
|
(0, inversify_1.inject)(operation_handler_registry_1.OperationHandlerRegistry),
|
|
89
90
|
__metadata("design:type", operation_handler_registry_1.OperationHandlerRegistry)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-action-handler.js","sourceRoot":"","sources":["../../../src/common/operations/operation-action-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"operation-action-handler.js","sourceRoot":"","sources":["../../../src/common/operations/operation-action-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAwF;AACxF,yCAA+C;AAG/C,4DAAwD;AACxD,mEAAuD;AACvD,+DAA2D;AAC3D,yFAAoF;AACpF,kEAA6D;AAE7D,6EAAwE;AAGjE,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAa/B,YAAyC,WAAqB;QAArB,gBAAW,GAAX,WAAW,CAAU;IAAG,CAAC;IAElE,OAAO,CAAC,MAAiB;QACrB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACvB,MAAM,IAAI,mCAAe,CAAC,6BAA6B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;SACzE;QACD,IAAI,IAAI,CA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ACnD,CAAC;CACJ,CAAA;AAhEY,wDAAsB;AAErB;IADT,IAAA,kBAAM,EAAC,qDAAwB,CAAC;8BACG,qDAAwB;wEAAC;AAGnD;IADT,IAAA,kBAAM,EAAC,iDAAsB,CAAC;8BACG,iDAAsB;sEAAC;AAG/C;IADT,IAAA,kBAAM,EAAC,wBAAU,CAAC;;0DACc;AAGvB;IADT,IAAA,kBAAM,EAAC,4BAAY,CAAC;;4DACgB;iCAX5B,sBAAsB;IADlC,IAAA,sBAAU,GAAE;IAcI,WAAA,IAAA,kBAAM,EAAC,gCAAU,CAAC,CAAA;;GAbtB,sBAAsB,CAgElC"}
|
|
@@ -13,21 +13,13 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Args,
|
|
17
|
-
import { Command } from '../command/command';
|
|
16
|
+
import { Args, Operation } from '@eclipse-glsp/protocol';
|
|
18
17
|
import { ClientSessionInitializer } from '../session/client-session-initializer';
|
|
19
18
|
import { Registry } from '../utils/registry';
|
|
20
19
|
import { OperationHandler, OperationHandlerConstructor, OperationHandlerFactory } from './operation-handler';
|
|
21
20
|
export declare class OperationHandlerRegistry extends Registry<string, OperationHandler> {
|
|
22
21
|
registerHandler(handler: OperationHandler): boolean;
|
|
23
22
|
getOperationHandler(operation: Operation): OperationHandler | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Returns the matching command for the given operation.
|
|
26
|
-
*
|
|
27
|
-
* @param operation operation
|
|
28
|
-
* @return the matching command for the given operation
|
|
29
|
-
*/
|
|
30
|
-
getExecutableCommand(operation: Operation): MaybePromise<Command | undefined>;
|
|
31
23
|
}
|
|
32
24
|
export declare class OperationHandlerRegistryInitializer implements ClientSessionInitializer {
|
|
33
25
|
protected factory: OperationHandlerFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-handler-registry.d.ts","sourceRoot":"","sources":["../../../src/common/operations/operation-handler-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,IAAI,EAAmB,
|
|
1
|
+
{"version":3,"file":"operation-handler-registry.d.ts","sourceRoot":"","sources":["../../../src/common/operations/operation-handler-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,IAAI,EAAmB,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE7G,qBACa,wBAAyB,SAAQ,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAC5E,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;IASnD,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,gBAAgB,GAAG,SAAS;CAG1E;AAED,qBACa,mCAAoC,YAAW,wBAAwB;IAEhF,SAAS,CAAC,OAAO,EAAE,uBAAuB,CAAC;IAI3C,SAAS,CAAC,mBAAmB,EAAE,2BAA2B,EAAE,CAAM;IAGlE,SAAS,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAE7C,UAAU,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI;CAIjC"}
|
|
@@ -30,7 +30,7 @@ const inversify_1 = require("inversify");
|
|
|
30
30
|
const registry_1 = require("../utils/registry");
|
|
31
31
|
const create_operation_handler_1 = require("./create-operation-handler");
|
|
32
32
|
const operation_handler_1 = require("./operation-handler");
|
|
33
|
-
let OperationHandlerRegistry =
|
|
33
|
+
let OperationHandlerRegistry = class OperationHandlerRegistry extends registry_1.Registry {
|
|
34
34
|
registerHandler(handler) {
|
|
35
35
|
if (create_operation_handler_1.CreateOperationHandler.is(handler)) {
|
|
36
36
|
handler.elementTypeIds.forEach(typeId => this.register(`${handler.operationType}_${typeId}`, handler));
|
|
@@ -43,21 +43,12 @@ let OperationHandlerRegistry = exports.OperationHandlerRegistry = class Operatio
|
|
|
43
43
|
getOperationHandler(operation) {
|
|
44
44
|
return protocol_1.CreateOperation.is(operation) ? this.get(`${operation.kind}_${operation.elementTypeId}`) : this.get(operation.kind);
|
|
45
45
|
}
|
|
46
|
-
/**
|
|
47
|
-
* Returns the matching command for the given operation.
|
|
48
|
-
*
|
|
49
|
-
* @param operation operation
|
|
50
|
-
* @return the matching command for the given operation
|
|
51
|
-
*/
|
|
52
|
-
getExecutableCommand(operation) {
|
|
53
|
-
var _a;
|
|
54
|
-
return (_a = this.getOperationHandler(operation)) === null || _a === void 0 ? void 0 : _a.createCommand(operation);
|
|
55
|
-
}
|
|
56
46
|
};
|
|
47
|
+
exports.OperationHandlerRegistry = OperationHandlerRegistry;
|
|
57
48
|
exports.OperationHandlerRegistry = OperationHandlerRegistry = __decorate([
|
|
58
49
|
(0, inversify_1.injectable)()
|
|
59
50
|
], OperationHandlerRegistry);
|
|
60
|
-
let OperationHandlerRegistryInitializer =
|
|
51
|
+
let OperationHandlerRegistryInitializer = class OperationHandlerRegistryInitializer {
|
|
61
52
|
constructor() {
|
|
62
53
|
this.handlerConstructors = [];
|
|
63
54
|
}
|
|
@@ -66,6 +57,7 @@ let OperationHandlerRegistryInitializer = exports.OperationHandlerRegistryInitia
|
|
|
66
57
|
handlers.forEach(handler => this.registry.registerHandler(handler));
|
|
67
58
|
}
|
|
68
59
|
};
|
|
60
|
+
exports.OperationHandlerRegistryInitializer = OperationHandlerRegistryInitializer;
|
|
69
61
|
__decorate([
|
|
70
62
|
(0, inversify_1.inject)(operation_handler_1.OperationHandlerFactory),
|
|
71
63
|
__metadata("design:type", Function)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-handler-registry.js","sourceRoot":"","sources":["../../../src/common/operations/operation-handler-registry.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"operation-handler-registry.js","sourceRoot":"","sources":["../../../src/common/operations/operation-handler-registry.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAA0E;AAC1E,yCAAyD;AAEzD,gDAA6C;AAC7C,yEAAoE;AACpE,2DAA6G;AAGtG,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,mBAAkC;IAC5E,eAAe,CAAC,OAAyB;QACrC,IAAI,iDAAsB,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE;YACpC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,aAAa,IAAI,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;YACvG,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;SACxD;IACL,CAAC;IAED,mBAAmB,CAAC,SAAoB;QACpC,OAAO,0BAAe,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/H,CAAC;CACJ,CAAA;AAbY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CAapC;AAGM,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IAAzC;QAMO,wBAAmB,GAAkC,EAAE,CAAC;IAStE,CAAC;IAJG,UAAU,CAAC,KAAY;QACnB,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;QACxF,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IACxE,CAAC;CACJ,CAAA;AAfY,kFAAmC;AAElC;IADT,IAAA,kBAAM,EAAC,2CAAuB,CAAC;;oEACW;AAIjC;IAFT,IAAA,kBAAM,EAAC,+CAA2B,CAAC;IACnC,IAAA,oBAAQ,GAAE;;gFACuD;AAGxD;IADT,IAAA,kBAAM,EAAC,wBAAwB,CAAC;8BACb,wBAAwB;qEAAC;8CATpC,mCAAmC;IAD/C,IAAA,sBAAU,GAAE;GACA,mCAAmC,CAe/C"}
|
|
@@ -33,14 +33,14 @@ export declare abstract class OperationHandler {
|
|
|
33
33
|
*
|
|
34
34
|
* @returns the operation type that can be handled.
|
|
35
35
|
*/
|
|
36
|
-
abstract operationType: string;
|
|
36
|
+
abstract readonly operationType: string;
|
|
37
37
|
readonly label?: string;
|
|
38
38
|
/**
|
|
39
39
|
* Creates a command that performs the operation in the source model(s). If `undefined` is returned, no update
|
|
40
40
|
* is performed on the model(s).
|
|
41
41
|
*
|
|
42
42
|
* @param operation The operation to process.
|
|
43
|
-
* @return The created command to be executed on the command stack or `undefined` nothing should be done.
|
|
43
|
+
* @return The created command to be executed on the command stack or `undefined` if nothing should be done.
|
|
44
44
|
*/
|
|
45
45
|
abstract createCommand(operation: Operation): MaybePromise<Command | undefined>;
|
|
46
46
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-handler.d.ts","sourceRoot":"","sources":["../../../src/common/operations/operation-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAsB,UAAU,EAAE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AoC,CAAC;AAEzE,MAAM,MAAM,uBAAuB,GAAG,CAAC,WAAW,EAAE,2BAA2B,KAAK,gBAAgB,CAAC"}
|
|
@@ -21,7 +21,7 @@ const model_state_1 = require("../features/model/model-state");
|
|
|
21
21
|
* The `OperationActionHandler` is responsible for retrieving all available (valid) operation handlers for an
|
|
22
22
|
* operation that is dispatched via `ActionDispatcher`.
|
|
23
23
|
*/
|
|
24
|
-
let OperationHandler =
|
|
24
|
+
let OperationHandler = class OperationHandler {
|
|
25
25
|
/**
|
|
26
26
|
* Executes the operation handler for the given {@link Operation} and returns the corresponding {@link Command}.
|
|
27
27
|
* If the given operation cannot be handled by this handler or the handler execution did not result in any changes
|
|
@@ -43,6 +43,7 @@ let OperationHandler = exports.OperationHandler = class OperationHandler {
|
|
|
43
43
|
return this.modelState.root && operation.kind === this.operationType;
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
+
exports.OperationHandler = OperationHandler;
|
|
46
47
|
__decorate([
|
|
47
48
|
(0, inversify_1.inject)(model_state_1.ModelState),
|
|
48
49
|
__metadata("design:type", Object)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-handler.js","sourceRoot":"","sources":["../../../src/common/operations/operation-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,yCAA2D;AAE3D,+DAA2D;AAE3D;;;;;;;;GAQG;AAEI,IAAe,gBAAgB,
|
|
1
|
+
{"version":3,"file":"operation-handler.js","sourceRoot":"","sources":["../../../src/common/operations/operation-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,yCAA2D;AAE3D,+DAA2D;AAE3D;;;;;;;;GAQG;AAEI,IAAe,gBAAgB,GAA/B,MAAe,gBAAgB;IAsBlC;;;;;;;OAOG;IACH,OAAO,CAAC,SAAoB;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/E,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,SAAoB;QACxB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,aAAa,CAAC;IACzE,CAAC;CACJ,CAAA;AA3CqB,4CAAgB;AAExB;IADT,IAAA,kBAAM,EAAC,wBAAU,CAAC;;oDACc;2BAFf,gBAAgB;IADrC,IAAA,sBAAU,GAAE;GACS,gBAAgB,CA2CrC;AAEY,QAAA,2BAA2B,GAAG,MAAM,CAAC,6BAA6B,CAAC,CAAC;AAIpE,QAAA,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 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
|
+
import { Action } from '@eclipse-glsp/protocol';
|
|
17
|
+
/**
|
|
18
|
+
* A helper interface that allows the server to mark actions that have been received from the client.
|
|
19
|
+
*/
|
|
20
|
+
export interface ClientAction extends Action {
|
|
21
|
+
__receivedFromClient: true;
|
|
22
|
+
}
|
|
23
|
+
export declare namespace ClientAction {
|
|
24
|
+
function is(object: unknown): object is ClientAction;
|
|
25
|
+
/**
|
|
26
|
+
* Mark the given action as {@link ClientAction} by attaching the "__receivedFromClient" property
|
|
27
|
+
* @param action The action that should be marked as client action
|
|
28
|
+
*/
|
|
29
|
+
function mark(action: Action): void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=client-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-action.d.ts","sourceRoot":"","sources":["../../../src/common/protocol/client-action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,MAAM;IACxC,oBAAoB,EAAE,IAAI,CAAC;CAC9B;AAED,yBAAiB,YAAY,CAAC;IAC1B,SAAgB,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,YAAY,CAE1D;IAED;;;OAGG;IACH,SAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEzC;CACJ"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2023 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ClientAction = void 0;
|
|
19
|
+
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
20
|
+
var ClientAction;
|
|
21
|
+
(function (ClientAction) {
|
|
22
|
+
function is(object) {
|
|
23
|
+
return protocol_1.Action.is(object) && '__receivedFromClient' in object && object.__receivedFromClient === true;
|
|
24
|
+
}
|
|
25
|
+
ClientAction.is = is;
|
|
26
|
+
/**
|
|
27
|
+
* Mark the given action as {@link ClientAction} by attaching the "__receivedFromClient" property
|
|
28
|
+
* @param action The action that should be marked as client action
|
|
29
|
+
*/
|
|
30
|
+
function mark(action) {
|
|
31
|
+
action.__receivedFromClient = true;
|
|
32
|
+
}
|
|
33
|
+
ClientAction.mark = mark;
|
|
34
|
+
})(ClientAction || (exports.ClientAction = ClientAction = {}));
|
|
35
|
+
//# sourceMappingURL=client-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-action.js","sourceRoot":"","sources":["../../../src/common/protocol/client-action.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,qDAAgD;AAShD,IAAiB,YAAY,CAY5B;AAZD,WAAiB,YAAY;IACzB,SAAgB,EAAE,CAAC,MAAe;QAC9B,OAAO,iBAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,sBAAsB,IAAI,MAAM,IAAI,MAAM,CAAC,oBAAoB,KAAK,IAAI,CAAC;IACzG,CAAC;IAFe,eAAE,KAEjB,CAAA;IAED;;;OAGG;IACH,SAAgB,IAAI,CAAC,MAAc;QAC9B,MAAuB,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACzD,CAAC;IAFe,iBAAI,OAEnB,CAAA;AACL,CAAC,EAZgB,YAAY,4BAAZ,YAAY,QAY5B"}
|
|
@@ -23,7 +23,7 @@ export declare class DefaultGLSPServer implements GLSPServer {
|
|
|
23
23
|
protected logger: Logger;
|
|
24
24
|
protected sessionManager: ClientSessionManager;
|
|
25
25
|
protected actionProvider: GlobalActionProvider;
|
|
26
|
-
protected glspClientProxy
|
|
26
|
+
protected glspClientProxy: GLSPClientProxy;
|
|
27
27
|
protected initializeResult?: InitializeResult;
|
|
28
28
|
protected applicationId: string;
|
|
29
29
|
protected clientSessions: Map<string, ClientSession>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-server.d.ts","sourceRoot":"","sources":["../../../src/common/protocol/glsp-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,aAAa,EACb,IAAI,EACJ,8BAA8B,
|
|
1
|
+
{"version":3,"file":"glsp-server.d.ts","sourceRoot":"","sources":["../../../src/common/protocol/glsp-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,aAAa,EACb,IAAI,EACJ,8BAA8B,EAC9B,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,iCAAiC,EACjC,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EAKf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,qBACa,iBAAkB,YAAW,UAAU;IAChD,gBAAuB,gBAAgB,WAAW;IAGlD,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IAGzB,SAAS,CAAC,cAAc,EAAE,oBAAoB,CAAC;IAG/C,SAAS,CAAC,cAAc,EAAE,oBAAoB,CAAC;IAG/C,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAE3C,SAAS,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAE9C,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC;IAEhC,SAAS,CAAC,cAAc,EAAE,GAAG,CAAC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AM,EAAE,MAAM,kBAAkB,GAAG,kBAAkB,EAAE;CAGzF"}
|
|
@@ -35,7 +35,8 @@ const global_action_provider_1 = require("../actions/global-action-provider");
|
|
|
35
35
|
const client_session_manager_1 = require("../session/client-session-manager");
|
|
36
36
|
const glsp_server_error_1 = require("../utils/glsp-server-error");
|
|
37
37
|
const logger_1 = require("../utils/logger");
|
|
38
|
-
|
|
38
|
+
const client_action_1 = require("./client-action");
|
|
39
|
+
let DefaultGLSPServer = DefaultGLSPServer_1 = class DefaultGLSPServer {
|
|
39
40
|
constructor(serverListeners = []) {
|
|
40
41
|
this.serverListeners = [];
|
|
41
42
|
this.clientSessions = new Map();
|
|
@@ -67,7 +68,7 @@ let DefaultGLSPServer = exports.DefaultGLSPServer = DefaultGLSPServer_1 = class
|
|
|
67
68
|
}
|
|
68
69
|
this.applicationId = params.applicationId;
|
|
69
70
|
const serverActions = {};
|
|
70
|
-
this.actionProvider.
|
|
71
|
+
this.actionProvider.actionKinds.forEach((kinds, diagramType) => (serverActions[diagramType] = kinds));
|
|
71
72
|
let result = { protocolVersion: DefaultGLSPServer_1.PROTOCOL_VERSION, serverActions };
|
|
72
73
|
result = await this.handleInitializeArgs(result, params.args);
|
|
73
74
|
this.getListenersToNotify('serverInitialized').forEach((listener) => listener.serverInitialized(this));
|
|
@@ -107,7 +108,9 @@ let DefaultGLSPServer = exports.DefaultGLSPServer = DefaultGLSPServer_1 = class
|
|
|
107
108
|
if (!clientSession) {
|
|
108
109
|
throw new Error(`No client session has been initialized for client id: ${clientSessionId}`);
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
+
const action = message.action;
|
|
112
|
+
client_action_1.ClientAction.mark(action);
|
|
113
|
+
clientSession.actionDispatcher.dispatch(action).catch(error => this.handleProcessError(message, error));
|
|
111
114
|
}
|
|
112
115
|
handleProcessError(message, reason) {
|
|
113
116
|
var _a, _b, _c;
|
|
@@ -119,15 +122,11 @@ let DefaultGLSPServer = exports.DefaultGLSPServer = DefaultGLSPServer_1 = class
|
|
|
119
122
|
details = (_c = (_b = reason.cause) === null || _b === void 0 ? void 0 : _b.toString) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
120
123
|
errorMsg = reason.message;
|
|
121
124
|
}
|
|
122
|
-
const errorAction = protocol_1.
|
|
125
|
+
const errorAction = protocol_1.MessageAction.create(errorMsg, { severity: 'ERROR', details });
|
|
123
126
|
this.sendToClient({ clientId: message.clientId, action: errorAction });
|
|
124
127
|
}
|
|
125
128
|
sendToClient(message) {
|
|
126
|
-
|
|
127
|
-
this.glspClientProxy.process(message);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
throw new Error("Could not send message to client. No 'GLSPClientProxy' is connected");
|
|
129
|
+
this.glspClientProxy.process(message);
|
|
131
130
|
}
|
|
132
131
|
getClientSession(sessionId) {
|
|
133
132
|
return this.clientSessions.get(sessionId);
|
|
@@ -153,6 +152,7 @@ let DefaultGLSPServer = exports.DefaultGLSPServer = DefaultGLSPServer_1 = class
|
|
|
153
152
|
return this.serverListeners.filter(listener => listener[method]);
|
|
154
153
|
}
|
|
155
154
|
};
|
|
155
|
+
exports.DefaultGLSPServer = DefaultGLSPServer;
|
|
156
156
|
DefaultGLSPServer.PROTOCOL_VERSION = '1.0.0';
|
|
157
157
|
__decorate([
|
|
158
158
|
(0, inversify_1.inject)(logger_1.Logger),
|
|
@@ -168,7 +168,6 @@ __decorate([
|
|
|
168
168
|
], DefaultGLSPServer.prototype, "actionProvider", void 0);
|
|
169
169
|
__decorate([
|
|
170
170
|
(0, inversify_1.inject)(protocol_1.GLSPClientProxy),
|
|
171
|
-
(0, inversify_1.optional)(),
|
|
172
171
|
__metadata("design:type", Object)
|
|
173
172
|
], DefaultGLSPServer.prototype, "glspClientProxy", void 0);
|
|
174
173
|
exports.DefaultGLSPServer = DefaultGLSPServer = DefaultGLSPServer_1 = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-server.js","sourceRoot":"","sources":["../../../src/common/protocol/glsp-server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAegC;AAChC,yCAAsE;AACtE,8EAAyE;AAEzE,8EAAyE;AACzE,kEAA6D;AAC7D,4CAAyC;
|
|
1
|
+
{"version":3,"file":"glsp-server.js","sourceRoot":"","sources":["../../../src/common/protocol/glsp-server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAegC;AAChC,yCAAsE;AACtE,8EAAyE;AAEzE,8EAAyE;AACzE,kEAA6D;AAC7D,4CAAyC;AACzC,mDAA+C;AAGxC,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAsB1B,YAAyD,kBAAwC,EAAE;QAFzF,oBAAe,GAAyB,EAAE,CAAC;QAGjD,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAyB,CAAC;QACvD,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpE,CAAC;IAES,uBAAuB,CAAC,MAA4B;QAC1D,IAAI,MAAM,CAAC,eAAe,KAAK,mBAAiB,CAAC,gBAAgB,EAAE;YAC/D,MAAM,IAAI,KAAK;YACX,mCAAmC;YACnC,0DAA0D,MAAM,CAAC,eAAe,uDAAuD,mBAAiB,CAAC,gBAAgB,GAAG,CAC/K,CAAC;SACL;IACL,CAAC;IAES,yBAAyB;QAC/B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SACjE;IACL,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,MAA4B;QAChD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4CAA4C,MAAM,CAAC,aAAa,sBAAsB,MAAM,CAAC,eAAe,EAAE,CAAC,CAAC;QACjI,IAAI,CAAC,uBAAuB,CAAC,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