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.68 to 1.1.69

42

dist/data/dataAccess.js

@@ -644,10 +644,16 @@ "use strict";

const entitySetName = odataRequest.queryPath[0].path;
const navPropertyName = odataRequest.queryPath.length > 1 ? odataRequest.queryPath[1].path : undefined;
const entitySet = this.metadata.getEntitySet(entitySetName);
if (navPropertyName && entitySet) {
let parentEntitySet = this.metadata.getEntitySet(entitySetName);
if (odataRequest.queryPath.length > 1 && parentEntitySet) {
// Creating a sub object
const entityType = entitySet.entityType;
const navPropDetail = entityType.navigationProperties.find((navProp) => navProp.name === navPropertyName);
let lastNavPropName = '';
for (let i = 0; i < odataRequest.queryPath.length; i++) {
if (lastNavPropName && parentEntitySet.navigationPropertyBinding[lastNavPropName]) {
parentEntitySet = parentEntitySet.navigationPropertyBinding[lastNavPropName];
}
lastNavPropName = odataRequest.queryPath[i].path;
}
const entityType = parentEntitySet.entityType;
const navPropDetail = entityType.navigationProperties.find((navProp) => navProp.name === lastNavPropName);
const navPropEntityType = navPropDetail.targetType;
const data = (await this.getMockEntitySet(entitySetName)).performGET(odataRequest.queryPath[0].keys, false, odataRequest.tenantId, odataRequest, true);
const data = (await this.getMockEntitySet(parentEntitySet.name)).performGET(odataRequest.queryPath[odataRequest.queryPath.length - 2].keys, false, odataRequest.tenantId, odataRequest, true);
const providedKeys = {};

@@ -659,3 +665,3 @@ navPropEntityType.keys.forEach((key) => {

});
const currentKeys = await this.getNavigationPropertyKeys(data, navPropDetail, entitySet.entityType, entitySet, providedKeys, odataRequest.tenantId, true);
const currentKeys = await this.getNavigationPropertyKeys(data, navPropDetail, parentEntitySet.entityType, parentEntitySet, providedKeys, odataRequest.tenantId, true);
if (data.DraftAdministrativeData !== null && data.DraftAdministrativeData !== undefined) {

@@ -665,3 +671,3 @@ data.DraftAdministrativeData.LastChangeDateTime = (0, common_1._getDateTimeOffset)(this.isV4());

if (!navPropDetail.containsTarget) {
const targetEntitySet = entitySet.navigationPropertyBinding[navPropertyName];
const targetEntitySet = parentEntitySet.navigationPropertyBinding[lastNavPropName];
odataRequest.setContext(`../$metadata#${targetEntitySet.name}/$entity`);

@@ -673,17 +679,17 @@ odataRequest.addResponseHeader('Location', `${targetEntitySet.name}(${Object.keys(currentKeys)

if (!this.isV4()) {
this.addV2Metadata(entitySet, currentKeys, postData);
this.addV2Metadata(parentEntitySet, currentKeys, postData);
}
}
else {
if (!data[navPropertyName]) {
data[navPropertyName] = [];
if (!data[lastNavPropName]) {
data[lastNavPropName] = [];
}
data[navPropertyName].push(postData);
data[lastNavPropName].push(postData);
}
return postData;
}
else if (entitySet) {
else if (parentEntitySet) {
// Creating a main object
const currentKeys = {};
entitySet.entityType.keys.forEach((key) => {
parentEntitySet.entityType.keys.forEach((key) => {
if (postData[key.name] !== undefined) {

@@ -693,9 +699,9 @@ currentKeys[key.name] = postData[key.name];

});
postData = await (await this.getMockEntitySet(entitySet.name)).performPOST(currentKeys, postData, odataRequest.tenantId, odataRequest, true);
odataRequest.setContext(`../$metadata#${entitySet.name}/$entity`);
odataRequest.addResponseHeader('Location', `${entitySet.name}(${Object.keys(currentKeys)
postData = await (await this.getMockEntitySet(parentEntitySet.name)).performPOST(currentKeys, postData, odataRequest.tenantId, odataRequest, true);
odataRequest.setContext(`../$metadata#${parentEntitySet.name}/$entity`);
odataRequest.addResponseHeader('Location', `${parentEntitySet.name}(${Object.keys(currentKeys)
.map((key) => `${key}='${currentKeys[key]}'`)
.join(',')})`);
if (!this.isV4()) {
this.addV2Metadata(entitySet, currentKeys, postData);
this.addV2Metadata(parentEntitySet, currentKeys, postData);
}

@@ -702,0 +708,0 @@ odataRequest.setResponseData(await postData);

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

const activateKeyValues = this.getKeys(draftData);
dataToClean.push(this.getKeys(draftData));
activateKeyValues.IsActiveEntity = true;

@@ -88,5 +89,5 @@ activeDraft = Object.assign({}, draftData);

activeDraft.HasDraftEntity = false;
activeDraft.HasActiveEntity = false;
activeDraft.Processed = true;
activeDraft.DraftAdministrativeData = null;
dataToClean.push(activateKeyValues);
if (!currentMockData.hasEntry(activateKeyValues, odataRequest)) {

@@ -103,4 +104,6 @@ await currentMockData.addEntry(activeDraft, odataRequest);

const myDataToClean = this.performGET(draftKeys, false, tenantId, odataRequest, true);
delete myDataToClean.Processed;
await currentMockData.updateEntry(draftKeys, myDataToClean, myDataToClean, odataRequest);
if (myDataToClean) {
delete myDataToClean.Processed;
await currentMockData.updateEntry(draftKeys, myDataToClean, myDataToClean, odataRequest);
}
}

@@ -129,5 +132,7 @@ await this.draftDiscard(keyValues, tenantId, odataRequest);

data.HasDraftEntity = true;
data.Processed = false;
const duplicate = Object.assign({}, data);
duplicate.IsActiveEntity = false;
duplicate.HasActiveEntity = true;
duplicate.Processed = false;
duplicate.HasDraftEntity = false;

@@ -219,2 +224,3 @@ const currentDate = (0, common_1._getDateTimeOffset)(this.isV4());

responseObject = await this.dataAccess.getData(odataRequest);
delete responseObject.Processed;
break;

@@ -221,0 +227,0 @@ }

{
"name": "@sap-ux/fe-mockserver-core",
"version": "1.1.68",
"version": "1.1.69",
"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

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