@eclipse-glsp/protocol
Advanced tools
Comparing version 1.1.0-next.964b0af.221 to 1.1.0-next.976795c.271
@@ -22,3 +22,3 @@ "use strict"; | ||
Action.hasKind = hasKind; | ||
})(Action = exports.Action || (exports.Action = {})); | ||
})(Action || (exports.Action = Action = {})); | ||
var ActionMessage; | ||
@@ -31,3 +31,3 @@ (function (ActionMessage) { | ||
ActionMessage.is = is; | ||
})(ActionMessage = exports.ActionMessage || (exports.ActionMessage = {})); | ||
})(ActionMessage || (exports.ActionMessage = ActionMessage = {})); | ||
var RequestAction; | ||
@@ -53,3 +53,3 @@ (function (RequestAction) { | ||
RequestAction.generateRequestId = generateRequestId; | ||
})(RequestAction = exports.RequestAction || (exports.RequestAction = {})); | ||
})(RequestAction || (exports.RequestAction = RequestAction = {})); | ||
var ResponseAction; | ||
@@ -70,3 +70,3 @@ (function (ResponseAction) { | ||
ResponseAction.hasValidResponseId = hasValidResponseId; | ||
})(ResponseAction = exports.ResponseAction || (exports.ResponseAction = {})); | ||
})(ResponseAction || (exports.ResponseAction = ResponseAction = {})); | ||
var RejectAction; | ||
@@ -83,3 +83,3 @@ (function (RejectAction) { | ||
RejectAction.create = create; | ||
})(RejectAction = exports.RejectAction || (exports.RejectAction = {})); | ||
})(RejectAction || (exports.RejectAction = RejectAction = {})); | ||
var Operation; | ||
@@ -101,3 +101,3 @@ (function (Operation) { | ||
Operation.hasKind = hasKind; | ||
})(Operation = exports.Operation || (exports.Operation = {})); | ||
})(Operation || (exports.Operation = Operation = {})); | ||
var CompoundOperation; | ||
@@ -118,3 +118,3 @@ (function (CompoundOperation) { | ||
CompoundOperation.create = create; | ||
})(CompoundOperation = exports.CompoundOperation || (exports.CompoundOperation = {})); | ||
})(CompoundOperation || (exports.CompoundOperation = CompoundOperation = {})); | ||
//# sourceMappingURL=base-protocol.js.map |
@@ -53,6 +53,2 @@ import { Action } from './base-protocol'; | ||
details?: string; | ||
/** | ||
* Timeout after which a displayed message disappears. | ||
*/ | ||
timeout?: number; | ||
} | ||
@@ -65,5 +61,81 @@ export declare namespace ServerMessageAction { | ||
details?: string; | ||
timeout?: number; | ||
}): ServerMessageAction; | ||
} | ||
/** | ||
* Sent by the server to the client to request presenting the progress of a long running process in the UI. | ||
*/ | ||
export interface StartProgressAction extends Action { | ||
kind: typeof StartProgressAction.KIND; | ||
/** | ||
* An ID that can be used in subsequent `updateProgress` and `endProgress` events to make them refer to the same progress reporting. | ||
*/ | ||
progressId: string; | ||
/** | ||
* Short title of the progress reporting. Shown in the UI to describe the long running process. | ||
*/ | ||
title: string; | ||
/** | ||
* Optional additional progress message. Shown in the UI to describe the long running process. | ||
*/ | ||
message?: string; | ||
/** | ||
* Progress percentage to display (value range: 0 to 100). If omitted no percentage is shown. | ||
*/ | ||
percentage?: number; | ||
} | ||
export declare namespace StartProgressAction { | ||
const KIND = "startProgress"; | ||
function is(object: any): object is StartProgressAction; | ||
function create(options: { | ||
progressId: string; | ||
title: string; | ||
message?: string; | ||
percentage?: number; | ||
}): StartProgressAction; | ||
} | ||
/** | ||
* Sent by the server to the client to presenting an update of the progress of a long running process in the UI. | ||
*/ | ||
export interface UpdateProgressAction extends Action { | ||
kind: typeof UpdateProgressAction.KIND; | ||
/** | ||
* The ID of the progress reporting to update. | ||
*/ | ||
progressId: string; | ||
/** | ||
* The message to show in the progress reporting. | ||
*/ | ||
message?: string; | ||
/** | ||
* The percentage (value range: 0 to 100) to show in the progress reporting. | ||
*/ | ||
percentage?: number; | ||
} | ||
export declare namespace UpdateProgressAction { | ||
const KIND = "updateProgress"; | ||
function is(object: any): object is UpdateProgressAction; | ||
function create(progressId: string, options?: { | ||
message?: string; | ||
percentage?: number; | ||
}): UpdateProgressAction; | ||
} | ||
/** | ||
* Sent by the server to the client to end the reporting of a progress. | ||
*/ | ||
export interface EndProgressAction extends Action { | ||
kind: typeof EndProgressAction.KIND; | ||
/** | ||
* The ID of the progress reporting to update. | ||
*/ | ||
progressId: string; | ||
/** | ||
* The message to show in the progress reporting. | ||
*/ | ||
message?: string; | ||
} | ||
export declare namespace EndProgressAction { | ||
const KIND = "endProgress"; | ||
function is(object: any): object is EndProgressAction; | ||
function create(progressId: string, message?: string): EndProgressAction; | ||
} | ||
//# sourceMappingURL=client-notification.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ServerMessageAction = exports.ServerStatusAction = void 0; | ||
exports.EndProgressAction = exports.UpdateProgressAction = exports.StartProgressAction = exports.ServerMessageAction = exports.ServerStatusAction = void 0; | ||
/******************************************************************************** | ||
* Copyright (c) 2021-2022 STMicroelectronics and others. | ||
* Copyright (c) 2021-2023 STMicroelectronics and others. | ||
* | ||
@@ -32,3 +32,3 @@ * This program and the accompanying materials are made available under the | ||
ServerStatusAction.create = create; | ||
})(ServerStatusAction = exports.ServerStatusAction || (exports.ServerStatusAction = {})); | ||
})(ServerStatusAction || (exports.ServerStatusAction = ServerStatusAction = {})); | ||
var ServerMessageAction; | ||
@@ -45,3 +45,43 @@ (function (ServerMessageAction) { | ||
ServerMessageAction.create = create; | ||
})(ServerMessageAction = exports.ServerMessageAction || (exports.ServerMessageAction = {})); | ||
})(ServerMessageAction || (exports.ServerMessageAction = ServerMessageAction = {})); | ||
var StartProgressAction; | ||
(function (StartProgressAction) { | ||
StartProgressAction.KIND = 'startProgress'; | ||
function is(object) { | ||
return base_protocol_1.Action.hasKind(object, StartProgressAction.KIND) && (0, type_util_1.hasStringProp)(object, 'progressId') && (0, type_util_1.hasStringProp)(object, 'title'); | ||
} | ||
StartProgressAction.is = is; | ||
function create(options) { | ||
return Object.assign({ kind: StartProgressAction.KIND }, options); | ||
} | ||
StartProgressAction.create = create; | ||
})(StartProgressAction || (exports.StartProgressAction = StartProgressAction = {})); | ||
var UpdateProgressAction; | ||
(function (UpdateProgressAction) { | ||
UpdateProgressAction.KIND = 'updateProgress'; | ||
function is(object) { | ||
return base_protocol_1.Action.hasKind(object, UpdateProgressAction.KIND) && (0, type_util_1.hasStringProp)(object, 'progressId'); | ||
} | ||
UpdateProgressAction.is = is; | ||
function create(progressId, options = {}) { | ||
return Object.assign({ kind: UpdateProgressAction.KIND, progressId }, options); | ||
} | ||
UpdateProgressAction.create = create; | ||
})(UpdateProgressAction || (exports.UpdateProgressAction = UpdateProgressAction = {})); | ||
var EndProgressAction; | ||
(function (EndProgressAction) { | ||
EndProgressAction.KIND = 'endProgress'; | ||
function is(object) { | ||
return base_protocol_1.Action.hasKind(object, EndProgressAction.KIND) && (0, type_util_1.hasStringProp)(object, 'progressId'); | ||
} | ||
EndProgressAction.is = is; | ||
function create(progressId, message) { | ||
return { | ||
kind: EndProgressAction.KIND, | ||
progressId, | ||
message | ||
}; | ||
} | ||
EndProgressAction.create = create; | ||
})(EndProgressAction || (exports.EndProgressAction = EndProgressAction = {})); | ||
//# sourceMappingURL=client-notification.js.map |
@@ -32,3 +32,3 @@ "use strict"; | ||
RequestClipboardDataAction.create = create; | ||
})(RequestClipboardDataAction = exports.RequestClipboardDataAction || (exports.RequestClipboardDataAction = {})); | ||
})(RequestClipboardDataAction || (exports.RequestClipboardDataAction = RequestClipboardDataAction = {})); | ||
var SetClipboardDataAction; | ||
@@ -45,3 +45,3 @@ (function (SetClipboardDataAction) { | ||
SetClipboardDataAction.create = create; | ||
})(SetClipboardDataAction = exports.SetClipboardDataAction || (exports.SetClipboardDataAction = {})); | ||
})(SetClipboardDataAction || (exports.SetClipboardDataAction = SetClipboardDataAction = {})); | ||
var CutOperation; | ||
@@ -62,3 +62,3 @@ (function (CutOperation) { | ||
CutOperation.create = create; | ||
})(CutOperation = exports.CutOperation || (exports.CutOperation = {})); | ||
})(CutOperation || (exports.CutOperation = CutOperation = {})); | ||
var PasteOperation; | ||
@@ -75,3 +75,3 @@ (function (PasteOperation) { | ||
PasteOperation.create = create; | ||
})(PasteOperation = exports.PasteOperation || (exports.PasteOperation = {})); | ||
})(PasteOperation || (exports.PasteOperation = PasteOperation = {})); | ||
//# sourceMappingURL=clipboard.js.map |
@@ -32,3 +32,3 @@ "use strict"; | ||
RequestContextActions.create = create; | ||
})(RequestContextActions = exports.RequestContextActions || (exports.RequestContextActions = {})); | ||
})(RequestContextActions || (exports.RequestContextActions = RequestContextActions = {})); | ||
var SetContextActions; | ||
@@ -45,3 +45,3 @@ (function (SetContextActions) { | ||
SetContextActions.create = create; | ||
})(SetContextActions = exports.SetContextActions || (exports.SetContextActions = {})); | ||
})(SetContextActions || (exports.SetContextActions = SetContextActions = {})); | ||
//# sourceMappingURL=contexts.js.map |
@@ -35,3 +35,3 @@ "use strict"; | ||
ReconnectEdgeOperation.create = create; | ||
})(ReconnectEdgeOperation = exports.ReconnectEdgeOperation || (exports.ReconnectEdgeOperation = {})); | ||
})(ReconnectEdgeOperation || (exports.ReconnectEdgeOperation = ReconnectEdgeOperation = {})); | ||
var ChangeRoutingPointsOperation; | ||
@@ -52,3 +52,3 @@ (function (ChangeRoutingPointsOperation) { | ||
ChangeRoutingPointsOperation.create = create; | ||
})(ChangeRoutingPointsOperation = exports.ChangeRoutingPointsOperation || (exports.ChangeRoutingPointsOperation = {})); | ||
})(ChangeRoutingPointsOperation || (exports.ChangeRoutingPointsOperation = ChangeRoutingPointsOperation = {})); | ||
//# sourceMappingURL=edge-modification.js.map |
@@ -37,3 +37,3 @@ "use strict"; | ||
CreateOperation.hasKind = hasKind; | ||
})(CreateOperation = exports.CreateOperation || (exports.CreateOperation = {})); | ||
})(CreateOperation || (exports.CreateOperation = CreateOperation = {})); | ||
var CreateNodeOperation; | ||
@@ -50,3 +50,3 @@ (function (CreateNodeOperation) { | ||
CreateNodeOperation.create = create; | ||
})(CreateNodeOperation = exports.CreateNodeOperation || (exports.CreateNodeOperation = {})); | ||
})(CreateNodeOperation || (exports.CreateNodeOperation = CreateNodeOperation = {})); | ||
var CreateEdgeOperation; | ||
@@ -63,3 +63,3 @@ (function (CreateEdgeOperation) { | ||
CreateEdgeOperation.create = create; | ||
})(CreateEdgeOperation = exports.CreateEdgeOperation || (exports.CreateEdgeOperation = {})); | ||
})(CreateEdgeOperation || (exports.CreateEdgeOperation = CreateEdgeOperation = {})); | ||
var DeleteElementOperation; | ||
@@ -80,3 +80,3 @@ (function (DeleteElementOperation) { | ||
DeleteElementOperation.create = create; | ||
})(DeleteElementOperation = exports.DeleteElementOperation || (exports.DeleteElementOperation = {})); | ||
})(DeleteElementOperation || (exports.DeleteElementOperation = DeleteElementOperation = {})); | ||
//# sourceMappingURL=element-creation.js.map |
@@ -17,3 +17,3 @@ "use strict"; | ||
RequestPopupModelAction.create = create; | ||
})(RequestPopupModelAction = exports.RequestPopupModelAction || (exports.RequestPopupModelAction = {})); | ||
})(RequestPopupModelAction || (exports.RequestPopupModelAction = RequestPopupModelAction = {})); | ||
var SetPopupModelAction; | ||
@@ -30,3 +30,3 @@ (function (SetPopupModelAction) { | ||
SetPopupModelAction.create = create; | ||
})(SetPopupModelAction = exports.SetPopupModelAction || (exports.SetPopupModelAction = {})); | ||
})(SetPopupModelAction || (exports.SetPopupModelAction = SetPopupModelAction = {})); | ||
//# sourceMappingURL=element-hover.js.map |
@@ -112,3 +112,3 @@ "use strict"; | ||
NavigationTarget.getTextPosition = getTextPosition; | ||
})(NavigationTarget = exports.NavigationTarget || (exports.NavigationTarget = {})); | ||
})(NavigationTarget || (exports.NavigationTarget = NavigationTarget = {})); | ||
var RequestNavigationTargetsAction; | ||
@@ -125,3 +125,3 @@ (function (RequestNavigationTargetsAction) { | ||
RequestNavigationTargetsAction.create = create; | ||
})(RequestNavigationTargetsAction = exports.RequestNavigationTargetsAction || (exports.RequestNavigationTargetsAction = {})); | ||
})(RequestNavigationTargetsAction || (exports.RequestNavigationTargetsAction = RequestNavigationTargetsAction = {})); | ||
var SetNavigationTargetsAction; | ||
@@ -138,3 +138,3 @@ (function (SetNavigationTargetsAction) { | ||
SetNavigationTargetsAction.create = create; | ||
})(SetNavigationTargetsAction = exports.SetNavigationTargetsAction || (exports.SetNavigationTargetsAction = {})); | ||
})(SetNavigationTargetsAction || (exports.SetNavigationTargetsAction = SetNavigationTargetsAction = {})); | ||
var NavigateToTargetAction; | ||
@@ -154,3 +154,3 @@ (function (NavigateToTargetAction) { | ||
NavigateToTargetAction.create = create; | ||
})(NavigateToTargetAction = exports.NavigateToTargetAction || (exports.NavigateToTargetAction = {})); | ||
})(NavigateToTargetAction || (exports.NavigateToTargetAction = NavigateToTargetAction = {})); | ||
var ResolveNavigationTargetAction; | ||
@@ -167,3 +167,3 @@ (function (ResolveNavigationTargetAction) { | ||
ResolveNavigationTargetAction.create = create; | ||
})(ResolveNavigationTargetAction = exports.ResolveNavigationTargetAction || (exports.ResolveNavigationTargetAction = {})); | ||
})(ResolveNavigationTargetAction || (exports.ResolveNavigationTargetAction = ResolveNavigationTargetAction = {})); | ||
var SetResolvedNavigationTargetAction; | ||
@@ -180,3 +180,3 @@ (function (SetResolvedNavigationTargetAction) { | ||
SetResolvedNavigationTargetAction.create = create; | ||
})(SetResolvedNavigationTargetAction = exports.SetResolvedNavigationTargetAction || (exports.SetResolvedNavigationTargetAction = {})); | ||
})(SetResolvedNavigationTargetAction || (exports.SetResolvedNavigationTargetAction = SetResolvedNavigationTargetAction = {})); | ||
var NavigateToExternalTargetAction; | ||
@@ -196,3 +196,3 @@ (function (NavigateToExternalTargetAction) { | ||
NavigateToExternalTargetAction.create = create; | ||
})(NavigateToExternalTargetAction = exports.NavigateToExternalTargetAction || (exports.NavigateToExternalTargetAction = {})); | ||
})(NavigateToExternalTargetAction || (exports.NavigateToExternalTargetAction = NavigateToExternalTargetAction = {})); | ||
//# sourceMappingURL=element-navigation.js.map |
@@ -35,2 +35,6 @@ /******************************************************************************** | ||
deselectedElementsIDs: string[]; | ||
/** | ||
* Whether all currently selected elements should be deselected. | ||
*/ | ||
deselectAll?: boolean; | ||
} | ||
@@ -42,4 +46,7 @@ export declare namespace SelectAction { | ||
selectedElementsIDs?: string[]; | ||
deselectedElementsIDs?: string[]; | ||
deselectedElementsIDs?: string[] | boolean; | ||
}): SelectAction; | ||
function addSelection(selectedElementsIDs: string[]): SelectAction; | ||
function removeSelection(deselectedElementsIDs: string[]): SelectAction; | ||
function setSelection(selectedElementsIDs: string[]): SelectAction; | ||
} | ||
@@ -46,0 +53,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SelectAllAction = exports.SelectAction = void 0; | ||
const array_util_1 = require("../utils/array-util"); | ||
const type_util_1 = require("../utils/type-util"); | ||
@@ -14,6 +15,25 @@ const base_protocol_1 = require("./base-protocol"); | ||
function create(options = {}) { | ||
return Object.assign({ kind: SelectAction.KIND, selectedElementsIDs: [], deselectedElementsIDs: [] }, options); | ||
var _a, _b; | ||
const deselectedElementsIDs = (_a = options.deselectedElementsIDs) !== null && _a !== void 0 ? _a : []; | ||
return { | ||
kind: SelectAction.KIND, | ||
selectedElementsIDs: (_b = options.selectedElementsIDs) !== null && _b !== void 0 ? _b : [], | ||
deselectedElementsIDs: (0, array_util_1.isStringArray)(deselectedElementsIDs, true) ? deselectedElementsIDs : [], | ||
deselectAll: typeof deselectedElementsIDs === 'boolean' ? deselectedElementsIDs : false | ||
}; | ||
} | ||
SelectAction.create = create; | ||
})(SelectAction = exports.SelectAction || (exports.SelectAction = {})); | ||
function addSelection(selectedElementsIDs) { | ||
return create({ selectedElementsIDs }); | ||
} | ||
SelectAction.addSelection = addSelection; | ||
function removeSelection(deselectedElementsIDs) { | ||
return create({ deselectedElementsIDs }); | ||
} | ||
SelectAction.removeSelection = removeSelection; | ||
function setSelection(selectedElementsIDs) { | ||
return create({ selectedElementsIDs, deselectedElementsIDs: true }); | ||
} | ||
SelectAction.setSelection = setSelection; | ||
})(SelectAction || (exports.SelectAction = SelectAction = {})); | ||
var SelectAllAction; | ||
@@ -33,3 +53,3 @@ (function (SelectAllAction) { | ||
SelectAllAction.create = create; | ||
})(SelectAllAction = exports.SelectAllAction || (exports.SelectAllAction = {})); | ||
})(SelectAllAction || (exports.SelectAllAction = SelectAllAction = {})); | ||
//# sourceMappingURL=element-selection.js.map |
/******************************************************************************** | ||
* Copyright (c) 2020-2022 EclipseSource and others. | ||
* Copyright (c) 2020-2023 EclipseSource and others. | ||
* | ||
@@ -4,0 +4,0 @@ * This program and the accompanying materials are made available under the |
@@ -20,3 +20,3 @@ "use strict"; | ||
RequestEditValidationAction.create = create; | ||
})(RequestEditValidationAction = exports.RequestEditValidationAction || (exports.RequestEditValidationAction = {})); | ||
})(RequestEditValidationAction || (exports.RequestEditValidationAction = RequestEditValidationAction = {})); | ||
var SetEditValidationResultAction; | ||
@@ -33,3 +33,3 @@ (function (SetEditValidationResultAction) { | ||
SetEditValidationResultAction.create = create; | ||
})(SetEditValidationResultAction = exports.SetEditValidationResultAction || (exports.SetEditValidationResultAction = {})); | ||
})(SetEditValidationResultAction || (exports.SetEditValidationResultAction = SetEditValidationResultAction = {})); | ||
var ApplyLabelEditOperation; | ||
@@ -46,3 +46,3 @@ (function (ApplyLabelEditOperation) { | ||
ApplyLabelEditOperation.create = create; | ||
})(ApplyLabelEditOperation = exports.ApplyLabelEditOperation || (exports.ApplyLabelEditOperation = {})); | ||
})(ApplyLabelEditOperation || (exports.ApplyLabelEditOperation = ApplyLabelEditOperation = {})); | ||
var ValidationStatus; | ||
@@ -53,3 +53,2 @@ (function (ValidationStatus) { | ||
*/ | ||
// eslint-disable-next-line no-shadow | ||
let Severity; | ||
@@ -62,3 +61,2 @@ (function (Severity) { | ||
Severity[Severity["OK"] = 4] = "OK"; | ||
// eslint-disable-next-line no-shadow | ||
Severity[Severity["NONE"] = 5] = "NONE"; | ||
@@ -106,3 +104,3 @@ })(Severity = ValidationStatus.Severity || (ValidationStatus.Severity = {})); | ||
ValidationStatus.isError = isError; | ||
})(ValidationStatus = exports.ValidationStatus || (exports.ValidationStatus = {})); | ||
})(ValidationStatus || (exports.ValidationStatus = ValidationStatus = {})); | ||
//# sourceMappingURL=element-text-editing.js.map |
@@ -32,3 +32,3 @@ "use strict"; | ||
RequestTypeHintsAction.create = create; | ||
})(RequestTypeHintsAction = exports.RequestTypeHintsAction || (exports.RequestTypeHintsAction = {})); | ||
})(RequestTypeHintsAction || (exports.RequestTypeHintsAction = RequestTypeHintsAction = {})); | ||
var SetTypeHintsAction; | ||
@@ -45,3 +45,3 @@ (function (SetTypeHintsAction) { | ||
SetTypeHintsAction.create = create; | ||
})(SetTypeHintsAction = exports.SetTypeHintsAction || (exports.SetTypeHintsAction = {})); | ||
})(SetTypeHintsAction || (exports.SetTypeHintsAction = SetTypeHintsAction = {})); | ||
//# sourceMappingURL=element-type-hints.js.map |
@@ -32,2 +32,11 @@ import { Action, RequestAction, ResponseAction } from './base-protocol'; | ||
/** | ||
* The default reasons for markers. | ||
*/ | ||
export declare namespace MarkersReason { | ||
/** Markers resulting from a batch validation */ | ||
const BATCH = "batch"; | ||
/** Markers resulting from a live validation */ | ||
const LIVE = "live"; | ||
} | ||
/** | ||
* Action to retrieve markers for the specified model elements. Sent from the client to the server. | ||
@@ -43,2 +52,6 @@ * The corresponding namespace declares the action kind as constant and offers helper functions for type guard checks | ||
elementsIDs: string[]; | ||
/** | ||
* The reason for this request, such as `batch` or `live` validation. `batch` by default. | ||
*/ | ||
reason?: string; | ||
} | ||
@@ -50,2 +63,3 @@ export declare namespace RequestMarkersAction { | ||
requestId?: string; | ||
reason?: string; | ||
}): RequestMarkersAction; | ||
@@ -66,2 +80,6 @@ } | ||
readonly markers: Marker[]; | ||
/** | ||
* The reason for message, such as `batch` or `live` validation. | ||
*/ | ||
reason?: string; | ||
} | ||
@@ -73,2 +91,3 @@ export declare namespace SetMarkersAction { | ||
responseId?: string; | ||
reason?: string; | ||
}): SetMarkersAction; | ||
@@ -75,0 +94,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DeleteMarkersAction = exports.SetMarkersAction = exports.RequestMarkersAction = exports.MarkerKind = void 0; | ||
exports.DeleteMarkersAction = exports.SetMarkersAction = exports.RequestMarkersAction = exports.MarkersReason = exports.MarkerKind = void 0; | ||
/******************************************************************************** | ||
* Copyright (c) 2021-2022 STMicroelectronics and others. | ||
* Copyright (c) 2021-2023 STMicroelectronics and others. | ||
* | ||
@@ -29,3 +29,13 @@ * This program and the accompanying materials are made available under the | ||
MarkerKind.ERROR = 'error'; | ||
})(MarkerKind = exports.MarkerKind || (exports.MarkerKind = {})); | ||
})(MarkerKind || (exports.MarkerKind = MarkerKind = {})); | ||
/** | ||
* The default reasons for markers. | ||
*/ | ||
var MarkersReason; | ||
(function (MarkersReason) { | ||
/** Markers resulting from a batch validation */ | ||
MarkersReason.BATCH = 'batch'; | ||
/** Markers resulting from a live validation */ | ||
MarkersReason.LIVE = 'live'; | ||
})(MarkersReason || (exports.MarkersReason = MarkersReason = {})); | ||
var RequestMarkersAction; | ||
@@ -39,6 +49,6 @@ (function (RequestMarkersAction) { | ||
function create(elementsIDs, options = {}) { | ||
return Object.assign({ kind: RequestMarkersAction.KIND, requestId: '', elementsIDs }, options); | ||
return Object.assign({ kind: RequestMarkersAction.KIND, requestId: '', elementsIDs, reason: MarkersReason.BATCH }, options); | ||
} | ||
RequestMarkersAction.create = create; | ||
})(RequestMarkersAction = exports.RequestMarkersAction || (exports.RequestMarkersAction = {})); | ||
})(RequestMarkersAction || (exports.RequestMarkersAction = RequestMarkersAction = {})); | ||
var SetMarkersAction; | ||
@@ -52,6 +62,6 @@ (function (SetMarkersAction) { | ||
function create(markers, options = {}) { | ||
return Object.assign({ kind: SetMarkersAction.KIND, responseId: '', markers }, options); | ||
return Object.assign({ kind: SetMarkersAction.KIND, responseId: '', markers, reason: MarkersReason.BATCH }, options); | ||
} | ||
SetMarkersAction.create = create; | ||
})(SetMarkersAction = exports.SetMarkersAction || (exports.SetMarkersAction = {})); | ||
})(SetMarkersAction || (exports.SetMarkersAction = SetMarkersAction = {})); | ||
var DeleteMarkersAction; | ||
@@ -71,3 +81,3 @@ (function (DeleteMarkersAction) { | ||
DeleteMarkersAction.create = create; | ||
})(DeleteMarkersAction = exports.DeleteMarkersAction || (exports.DeleteMarkersAction = {})); | ||
})(DeleteMarkersAction || (exports.DeleteMarkersAction = DeleteMarkersAction = {})); | ||
//# sourceMappingURL=element-validation.js.map |
@@ -17,3 +17,3 @@ "use strict"; | ||
RequestModelAction.create = create; | ||
})(RequestModelAction = exports.RequestModelAction || (exports.RequestModelAction = {})); | ||
})(RequestModelAction || (exports.RequestModelAction = RequestModelAction = {})); | ||
var SetModelAction; | ||
@@ -30,3 +30,3 @@ (function (SetModelAction) { | ||
SetModelAction.create = create; | ||
})(SetModelAction = exports.SetModelAction || (exports.SetModelAction = {})); | ||
})(SetModelAction || (exports.SetModelAction = SetModelAction = {})); | ||
var UpdateModelAction; | ||
@@ -43,3 +43,3 @@ (function (UpdateModelAction) { | ||
UpdateModelAction.create = create; | ||
})(UpdateModelAction = exports.UpdateModelAction || (exports.UpdateModelAction = {})); | ||
})(UpdateModelAction || (exports.UpdateModelAction = UpdateModelAction = {})); | ||
var SourceModelChangedAction; | ||
@@ -59,3 +59,3 @@ (function (SourceModelChangedAction) { | ||
SourceModelChangedAction.create = create; | ||
})(SourceModelChangedAction = exports.SourceModelChangedAction || (exports.SourceModelChangedAction = {})); | ||
})(SourceModelChangedAction || (exports.SourceModelChangedAction = SourceModelChangedAction = {})); | ||
//# sourceMappingURL=model-data.js.map |
@@ -35,3 +35,3 @@ "use strict"; | ||
SetEditModeAction.create = create; | ||
})(SetEditModeAction = exports.SetEditModeAction || (exports.SetEditModeAction = {})); | ||
})(SetEditModeAction || (exports.SetEditModeAction = SetEditModeAction = {})); | ||
/** | ||
@@ -44,3 +44,3 @@ * The potential default values for the `editMode` property of a {@link SetEditModeAction}. | ||
EditMode.EDITABLE = 'editable'; | ||
})(EditMode = exports.EditMode || (exports.EditMode = {})); | ||
})(EditMode || (exports.EditMode = EditMode = {})); | ||
//# sourceMappingURL=model-edit-mode.js.map |
/******************************************************************************** | ||
* Copyright (c) 2021-2022 STMicroelectronics and others. | ||
* Copyright (c) 2021-2023 STMicroelectronics and others. | ||
* | ||
@@ -81,5 +81,5 @@ * This program and the accompanying materials are made available under the | ||
/** | ||
* The identifiers of the elements that should be layouted, may be just the root element. | ||
* The identifiers of the elements that should be layouted, will default to the root element if not defined. | ||
*/ | ||
elementIds: string[]; | ||
elementIds?: string[]; | ||
} | ||
@@ -89,4 +89,4 @@ export declare namespace LayoutOperation { | ||
function is(object: any): object is LayoutOperation; | ||
function create(elementIds: string[]): LayoutOperation; | ||
function create(elementIds?: string[]): LayoutOperation; | ||
} | ||
//# sourceMappingURL=model-layout.d.ts.map |
@@ -17,3 +17,3 @@ "use strict"; | ||
RequestBoundsAction.create = create; | ||
})(RequestBoundsAction = exports.RequestBoundsAction || (exports.RequestBoundsAction = {})); | ||
})(RequestBoundsAction || (exports.RequestBoundsAction = RequestBoundsAction = {})); | ||
var ComputedBoundsAction; | ||
@@ -30,3 +30,3 @@ (function (ComputedBoundsAction) { | ||
ComputedBoundsAction.create = create; | ||
})(ComputedBoundsAction = exports.ComputedBoundsAction || (exports.ComputedBoundsAction = {})); | ||
})(ComputedBoundsAction || (exports.ComputedBoundsAction = ComputedBoundsAction = {})); | ||
var LayoutOperation; | ||
@@ -47,3 +47,3 @@ (function (LayoutOperation) { | ||
LayoutOperation.create = create; | ||
})(LayoutOperation = exports.LayoutOperation || (exports.LayoutOperation = {})); | ||
})(LayoutOperation || (exports.LayoutOperation = LayoutOperation = {})); | ||
//# sourceMappingURL=model-layout.js.map |
@@ -32,3 +32,3 @@ "use strict"; | ||
SaveModelAction.create = create; | ||
})(SaveModelAction = exports.SaveModelAction || (exports.SaveModelAction = {})); | ||
})(SaveModelAction || (exports.SaveModelAction = SaveModelAction = {})); | ||
var SetDirtyStateAction; | ||
@@ -45,3 +45,3 @@ (function (SetDirtyStateAction) { | ||
SetDirtyStateAction.create = create; | ||
})(SetDirtyStateAction = exports.SetDirtyStateAction || (exports.SetDirtyStateAction = {})); | ||
})(SetDirtyStateAction || (exports.SetDirtyStateAction = SetDirtyStateAction = {})); | ||
var RequestExportSvgAction; | ||
@@ -58,3 +58,3 @@ (function (RequestExportSvgAction) { | ||
RequestExportSvgAction.create = create; | ||
})(RequestExportSvgAction = exports.RequestExportSvgAction || (exports.RequestExportSvgAction = {})); | ||
})(RequestExportSvgAction || (exports.RequestExportSvgAction = RequestExportSvgAction = {})); | ||
var ExportSvgAction; | ||
@@ -71,3 +71,3 @@ (function (ExportSvgAction) { | ||
ExportSvgAction.create = create; | ||
})(ExportSvgAction = exports.ExportSvgAction || (exports.ExportSvgAction = {})); | ||
})(ExportSvgAction || (exports.ExportSvgAction = ExportSvgAction = {})); | ||
//# sourceMappingURL=model-saving.js.map |
@@ -16,3 +16,3 @@ "use strict"; | ||
SModelElementSchema.is = is; | ||
})(SModelElementSchema = exports.SModelElementSchema || (exports.SModelElementSchema = {})); | ||
})(SModelElementSchema || (exports.SModelElementSchema = SModelElementSchema = {})); | ||
//# sourceMappingURL=model-structure.js.map |
@@ -36,3 +36,3 @@ "use strict"; | ||
ChangeBoundsOperation.create = create; | ||
})(ChangeBoundsOperation = exports.ChangeBoundsOperation || (exports.ChangeBoundsOperation = {})); | ||
})(ChangeBoundsOperation || (exports.ChangeBoundsOperation = ChangeBoundsOperation = {})); | ||
var ChangeContainerOperation; | ||
@@ -49,3 +49,3 @@ (function (ChangeContainerOperation) { | ||
ChangeContainerOperation.create = create; | ||
})(ChangeContainerOperation = exports.ChangeContainerOperation || (exports.ChangeContainerOperation = {})); | ||
})(ChangeContainerOperation || (exports.ChangeContainerOperation = ChangeContainerOperation = {})); | ||
//# sourceMappingURL=node-modification.js.map |
@@ -32,3 +32,3 @@ "use strict"; | ||
TriggerNodeCreationAction.create = create; | ||
})(TriggerNodeCreationAction = exports.TriggerNodeCreationAction || (exports.TriggerNodeCreationAction = {})); | ||
})(TriggerNodeCreationAction || (exports.TriggerNodeCreationAction = TriggerNodeCreationAction = {})); | ||
var TriggerEdgeCreationAction; | ||
@@ -45,3 +45,3 @@ (function (TriggerEdgeCreationAction) { | ||
TriggerEdgeCreationAction.create = create; | ||
})(TriggerEdgeCreationAction = exports.TriggerEdgeCreationAction || (exports.TriggerEdgeCreationAction = {})); | ||
})(TriggerEdgeCreationAction || (exports.TriggerEdgeCreationAction = TriggerEdgeCreationAction = {})); | ||
//# sourceMappingURL=tool-palette.js.map |
@@ -12,3 +12,3 @@ "use strict"; | ||
EditorContext.is = is; | ||
})(EditorContext = exports.EditorContext || (exports.EditorContext = {})); | ||
})(EditorContext || (exports.EditorContext = EditorContext = {})); | ||
var LabeledAction; | ||
@@ -30,3 +30,3 @@ (function (LabeledAction) { | ||
LabeledAction.toActionArray = toActionArray; | ||
})(LabeledAction = exports.LabeledAction || (exports.LabeledAction = {})); | ||
})(LabeledAction || (exports.LabeledAction = LabeledAction = {})); | ||
var PaletteItem; | ||
@@ -52,3 +52,3 @@ (function (PaletteItem) { | ||
PaletteItem.isTriggerElementCreationAction = isTriggerElementCreationAction; | ||
})(PaletteItem = exports.PaletteItem || (exports.PaletteItem = {})); | ||
})(PaletteItem || (exports.PaletteItem = PaletteItem = {})); | ||
var MenuItem; | ||
@@ -60,3 +60,3 @@ (function (MenuItem) { | ||
MenuItem.is = is; | ||
})(MenuItem = exports.MenuItem || (exports.MenuItem = {})); | ||
})(MenuItem || (exports.MenuItem = MenuItem = {})); | ||
//# sourceMappingURL=types.js.map |
@@ -33,3 +33,3 @@ "use strict"; | ||
UndoAction.create = create; | ||
})(UndoAction = exports.UndoAction || (exports.UndoAction = {})); | ||
})(UndoAction || (exports.UndoAction = UndoAction = {})); | ||
var RedoAction; | ||
@@ -48,3 +48,3 @@ (function (RedoAction) { | ||
RedoAction.create = create; | ||
})(RedoAction = exports.RedoAction || (exports.RedoAction = {})); | ||
})(RedoAction || (exports.RedoAction = RedoAction = {})); | ||
//# sourceMappingURL=undo-redo.js.map |
@@ -17,3 +17,3 @@ "use strict"; | ||
CenterAction.create = create; | ||
})(CenterAction = exports.CenterAction || (exports.CenterAction = {})); | ||
})(CenterAction || (exports.CenterAction = CenterAction = {})); | ||
var FitToScreenAction; | ||
@@ -30,3 +30,3 @@ (function (FitToScreenAction) { | ||
FitToScreenAction.create = create; | ||
})(FitToScreenAction = exports.FitToScreenAction || (exports.FitToScreenAction = {})); | ||
})(FitToScreenAction || (exports.FitToScreenAction = FitToScreenAction = {})); | ||
//# sourceMappingURL=viewport.js.map |
@@ -31,11 +31,19 @@ /******************************************************************************** | ||
export * from './action-protocol'; | ||
export * from './glsp-client'; | ||
export * from './jsonrpc/base-jsonrpc-glsp-client'; | ||
export * from './jsonrpc/glsp-jsonrpc-client'; | ||
export * from './client-server-protocol/base-glsp-client'; | ||
export * from './client-server-protocol/glsp-client'; | ||
export * from './client-server-protocol/glsp-server'; | ||
export * from './client-server-protocol/jsonrpc/base-jsonrpc-glsp-client'; | ||
export * from './client-server-protocol/jsonrpc/glsp-jsonrpc-client'; | ||
export * from './client-server-protocol/jsonrpc/glsp-jsonrpc-server'; | ||
export * from './client-server-protocol/jsonrpc/websocket-connection'; | ||
export * from './client-server-protocol/jsonrpc/ws-connection-provider'; | ||
export * from './client-server-protocol/types'; | ||
export * from './model/default-types'; | ||
export * from './model/model-schema'; | ||
export * from './utils/array-util'; | ||
export * from './utils/di-util'; | ||
export * from './utils/disposable'; | ||
export * from './utils/event'; | ||
export * from './utils/type-util'; | ||
export { SetBoundsAction, SetViewportAction }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -49,10 +49,18 @@ "use strict"; | ||
__exportStar(require("./action-protocol"), exports); | ||
__exportStar(require("./glsp-client"), exports); | ||
__exportStar(require("./jsonrpc/base-jsonrpc-glsp-client"), exports); | ||
__exportStar(require("./jsonrpc/glsp-jsonrpc-client"), exports); | ||
__exportStar(require("./client-server-protocol/base-glsp-client"), exports); | ||
__exportStar(require("./client-server-protocol/glsp-client"), exports); | ||
__exportStar(require("./client-server-protocol/glsp-server"), exports); | ||
__exportStar(require("./client-server-protocol/jsonrpc/base-jsonrpc-glsp-client"), exports); | ||
__exportStar(require("./client-server-protocol/jsonrpc/glsp-jsonrpc-client"), exports); | ||
__exportStar(require("./client-server-protocol/jsonrpc/glsp-jsonrpc-server"), exports); | ||
__exportStar(require("./client-server-protocol/jsonrpc/websocket-connection"), exports); | ||
__exportStar(require("./client-server-protocol/jsonrpc/ws-connection-provider"), exports); | ||
__exportStar(require("./client-server-protocol/types"), exports); | ||
__exportStar(require("./model/default-types"), exports); | ||
__exportStar(require("./model/model-schema"), exports); | ||
__exportStar(require("./utils/array-util"), exports); | ||
__exportStar(require("./utils/di-util"), exports); | ||
__exportStar(require("./utils/disposable"), exports); | ||
__exportStar(require("./utils/event"), exports); | ||
__exportStar(require("./utils/type-util"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -50,3 +50,3 @@ "use strict"; | ||
DefaultTypes.NODE_DIAMOND = 'node:diamond'; | ||
})(DefaultTypes = exports.DefaultTypes || (exports.DefaultTypes = {})); | ||
})(DefaultTypes || (exports.DefaultTypes = DefaultTypes = {})); | ||
//# sourceMappingURL=default-types.js.map |
/******************************************************************************** | ||
* Copyright (c) 2019-2022 EclipseSource and others. | ||
* Copyright (c) 2019-2023 EclipseSource and others. | ||
* | ||
@@ -69,2 +69,8 @@ * This program and the accompanying materials are made available under the | ||
/** | ||
* Helper function to convert a {@link MaybeArray} into an array. | ||
* @param maybe The MaybeArray to convert | ||
* @returns The corresponding array | ||
*/ | ||
export declare function asArray<T>(maybe: MaybeArray<T>): T[]; | ||
/** | ||
* Adds the given values to the given array. The add operation is executed distinct meaning | ||
@@ -71,0 +77,0 @@ * a value will not be pushed to the array if its already present in the array. |
"use strict"; | ||
/******************************************************************************** | ||
* Copyright (c) 2019-2022 EclipseSource and others. | ||
* Copyright (c) 2019-2023 EclipseSource and others. | ||
* | ||
@@ -18,3 +18,3 @@ * This program and the accompanying materials are made available under the | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isArrayMatching = exports.isStringArray = exports.isArrayOfPrimitive = exports.isArrayOfClass = exports.isArrayOfType = exports.distinctAdd = exports.flatPush = exports.remove = exports.pluck = exports.last = exports.first = void 0; | ||
exports.isArrayMatching = exports.isStringArray = exports.isArrayOfPrimitive = exports.isArrayOfClass = exports.isArrayOfType = exports.distinctAdd = exports.asArray = exports.flatPush = exports.remove = exports.pluck = exports.last = exports.first = void 0; | ||
function first(array, n) { | ||
@@ -70,2 +70,14 @@ if (n) { | ||
/** | ||
* Helper function to convert a {@link MaybeArray} into an array. | ||
* @param maybe The MaybeArray to convert | ||
* @returns The corresponding array | ||
*/ | ||
function asArray(maybe) { | ||
if (Array.isArray(maybe)) { | ||
return maybe; | ||
} | ||
return [maybe]; | ||
} | ||
exports.asArray = asArray; | ||
/** | ||
* Adds the given values to the given array. The add operation is executed distinct meaning | ||
@@ -72,0 +84,0 @@ * a value will not be pushed to the array if its already present in the array. |
@@ -0,5 +1,21 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2023 EclipseSource and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
import * as jsonrpc from 'vscode-jsonrpc'; | ||
/** | ||
* Interface for objects that can or need to be disposed properly. | ||
*/ | ||
export interface Disposable { | ||
export interface Disposable extends jsonrpc.Disposable { | ||
/** | ||
@@ -6,0 +22,0 @@ * Dispose this object. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DisposableCollection = exports.Disposable = void 0; | ||
/******************************************************************************** | ||
* Copyright (c) 2023 EclipseSource and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
const array_util_1 = require("./array-util"); | ||
const type_util_1 = require("./type-util"); | ||
const array_util_1 = require("../utils/array-util"); | ||
const type_util_1 = require("../utils/type-util"); | ||
var Disposable; | ||
@@ -45,3 +30,3 @@ (function (Disposable) { | ||
Disposable.create = create; | ||
})(Disposable = exports.Disposable || (exports.Disposable = {})); | ||
})(Disposable || (exports.Disposable = Disposable = {})); | ||
/** | ||
@@ -48,0 +33,0 @@ * Reusable base class to manage a collection of {@link Disposable}s. |
@@ -54,3 +54,3 @@ /******************************************************************************** | ||
* Essentially this wraps an instance of check as typeguard function. | ||
* @param constructor The constructor fo the class for which the typeguard should be created. | ||
* @param constructor The constructor of the class for which the typeguard should be created. | ||
* @returns The typeguard for this class. | ||
@@ -60,43 +60,54 @@ */ | ||
/** | ||
* Validates whether the given object as a property of type `string` with the given key. | ||
* Utility type that represents an arbitrary function. Should be used instead | ||
* of the default `Function` type which is considered to be unsafe. | ||
*/ | ||
export type SafeFunction<T = any> = (...args: any[]) => T; | ||
/** | ||
* Validates whether the given object has a property of type `string` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `string`. | ||
*/ | ||
export declare function hasStringProp(object: AnyObject, propertyKey: string): boolean; | ||
export declare function hasStringProp(object: AnyObject, propertyKey: string, optional?: boolean): boolean; | ||
/** | ||
* Validates whether the given object as a property of type `boolean` with the given key. | ||
* Validates whether the given object has a property of type `boolean` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `boolean`. | ||
*/ | ||
export declare function hasBooleanProp(object: AnyObject, propertyKey: string): boolean; | ||
export declare function hasBooleanProp(object: AnyObject, propertyKey: string, optional?: boolean): boolean; | ||
/** | ||
* Validates whether the given object as a property of type `number` with the given key. | ||
* Validates whether the given object has a property of type `number` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `number`. | ||
*/ | ||
export declare function hasNumberProp(object: AnyObject, propertyKey: string): boolean; | ||
export declare function hasNumberProp(object: AnyObject, propertyKey: string, optional?: boolean): boolean; | ||
/** | ||
* Validates whether the given object as a property of type `object` with the given key. | ||
* Validates whether the given object has a property of type `object` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `object`. | ||
*/ | ||
export declare function hasObjectProp(object: AnyObject, propertyKey: string): boolean; | ||
export declare function hasObjectProp(object: AnyObject, propertyKey: string, optional?: boolean): boolean; | ||
/** | ||
* Validates whether the given object as a property of type `function` with the given key. | ||
* Validates whether the given object has a property of type `function` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `function`. | ||
*/ | ||
export declare function hasFunctionProp(object: AnyObject, propertyKey: string): boolean; | ||
export declare function hasFunctionProp(object: AnyObject, propertyKey: string, optional?: boolean): boolean; | ||
/** | ||
* Validates whether the given object as a property of type `Array` with the given key. | ||
* Validates whether the given object has a property of type `Array` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `Array`. | ||
*/ | ||
export declare function hasArrayProp(object: AnyObject, propertyKey: string): boolean; | ||
export declare function hasArrayProp(object: AnyObject, propertyKey: string, optional?: boolean): boolean; | ||
//# sourceMappingURL=type-util.d.ts.map |
@@ -31,7 +31,7 @@ "use strict"; | ||
AnyObject.is = is; | ||
})(AnyObject = exports.AnyObject || (exports.AnyObject = {})); | ||
})(AnyObject || (exports.AnyObject = AnyObject = {})); | ||
/** | ||
* Utility function that create a typeguard function for a given class constructor. | ||
* Essentially this wraps an instance of check as typeguard function. | ||
* @param constructor The constructor fo the class for which the typeguard should be created. | ||
* @param constructor The constructor of the class for which the typeguard should be created. | ||
* @returns The typeguard for this class. | ||
@@ -44,61 +44,73 @@ */ | ||
/** | ||
* Validates whether the given object as a property of type `string` with the given key. | ||
* Validates whether the given object has a property of type `string` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `string`. | ||
*/ | ||
function hasStringProp(object, propertyKey) { | ||
return !!object && propertyKey in object && typeof object[propertyKey] === 'string'; | ||
function hasStringProp(object, propertyKey, optional = false) { | ||
const property = object[propertyKey]; | ||
return property !== undefined ? typeof property === 'string' : optional; | ||
} | ||
exports.hasStringProp = hasStringProp; | ||
/** | ||
* Validates whether the given object as a property of type `boolean` with the given key. | ||
* Validates whether the given object has a property of type `boolean` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `boolean`. | ||
*/ | ||
function hasBooleanProp(object, propertyKey) { | ||
return propertyKey in object && typeof object[propertyKey] === 'boolean'; | ||
function hasBooleanProp(object, propertyKey, optional = false) { | ||
const property = object[propertyKey]; | ||
return property !== undefined ? typeof property === 'boolean' : optional; | ||
} | ||
exports.hasBooleanProp = hasBooleanProp; | ||
/** | ||
* Validates whether the given object as a property of type `number` with the given key. | ||
* Validates whether the given object has a property of type `number` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `number`. | ||
*/ | ||
function hasNumberProp(object, propertyKey) { | ||
return propertyKey in object && typeof object[propertyKey] === 'number'; | ||
function hasNumberProp(object, propertyKey, optional = false) { | ||
const property = object[propertyKey]; | ||
return property !== undefined ? typeof property === 'number' : optional; | ||
} | ||
exports.hasNumberProp = hasNumberProp; | ||
/** | ||
* Validates whether the given object as a property of type `object` with the given key. | ||
* Validates whether the given object has a property of type `object` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `object`. | ||
*/ | ||
function hasObjectProp(object, propertyKey) { | ||
return propertyKey in object && AnyObject.is(object[propertyKey]); | ||
function hasObjectProp(object, propertyKey, optional = false) { | ||
const property = object[propertyKey]; | ||
return property !== undefined ? AnyObject.is(property) : optional; | ||
} | ||
exports.hasObjectProp = hasObjectProp; | ||
/** | ||
* Validates whether the given object as a property of type `function` with the given key. | ||
* Validates whether the given object has a property of type `function` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `function`. | ||
*/ | ||
function hasFunctionProp(object, propertyKey) { | ||
return propertyKey in object && typeof object[propertyKey] === 'function'; | ||
function hasFunctionProp(object, propertyKey, optional = false) { | ||
const property = object[propertyKey]; | ||
return property !== undefined ? typeof property === 'function' : optional; | ||
} | ||
exports.hasFunctionProp = hasFunctionProp; | ||
/** | ||
* Validates whether the given object as a property of type `Array` with the given key. | ||
* Validates whether the given object has a property of type `Array` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `Array`. | ||
*/ | ||
function hasArrayProp(object, propertyKey) { | ||
return propertyKey in object && Array.isArray(object[propertyKey]); | ||
function hasArrayProp(object, propertyKey, optional = false) { | ||
const property = object[propertyKey]; | ||
return property !== undefined ? Array.isArray(property) : optional; | ||
} | ||
exports.hasArrayProp = hasArrayProp; | ||
//# sourceMappingURL=type-util.js.map |
{ | ||
"name": "@eclipse-glsp/protocol", | ||
"version": "1.1.0-next.964b0af.221+964b0af", | ||
"version": "1.1.0-next.976795c.271+976795c", | ||
"description": "The protocol definition for client-server communication in GLSP", | ||
@@ -49,5 +49,5 @@ "keywords": [ | ||
"dependencies": { | ||
"sprotty-protocol": "0.13.0-next.f4445dd.342", | ||
"sprotty-protocol": "0.14.0-next.02bbac0.26", | ||
"uuid": "7.0.3", | ||
"vscode-ws-jsonrpc": "^2.0.1" | ||
"vscode-jsonrpc": "^8.0.2" | ||
}, | ||
@@ -57,6 +57,9 @@ "devDependencies": { | ||
}, | ||
"peerDependencies": { | ||
"inversify": "^5.1.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "964b0afec183bf5f0b7195f9020ea57b3d0c327f" | ||
"gitHead": "976795cf74566bacc8c90980b0e81b71087c0c69" | ||
} |
# Eclipse GLSP - Protocol | ||
The generic client-server communication protocol for the [Graphical Language Server Platform (GLSP)](https://github.com/eclipse-glsp/glsp) and a json-rpc based default implementation. | ||
In addition, this package provides shared common code and utility libraries for GLSP components. | ||
@@ -10,4 +11,4 @@ This project is built with `yarn` and is available from npm via [@eclipse-glsp/protocol](https://www.npmjs.com/package/@eclipse-glsp/protocol). | ||
For more information, please visit the [Eclipse GLSP Umbrella repository](https://github.com/eclipse-glsp/glsp) and the [Eclipse GLSP Website](https://www.eclipse.org/glsp/). | ||
If you have questions, contact us on our [spectrum chat](https://spectrum.chat/glsp/) and have a look at our [communication and support options](https://www.eclipse.org/glsp/contact/). | ||
If you have questions, please raise them in the [discussions](https://github.com/eclipse-glsp/glsp/discussions) and have a look at our [communication and support options](https://www.eclipse.org/glsp/contact/). | ||
![alt](https://www.eclipse.org/glsp/images/diagramanimated.gif) |
/******************************************************************************** | ||
* Copyright (c) 2022 STMicroelectronics and others. | ||
* Copyright (c) 2022-2023 STMicroelectronics and others. | ||
* | ||
@@ -18,3 +18,9 @@ * This program and the accompanying materials are made available under the | ||
import { expect } from 'chai'; | ||
import { ServerMessageAction, ServerStatusAction } from './client-notification'; | ||
import { | ||
EndProgressAction, | ||
ServerMessageAction, | ||
ServerStatusAction, | ||
StartProgressAction, | ||
UpdateProgressAction | ||
} from './client-notification'; | ||
/** | ||
@@ -83,10 +89,109 @@ * Tests for the utility functions declared in the namespaces of the protocol | ||
details: 'details', | ||
severity: 'ERROR', | ||
timeout: 5 | ||
severity: 'ERROR' | ||
}; | ||
const { message, severity, timeout, details } = expected; | ||
expect(ServerMessageAction.create(message, { severity, timeout, details })).to.deep.equals(expected); | ||
const { message, severity, details } = expected; | ||
expect(ServerMessageAction.create(message, { severity, details })).to.deep.equals(expected); | ||
}); | ||
}); | ||
}); | ||
describe('StartProgressAction', () => { | ||
describe('is', () => { | ||
it('should return true for an object having the correct type and a value for all required interface properties', () => { | ||
const messageAction: StartProgressAction = { kind: 'startProgress', progressId: '1', title: 'Progress title' }; | ||
expect(StartProgressAction.is(messageAction)).to.be.true; | ||
}); | ||
it('should return false for `undefined`', () => { | ||
expect(StartProgressAction.is(undefined)).to.be.false; | ||
}); | ||
it('should return false for an object that does not have all required interface properties', () => { | ||
expect(StartProgressAction.is({ kind: 'notTheRightOne' })).to.be.false; | ||
}); | ||
}); | ||
describe('create', () => { | ||
it('should return an object conforming to the interface with matching properties for the given required arguments and default values for the optional arguments', () => { | ||
const progressId = '1'; | ||
const title = 'Progress title'; | ||
const expected: StartProgressAction = { kind: StartProgressAction.KIND, progressId, title }; | ||
expect(StartProgressAction.create({ progressId, title })).to.deep.equals(expected); | ||
}); | ||
it('should return an object conforming to the interface with matching properties for the given required and optional arguments', () => { | ||
const expected: StartProgressAction = { | ||
kind: StartProgressAction.KIND, | ||
progressId: '1', | ||
title: 'Progress title', | ||
message: 'Some message', | ||
percentage: 10 | ||
}; | ||
const { progressId, title, message, percentage } = expected; | ||
expect(StartProgressAction.create({ progressId, title, message, percentage })).to.deep.equals(expected); | ||
}); | ||
}); | ||
}); | ||
describe('UpdateProgressAction', () => { | ||
describe('is', () => { | ||
it('should return true for an object having the correct type and a value for all required interface properties', () => { | ||
const messageAction: UpdateProgressAction = { kind: 'updateProgress', progressId: '1' }; | ||
expect(UpdateProgressAction.is(messageAction)).to.be.true; | ||
}); | ||
it('should return false for `undefined`', () => { | ||
expect(UpdateProgressAction.is(undefined)).to.be.false; | ||
}); | ||
it('should return false for an object that does not have all required interface properties', () => { | ||
expect(UpdateProgressAction.is({ kind: 'notTheRightOne' })).to.be.false; | ||
}); | ||
}); | ||
describe('create', () => { | ||
it('should return an object conforming to the interface with matching properties for the given required arguments and default values for the optional arguments', () => { | ||
const progressId = '1'; | ||
const expected: UpdateProgressAction = { kind: UpdateProgressAction.KIND, progressId }; | ||
expect(UpdateProgressAction.create(progressId)).to.deep.equals(expected); | ||
}); | ||
it('should return an object conforming to the interface with matching properties for the given required and optional arguments', () => { | ||
const expected: UpdateProgressAction = { | ||
kind: UpdateProgressAction.KIND, | ||
progressId: '1', | ||
message: 'Some message', | ||
percentage: 10 | ||
}; | ||
const { progressId, message, percentage } = expected; | ||
expect(UpdateProgressAction.create(progressId, { message, percentage })).to.deep.equals(expected); | ||
}); | ||
}); | ||
}); | ||
describe('EndProgressAction', () => { | ||
describe('is', () => { | ||
it('should return true for an object having the correct type and a value for all required interface properties', () => { | ||
const messageAction: EndProgressAction = { kind: 'endProgress', progressId: '1' }; | ||
expect(EndProgressAction.is(messageAction)).to.be.true; | ||
}); | ||
it('should return false for `undefined`', () => { | ||
expect(EndProgressAction.is(undefined)).to.be.false; | ||
}); | ||
it('should return false for an object that does not have all required interface properties', () => { | ||
expect(EndProgressAction.is({ kind: 'notTheRightOne' })).to.be.false; | ||
}); | ||
}); | ||
describe('create', () => { | ||
it('should return an object conforming to the interface with matching properties for the given required arguments and default values for the optional arguments', () => { | ||
const progressId = '1'; | ||
const expected: EndProgressAction = { kind: EndProgressAction.KIND, progressId, message: undefined }; | ||
expect(EndProgressAction.create(progressId)).to.deep.equals(expected); | ||
}); | ||
it('should return an object conforming to the interface with matching properties for the given required and optional arguments', () => { | ||
const expected: EndProgressAction = { | ||
kind: EndProgressAction.KIND, | ||
progressId: '1', | ||
message: 'Some message' | ||
}; | ||
const { progressId, message } = expected; | ||
expect(EndProgressAction.create(progressId, message)).to.deep.equals(expected); | ||
}); | ||
}); | ||
}); | ||
}); |
/******************************************************************************** | ||
* Copyright (c) 2021-2022 STMicroelectronics and others. | ||
* Copyright (c) 2021-2023 STMicroelectronics and others. | ||
* | ||
@@ -87,7 +87,2 @@ * This program and the accompanying materials are made available under the | ||
details?: string; | ||
/** | ||
* Timeout after which a displayed message disappears. | ||
*/ | ||
timeout?: number; | ||
} | ||
@@ -107,3 +102,2 @@ | ||
details?: string; | ||
timeout?: number; | ||
} = {} | ||
@@ -119,1 +113,114 @@ ): ServerMessageAction { | ||
} | ||
/** | ||
* Sent by the server to the client to request presenting the progress of a long running process in the UI. | ||
*/ | ||
export interface StartProgressAction extends Action { | ||
kind: typeof StartProgressAction.KIND; | ||
/** | ||
* An ID that can be used in subsequent `updateProgress` and `endProgress` events to make them refer to the same progress reporting. | ||
*/ | ||
progressId: string; | ||
/** | ||
* Short title of the progress reporting. Shown in the UI to describe the long running process. | ||
*/ | ||
title: string; | ||
/** | ||
* Optional additional progress message. Shown in the UI to describe the long running process. | ||
*/ | ||
message?: string; | ||
/** | ||
* Progress percentage to display (value range: 0 to 100). If omitted no percentage is shown. | ||
*/ | ||
percentage?: number; | ||
} | ||
export namespace StartProgressAction { | ||
export const KIND = 'startProgress'; | ||
export function is(object: any): object is StartProgressAction { | ||
return Action.hasKind(object, KIND) && hasStringProp(object, 'progressId') && hasStringProp(object, 'title'); | ||
} | ||
export function create(options: { progressId: string; title: string; message?: string; percentage?: number }): StartProgressAction { | ||
return { | ||
kind: KIND, | ||
...options | ||
}; | ||
} | ||
} | ||
/** | ||
* Sent by the server to the client to presenting an update of the progress of a long running process in the UI. | ||
*/ | ||
export interface UpdateProgressAction extends Action { | ||
kind: typeof UpdateProgressAction.KIND; | ||
/** | ||
* The ID of the progress reporting to update. | ||
*/ | ||
progressId: string; | ||
/** | ||
* The message to show in the progress reporting. | ||
*/ | ||
message?: string; | ||
/** | ||
* The percentage (value range: 0 to 100) to show in the progress reporting. | ||
*/ | ||
percentage?: number; | ||
} | ||
export namespace UpdateProgressAction { | ||
export const KIND = 'updateProgress'; | ||
export function is(object: any): object is UpdateProgressAction { | ||
return Action.hasKind(object, KIND) && hasStringProp(object, 'progressId'); | ||
} | ||
export function create( | ||
progressId: string, | ||
options: { | ||
message?: string; | ||
percentage?: number; | ||
} = {} | ||
): UpdateProgressAction { | ||
return { | ||
kind: KIND, | ||
progressId, | ||
...options | ||
}; | ||
} | ||
} | ||
/** | ||
* Sent by the server to the client to end the reporting of a progress. | ||
*/ | ||
export interface EndProgressAction extends Action { | ||
kind: typeof EndProgressAction.KIND; | ||
/** | ||
* The ID of the progress reporting to update. | ||
*/ | ||
progressId: string; | ||
/** | ||
* The message to show in the progress reporting. | ||
*/ | ||
message?: string; | ||
} | ||
export namespace EndProgressAction { | ||
export const KIND = 'endProgress'; | ||
export function is(object: any): object is EndProgressAction { | ||
return Action.hasKind(object, KIND) && hasStringProp(object, 'progressId'); | ||
} | ||
export function create(progressId: string, message?: string): EndProgressAction { | ||
return { | ||
kind: KIND, | ||
progressId, | ||
message | ||
}; | ||
} | ||
} |
@@ -48,3 +48,4 @@ /******************************************************************************** | ||
selectedElementsIDs: [], | ||
deselectedElementsIDs: [] | ||
deselectedElementsIDs: [], | ||
deselectAll: false | ||
}; | ||
@@ -57,3 +58,4 @@ expect(SelectAction.create()).to.deep.equals(expected); | ||
selectedElementsIDs: ['selected'], | ||
deselectedElementsIDs: ['deselected'] | ||
deselectedElementsIDs: ['deselected'], | ||
deselectAll: false | ||
}; | ||
@@ -63,3 +65,49 @@ const { selectedElementsIDs, deselectedElementsIDs } = expected; | ||
}); | ||
it('should return an object conforming to the interface with matching properties for the given required and optional arguments: deselectAll', () => { | ||
const expected: SelectAction = { | ||
kind: 'elementSelected', | ||
selectedElementsIDs: ['selected'], | ||
deselectedElementsIDs: [], | ||
deselectAll: true | ||
}; | ||
const { selectedElementsIDs } = expected; | ||
expect(SelectAction.create({ deselectedElementsIDs: true, selectedElementsIDs })).to.deep.equals(expected); | ||
}); | ||
}); | ||
describe('addSelection', () => { | ||
it('should return an object conforming to the interface with matching properties for the given required and optional arguments', () => { | ||
const expected: SelectAction = { | ||
kind: 'elementSelected', | ||
selectedElementsIDs: ['selected'], | ||
deselectedElementsIDs: [], | ||
deselectAll: false | ||
}; | ||
const { selectedElementsIDs } = expected; | ||
expect(SelectAction.addSelection(selectedElementsIDs)).to.deep.equals(expected); | ||
}); | ||
}); | ||
describe('removeSelection', () => { | ||
it('should return an object conforming to the interface with matching properties for the given required and optional arguments', () => { | ||
const expected: SelectAction = { | ||
kind: 'elementSelected', | ||
selectedElementsIDs: [], | ||
deselectedElementsIDs: ['deselected'], | ||
deselectAll: false | ||
}; | ||
const { deselectedElementsIDs } = expected; | ||
expect(SelectAction.removeSelection(deselectedElementsIDs)).to.deep.equals(expected); | ||
}); | ||
}); | ||
describe('setSelection', () => { | ||
it('should return an object conforming to the interface with matching properties for the given required and optional arguments', () => { | ||
const expected: SelectAction = { | ||
kind: 'elementSelected', | ||
selectedElementsIDs: ['selected'], | ||
deselectedElementsIDs: [], | ||
deselectAll: true | ||
}; | ||
const { selectedElementsIDs } = expected; | ||
expect(SelectAction.setSelection(selectedElementsIDs)).to.deep.equals(expected); | ||
}); | ||
}); | ||
}); | ||
@@ -66,0 +114,0 @@ |
@@ -17,2 +17,3 @@ /******************************************************************************** | ||
import * as sprotty from 'sprotty-protocol/lib/actions'; | ||
import { isStringArray } from '../utils/array-util'; | ||
import { hasArrayProp, hasBooleanProp } from '../utils/type-util'; | ||
@@ -40,2 +41,7 @@ import { Action } from './base-protocol'; | ||
deselectedElementsIDs: string[]; | ||
/** | ||
* Whether all currently selected elements should be deselected. | ||
*/ | ||
deselectAll?: boolean; | ||
} | ||
@@ -50,10 +56,23 @@ | ||
export function create(options: { selectedElementsIDs?: string[]; deselectedElementsIDs?: string[] } = {}): SelectAction { | ||
export function create(options: { selectedElementsIDs?: string[]; deselectedElementsIDs?: string[] | boolean } = {}): SelectAction { | ||
const deselectedElementsIDs = options.deselectedElementsIDs ?? []; | ||
return { | ||
kind: KIND, | ||
selectedElementsIDs: [], | ||
deselectedElementsIDs: [], | ||
...options | ||
selectedElementsIDs: options.selectedElementsIDs ?? [], | ||
deselectedElementsIDs: isStringArray(deselectedElementsIDs, true) ? deselectedElementsIDs : [], | ||
deselectAll: typeof deselectedElementsIDs === 'boolean' ? deselectedElementsIDs : false | ||
}; | ||
} | ||
export function addSelection(selectedElementsIDs: string[]): SelectAction { | ||
return create({ selectedElementsIDs }); | ||
} | ||
export function removeSelection(deselectedElementsIDs: string[]): SelectAction { | ||
return create({ deselectedElementsIDs }); | ||
} | ||
export function setSelection(selectedElementsIDs: string[]): SelectAction { | ||
return create({ selectedElementsIDs, deselectedElementsIDs: true }); | ||
} | ||
} | ||
@@ -60,0 +79,0 @@ |
/******************************************************************************** | ||
* Copyright (c) 2022 STMicroelectronics and others. | ||
* Copyright (c) 2022-2023 STMicroelectronics and others. | ||
* | ||
@@ -107,3 +107,3 @@ * This program and the accompanying materials are made available under the | ||
kind: 'setEditValidationResult', | ||
responseId: 'myRespsone', | ||
responseId: 'myResponse', | ||
args: { some: 'args' }, | ||
@@ -110,0 +110,0 @@ status: { severity: ValidationStatus.Severity.OK } |
/******************************************************************************** | ||
* Copyright (c) 2020-2022 EclipseSource and others. | ||
* Copyright (c) 2020-2023 EclipseSource and others. | ||
* | ||
@@ -167,3 +167,2 @@ * This program and the accompanying materials are made available under the | ||
*/ | ||
// eslint-disable-next-line no-shadow | ||
export enum Severity { | ||
@@ -175,3 +174,2 @@ FATAL, | ||
OK, | ||
// eslint-disable-next-line no-shadow | ||
NONE | ||
@@ -178,0 +176,0 @@ } |
/******************************************************************************** | ||
* Copyright (c) 2022 STMicroelectronics and others. | ||
* Copyright (c) 2022-2023 STMicroelectronics and others. | ||
* | ||
@@ -48,3 +48,4 @@ * This program and the accompanying materials are made available under the | ||
requestId: '', | ||
elementsIDs: ['myIds'] | ||
elementsIDs: ['myIds'], | ||
reason: 'batch' | ||
}; | ||
@@ -58,3 +59,4 @@ const { elementsIDs } = expected; | ||
requestId: 'myRequest', | ||
elementsIDs: ['myIds'] | ||
elementsIDs: ['myIds'], | ||
reason: 'batch' | ||
}; | ||
@@ -90,2 +92,3 @@ const { elementsIDs, requestId } = expected; | ||
responseId: '', | ||
reason: 'batch', | ||
markers: [{ description: 'desc', elementId: 'myId', kind: 'info', label: 'string' }] | ||
@@ -100,2 +103,3 @@ }; | ||
responseId: 'myResponse', | ||
reason: 'batch', | ||
markers: [{ description: 'desc', elementId: 'myId', kind: 'info', label: 'string' }] | ||
@@ -102,0 +106,0 @@ }; |
/******************************************************************************** | ||
* Copyright (c) 2021-2022 STMicroelectronics and others. | ||
* Copyright (c) 2021-2023 STMicroelectronics and others. | ||
* | ||
@@ -51,2 +51,12 @@ * This program and the accompanying materials are made available under the | ||
/** | ||
* The default reasons for markers. | ||
*/ | ||
export namespace MarkersReason { | ||
/** Markers resulting from a batch validation */ | ||
export const BATCH = 'batch'; | ||
/** Markers resulting from a live validation */ | ||
export const LIVE = 'live'; | ||
} | ||
/** | ||
* Action to retrieve markers for the specified model elements. Sent from the client to the server. | ||
@@ -63,2 +73,7 @@ * The corresponding namespace declares the action kind as constant and offers helper functions for type guard checks | ||
elementsIDs: string[]; | ||
/** | ||
* The reason for this request, such as `batch` or `live` validation. `batch` by default. | ||
*/ | ||
reason?: string; | ||
} | ||
@@ -73,3 +88,3 @@ | ||
export function create(elementsIDs: string[], options: { requestId?: string } = {}): RequestMarkersAction { | ||
export function create(elementsIDs: string[], options: { requestId?: string; reason?: string } = {}): RequestMarkersAction { | ||
return { | ||
@@ -79,2 +94,3 @@ kind: KIND, | ||
elementsIDs, | ||
reason: MarkersReason.BATCH, | ||
...options | ||
@@ -99,2 +115,7 @@ }; | ||
readonly markers: Marker[]; | ||
/** | ||
* The reason for message, such as `batch` or `live` validation. | ||
*/ | ||
reason?: string; | ||
} | ||
@@ -109,3 +130,3 @@ | ||
export function create(markers: Marker[], options: { responseId?: string } = {}): SetMarkersAction { | ||
export function create(markers: Marker[], options: { responseId?: string; reason?: string } = {}): SetMarkersAction { | ||
return { | ||
@@ -115,2 +136,3 @@ kind: KIND, | ||
markers, | ||
reason: MarkersReason.BATCH, | ||
...options | ||
@@ -117,0 +139,0 @@ }; |
/******************************************************************************** | ||
* Copyright (c) 2021-2022 STMicroelectronics and others. | ||
* Copyright (c) 2021-2023 STMicroelectronics and others. | ||
* | ||
@@ -118,5 +118,5 @@ * This program and the accompanying materials are made available under the | ||
/** | ||
* The identifiers of the elements that should be layouted, may be just the root element. | ||
* The identifiers of the elements that should be layouted, will default to the root element if not defined. | ||
*/ | ||
elementIds: string[]; | ||
elementIds?: string[]; | ||
} | ||
@@ -131,3 +131,3 @@ | ||
export function create(elementIds: string[]): LayoutOperation { | ||
export function create(elementIds?: string[]): LayoutOperation { | ||
return { | ||
@@ -134,0 +134,0 @@ kind: KIND, |
/******************************************************************************** | ||
* Copyright (c) 2022 STMicroelectronics and others. | ||
* Copyright (c) 2022-2023 STMicroelectronics and others. | ||
* | ||
@@ -21,3 +21,3 @@ * This program and the accompanying materials are made available under the | ||
describe('Tool palette Actions', () => { | ||
describe('TrigerNodeCreationAction', () => { | ||
describe('TriggerNodeCreationAction', () => { | ||
describe('is', () => { | ||
@@ -24,0 +24,0 @@ it('should return true for an object having the correct type and a value for all required interface properties', () => { |
@@ -22,3 +22,3 @@ /******************************************************************************** | ||
declare module 'sprotty-protocol/lib/actions' { | ||
// eslint-disable-next-line no-shadow | ||
// eslint-disable-next-line @typescript-eslint/no-shadow | ||
namespace SetViewportAction { | ||
@@ -28,3 +28,3 @@ export function is(object: any): object is SetViewportAction; | ||
// eslint-disable-next-line no-shadow | ||
// eslint-disable-next-line @typescript-eslint/no-shadow | ||
namespace SetBoundsAction { | ||
@@ -52,10 +52,18 @@ export function is(object: any): object is SetBoundsAction; | ||
export * from './action-protocol'; | ||
export * from './glsp-client'; | ||
export * from './jsonrpc/base-jsonrpc-glsp-client'; | ||
export * from './jsonrpc/glsp-jsonrpc-client'; | ||
export * from './client-server-protocol/base-glsp-client'; | ||
export * from './client-server-protocol/glsp-client'; | ||
export * from './client-server-protocol/glsp-server'; | ||
export * from './client-server-protocol/jsonrpc/base-jsonrpc-glsp-client'; | ||
export * from './client-server-protocol/jsonrpc/glsp-jsonrpc-client'; | ||
export * from './client-server-protocol/jsonrpc/glsp-jsonrpc-server'; | ||
export * from './client-server-protocol/jsonrpc/websocket-connection'; | ||
export * from './client-server-protocol/jsonrpc/ws-connection-provider'; | ||
export * from './client-server-protocol/types'; | ||
export * from './model/default-types'; | ||
export * from './model/model-schema'; | ||
export * from './utils/array-util'; | ||
export * from './utils/di-util'; | ||
export * from './utils/disposable'; | ||
export * from './utils/event'; | ||
export * from './utils/type-util'; | ||
export { SetBoundsAction, SetViewportAction }; |
/******************************************************************************** | ||
* Copyright (c) 2019-2022 EclipseSource and others. | ||
* Copyright (c) 2019-2023 EclipseSource and others. | ||
* | ||
@@ -102,2 +102,13 @@ * This program and the accompanying materials are made available under the | ||
/** | ||
* Helper function to convert a {@link MaybeArray} into an array. | ||
* @param maybe The MaybeArray to convert | ||
* @returns The corresponding array | ||
*/ | ||
export function asArray<T>(maybe: MaybeArray<T>): T[] { | ||
if (Array.isArray(maybe)) { | ||
return maybe; | ||
} | ||
return [maybe]; | ||
} | ||
/** | ||
* Adds the given values to the given array. The add operation is executed distinct meaning | ||
@@ -104,0 +115,0 @@ * a value will not be pushed to the array if its already present in the array. |
@@ -16,4 +16,5 @@ /******************************************************************************** | ||
********************************************************************************/ | ||
import { remove } from './array-util'; | ||
import { AnyObject, hasFunctionProp } from './type-util'; | ||
import * as jsonrpc from 'vscode-jsonrpc'; | ||
import { remove } from '../utils/array-util'; | ||
import { AnyObject, hasFunctionProp } from '../utils/type-util'; | ||
@@ -23,3 +24,3 @@ /** | ||
*/ | ||
export interface Disposable { | ||
export interface Disposable extends jsonrpc.Disposable { | ||
/** | ||
@@ -26,0 +27,0 @@ * Dispose this object. |
@@ -57,5 +57,17 @@ /******************************************************************************** | ||
}); | ||
it('should return false for an object that does not have a property that matches the given key.', () => { | ||
it('should return false for an object that does not have a property that matches the given key', () => { | ||
expect(hasStringProp({ anotherProp: 123 }, 'someProp')).to.be.false; | ||
}); | ||
it('should return true for an object that does not have a matching key when using the optional flag', () => { | ||
expect(hasStringProp({ anotherProp: 123 }, 'someProp', true)).to.be.true; | ||
}); | ||
it('should return false for an object that has a property with matching name but invalid type when using the optional flag', () => { | ||
expect(hasStringProp({ someProp: 123 }, 'someProp', true)).to.be.false; | ||
}); | ||
it('should return true for an object that has a property with matching name but without value when using the optional flag', () => { | ||
expect(hasStringProp({ someProp: undefined }, 'someProp', true)).to.be.true; | ||
}); | ||
it('should return true for an object that has a property that matches the given key and type when using the optional flag', () => { | ||
expect(hasStringProp({ someProp: 'someKey' }, 'someProp', true)).to.be.true; | ||
}); | ||
}); | ||
@@ -70,5 +82,17 @@ | ||
}); | ||
it('should return false for an object that does not have a property that matches the given key.', () => { | ||
it('should return false for an object that does not have a property that matches the given key', () => { | ||
expect(hasBooleanProp({ anotherProp: 123 }, 'someProp')).to.be.false; | ||
}); | ||
it('should return true for an object that does not have a matching key when using the optional flag', () => { | ||
expect(hasBooleanProp({ anotherProp: 123 }, 'someProp', true)).to.be.true; | ||
}); | ||
it('should return false for an object that has a property with matching name but invalid type when using the optional flag', () => { | ||
expect(hasBooleanProp({ someProp: 123 }, 'someProp', true)).to.be.false; | ||
}); | ||
it('should return true for an object that has a property with matching name but without value when using the optional flag', () => { | ||
expect(hasBooleanProp({ someProp: undefined }, 'someProp', true)).to.be.true; | ||
}); | ||
it('should return true for an object that has a property that matches the given key and type when using the optional flag', () => { | ||
expect(hasBooleanProp({ someProp: true }, 'someProp', true)).to.be.true; | ||
}); | ||
}); | ||
@@ -83,5 +107,17 @@ | ||
}); | ||
it('should return false for an object that does not have a property that matches the given key.', () => { | ||
expect(hasBooleanProp({ anotherProp: 123 }, 'someProp')).to.be.false; | ||
it('should return false for an object that does not have a property that matches the given key', () => { | ||
expect(hasNumberProp({ anotherProp: 123 }, 'someProp')).to.be.false; | ||
}); | ||
it('should return true for an object that does not have a matching key when using the optional flag', () => { | ||
expect(hasNumberProp({ anotherProp: 123 }, 'someProp', true)).to.be.true; | ||
}); | ||
it('should return false for an object that has a property with matching name but invalid type when using the optional flag', () => { | ||
expect(hasNumberProp({ someProp: '123' }, 'someProp', true)).to.be.false; | ||
}); | ||
it('should return true for an object that has a property with matching name but without value when using the optional flag', () => { | ||
expect(hasNumberProp({ someProp: undefined }, 'someProp', true)).to.be.true; | ||
}); | ||
it('should return true for an object that has a property that matches the given key and type when using the optional flag', () => { | ||
expect(hasNumberProp({ someProp: 123 }, 'someProp', true)).to.be.true; | ||
}); | ||
}); | ||
@@ -96,5 +132,17 @@ | ||
}); | ||
it('should return false for an object that does not have a property that matches the given key.', () => { | ||
it('should return false for an object that does not have a property that matches the given key', () => { | ||
expect(hasObjectProp({ anotherProp: 123 }, 'someProp')).to.be.false; | ||
}); | ||
it('should return true for an object that does not have a matching key when using the optional flag', () => { | ||
expect(hasObjectProp({ anotherProp: 123 }, 'someProp', true)).to.be.true; | ||
}); | ||
it('should return false for an object that has a property with matching name but invalid type when using the optional flag', () => { | ||
expect(hasObjectProp({ someProp: 123 }, 'someProp', true)).to.be.false; | ||
}); | ||
it('should return true for an object that has a property with matching name but without value when using the optional flag', () => { | ||
expect(hasObjectProp({ someProp: undefined }, 'someProp', true)).to.be.true; | ||
}); | ||
it('should return true for an object that has a property that matches the given key and type when using the optional flag', () => { | ||
expect(hasObjectProp({ someProp: { value: 'someKey' } }, 'someProp', true)).to.be.true; | ||
}); | ||
}); | ||
@@ -110,5 +158,18 @@ | ||
}); | ||
it('should return false for an object that does not have a property that matches the given key.', () => { | ||
it('should return false for an object that does not have a property that matches the given key', () => { | ||
expect(hasFunctionProp({ anotherProp: 123 }, 'someProp')).to.be.false; | ||
}); | ||
it('should return true for an object that does not have a matching key when using the optional flag', () => { | ||
expect(hasFunctionProp({ anotherProp: 123 }, 'someProp', true)).to.be.true; | ||
}); | ||
it('should return false for an object that has a property with matching name but invalid type when using the optional flag', () => { | ||
expect(hasFunctionProp({ someProp: 123 }, 'someProp', true)).to.be.false; | ||
}); | ||
it('should return true for an object that has a property with matching name but without value when using the optional flag', () => { | ||
expect(hasFunctionProp({ someProp: undefined }, 'someProp', true)).to.be.true; | ||
}); | ||
it('should return true for an object that has a property that matches the given key and type when using the optional flag', () => { | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
expect(hasFunctionProp({ someProp: () => {} }, 'someProp', true)).to.be.true; | ||
}); | ||
}); | ||
@@ -123,6 +184,18 @@ | ||
}); | ||
it('should return false for an object that does not have a property that matches the given key.', () => { | ||
it('should return false for an object that does not have a property that matches the given key', () => { | ||
expect(hasArrayProp({ anotherProp: 123 }, 'someProp')).to.be.false; | ||
}); | ||
it('should return true for an object that does not have a matching key when using the optional flag', () => { | ||
expect(hasArrayProp({ anotherProp: 123 }, 'someProp', true)).to.be.true; | ||
}); | ||
it('should return false for an object that has a property with matching name but invalid type when using the optional flag', () => { | ||
expect(hasArrayProp({ someProp: 123 }, 'someProp', true)).to.be.false; | ||
}); | ||
it('should return true for an object that has a property with matching name but without value when using the optional flag', () => { | ||
expect(hasArrayProp({ someProp: undefined }, 'someProp', true)).to.be.true; | ||
}); | ||
it('should return true for an object that has a property that matches the given key and type when using the optional flag', () => { | ||
expect(hasArrayProp({ someProp: ['some', 'prop'] }, 'someProp', true)).to.be.true; | ||
}); | ||
}); | ||
}); |
@@ -64,3 +64,3 @@ /******************************************************************************** | ||
* Essentially this wraps an instance of check as typeguard function. | ||
* @param constructor The constructor fo the class for which the typeguard should be created. | ||
* @param constructor The constructor of the class for which the typeguard should be created. | ||
* @returns The typeguard for this class. | ||
@@ -73,59 +73,77 @@ */ | ||
/** | ||
* Validates whether the given object as a property of type `string` with the given key. | ||
* Utility type that represents an arbitrary function. Should be used instead | ||
* of the default `Function` type which is considered to be unsafe. | ||
*/ | ||
export type SafeFunction<T = any> = (...args: any[]) => T; | ||
/** | ||
* Validates whether the given object has a property of type `string` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `string`. | ||
*/ | ||
export function hasStringProp(object: AnyObject, propertyKey: string): boolean { | ||
return !!object && propertyKey in object && typeof (object as any)[propertyKey] === 'string'; | ||
export function hasStringProp(object: AnyObject, propertyKey: string, optional = false): boolean { | ||
const property = (object as any)[propertyKey]; | ||
return property !== undefined ? typeof property === 'string' : optional; | ||
} | ||
/** | ||
* Validates whether the given object as a property of type `boolean` with the given key. | ||
* Validates whether the given object has a property of type `boolean` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `boolean`. | ||
*/ | ||
export function hasBooleanProp(object: AnyObject, propertyKey: string): boolean { | ||
return propertyKey in object && typeof (object as any)[propertyKey] === 'boolean'; | ||
export function hasBooleanProp(object: AnyObject, propertyKey: string, optional = false): boolean { | ||
const property = (object as any)[propertyKey]; | ||
return property !== undefined ? typeof property === 'boolean' : optional; | ||
} | ||
/** | ||
* Validates whether the given object as a property of type `number` with the given key. | ||
* Validates whether the given object has a property of type `number` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `number`. | ||
*/ | ||
export function hasNumberProp(object: AnyObject, propertyKey: string): boolean { | ||
return propertyKey in object && typeof (object as any)[propertyKey] === 'number'; | ||
export function hasNumberProp(object: AnyObject, propertyKey: string, optional = false): boolean { | ||
const property = (object as any)[propertyKey]; | ||
return property !== undefined ? typeof property === 'number' : optional; | ||
} | ||
/** | ||
* Validates whether the given object as a property of type `object` with the given key. | ||
* Validates whether the given object has a property of type `object` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `object`. | ||
*/ | ||
export function hasObjectProp(object: AnyObject, propertyKey: string): boolean { | ||
return propertyKey in object && AnyObject.is((object as any)[propertyKey]); | ||
export function hasObjectProp(object: AnyObject, propertyKey: string, optional = false): boolean { | ||
const property = (object as any)[propertyKey]; | ||
return property !== undefined ? AnyObject.is(property) : optional; | ||
} | ||
/** | ||
* Validates whether the given object as a property of type `function` with the given key. | ||
* Validates whether the given object has a property of type `function` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `function`. | ||
*/ | ||
export function hasFunctionProp(object: AnyObject, propertyKey: string): boolean { | ||
return propertyKey in object && typeof (object as any)[propertyKey] === 'function'; | ||
export function hasFunctionProp(object: AnyObject, propertyKey: string, optional = false): boolean { | ||
const property = (object as any)[propertyKey]; | ||
return property !== undefined ? typeof property === 'function' : optional; | ||
} | ||
/** | ||
* Validates whether the given object as a property of type `Array` with the given key. | ||
* Validates whether the given object has a property of type `Array` with the given key. | ||
* @param object The object that should be validated | ||
* @param propertyKey The key of the property | ||
* @param optional Flag to indicate wether the property can be optional i.e. also return true if the given key is undefined | ||
* @returns `true` if the object has property with matching key of type `Array`. | ||
*/ | ||
export function hasArrayProp(object: AnyObject, propertyKey: string): boolean { | ||
return propertyKey in object && Array.isArray((object as any)[propertyKey]); | ||
export function hasArrayProp(object: AnyObject, propertyKey: string, optional = false): boolean { | ||
const property = (object as any)[propertyKey]; | ||
return property !== undefined ? Array.isArray(property) : optional; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 13 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 7 instances in 1 package
14656
14
846900
4
229
22
+ Addedvscode-jsonrpc@^8.0.2
+ Addedinversify@5.1.1(transitive)
+ Addedsprotty-protocol@0.14.0-next.02bbac0.26(transitive)
+ Addedvscode-jsonrpc@8.2.1(transitive)
- Removedvscode-ws-jsonrpc@^2.0.1
- Removedsprotty-protocol@0.13.0-next.f4445dd.342(transitive)
- Removedvscode-jsonrpc@8.0.2(transitive)
- Removedvscode-ws-jsonrpc@2.0.2(transitive)