@eclipse-glsp/protocol
Advanced tools
Comparing version 0.10.0-next.6715f8e.162 to 0.10.0-next.6bee8eb.163
@@ -0,1 +1,2 @@ | ||
import { JsonAny } from './types'; | ||
/** | ||
@@ -58,6 +59,6 @@ * A general message serves as an envelope carrying an action to be transmitted between the client and the server via a DiagramServer. | ||
readonly responseId: string; | ||
readonly detail?: string | number | boolean | import("./types").Args | import("./types").JsonArray | null | undefined; | ||
readonly detail?: JsonAny | undefined; | ||
static readonly KIND = "rejectRequest"; | ||
readonly kind = "rejectRequest"; | ||
constructor(message: string, responseId: string, detail?: string | number | boolean | import("./types").Args | import("./types").JsonArray | null | undefined); | ||
constructor(message: string, responseId: string, detail?: JsonAny | undefined); | ||
} | ||
@@ -64,0 +65,0 @@ export declare function isRejectAction(action: any): action is RejectAction; |
@@ -22,3 +22,3 @@ "use strict"; | ||
function isActionMessage(object) { | ||
return object !== undefined && typeguard_util_1.isString(object, 'clientId') && isAction(object['action']); | ||
return object !== undefined && (0, typeguard_util_1.isString)(object, 'clientId') && isAction(object['action']); | ||
} | ||
@@ -31,3 +31,3 @@ exports.isActionMessage = isActionMessage; | ||
function isAction(action) { | ||
return action !== undefined && typeguard_util_1.isString(action, 'kind'); | ||
return action !== undefined && (0, typeguard_util_1.isString)(action, 'kind'); | ||
} | ||
@@ -40,3 +40,3 @@ exports.isAction = isAction; | ||
function isRequestAction(action) { | ||
return isAction(action) && typeguard_util_1.isString(action, 'requestId'); | ||
return isAction(action) && (0, typeguard_util_1.isString)(action, 'requestId'); | ||
} | ||
@@ -66,3 +66,3 @@ exports.isRequestAction = isRequestAction; | ||
function isRejectAction(action) { | ||
return isResponseAction(action) && action.kind === RejectAction.KIND && typeguard_util_1.isString(action, 'message'); | ||
return isResponseAction(action) && action.kind === RejectAction.KIND && (0, typeguard_util_1.isString)(action, 'message'); | ||
} | ||
@@ -82,5 +82,5 @@ exports.isRejectAction = isRejectAction; | ||
function isCompoundOperation(operation) { | ||
return isActionKind(operation, CompoundOperation.KIND) && typeguard_util_1.isArray(operation, 'operationList'); | ||
return isActionKind(operation, CompoundOperation.KIND) && (0, typeguard_util_1.isArray)(operation, 'operationList'); | ||
} | ||
exports.isCompoundOperation = isCompoundOperation; | ||
//# sourceMappingURL=base-protocol.js.map |
@@ -36,6 +36,6 @@ "use strict"; | ||
function isGLSPServerStatusAction(action) { | ||
return (base_protocol_1.isActionKind(action, GLSPServerStatusAction.KIND) && | ||
typeguard_util_1.isString(action, 'severity') && | ||
typeguard_util_1.isString(action, 'message') && | ||
typeguard_util_1.isNumber(action, 'timeout')); | ||
return ((0, base_protocol_1.isActionKind)(action, GLSPServerStatusAction.KIND) && | ||
(0, typeguard_util_1.isString)(action, 'severity') && | ||
(0, typeguard_util_1.isString)(action, 'message') && | ||
(0, typeguard_util_1.isNumber)(action, 'timeout')); | ||
} | ||
@@ -58,8 +58,8 @@ exports.isGLSPServerStatusAction = isGLSPServerStatusAction; | ||
function isServerMessageAction(action) { | ||
return (base_protocol_1.isActionKind(action, ServerMessageAction.KIND) && | ||
typeguard_util_1.isString(action, 'severity') && | ||
typeguard_util_1.isString(action, 'message') && | ||
typeguard_util_1.isNumber(action, 'timeout')); | ||
return ((0, base_protocol_1.isActionKind)(action, ServerMessageAction.KIND) && | ||
(0, typeguard_util_1.isString)(action, 'severity') && | ||
(0, typeguard_util_1.isString)(action, 'message') && | ||
(0, typeguard_util_1.isNumber)(action, 'timeout')); | ||
} | ||
exports.isServerMessageAction = isServerMessageAction; | ||
//# sourceMappingURL=client-notification.js.map |
@@ -25,3 +25,3 @@ "use strict"; | ||
class RequestClipboardDataAction { | ||
constructor(editorContext, requestId = base_protocol_1.generateRequestId(), kind = RequestClipboardDataAction.KIND) { | ||
constructor(editorContext, requestId = (0, base_protocol_1.generateRequestId)(), kind = RequestClipboardDataAction.KIND) { | ||
this.editorContext = editorContext; | ||
@@ -38,3 +38,3 @@ this.requestId = requestId; | ||
function isRequestClipboardDataAction(action) { | ||
return base_protocol_1.isActionKind(action, RequestClipboardDataAction.KIND) && typeguard_util_1.isObject(action, 'editorContext') && typeguard_util_1.isString(action, 'requestId'); | ||
return (0, base_protocol_1.isActionKind)(action, RequestClipboardDataAction.KIND) && (0, typeguard_util_1.isObject)(action, 'editorContext') && (0, typeguard_util_1.isString)(action, 'requestId'); | ||
} | ||
@@ -55,3 +55,3 @@ exports.isRequestClipboardDataAction = isRequestClipboardDataAction; | ||
function isSetClipboardDataAction(action) { | ||
return base_protocol_1.isActionKind(action, SetClipboardDataAction.KIND) && typeguard_util_1.isObject(action, 'clipboardData') && typeguard_util_1.isString(action, 'responseId'); | ||
return (0, base_protocol_1.isActionKind)(action, SetClipboardDataAction.KIND) && (0, typeguard_util_1.isObject)(action, 'clipboardData') && (0, typeguard_util_1.isString)(action, 'responseId'); | ||
} | ||
@@ -72,3 +72,3 @@ exports.isSetClipboardDataAction = isSetClipboardDataAction; | ||
function isCutOperation(action) { | ||
return base_protocol_1.isActionKind(action, CutOperation.KIND) && typeguard_util_1.isObject(action, 'editorContext'); | ||
return (0, base_protocol_1.isActionKind)(action, CutOperation.KIND) && (0, typeguard_util_1.isObject)(action, 'editorContext'); | ||
} | ||
@@ -90,5 +90,5 @@ exports.isCutOperation = isCutOperation; | ||
function isPasteOperation(action) { | ||
return base_protocol_1.isActionKind(action, PasteOperation.KIND) && typeguard_util_1.isObject(action, 'clipboardData') && typeguard_util_1.isObject(action, 'editorContext'); | ||
return (0, base_protocol_1.isActionKind)(action, PasteOperation.KIND) && (0, typeguard_util_1.isObject)(action, 'clipboardData') && (0, typeguard_util_1.isObject)(action, 'editorContext'); | ||
} | ||
exports.isPasteOperation = isPasteOperation; | ||
//# sourceMappingURL=clipboard.js.map |
@@ -25,3 +25,3 @@ "use strict"; | ||
class RequestContextActions { | ||
constructor(contextId, editorContext, requestId = base_protocol_1.generateRequestId(), kind = RequestContextActions.KIND) { | ||
constructor(contextId, editorContext, requestId = (0, base_protocol_1.generateRequestId)(), kind = RequestContextActions.KIND) { | ||
this.contextId = contextId; | ||
@@ -36,6 +36,6 @@ this.editorContext = editorContext; | ||
function isRequestContextActions(action) { | ||
return (base_protocol_1.isActionKind(action, RequestContextActions.KIND) && | ||
typeguard_util_1.isString(action, 'contextId') && | ||
typeguard_util_1.isObject(action, 'editorContext') && | ||
typeguard_util_1.isString(action, 'requestId')); | ||
return ((0, base_protocol_1.isActionKind)(action, RequestContextActions.KIND) && | ||
(0, typeguard_util_1.isString)(action, 'contextId') && | ||
(0, typeguard_util_1.isObject)(action, 'editorContext') && | ||
(0, typeguard_util_1.isString)(action, 'requestId')); | ||
} | ||
@@ -57,5 +57,5 @@ exports.isRequestContextActions = isRequestContextActions; | ||
function isSetContextActionsAction(action) { | ||
return base_protocol_1.isActionKind(action, SetContextActions.KIND) && typeguard_util_1.isArray(action, 'actions') && typeguard_util_1.isString(action, 'responseId'); | ||
return (0, base_protocol_1.isActionKind)(action, SetContextActions.KIND) && (0, typeguard_util_1.isArray)(action, 'actions') && (0, typeguard_util_1.isString)(action, 'responseId'); | ||
} | ||
exports.isSetContextActionsAction = isSetContextActionsAction; | ||
//# sourceMappingURL=contexts.js.map |
@@ -35,6 +35,6 @@ "use strict"; | ||
function isReconnectEdgeOperation(action) { | ||
return (base_protocol_1.isActionKind(action, ReconnectEdgeOperation.KIND) && | ||
typeguard_util_1.isString(action, 'edgeElementId') && | ||
typeguard_util_1.isString(action, 'sourceElementId') && | ||
typeguard_util_1.isString(action, 'targetElementId')); | ||
return ((0, base_protocol_1.isActionKind)(action, ReconnectEdgeOperation.KIND) && | ||
(0, typeguard_util_1.isString)(action, 'edgeElementId') && | ||
(0, typeguard_util_1.isString)(action, 'sourceElementId') && | ||
(0, typeguard_util_1.isString)(action, 'targetElementId')); | ||
} | ||
@@ -55,5 +55,5 @@ exports.isReconnectEdgeOperation = isReconnectEdgeOperation; | ||
function isChangeRoutingsPointsOperation(action) { | ||
return base_protocol_1.isActionKind(action, ChangeRoutingPointsOperation.KIND) && typeguard_util_1.isArray(action, 'newRoutingPoints'); | ||
return (0, base_protocol_1.isActionKind)(action, ChangeRoutingPointsOperation.KIND) && (0, typeguard_util_1.isArray)(action, 'newRoutingPoints'); | ||
} | ||
exports.isChangeRoutingsPointsOperation = isChangeRoutingsPointsOperation; | ||
//# sourceMappingURL=edge-modification.js.map |
@@ -22,3 +22,3 @@ "use strict"; | ||
function isCreateOperation(action) { | ||
return base_protocol_1.isAction(action) && typeguard_util_1.isString(action, 'elementTypeId'); | ||
return (0, base_protocol_1.isAction)(action) && (0, typeguard_util_1.isString)(action, 'elementTypeId'); | ||
} | ||
@@ -41,3 +41,3 @@ exports.isCreateOperation = isCreateOperation; | ||
function isCreateNodeOperation(action) { | ||
return base_protocol_1.isActionKind(action, CreateNodeOperation.KIND) && typeguard_util_1.isString(action, 'elementTypeId'); | ||
return (0, base_protocol_1.isActionKind)(action, CreateNodeOperation.KIND) && (0, typeguard_util_1.isString)(action, 'elementTypeId'); | ||
} | ||
@@ -60,6 +60,6 @@ exports.isCreateNodeOperation = isCreateNodeOperation; | ||
function isCreateEdgeOperation(action) { | ||
return (base_protocol_1.isActionKind(action, CreateEdgeOperation.KIND) && | ||
typeguard_util_1.isString(action, 'elementTypeId') && | ||
typeguard_util_1.isString(action, 'sourceElementId') && | ||
typeguard_util_1.isString(action, 'targetElementId')); | ||
return ((0, base_protocol_1.isActionKind)(action, CreateEdgeOperation.KIND) && | ||
(0, typeguard_util_1.isString)(action, 'elementTypeId') && | ||
(0, typeguard_util_1.isString)(action, 'sourceElementId') && | ||
(0, typeguard_util_1.isString)(action, 'targetElementId')); | ||
} | ||
@@ -79,5 +79,5 @@ exports.isCreateEdgeOperation = isCreateEdgeOperation; | ||
function isDeleteElementOperation(action) { | ||
return base_protocol_1.isActionKind(action, DeleteElementOperation.KIND) && typeguard_util_1.isArray(action, 'elementIds'); | ||
return (0, base_protocol_1.isActionKind)(action, DeleteElementOperation.KIND) && (0, typeguard_util_1.isArray)(action, 'elementIds'); | ||
} | ||
exports.isDeleteElementOperation = isDeleteElementOperation; | ||
//# sourceMappingURL=element-creation.js.map |
@@ -34,3 +34,3 @@ "use strict"; | ||
static create(elementId, bounds) { | ||
return new RequestPopupModelAction(elementId, bounds, base_protocol_1.generateRequestId()); | ||
return new RequestPopupModelAction(elementId, bounds, (0, base_protocol_1.generateRequestId)()); | ||
} | ||
@@ -41,6 +41,6 @@ } | ||
function isRequestPopupModelAction(action) { | ||
return (base_protocol_1.isActionKind(action, RequestPopupModelAction.KIND) && | ||
typeguard_util_1.isString(action, 'elementId') && | ||
typeguard_util_1.isObject(action, 'bounds') && | ||
typeguard_util_1.isString(action, 'requestId')); | ||
return ((0, base_protocol_1.isActionKind)(action, RequestPopupModelAction.KIND) && | ||
(0, typeguard_util_1.isString)(action, 'elementId') && | ||
(0, typeguard_util_1.isObject)(action, 'bounds') && | ||
(0, typeguard_util_1.isString)(action, 'requestId')); | ||
} | ||
@@ -62,5 +62,5 @@ exports.isRequestPopupModelAction = isRequestPopupModelAction; | ||
function isSetPopupModelAction(action) { | ||
return base_protocol_1.isActionKind(action, SetPopupModelAction.KIND) && typeguard_util_1.isObject(action, 'newRoot') && typeguard_util_1.isString(action, 'responseId'); | ||
return (0, base_protocol_1.isActionKind)(action, SetPopupModelAction.KIND) && (0, typeguard_util_1.isObject)(action, 'newRoot') && (0, typeguard_util_1.isString)(action, 'responseId'); | ||
} | ||
exports.isSetPopupModelAction = isSetPopupModelAction; | ||
//# sourceMappingURL=element-hover.js.map |
@@ -79,3 +79,3 @@ "use strict"; | ||
class RequestNavigationTargetsAction { | ||
constructor(targetTypeId, editorContext, requestId = base_protocol_1.generateRequestId()) { | ||
constructor(targetTypeId, editorContext, requestId = (0, base_protocol_1.generateRequestId)()) { | ||
this.targetTypeId = targetTypeId; | ||
@@ -90,6 +90,6 @@ this.editorContext = editorContext; | ||
function isRequestNavigationTargetsAction(action) { | ||
return (base_protocol_1.isActionKind(action, RequestNavigationTargetsAction.KIND) && | ||
typeguard_util_1.isString(action, 'targetTypeId') && | ||
typeguard_util_1.isObject(action, 'editorContext') && | ||
typeguard_util_1.isString(action, 'requestId')); | ||
return ((0, base_protocol_1.isActionKind)(action, RequestNavigationTargetsAction.KIND) && | ||
(0, typeguard_util_1.isString)(action, 'targetTypeId') && | ||
(0, typeguard_util_1.isObject)(action, 'editorContext') && | ||
(0, typeguard_util_1.isString)(action, 'requestId')); | ||
} | ||
@@ -113,3 +113,3 @@ exports.isRequestNavigationTargetsAction = isRequestNavigationTargetsAction; | ||
function isSetNavigationTargetsAction(action) { | ||
return base_protocol_1.isActionKind(action, SetNavigationTargetsAction.KIND) && typeguard_util_1.isArray(action, 'targets') && typeguard_util_1.isString(action, 'responseId'); | ||
return (0, base_protocol_1.isActionKind)(action, SetNavigationTargetsAction.KIND) && (0, typeguard_util_1.isArray)(action, 'targets') && (0, typeguard_util_1.isString)(action, 'responseId'); | ||
} | ||
@@ -127,3 +127,3 @@ exports.isSetNavigationTargetsAction = isSetNavigationTargetsAction; | ||
function isNavigateToTargetAction(action) { | ||
return base_protocol_1.isActionKind(action, NavigateToTargetAction.KIND) && typeguard_util_1.isObject(action, 'target'); | ||
return (0, base_protocol_1.isActionKind)(action, NavigateToTargetAction.KIND) && (0, typeguard_util_1.isObject)(action, 'target'); | ||
} | ||
@@ -137,3 +137,3 @@ exports.isNavigateToTargetAction = isNavigateToTargetAction; | ||
class ResolveNavigationTargetAction { | ||
constructor(navigationTarget, requestId = base_protocol_1.generateRequestId()) { | ||
constructor(navigationTarget, requestId = (0, base_protocol_1.generateRequestId)()) { | ||
this.navigationTarget = navigationTarget; | ||
@@ -147,3 +147,3 @@ this.requestId = requestId; | ||
function isResolveNavigationTargetAction(action) { | ||
return (base_protocol_1.isActionKind(action, ResolveNavigationTargetAction.KIND) && typeguard_util_1.isObject(action, 'navigationTarget') && typeguard_util_1.isString(action, 'requestId')); | ||
return ((0, base_protocol_1.isActionKind)(action, ResolveNavigationTargetAction.KIND) && (0, typeguard_util_1.isObject)(action, 'navigationTarget') && (0, typeguard_util_1.isString)(action, 'requestId')); | ||
} | ||
@@ -166,3 +166,3 @@ exports.isResolveNavigationTargetAction = isResolveNavigationTargetAction; | ||
function isSetResolvedNavigationTargets(action) { | ||
return base_protocol_1.isActionKind(action, SetResolvedNavigationTargetAction.KIND) && typeguard_util_1.isArray(action, 'elementIds') && typeguard_util_1.isString(action, 'responseId'); | ||
return (0, base_protocol_1.isActionKind)(action, SetResolvedNavigationTargetAction.KIND) && (0, typeguard_util_1.isArray)(action, 'elementIds') && (0, typeguard_util_1.isString)(action, 'responseId'); | ||
} | ||
@@ -184,5 +184,5 @@ exports.isSetResolvedNavigationTargets = isSetResolvedNavigationTargets; | ||
function isNavigateToExternalTargetAction(action) { | ||
return base_protocol_1.isActionKind(action, NavigateToExternalTargetAction.KIND) && typeguard_util_1.isObject(action, 'target'); | ||
return (0, base_protocol_1.isActionKind)(action, NavigateToExternalTargetAction.KIND) && (0, typeguard_util_1.isObject)(action, 'target'); | ||
} | ||
exports.isNavigateToExternalTargetAction = isNavigateToExternalTargetAction; | ||
//# sourceMappingURL=element-navigation.js.map |
@@ -36,3 +36,3 @@ "use strict"; | ||
function isSelectAction(action) { | ||
return base_protocol_1.isActionKind(action, SelectAction.KIND) && typeguard_util_1.isArray(action, 'selectedElementsIDs') && typeguard_util_1.isArray(action, 'deselectedElementsIDs'); | ||
return (0, base_protocol_1.isActionKind)(action, SelectAction.KIND) && (0, typeguard_util_1.isArray)(action, 'selectedElementsIDs') && (0, typeguard_util_1.isArray)(action, 'deselectedElementsIDs'); | ||
} | ||
@@ -55,5 +55,5 @@ exports.isSelectAction = isSelectAction; | ||
function isSelectAllAction(action) { | ||
return base_protocol_1.isActionKind(action, SelectAllAction.KIND) && typeguard_util_1.isBoolean(action, 'select'); | ||
return (0, base_protocol_1.isActionKind)(action, SelectAllAction.KIND) && (0, typeguard_util_1.isBoolean)(action, 'select'); | ||
} | ||
exports.isSelectAllAction = isSelectAllAction; | ||
//# sourceMappingURL=element-selection.js.map |
@@ -25,3 +25,3 @@ "use strict"; | ||
class RequestEditValidationAction { | ||
constructor(contextId, modelElementId, text, requestId = base_protocol_1.generateRequestId(), kind = RequestEditValidationAction.KIND) { | ||
constructor(contextId, modelElementId, text, requestId = (0, base_protocol_1.generateRequestId)(), kind = RequestEditValidationAction.KIND) { | ||
this.contextId = contextId; | ||
@@ -37,7 +37,7 @@ this.modelElementId = modelElementId; | ||
function isRequestEditValidationAction(action) { | ||
return (base_protocol_1.isRequestAction(action) && | ||
return ((0, base_protocol_1.isRequestAction)(action) && | ||
action.kind === RequestEditValidationAction.KIND && | ||
typeguard_util_1.isString(action, 'contextId') && | ||
typeguard_util_1.isString(action, 'modelElementId') && | ||
typeguard_util_1.isString(action, 'text')); | ||
(0, typeguard_util_1.isString)(action, 'contextId') && | ||
(0, typeguard_util_1.isString)(action, 'modelElementId') && | ||
(0, typeguard_util_1.isString)(action, 'text')); | ||
} | ||
@@ -59,3 +59,3 @@ exports.isRequestEditValidationAction = isRequestEditValidationAction; | ||
function isSetEditValidationResultAction(action) { | ||
return base_protocol_1.isActionKind(action, SetEditValidationResultAction.KIND) && typeguard_util_1.isObject(action, 'status') && typeguard_util_1.isString(action, 'responseId'); | ||
return (0, base_protocol_1.isActionKind)(action, SetEditValidationResultAction.KIND) && (0, typeguard_util_1.isObject)(action, 'status') && (0, typeguard_util_1.isString)(action, 'responseId'); | ||
} | ||
@@ -73,3 +73,3 @@ exports.isSetEditValidationResultAction = isSetEditValidationResultAction; | ||
function isApplyLabelEditOperation(action) { | ||
return base_protocol_1.isActionKind(action, ApplyLabelEditOperation.KIND) && typeguard_util_1.isString(action, 'labelId') && typeguard_util_1.isString(action, 'text'); | ||
return (0, base_protocol_1.isActionKind)(action, ApplyLabelEditOperation.KIND) && (0, typeguard_util_1.isString)(action, 'labelId') && (0, typeguard_util_1.isString)(action, 'text'); | ||
} | ||
@@ -76,0 +76,0 @@ exports.isApplyLabelEditOperation = isApplyLabelEditOperation; |
@@ -20,3 +20,3 @@ "use strict"; | ||
function isRequestTypeHintsAction(action) { | ||
return base_protocol_1.isActionKind(action, RequestTypeHintsAction.KIND); | ||
return (0, base_protocol_1.isActionKind)(action, RequestTypeHintsAction.KIND); | ||
} | ||
@@ -38,5 +38,5 @@ exports.isRequestTypeHintsAction = isRequestTypeHintsAction; | ||
function isSetTypeHintsAction(action) { | ||
return base_protocol_1.isActionKind(action, SetTypeHintsAction.KIND) && typeguard_util_1.isArray(action, 'shapeHints') && typeguard_util_1.isArray(action, 'edgeHints'); | ||
return (0, base_protocol_1.isActionKind)(action, SetTypeHintsAction.KIND) && (0, typeguard_util_1.isArray)(action, 'shapeHints') && (0, typeguard_util_1.isArray)(action, 'edgeHints'); | ||
} | ||
exports.isSetTypeHintsAction = isSetTypeHintsAction; | ||
//# sourceMappingURL=element-type-hints.js.map |
@@ -51,3 +51,3 @@ "use strict"; | ||
function isRequestMarkersAction(action) { | ||
return base_protocol_1.isActionKind(action, RequestMarkersAction.KIND) && typeguard_util_1.isArray(action, 'elementsIDs'); | ||
return (0, base_protocol_1.isActionKind)(action, RequestMarkersAction.KIND) && (0, typeguard_util_1.isArray)(action, 'elementsIDs'); | ||
} | ||
@@ -68,3 +68,3 @@ exports.isRequestMarkersAction = isRequestMarkersAction; | ||
function isSetMarkersAction(action) { | ||
return base_protocol_1.isActionKind(action, SetMarkersAction.KIND) && typeguard_util_1.isArray(action, 'markers'); | ||
return (0, base_protocol_1.isActionKind)(action, SetMarkersAction.KIND) && (0, typeguard_util_1.isArray)(action, 'markers'); | ||
} | ||
@@ -83,3 +83,3 @@ exports.isSetMarkersAction = isSetMarkersAction; | ||
DeleteMarkersAction = DeleteMarkersAction_1 = __decorate([ | ||
inversify_1.injectable(), | ||
(0, inversify_1.injectable)(), | ||
__metadata("design:paramtypes", [Array, Object]) | ||
@@ -89,5 +89,5 @@ ], DeleteMarkersAction); | ||
function isDeleteMarkersAction(action) { | ||
return base_protocol_1.isActionKind(action, DeleteMarkersAction.KIND) && typeguard_util_1.isArray(action, 'markers'); | ||
return (0, base_protocol_1.isActionKind)(action, DeleteMarkersAction.KIND) && (0, typeguard_util_1.isArray)(action, 'markers'); | ||
} | ||
exports.isDeleteMarkersAction = isDeleteMarkersAction; | ||
//# sourceMappingURL=element-validation.js.map |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -33,3 +33,3 @@ "use strict"; | ||
static create(newRoot) { | ||
return new RequestBoundsAction(newRoot, base_protocol_1.generateRequestId()); | ||
return new RequestBoundsAction(newRoot, (0, base_protocol_1.generateRequestId)()); | ||
} | ||
@@ -40,3 +40,3 @@ } | ||
function isRequestBoundsAction(action) { | ||
return base_protocol_1.isActionKind(action, RequestBoundsAction.KIND) && typeguard_util_1.isObject(action, 'newRoot') && typeguard_util_1.isString(action, 'requestId'); | ||
return (0, base_protocol_1.isActionKind)(action, RequestBoundsAction.KIND) && (0, typeguard_util_1.isObject)(action, 'newRoot') && (0, typeguard_util_1.isString)(action, 'requestId'); | ||
} | ||
@@ -61,3 +61,3 @@ exports.isRequestBoundsAction = isRequestBoundsAction; | ||
function isComputedBoundsAction(action) { | ||
return base_protocol_1.isActionKind(action, ComputedBoundsAction.KIND) && typeguard_util_1.isArray(action, 'bounds') && typeguard_util_1.isString(action, 'responseId'); | ||
return (0, base_protocol_1.isActionKind)(action, ComputedBoundsAction.KIND) && (0, typeguard_util_1.isArray)(action, 'bounds') && (0, typeguard_util_1.isString)(action, 'responseId'); | ||
} | ||
@@ -77,5 +77,5 @@ exports.isComputedBoundsAction = isComputedBoundsAction; | ||
function isLayoutOperation(action) { | ||
return base_protocol_1.isActionKind(action, LayoutOperation.KIND) && typeguard_util_1.isArray(action, 'elementIds'); | ||
return (0, base_protocol_1.isActionKind)(action, LayoutOperation.KIND) && (0, typeguard_util_1.isArray)(action, 'elementIds'); | ||
} | ||
exports.isLayoutOperation = isLayoutOperation; | ||
//# sourceMappingURL=mode-layout.js.map |
@@ -32,3 +32,3 @@ "use strict"; | ||
static create(options) { | ||
return new RequestModelAction(options, base_protocol_1.generateRequestId()); | ||
return new RequestModelAction(options, (0, base_protocol_1.generateRequestId)()); | ||
} | ||
@@ -39,3 +39,3 @@ } | ||
function isRequestModelAction(action) { | ||
return base_protocol_1.isActionKind(action, RequestModelAction.KIND); | ||
return (0, base_protocol_1.isActionKind)(action, RequestModelAction.KIND); | ||
} | ||
@@ -56,3 +56,3 @@ exports.isRequestModelAction = isRequestModelAction; | ||
function isSetModelAction(action) { | ||
return base_protocol_1.isActionKind(action, SetModelAction.KIND) && typeguard_util_1.isObject(action, 'newRoot'); | ||
return (0, base_protocol_1.isActionKind)(action, SetModelAction.KIND) && (0, typeguard_util_1.isObject)(action, 'newRoot'); | ||
} | ||
@@ -74,3 +74,3 @@ exports.isSetModelAction = isSetModelAction; | ||
function isUpdateModelAction(action) { | ||
return base_protocol_1.isActionKind(action, UpdateModelAction.KIND) && typeguard_util_1.isObject(action, 'newRoot') && typeguard_util_1.isBoolean(action, 'animate'); | ||
return (0, base_protocol_1.isActionKind)(action, UpdateModelAction.KIND) && (0, typeguard_util_1.isObject)(action, 'newRoot') && (0, typeguard_util_1.isBoolean)(action, 'animate'); | ||
} | ||
@@ -87,5 +87,5 @@ exports.isUpdateModelAction = isUpdateModelAction; | ||
function isModelSourceChangedAction(action) { | ||
return base_protocol_1.isActionKind(action, ModelSourceChangedAction.KIND) && typeguard_util_1.isString(action, 'modelSourceName'); | ||
return (0, base_protocol_1.isActionKind)(action, ModelSourceChangedAction.KIND) && (0, typeguard_util_1.isString)(action, 'modelSourceName'); | ||
} | ||
exports.isModelSourceChangedAction = isModelSourceChangedAction; | ||
//# sourceMappingURL=model-data.js.map |
@@ -40,3 +40,3 @@ "use strict"; | ||
SetEditModeAction = SetEditModeAction_1 = __decorate([ | ||
inversify_1.injectable(), | ||
(0, inversify_1.injectable)(), | ||
__metadata("design:paramtypes", [String, String]) | ||
@@ -46,3 +46,3 @@ ], SetEditModeAction); | ||
function isSetEditModeAction(action) { | ||
return base_protocol_1.isActionKind(action, SetEditModeAction.KIND) && typeguard_util_1.isString(action, 'editMode'); | ||
return (0, base_protocol_1.isActionKind)(action, SetEditModeAction.KIND) && (0, typeguard_util_1.isString)(action, 'editMode'); | ||
} | ||
@@ -49,0 +49,0 @@ exports.isSetEditModeAction = isSetEditModeAction; |
@@ -30,3 +30,3 @@ "use strict"; | ||
function isSaveModelAction(action) { | ||
return base_protocol_1.isActionKind(action, SaveModelAction.KIND); | ||
return (0, base_protocol_1.isActionKind)(action, SaveModelAction.KIND); | ||
} | ||
@@ -52,3 +52,3 @@ exports.isSaveModelAction = isSaveModelAction; | ||
function isSetDirtyStateAction(action) { | ||
return base_protocol_1.isActionKind(action, SetDirtyStateAction.KIND) && typeguard_util_1.isBoolean(action, 'isDirty'); | ||
return (0, base_protocol_1.isActionKind)(action, SetDirtyStateAction.KIND) && (0, typeguard_util_1.isBoolean)(action, 'isDirty'); | ||
} | ||
@@ -66,5 +66,5 @@ exports.isSetDirtyStateAction = isSetDirtyStateAction; | ||
function isExportSvgAction(action) { | ||
return base_protocol_1.isActionKind(action, ExportSvgAction.KIND) && typeguard_util_1.isString(action, 'svg'); | ||
return (0, base_protocol_1.isActionKind)(action, ExportSvgAction.KIND) && (0, typeguard_util_1.isString)(action, 'svg'); | ||
} | ||
exports.isExportSvgAction = isExportSvgAction; | ||
//# sourceMappingURL=model-saving.js.map |
@@ -21,3 +21,3 @@ "use strict"; | ||
function isSModelElementSchema(schema) { | ||
return schema !== undefined && typeof schema === 'object' && typeguard_util_1.isString(schema, 'type') && typeguard_util_1.isString(schema, 'id'); | ||
return schema !== undefined && typeof schema === 'object' && (0, typeguard_util_1.isString)(schema, 'type') && (0, typeguard_util_1.isString)(schema, 'id'); | ||
} | ||
@@ -24,0 +24,0 @@ exports.isSModelElementSchema = isSModelElementSchema; |
@@ -35,3 +35,3 @@ "use strict"; | ||
function isChangeBoundsOperation(action) { | ||
return base_protocol_1.isActionKind(action, ChangeBoundsOperation.KIND) && typeguard_util_1.isArray(action, 'newBounds'); | ||
return (0, base_protocol_1.isActionKind)(action, ChangeBoundsOperation.KIND) && (0, typeguard_util_1.isArray)(action, 'newBounds'); | ||
} | ||
@@ -53,5 +53,5 @@ exports.isChangeBoundsOperation = isChangeBoundsOperation; | ||
function isChangeContainerOperation(action) { | ||
return base_protocol_1.isActionKind(action, ChangeContainerOperation.KIND) && typeguard_util_1.isString(action, 'elementId') && typeguard_util_1.isString(action, 'targetContainerId'); | ||
return (0, base_protocol_1.isActionKind)(action, ChangeContainerOperation.KIND) && (0, typeguard_util_1.isString)(action, 'elementId') && (0, typeguard_util_1.isString)(action, 'targetContainerId'); | ||
} | ||
exports.isChangeContainerOperation = isChangeContainerOperation; | ||
//# sourceMappingURL=node-modification.js.map |
/******************************************************************************** | ||
* Copyright (c) 2021 STMicroelectronics and others. | ||
* Copyright (c) 2021-2022 STMicroelectronics and others. | ||
* | ||
@@ -4,0 +4,0 @@ * This program and the accompanying materials are made available under the |
"use strict"; | ||
/******************************************************************************** | ||
* Copyright (c) 2021 STMicroelectronics and others. | ||
* Copyright (c) 2021-2022 STMicroelectronics and others. | ||
* | ||
@@ -30,3 +30,3 @@ * This program and the accompanying materials are made available under the | ||
function isTriggerElementTypeCreationAction(action) { | ||
return base_protocol_1.isAction(action) && typeguard_util_1.isString(action, 'elementTypeId'); | ||
return (0, base_protocol_1.isAction)(action) && (0, typeguard_util_1.isString)(action, 'elementTypeId'); | ||
} | ||
@@ -33,0 +33,0 @@ exports.isTriggerElementTypeCreationAction = isTriggerElementTypeCreationAction; |
@@ -31,3 +31,3 @@ "use strict"; | ||
function isUndoOperation(action) { | ||
return base_protocol_1.isActionKind(action, UndoOperation.KIND); | ||
return (0, base_protocol_1.isActionKind)(action, UndoOperation.KIND); | ||
} | ||
@@ -46,5 +46,5 @@ exports.isUndoOperation = isUndoOperation; | ||
function isRedoOperation(action) { | ||
return base_protocol_1.isActionKind(action, RedoOperation.KIND); | ||
return (0, base_protocol_1.isActionKind)(action, RedoOperation.KIND); | ||
} | ||
exports.isRedoOperation = isRedoOperation; | ||
//# sourceMappingURL=undo-redo.js.map |
@@ -37,3 +37,3 @@ "use strict"; | ||
function isCenterAction(action) { | ||
return base_protocol_1.isActionKind(action, CenterAction.KIND) && typeguard_util_1.isBoolean(action, 'animate') && typeguard_util_1.isBoolean(action, 'retainZoom'); | ||
return (0, base_protocol_1.isActionKind)(action, CenterAction.KIND) && (0, typeguard_util_1.isBoolean)(action, 'animate') && (0, typeguard_util_1.isBoolean)(action, 'retainZoom'); | ||
} | ||
@@ -53,5 +53,5 @@ exports.isCenterAction = isCenterAction; | ||
function isFitToScreenAction(action) { | ||
return base_protocol_1.isActionKind(action, FitToScreenAction.KIND) && typeguard_util_1.isArray(action, 'elementIds') && typeguard_util_1.isBoolean(action, 'animate'); | ||
return (0, base_protocol_1.isActionKind)(action, FitToScreenAction.KIND) && (0, typeguard_util_1.isArray)(action, 'elementIds') && (0, typeguard_util_1.isBoolean)(action, 'animate'); | ||
} | ||
exports.isFitToScreenAction = isFitToScreenAction; | ||
//# sourceMappingURL=viewport.js.map |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
/******************************************************************************** | ||
* Copyright (c) 2019-2021 EclipseSource and others. | ||
* Copyright (c) 2019-2022 EclipseSource and others. | ||
* | ||
@@ -39,3 +39,3 @@ * This program and the accompanying materials are made available under the | ||
protected doCreateConnection(): Promise<MessageConnection>; | ||
protected handleConnectionError(error: Error, message: Message, count: number): void; | ||
protected handleConnectionError(error: Error, message: Message | undefined, count: number | undefined): void; | ||
protected handleConnectionClosed(): void; | ||
@@ -42,0 +42,0 @@ protected isConnectionActive(): boolean; |
@@ -88,3 +88,3 @@ "use strict"; | ||
const connection = typeof this.connectionProvider === 'function' ? await this.connectionProvider() : this.connectionProvider; | ||
connection.onError((data) => this.handleConnectionError(data[0], data[1], data[2])); | ||
connection.onError(data => this.handleConnectionError(data[0], data[1], data[2])); | ||
connection.onClose(() => this.handleConnectionClosed()); | ||
@@ -91,0 +91,0 @@ return connection; |
@@ -21,6 +21,6 @@ "use strict"; | ||
function createWebsocketConnectionProvider(websocket, logger) { | ||
const socket = vscode_ws_jsonrpc_1.toSocket(websocket); | ||
const socket = (0, vscode_ws_jsonrpc_1.toSocket)(websocket); | ||
const reader = new vscode_ws_jsonrpc_1.WebSocketMessageReader(socket); | ||
const writer = new vscode_ws_jsonrpc_1.WebSocketMessageWriter(socket); | ||
return vscode_ws_jsonrpc_1.createMessageConnection(reader, writer, logger); | ||
return (0, vscode_ws_jsonrpc_1.createMessageConnection)(reader, writer, logger); | ||
} | ||
@@ -27,0 +27,0 @@ JsonrpcGLSPClient.createWebsocketConnectionProvider = createWebsocketConnectionProvider; |
/******************************************************************************** | ||
* Copyright (c) 2019-2021 EclipseSource and others. | ||
* Copyright (c) 2019-2022 EclipseSource and others. | ||
* | ||
@@ -16,6 +16,27 @@ * This program and the accompanying materials are made available under the | ||
********************************************************************************/ | ||
/** | ||
* A union type for for objects that can either be a single element or and array of elements. | ||
*/ | ||
export declare type MaybeArray<T> = T | T[]; | ||
export declare function remove<T>(array: T[], value: T): boolean; | ||
/** | ||
* Removes the given values from the given array (if present). | ||
* @param array The array to execute the remove operation on. | ||
* @param values The values that should be removed from the array. | ||
*/ | ||
export declare function remove<T>(array: T[], ...values: T[]): void; | ||
/** | ||
* Push an array of values to the given array. The values can either be single objects of a concrete type `T` | ||
* or can also be nested arrays of T. If nested arrays are passed the they will be destructured (i.e. flattened) | ||
* so that they can be pushed to the given array. | ||
* @param array The array to push to. | ||
* @param toPush The values of {@link MaybeArray}s that should be pushed. | ||
*/ | ||
export declare function flatPush<T>(array: T[], toPush: MaybeArray<T>[]): void; | ||
export declare function distinctAdd<T>(array: T[], value: T): boolean; | ||
/** | ||
* Adds the given values to the given array. The add operation is executed distinct meaning | ||
* a value will not be pushed to the array if its already present in the array. | ||
* @param array The array to push to. | ||
* @param values The values that should be added distinctively. | ||
*/ | ||
export declare function distinctAdd<T>(array: T[], ...values: T[]): void; | ||
interface Constructor<T> { | ||
@@ -25,8 +46,46 @@ new (...args: any[]): T; | ||
declare type PrimitiveType = 'bigint' | 'boolean' | 'function' | 'number' | 'object' | 'string' | 'symbol' | 'undefined'; | ||
/** | ||
* A typeguard function to check wether a given object is an array of a specific type `T`. As it checks the type of each individual | ||
* array element this guard check is expensive and should only be used in cases where complete type-safety is required. | ||
* @param object The object to check. | ||
* @param typeGuard A typeguard to check the type of the individual elements. | ||
* @param supportEmpty A flag to determine wether empty arrays should pass the typeguard check. | ||
* @returns A type predicate indicating wether the given object has passed the type guard check. | ||
*/ | ||
export declare function isArrayOfType<T>(object: any, typeGuard: (elem: any) => elem is T, supportEmpty?: boolean): object is T[]; | ||
export declare function isArrayOfClass<T>(object: any, className: Constructor<T>, supportEmpty?: boolean): object is T[]; | ||
/** | ||
* A typeguard function to check wether a given object is an array of a class`T`. As it checks the wether each individual element | ||
* is an instance of the given class this guard check is expensive and should only be used in cases where complete type-safety is required. | ||
* @param object The object to check. | ||
* @param constructor The constructor for the class under test. | ||
* @param supportEmpty A flag to determine wether empty arrays should pass the typeguard check. | ||
* @returns A type predicate indicating wether the given object has passed the type guard check. | ||
*/ | ||
export declare function isArrayOfClass<T>(object: any, constructor: Constructor<T>, supportEmpty?: boolean): object is T[]; | ||
/** | ||
* A typeguard function to check wether a given object is an array of a {@link PrimitiveType} `T. As it checks the type of each individual | ||
* array element this guard check is expensive and should only be used in cases where complete type-safety is required. | ||
* @param object The object to check. | ||
* @param primitiveType The expected primitive type of the elements. | ||
* @param supportEmpty A flag to determine wether empty arrays should pass the typeguard check. | ||
* @returns A type predicate indicating wether the given object has passed the type guard check. | ||
*/ | ||
export declare function isArrayOfPrimitive<T>(object: any, primitiveType: PrimitiveType, supportEmpty?: boolean): object is T[]; | ||
/** | ||
* A typeguard function to check wether a given object is an array of a strings. As it checks the type of each individual | ||
* array element this guard check is expensive and should only be used in cases where complete type-safety is required. | ||
* @param object The object to check. | ||
* @param supportEmpty A flag to determine wether empty arrays should pass the typeguard check. | ||
* @returns A type predicate indicating wether the given object has passed the type guard check. | ||
*/ | ||
export declare function isStringArray(object: any, supportEmpty?: boolean): object is string[]; | ||
/** | ||
* A typeguard function to check wether a given object is an array where each element matches the given predicate. | ||
* @param object The object to check. | ||
* @param predicate The predicate to test with. | ||
* @param supportEmpty A flag to determine wether empty arrays be matched by the predicate.. | ||
* @returns `true` if the given object is an array and all elements match the given predicate. `false` otherwise. | ||
*/ | ||
export declare function isArrayMatching(object: any, predicate: (elem: any) => boolean, supportEmpty?: boolean): boolean; | ||
export {}; | ||
//# sourceMappingURL=array-util.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isArrayMatching = exports.isStringArray = exports.isArrayOfPrimitive = exports.isArrayOfClass = exports.isArrayOfType = exports.distinctAdd = exports.flatPush = exports.remove = void 0; | ||
function remove(array, value) { | ||
const index = array.indexOf(value); | ||
if (index >= 0) { | ||
array.splice(index, 1); | ||
return true; | ||
} | ||
return false; | ||
/** | ||
* Removes the given values from the given array (if present). | ||
* @param array The array to execute the remove operation on. | ||
* @param values The values that should be removed from the array. | ||
*/ | ||
function remove(array, ...values) { | ||
values.forEach(value => { | ||
const index = array.indexOf(value); | ||
if (index >= 0) { | ||
array.splice(index, 1); | ||
} | ||
}); | ||
} | ||
exports.remove = remove; | ||
/** | ||
* Push an array of values to the given array. The values can either be single objects of a concrete type `T` | ||
* or can also be nested arrays of T. If nested arrays are passed the they will be destructured (i.e. flattened) | ||
* so that they can be pushed to the given array. | ||
* @param array The array to push to. | ||
* @param toPush The values of {@link MaybeArray}s that should be pushed. | ||
*/ | ||
function flatPush(array, toPush) { | ||
@@ -17,10 +29,24 @@ toPush.forEach(value => (Array.isArray(value) ? array.push(...value) : array.push(value))); | ||
exports.flatPush = flatPush; | ||
function distinctAdd(array, value) { | ||
if (!array.includes(value)) { | ||
array.push(value); | ||
return true; | ||
} | ||
return false; | ||
/** | ||
* Adds the given values to the given array. The add operation is executed distinct meaning | ||
* a value will not be pushed to the array if its already present in the array. | ||
* @param array The array to push to. | ||
* @param values The values that should be added distinctively. | ||
*/ | ||
function distinctAdd(array, ...values) { | ||
values.forEach(value => { | ||
if (!array.includes(value)) { | ||
array.push(value); | ||
} | ||
}); | ||
} | ||
exports.distinctAdd = distinctAdd; | ||
/** | ||
* A typeguard function to check wether a given object is an array of a specific type `T`. As it checks the type of each individual | ||
* array element this guard check is expensive and should only be used in cases where complete type-safety is required. | ||
* @param object The object to check. | ||
* @param typeGuard A typeguard to check the type of the individual elements. | ||
* @param supportEmpty A flag to determine wether empty arrays should pass the typeguard check. | ||
* @returns A type predicate indicating wether the given object has passed the type guard check. | ||
*/ | ||
function isArrayOfType(object, typeGuard, supportEmpty = false) { | ||
@@ -30,6 +56,22 @@ return isArrayMatching(object, element => typeGuard(element), supportEmpty); | ||
exports.isArrayOfType = isArrayOfType; | ||
function isArrayOfClass(object, className, supportEmpty = false) { | ||
return isArrayMatching(object, element => element instanceof className, supportEmpty); | ||
/** | ||
* A typeguard function to check wether a given object is an array of a class`T`. As it checks the wether each individual element | ||
* is an instance of the given class this guard check is expensive and should only be used in cases where complete type-safety is required. | ||
* @param object The object to check. | ||
* @param constructor The constructor for the class under test. | ||
* @param supportEmpty A flag to determine wether empty arrays should pass the typeguard check. | ||
* @returns A type predicate indicating wether the given object has passed the type guard check. | ||
*/ | ||
function isArrayOfClass(object, constructor, supportEmpty = false) { | ||
return isArrayMatching(object, element => element instanceof constructor, supportEmpty); | ||
} | ||
exports.isArrayOfClass = isArrayOfClass; | ||
/** | ||
* A typeguard function to check wether a given object is an array of a {@link PrimitiveType} `T. As it checks the type of each individual | ||
* array element this guard check is expensive and should only be used in cases where complete type-safety is required. | ||
* @param object The object to check. | ||
* @param primitiveType The expected primitive type of the elements. | ||
* @param supportEmpty A flag to determine wether empty arrays should pass the typeguard check. | ||
* @returns A type predicate indicating wether the given object has passed the type guard check. | ||
*/ | ||
function isArrayOfPrimitive(object, primitiveType, supportEmpty = false) { | ||
@@ -39,2 +81,9 @@ return isArrayMatching(object, element => typeof element === primitiveType, supportEmpty); | ||
exports.isArrayOfPrimitive = isArrayOfPrimitive; | ||
/** | ||
* A typeguard function to check wether a given object is an array of a strings. As it checks the type of each individual | ||
* array element this guard check is expensive and should only be used in cases where complete type-safety is required. | ||
* @param object The object to check. | ||
* @param supportEmpty A flag to determine wether empty arrays should pass the typeguard check. | ||
* @returns A type predicate indicating wether the given object has passed the type guard check. | ||
*/ | ||
function isStringArray(object, supportEmpty = false) { | ||
@@ -44,2 +93,9 @@ return isArrayOfPrimitive(object, 'string', supportEmpty); | ||
exports.isStringArray = isStringArray; | ||
/** | ||
* A typeguard function to check wether a given object is an array where each element matches the given predicate. | ||
* @param object The object to check. | ||
* @param predicate The predicate to test with. | ||
* @param supportEmpty A flag to determine wether empty arrays be matched by the predicate.. | ||
* @returns `true` if the given object is an array and all elements match the given predicate. `false` otherwise. | ||
*/ | ||
function isArrayMatching(object, predicate, supportEmpty = false) { | ||
@@ -46,0 +102,0 @@ return Array.isArray(object) && object.every(predicate) && (supportEmpty || object.length > 0); |
{ | ||
"name": "@eclipse-glsp/protocol", | ||
"version": "0.10.0-next.6715f8e.162+6715f8e", | ||
"version": "0.10.0-next.6bee8eb.163+6bee8eb", | ||
"description": "The protocol definition for client-server communication in GLSP", | ||
@@ -36,3 +36,3 @@ "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)", | ||
"dependencies": { | ||
"inversify": "^5.0.1", | ||
"inversify": "^5.1.1", | ||
"uuid": "7.0.3", | ||
@@ -42,10 +42,7 @@ "vscode-ws-jsonrpc": "0.2.0" | ||
"devDependencies": { | ||
"@babel/runtime": "^7.11.2", | ||
"@types/uuid": "3.4.5", | ||
"rimraf": "^2.6.1", | ||
"typescript": "^3.9.2" | ||
"@types/uuid": "3.4.5" | ||
}, | ||
"scripts": { | ||
"prepare": "yarn clean && yarn build && yarn lint", | ||
"clean": "rimraf lib", | ||
"clean": "rimraf lib tsconfig.tsbuildinfo ", | ||
"build": "tsc", | ||
@@ -60,3 +57,3 @@ "lint": "eslint -c ./.eslintrc.js --ext .ts ./src", | ||
"types": "lib/index", | ||
"gitHead": "6715f8e6df688b67c1aebf75b093ee810ac879b3" | ||
"gitHead": "6bee8ebad7771ab470b4e7299fc8f2c0856b54b5" | ||
} |
/******************************************************************************** | ||
* Copyright (c) 2021 STMicroelectronics and others. | ||
* Copyright (c) 2021-2022 STMicroelectronics and others. | ||
* | ||
@@ -36,3 +36,7 @@ * This program and the accompanying materials are made available under the | ||
constructor(public readonly elementTypeId: string, readonly args?: Args, public readonly kind = TriggerNodeCreationAction.KIND) { | ||
constructor( | ||
override readonly elementTypeId: string, | ||
override readonly args?: Args, | ||
override readonly kind = TriggerNodeCreationAction.KIND | ||
) { | ||
super(elementTypeId, args, kind); | ||
@@ -54,5 +58,5 @@ } | ||
constructor( | ||
public readonly elementTypeId: string, | ||
readonly args?: Args, | ||
public readonly kind: string = TriggerEdgeCreationAction.KIND | ||
override readonly elementTypeId: string, | ||
override readonly args?: Args, | ||
override readonly kind: string = TriggerEdgeCreationAction.KIND | ||
) { | ||
@@ -59,0 +63,0 @@ super(elementTypeId, args, kind); |
/******************************************************************************** | ||
* Copyright (c) 2019-2021 EclipseSource and others. | ||
* Copyright (c) 2019-2022 EclipseSource and others. | ||
* | ||
@@ -18,3 +18,2 @@ * This program and the accompanying materials are made available under the | ||
import { Message, MessageConnection } from 'vscode-ws-jsonrpc'; | ||
import { | ||
@@ -130,3 +129,3 @@ ActionMessageHandler, | ||
const connection = typeof this.connectionProvider === 'function' ? await this.connectionProvider() : this.connectionProvider; | ||
connection.onError((data: [Error, Message, number]) => this.handleConnectionError(data[0], data[1], data[2])); | ||
connection.onError(data => this.handleConnectionError(data[0], data[1], data[2])); | ||
connection.onClose(() => this.handleConnectionClosed()); | ||
@@ -136,3 +135,3 @@ return connection; | ||
protected handleConnectionError(error: Error, message: Message, count: number): void { | ||
protected handleConnectionError(error: Error, message: Message | undefined, count: number | undefined): void { | ||
JsonrpcGLSPClient.error('Connection to server is erroring. Shutting down server.', error); | ||
@@ -139,0 +138,0 @@ this.stop(); |
/******************************************************************************** | ||
* Copyright (c) 2019-2021 EclipseSource and others. | ||
* Copyright (c) 2019-2022 EclipseSource and others. | ||
* | ||
@@ -16,13 +16,28 @@ * This program and the accompanying materials are made available under the | ||
********************************************************************************/ | ||
/** | ||
* A union type for for objects that can either be a single element or and array of elements. | ||
*/ | ||
export type MaybeArray<T> = T | T[]; | ||
export function remove<T>(array: T[], value: T): boolean { | ||
const index = array.indexOf(value); | ||
if (index >= 0) { | ||
array.splice(index, 1); | ||
return true; | ||
} | ||
return false; | ||
/** | ||
* Removes the given values from the given array (if present). | ||
* @param array The array to execute the remove operation on. | ||
* @param values The values that should be removed from the array. | ||
*/ | ||
export function remove<T>(array: T[], ...values: T[]): void { | ||
values.forEach(value => { | ||
const index = array.indexOf(value); | ||
if (index >= 0) { | ||
array.splice(index, 1); | ||
} | ||
}); | ||
} | ||
/** | ||
* Push an array of values to the given array. The values can either be single objects of a concrete type `T` | ||
* or can also be nested arrays of T. If nested arrays are passed the they will be destructured (i.e. flattened) | ||
* so that they can be pushed to the given array. | ||
* @param array The array to push to. | ||
* @param toPush The values of {@link MaybeArray}s that should be pushed. | ||
*/ | ||
export function flatPush<T>(array: T[], toPush: MaybeArray<T>[]): void { | ||
@@ -32,10 +47,15 @@ toPush.forEach(value => (Array.isArray(value) ? array.push(...value) : array.push(value))); | ||
export function distinctAdd<T>(array: T[], value: T): boolean { | ||
if (!array.includes(value)) { | ||
array.push(value); | ||
return true; | ||
} | ||
return false; | ||
/** | ||
* Adds the given values to the given array. The add operation is executed distinct meaning | ||
* a value will not be pushed to the array if its already present in the array. | ||
* @param array The array to push to. | ||
* @param values The values that should be added distinctively. | ||
*/ | ||
export function distinctAdd<T>(array: T[], ...values: T[]): void { | ||
values.forEach(value => { | ||
if (!array.includes(value)) { | ||
array.push(value); | ||
} | ||
}); | ||
} | ||
interface Constructor<T> { | ||
@@ -46,2 +66,10 @@ new (...args: any[]): T; | ||
/** | ||
* A typeguard function to check wether a given object is an array of a specific type `T`. As it checks the type of each individual | ||
* array element this guard check is expensive and should only be used in cases where complete type-safety is required. | ||
* @param object The object to check. | ||
* @param typeGuard A typeguard to check the type of the individual elements. | ||
* @param supportEmpty A flag to determine wether empty arrays should pass the typeguard check. | ||
* @returns A type predicate indicating wether the given object has passed the type guard check. | ||
*/ | ||
export function isArrayOfType<T>(object: any, typeGuard: (elem: any) => elem is T, supportEmpty = false): object is T[] { | ||
@@ -51,6 +79,22 @@ return isArrayMatching(object, element => typeGuard(element), supportEmpty); | ||
export function isArrayOfClass<T>(object: any, className: Constructor<T>, supportEmpty = false): object is T[] { | ||
return isArrayMatching(object, element => element instanceof className, supportEmpty); | ||
/** | ||
* A typeguard function to check wether a given object is an array of a class`T`. As it checks the wether each individual element | ||
* is an instance of the given class this guard check is expensive and should only be used in cases where complete type-safety is required. | ||
* @param object The object to check. | ||
* @param constructor The constructor for the class under test. | ||
* @param supportEmpty A flag to determine wether empty arrays should pass the typeguard check. | ||
* @returns A type predicate indicating wether the given object has passed the type guard check. | ||
*/ | ||
export function isArrayOfClass<T>(object: any, constructor: Constructor<T>, supportEmpty = false): object is T[] { | ||
return isArrayMatching(object, element => element instanceof constructor, supportEmpty); | ||
} | ||
/** | ||
* A typeguard function to check wether a given object is an array of a {@link PrimitiveType} `T. As it checks the type of each individual | ||
* array element this guard check is expensive and should only be used in cases where complete type-safety is required. | ||
* @param object The object to check. | ||
* @param primitiveType The expected primitive type of the elements. | ||
* @param supportEmpty A flag to determine wether empty arrays should pass the typeguard check. | ||
* @returns A type predicate indicating wether the given object has passed the type guard check. | ||
*/ | ||
export function isArrayOfPrimitive<T>(object: any, primitiveType: PrimitiveType, supportEmpty = false): object is T[] { | ||
@@ -60,2 +104,9 @@ return isArrayMatching(object, element => typeof element === primitiveType, supportEmpty); | ||
/** | ||
* A typeguard function to check wether a given object is an array of a strings. As it checks the type of each individual | ||
* array element this guard check is expensive and should only be used in cases where complete type-safety is required. | ||
* @param object The object to check. | ||
* @param supportEmpty A flag to determine wether empty arrays should pass the typeguard check. | ||
* @returns A type predicate indicating wether the given object has passed the type guard check. | ||
*/ | ||
export function isStringArray(object: any, supportEmpty = false): object is string[] { | ||
@@ -65,4 +116,11 @@ return isArrayOfPrimitive(object, 'string', supportEmpty); | ||
/** | ||
* A typeguard function to check wether a given object is an array where each element matches the given predicate. | ||
* @param object The object to check. | ||
* @param predicate The predicate to test with. | ||
* @param supportEmpty A flag to determine wether empty arrays be matched by the predicate.. | ||
* @returns `true` if the given object is an array and all elements match the given predicate. `false` otherwise. | ||
*/ | ||
export function isArrayMatching(object: any, predicate: (elem: any) => boolean, supportEmpty = false): boolean { | ||
return Array.isArray(object) && object.every(predicate) && (supportEmpty || object.length > 0); | ||
} |
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
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 6 instances 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 4 instances in 1 package
391680
1
5842
14
Updatedinversify@^5.1.1