New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@eclipse-emfcloud/modelserver-node

Package Overview
Dependencies
Maintainers
7
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eclipse-emfcloud/modelserver-node - npm Package Compare versions

Comparing version 0.2.0-next.4f5c0b2.23 to 0.2.0-next.55b519b.29

15

lib/client/model-server-client.js

@@ -323,8 +323,9 @@ "use strict";

const { aggregatedUpdateResult: current } = this.peekNestedContext();
const result = web_socket_utils_1.WebSocketMessageAcceptor.promise(this.socket, message => {
const matched = message.type === 'success' && modelserver_client_1.Operations.isPatch(message.data.patch);
if (matched && current) {
this.mergeModelUpdateResult(current, message.data);
const result = web_socket_utils_1.WebSocketMessageAcceptor.promise(this.socket, message => true, // Need to accept and merge failed updates as well as successful
modelserver_client_1.MessageDataMapper.patchModel).then(modelUpdateResult => {
// If we are currently tracking a merged update result, incorporate this new result
if (current) {
this.mergeModelUpdateResult(current, modelUpdateResult);
}
return matched;
return modelUpdateResult;
});

@@ -378,3 +379,7 @@ this.socket.send(JSON.stringify(this.message('execute', body)));

if ((src === null || src === void 0 ? void 0 : src.patch) && src.patch.length) {
dst.success = dst.success && src.success;
dst.patch = ((_a = dst.patch) !== null && _a !== void 0 ? _a : []).concat(src.patch);
if (dst.success && src.patchModel) {
dst.patchModel = src.patchModel;
}
}

@@ -381,0 +386,0 @@ }

@@ -12,3 +12,3 @@ /// <reference types="node" />

*******************************************************************************/
import { AnyObject, ModelServerMessage, TypeGuard } from '@eclipse-emfcloud/modelserver-client';
import { AnyObject, MessageDataMapper, ModelServerMessage, TypeGuard } from '@eclipse-emfcloud/modelserver-client';
import { Request } from 'express';

@@ -87,3 +87,14 @@ import { Logger } from 'winston';

*/
static promise<U>(socket: WebSocket, predicate: (object: ModelServerMessage<U>) => boolean): Promise<U>;
static promise<D>(socket: WebSocket, predicate: (object: ModelServerMessage<D>) => boolean): Promise<D>;
/**
* Convenience for creating a promise that will be resolved when a message of the expected
* type is received, with transformation of the message by a mapper function.
* If the socket is closed before that, then the promise is rejected.
*
* @param socket the socket on which to wait for incoming messages
* @param predicate a test whether a message payload is of the expected type
* @param mapper a message data mapper to generate the promised result
* @returns a promise of the expected mapped message type
*/
static promise<D = unknown, U = unknown>(socket: WebSocket, predicate: (object: ModelServerMessage<D>) => boolean, mapper: MessageDataMapper<U>): Promise<U>;
}

@@ -90,0 +101,0 @@ /**

@@ -106,13 +106,8 @@ "use strict";

}
/**
* Convenience for creating a promise that will be resolved when a message of the expected
* type is received. If the socket is closed before that, then the promise is rejected.
*
* @param socket the socket on which to wait for incoming messages
* @param predicate a test whether a message payload is of the expected type
* @returns a promise of the expected message type
*/
static promise(socket, predicate) {
static promise(socket, predicate, mapper) {
if (!mapper) {
mapper = modelserver_client_1.IdentityMapper;
}
return new Promise((resolve, reject) => {
const parser = message => (predicate(message) ? message.data : undefined);
const parser = message => (predicate(message) ? mapper(message) : undefined);
WebSocketMessageAcceptor.accept(socket, parser, resolve, () => reject('Socket closed'));

@@ -119,0 +114,0 @@ });

@@ -68,8 +68,28 @@ "use strict";

exports.SubscriptionRoutes = SubscriptionRoutes;
/**
* Parse the subscription request query parameters coming from the downstream client to
* extract details for local use and filter what is passed along to the upstream
* subscription. This includes
*
* - enforcing required parameters, e.g. `modeluri`
* - applying type coercion and defaults to known parameters, e.g. `livevalidation`
* - filtering out query parameters that cannot be parsed from simple strings
*
* @param query the subscription request query parameters from downstream that we forward to the upstream server
* @returns the parsed and filtered subscription query parameters
*/
function parseQuery(query) {
return {
return Object.keys(query).reduce((acc, item) => {
const param = parseQueryParam(query, item);
if (param && !acc[item]) {
acc[item] = param;
}
return acc;
}, {
// Special-case these because the modeluri is required and the
// other two are known parameters and have typed default values
modeluri: parseQueryParam(query, 'modeluri'),
livevalidation: parseQueryParam(query, 'livevalidation', false),
timeout: parseQueryParam(query, 'timeout', 'number')
};
});
}

@@ -76,0 +96,0 @@ function parseQueryParam(query, name, typeOrDefaultValue, defaultValue) {

{
"name": "@eclipse-emfcloud/modelserver-node",
"version": "0.2.0-next.4f5c0b2.23+4f5c0b2",
"version": "0.2.0-next.55b519b.29+55b519b",
"description": "Business Logic layer façade for the Model Server.",

@@ -28,3 +28,3 @@ "license": "(EPL-2.0 OR MIT)",

"dependencies": {
"@eclipse-emfcloud/modelserver-plugin-ext": "0.2.0-next.4f5c0b2.23+4f5c0b2",
"@eclipse-emfcloud/modelserver-plugin-ext": "0.2.0-next.55b519b.29+55b519b",
"axios": "^0.24.0",

@@ -62,3 +62,3 @@ "express": "^4.17.1",

},
"gitHead": "4f5c0b2c2af215e9afb7199fb9b45490f6ed49be"
"gitHead": "55b519b108e4c09db3a33bd06ccccb9cf833af5f"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc