Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap-ux/fe-mockserver-core

Package Overview
Dependencies
Maintainers
3
Versions
210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap-ux/fe-mockserver-core - npm Package Compare versions

Comparing version 1.1.50 to 1.1.51

16

dist/data/dataAccess.js

@@ -321,9 +321,15 @@ "use strict";

processedNavProps.push(navProp);
const subElement = element[navProp.name];
const subExpand = expandDefinition.expand[navProp.name];
if (Array.isArray(subElement)) {
this.apply$Select(subExpand, subElement, navProp.targetType);
if (expandDefinition.expand[navProp.name].removeFromResult) {
// delete the navigation property, it was expanded for internal reasons only
delete element[navProp.name];
}
else {
this.apply$Select(subExpand, [subElement], navProp.targetType);
const subElement = element[navProp.name];
const subExpand = expandDefinition.expand[navProp.name];
if (Array.isArray(subElement)) {
this.apply$Select(subExpand, subElement, navProp.targetType);
}
else {
this.apply$Select(subExpand, [subElement], navProp.targetType);
}
}

@@ -330,0 +336,0 @@ }

@@ -39,3 +39,3 @@ import type ODataRequest from '../../request/odataRequest';

createTransformation(identifier: string | FilterMethodCall): PreparedFunction;
checkSimpleExpression(filterExpression: any, mockData: any, tenantId: string, odataRequest: ODataRequest): boolean;
checkSimpleExpression(filterExpression: any, mockData: any, tenantId: string, odataRequest: ODataRequest): any;
private checkLambdaExpression;

@@ -42,0 +42,0 @@ checkSearch(mockData: any, searchQueries: string[], _odataRequest: ODataRequest): boolean;

@@ -335,5 +335,2 @@ "use strict";

checkLambdaExpression(expression, identifierTransformation, mockData, tenantId, odataRequest) {
const lambdaOperator = expression.operator;
let hasAnyValid = false;
let hasAllValid = true;
let mockDataToCheckValue = identifierTransformation(getData(mockData, expression.target));

@@ -354,3 +351,3 @@ if (!Array.isArray(mockDataToCheckValue)) {

}
mockDataToCheckValue.find((subMockData) => {
const check = (subMockData) => {
let mockDataToCheck = subMockData;

@@ -360,16 +357,10 @@ if (expression.key && expression.key.length > 0) {

}
const isEntryValid = this.checkFilter(mockDataToCheck, expression.expression, tenantId, odataRequest);
if (!isEntryValid) {
hasAllValid = false;
}
else {
hasAnyValid = true;
}
});
if (lambdaOperator === 'ANY') {
return hasAnyValid;
return this.checkFilter(mockDataToCheck, expression.expression, tenantId, odataRequest);
};
switch (expression.operator) {
case 'ALL':
return mockDataToCheckValue.every(check);
case 'ANY':
return mockDataToCheckValue.some(check);
}
else {
return hasAllValid;
}
}

@@ -376,0 +367,0 @@ checkSearch(mockData, searchQueries, _odataRequest) {

@@ -10,3 +10,3 @@ import { EmbeddedActionsParser, Lexer } from 'chevrotain';

type: 'lambda';
operator: string;
operator: 'ALL' | 'ANY';
key: string;

@@ -13,0 +13,0 @@ expression: FilterExpression;

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

properties: Record<string, boolean>;
removeFromResult?: boolean;
};

@@ -81,4 +82,5 @@ type ODataRequestContent = {

setDataCount(dataCount: number): void;
private addExpandForFilters;
}
export {};
//# sourceMappingURL=odataRequest.d.ts.map

@@ -17,2 +17,3 @@ "use strict";

this.dataAccess = dataAccess;
this.expandProperties = {};
this.responseHeaders = {};

@@ -46,6 +47,5 @@ this.statusCode = 200;

this.countRequested = searchParams.has('$count');
this.selectedProperties = {};
const selectParams = searchParams.get('$select');
const expandParams = searchParams.get('$expand');
if (selectParams) {
this.selectedProperties = {};
const props = selectParams.split(',');

@@ -59,4 +59,5 @@ props.forEach((property) => {

else {
this.selectedProperties['*'] = true;
this.selectedProperties = { '*': true };
}
const expandParams = searchParams.get('$expand');
if (expandParams) {

@@ -67,2 +68,3 @@ const expandParameters = this.parseExpand(expandParams);

}
this.addExpandForFilters(); // implicitly expand the properties used in filters
if (this.aggregateDefinition) {

@@ -410,4 +412,40 @@ const additionalSelectProperty = {};

}
addExpandForFilters() {
var _a;
function expandPath(path, expands, lambdaVariable, skipLast) {
var _a;
const segments = path.split('/');
if (segments[0] === lambdaVariable) {
segments.shift();
}
if (skipLast) {
segments.pop();
}
let target = expands;
for (const segment of segments) {
target[segment] = (_a = target[segment]) !== null && _a !== void 0 ? _a : {
expand: {},
properties: { '*': true },
removeFromResult: true
};
target = target[segment].expand;
}
return target;
}
function expand(expression, expandDefinitions, lambdaVariable) {
var _a;
if (typeof expression.identifier === 'string') {
expandPath(expression.identifier, expandDefinitions, lambdaVariable, true);
}
else if (((_a = expression.identifier) === null || _a === void 0 ? void 0 : _a.type) === 'lambda') {
const target = expandPath(expression.identifier.target, expandDefinitions, lambdaVariable);
for (const subExpression of expression.identifier.expression.expressions) {
expand(subExpression, target, expression.identifier.key);
}
}
}
(_a = this.filterDefinition) === null || _a === void 0 ? void 0 : _a.expressions.forEach((expression) => expand(expression, this.expandProperties));
}
}
exports.default = ODataRequest;
//# sourceMappingURL=odataRequest.js.map
{
"name": "@sap-ux/fe-mockserver-core",
"version": "1.1.50",
"version": "1.1.51",
"description": "SAP Fiori OData - Fiori elements mock server core",

@@ -5,0 +5,0 @@ "repository": {

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

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