@sap-ux/fe-mockserver-core
Advanced tools
Comparing version 1.1.86 to 1.1.87
@@ -35,2 +35,18 @@ "use strict"; | ||
} | ||
function getSourceReference(aggregationAnnotation) { | ||
var _a; | ||
const parentNavigationProperty = aggregationAnnotation.ParentNavigationProperty; | ||
const referentialConstraint = (_a = parentNavigationProperty.$target) === null || _a === void 0 ? void 0 : _a.referentialConstraint[0]; | ||
if (!parentNavigationProperty.$target || !referentialConstraint) { | ||
throw new Error(`Unknown ParentNavigationProperty: '${parentNavigationProperty.value}'`); | ||
} | ||
return referentialConstraint.sourceProperty; | ||
} | ||
function getNodeProperty(aggregationAnnotation) { | ||
const nodeProperty = aggregationAnnotation.NodeProperty; | ||
if (!nodeProperty.$target) { | ||
throw new Error(`Unknown NodeProperty: '${nodeProperty.value}'`); | ||
} | ||
return nodeProperty.$target.name; | ||
} | ||
class FileBasedMockData { | ||
@@ -557,3 +573,3 @@ constructor(mockData, entityType, mockDataEntitySet, contextId) { | ||
if (aggregationAnnotation) { | ||
const nodeProperty = aggregationAnnotation.NodeProperty.$target.name; | ||
const nodeProperty = getNodeProperty(aggregationAnnotation); | ||
let adjustedData = data.map((adjustedRowData) => { | ||
@@ -573,3 +589,3 @@ const item = this._mockData.find((dataItem) => dataItem[nodeProperty] === adjustedRowData[nodeProperty]); | ||
const hierarchyNodes = this.buildHierarchyTree(hierarchyQualifier, adjustedData, hierarchyDefinition); | ||
const sourceReference = aggregationAnnotation.ParentNavigationProperty.$target.referentialConstraint[0].sourceProperty; | ||
const sourceReference = getSourceReference(aggregationAnnotation); | ||
// TODO Considering the input set the top level node is not necessarely the root node | ||
@@ -645,3 +661,3 @@ const allRootNodes = adjustedData.filter((node) => { | ||
if (aggregationAnnotation) { | ||
const nodeProperty = aggregationAnnotation.NodeProperty.$target.name; | ||
const nodeProperty = getNodeProperty(aggregationAnnotation); | ||
const adjustedData = this._mockData.map((item) => { | ||
@@ -657,3 +673,3 @@ const adjustedRowData = hierarchyFilter.find((dataItem) => dataItem[nodeProperty] === item[nodeProperty]); | ||
const hierarchyNodes = this.buildHierarchyTree(_parameters.qualifier, adjustedData, hierarchyDefinition); | ||
const sourceReference = aggregationAnnotation.ParentNavigationProperty.$target.referentialConstraint[0].sourceProperty; | ||
const sourceReference = getSourceReference(aggregationAnnotation); | ||
const rootNodes = hierarchyNodes['']; | ||
@@ -706,3 +722,3 @@ rootNodes.forEach((rootNode) => { | ||
matchedProperty: (_j = hierarchyAnnotation === null || hierarchyAnnotation === void 0 ? void 0 : hierarchyAnnotation.MatchedProperty) === null || _j === void 0 ? void 0 : _j.$target.name, | ||
sourceReference: aggregationAnnotation.ParentNavigationProperty.$target.referentialConstraint[0].sourceProperty | ||
sourceReference: getSourceReference(aggregationAnnotation) | ||
}; | ||
@@ -715,4 +731,4 @@ } | ||
if (aggregationAnnotation) { | ||
const nodeProperty = aggregationAnnotation.NodeProperty.$target.name; | ||
const sourceReference = aggregationAnnotation.ParentNavigationProperty.$target.referentialConstraint[0].sourceProperty; | ||
const nodeProperty = getNodeProperty(aggregationAnnotation); | ||
const sourceReference = getSourceReference(aggregationAnnotation); | ||
const adjustedData = this._mockData.map((item) => { | ||
@@ -719,0 +735,0 @@ const adjustedRowData = limitedHierarchy.find((dataItem) => dataItem[nodeProperty] === item[nodeProperty]); |
{ | ||
"name": "@sap-ux/fe-mockserver-core", | ||
"version": "1.1.86", | ||
"version": "1.1.87", | ||
"description": "SAP Fiori OData - Fiori elements mock server core", | ||
@@ -17,3 +17,3 @@ "repository": { | ||
"dependencies": { | ||
"@sap-ux/annotation-converter": "0.6.12", | ||
"@sap-ux/annotation-converter": "0.6.13", | ||
"@sap-ux/edmx-parser": "0.5.14", | ||
@@ -32,3 +32,3 @@ "@ui5/logger": "2.0.1", | ||
"devDependencies": { | ||
"@sap-ux/vocabularies-types": "0.7.5", | ||
"@sap-ux/vocabularies-types": "0.7.6", | ||
"@sap-ux/fe-mockserver-plugin-cds": "1.0.4", | ||
@@ -35,0 +35,0 @@ "@types/body-parser": "1.19.2", |
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
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
547145
6316
+ Added@sap-ux/annotation-converter@0.6.13(transitive)
+ Added@sap-ux/vocabularies-types@0.7.6(transitive)
- Removed@sap-ux/annotation-converter@0.6.12(transitive)
- Removed@sap-ux/vocabularies-types@0.7.5(transitive)