@sap-ux/fe-mockserver-core
Advanced tools
Comparing version 1.1.80 to 1.1.81
@@ -6,2 +6,10 @@ import type { Action, ComplexType, EntityType, NavigationProperty, Property, TypeDefinition } from '@sap-ux/vocabularies-types'; | ||
export type KeyDefinitions = Record<string, number | boolean | string>; | ||
type HierarchyDefinition = { | ||
distanceFromRootProperty: string | undefined; | ||
drillStateProperty: string | undefined; | ||
matchedDescendantCountProperty: string | undefined; | ||
matchedProperty: string | undefined; | ||
limitedDescendantCountProperty: string | undefined; | ||
sourceReference: string; | ||
}; | ||
export declare class FileBasedMockData { | ||
@@ -15,2 +23,3 @@ protected _mockData: object[]; | ||
private validateProperties; | ||
private cleanupHierarchyData; | ||
addEntry(mockEntry: any, _odataRequest: ODataRequest): Promise<void>; | ||
@@ -70,9 +79,11 @@ updateEntry(keyValues: KeyDefinitions, updatedData: object, _patchData: object, _odataRequest: ODataRequest): Promise<void>; | ||
buildTree(hierarchyNode: any, allItems: Record<string, any[]>, idNode: string, parentIdentifier: string, depth: number | undefined, parentNode: any): any; | ||
buildHierarchyTree(hierarchyQualifier: string, inputSet: any[]): Record<string, any>; | ||
flattenTree(currentNode: any, outItems: any[], nodeProperty: string, distanceFromRootProperty: string | undefined, limitedDescendantCount: string | undefined, matchedDescendantCountProperty: string | undefined, drillStateProperty: string | undefined, depth: number, toExpand?: string[], toCollapse?: string[], toShow?: string[], toShowAncestors?: string[], forceExpand?: boolean): number; | ||
getAncestorsOfNode(currentNode: any, outItems: any[], nodeProperty: string, distanceFromRootProperty: string | undefined, matchedDescendantsProperty: string | undefined, matchedProperty: string | undefined, drillStateProperty: string | undefined, depth: number, matchedChildrenCount: number, matchedProperties: any[]): number; | ||
buildHierarchyTree(hierarchyQualifier: string, inputSet: any[], hierarchyDefinition: HierarchyDefinition): Record<string, any>; | ||
flattenTree(currentNode: any, outItems: any[], nodeProperty: string, hierarchyDefinition: HierarchyDefinition, depth: number, toExpand?: string[], toCollapse?: string[], toShow?: string[], toShowAncestors?: string[], forceExpand?: boolean): number; | ||
getAncestorsOfNode(currentNode: any, outItems: any[], nodeProperty: string, hierarchyDefinition: HierarchyDefinition, depth: number, matchedChildrenCount: number, matchedProperties: any[]): number; | ||
getTopLevels(data: any[], _parameters: TopLevelParameters, _odataRequest: ODataRequest): Promise<any[]>; | ||
getDescendants(inputSet: object[], lastFilterTransformationResult: object[], hierarchyFilter: object[], entityType: EntityType, _parameters: AncestorDescendantsParameters, _odataRequest: ODataRequest): Promise<object[]>; | ||
getHierarchyDefinition(hierarchyQualifier: string): HierarchyDefinition; | ||
getAncestors(inputSet: object[], lastFilterTransformationResult: object[], limitedHierarchy: object[], entityType: EntityType, _parameters: AncestorDescendantsParameters, _odataRequest: ODataRequest): Promise<object[]>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=fileBasedMockData.d.ts.map |
@@ -48,4 +48,13 @@ "use strict"; | ||
this._mockData.forEach((mockLine) => { | ||
var _a, _b; | ||
// We need to ensure that complex types are at least partially created | ||
this.validateProperties(mockLine, this._entityType.entityProperties); | ||
const allAggregations = (_b = (_a = this._entityType.annotations) === null || _a === void 0 ? void 0 : _a.Aggregation) !== null && _b !== void 0 ? _b : {}; | ||
Object.keys(allAggregations) | ||
.filter((aggregationName) => aggregationName.startsWith('RecursiveHierarchy')) | ||
.forEach((aggregationName) => { | ||
const aggregationDefinition = allAggregations[aggregationName]; | ||
const hierarchyDefinition = this.getHierarchyDefinition(aggregationDefinition.qualifier); | ||
this.cleanupHierarchyData(mockLine, hierarchyDefinition); | ||
}); | ||
}); | ||
@@ -57,6 +66,3 @@ } | ||
properties.forEach((prop) => { | ||
var _a, _b; | ||
if (!prop.nullable && | ||
!mockEntry.hasOwnProperty(prop.name) && | ||
((_b = (_a = prop.annotations.Core) === null || _a === void 0 ? void 0 : _a.Computed) === null || _b === void 0 ? void 0 : _b.valueOf()) !== true) { | ||
if (!prop.nullable && !mockEntry.hasOwnProperty(prop.name)) { | ||
mockEntry[prop.name] = this.getDefaultValueFromType(prop.type, prop.targetType, prop.defaultValue); | ||
@@ -70,2 +76,19 @@ } | ||
} | ||
cleanupHierarchyData(mockEntry, hierarchyDefinition) { | ||
if (hierarchyDefinition.matchedProperty) { | ||
delete mockEntry[hierarchyDefinition.matchedProperty]; | ||
} | ||
if (hierarchyDefinition.matchedDescendantCountProperty) { | ||
delete mockEntry[hierarchyDefinition.matchedDescendantCountProperty]; | ||
} | ||
if (hierarchyDefinition.limitedDescendantCountProperty) { | ||
delete mockEntry[hierarchyDefinition.limitedDescendantCountProperty]; | ||
} | ||
if (hierarchyDefinition.drillStateProperty) { | ||
delete mockEntry[hierarchyDefinition.drillStateProperty]; | ||
} | ||
if (hierarchyDefinition.distanceFromRootProperty) { | ||
delete mockEntry[hierarchyDefinition.distanceFromRootProperty]; | ||
} | ||
} | ||
async addEntry(mockEntry, _odataRequest) { | ||
@@ -416,13 +439,10 @@ this._mockData.push(mockEntry); | ||
} | ||
buildHierarchyTree(hierarchyQualifier, inputSet) { | ||
var _a, _b; | ||
buildHierarchyTree(hierarchyQualifier, inputSet, hierarchyDefinition) { | ||
//if (!this._hierarchyTree[hierarchyQualifier]) { | ||
const itemPerParents = {}; | ||
const aggregationAnnotation = (_b = (_a = this._entityType.annotations) === null || _a === void 0 ? void 0 : _a.Aggregation) === null || _b === void 0 ? void 0 : _b[`RecursiveHierarchy#${hierarchyQualifier}`]; | ||
const sourceReference = aggregationAnnotation.ParentNavigationProperty.$target.referentialConstraint[0].sourceProperty; | ||
inputSet.forEach((item) => { | ||
if (!itemPerParents[item[sourceReference]]) { | ||
itemPerParents[item[sourceReference]] = []; | ||
if (!itemPerParents[item[hierarchyDefinition.sourceReference]]) { | ||
itemPerParents[item[hierarchyDefinition.sourceReference]] = []; | ||
} | ||
itemPerParents[item[sourceReference]].push(item); | ||
itemPerParents[item[hierarchyDefinition.sourceReference]].push(item); | ||
}); | ||
@@ -432,3 +452,3 @@ this._hierarchyTree[hierarchyQualifier] = itemPerParents; | ||
} | ||
flattenTree(currentNode, outItems, nodeProperty, distanceFromRootProperty, limitedDescendantCount, matchedDescendantCountProperty, drillStateProperty, depth, toExpand = [], toCollapse = [], toShow = [], toShowAncestors = [], forceExpand = false) { | ||
flattenTree(currentNode, outItems, nodeProperty, hierarchyDefinition, depth, toExpand = [], toCollapse = [], toShow = [], toShowAncestors = [], forceExpand = false) { | ||
var _a, _b; | ||
@@ -461,14 +481,14 @@ let descendantCount = 0; | ||
} | ||
if (distanceFromRootProperty) { | ||
currentNode[distanceFromRootProperty] = currentNode.$rootDistance; | ||
if (hierarchyDefinition.distanceFromRootProperty) { | ||
currentNode[hierarchyDefinition.distanceFromRootProperty] = currentNode.$rootDistance; | ||
} | ||
if (drillStateProperty) { | ||
if (hierarchyDefinition.drillStateProperty) { | ||
if (((_a = currentNode.$children) === null || _a === void 0 ? void 0 : _a.length) === 0) { | ||
currentNode[drillStateProperty] = 'leaf'; | ||
currentNode[hierarchyDefinition.drillStateProperty] = 'leaf'; | ||
} | ||
else if (isLastLevel && !shouldShowAncestor) { | ||
currentNode[drillStateProperty] = 'collapsed'; | ||
currentNode[hierarchyDefinition.drillStateProperty] = 'collapsed'; | ||
} | ||
else { | ||
currentNode[drillStateProperty] = 'expanded'; | ||
currentNode[hierarchyDefinition.drillStateProperty] = 'expanded'; | ||
} | ||
@@ -478,6 +498,7 @@ } | ||
children.forEach((child) => { | ||
descendantCount += this.flattenTree(child, outItems, nodeProperty, distanceFromRootProperty, limitedDescendantCount, matchedDescendantCountProperty, drillStateProperty, depth - 1, toExpand, toCollapse, toShow, toShowAncestors, forceExpand); | ||
descendantCount += this.flattenTree(child, outItems, nodeProperty, hierarchyDefinition, depth - 1, toExpand, toCollapse, toShow, toShowAncestors, forceExpand); | ||
}); | ||
if (limitedDescendantCount) { | ||
currentNode[limitedDescendantCount] = isLastLevel && !shouldShowAncestor ? 0 : descendantCount; | ||
if (hierarchyDefinition.limitedDescendantCountProperty) { | ||
currentNode[hierarchyDefinition.limitedDescendantCountProperty] = | ||
isLastLevel && !shouldShowAncestor ? 0 : descendantCount; | ||
} | ||
@@ -491,3 +512,3 @@ if (currentNode.$inResultSet && wasAdded) { | ||
} | ||
getAncestorsOfNode(currentNode, outItems, nodeProperty, distanceFromRootProperty, matchedDescendantsProperty, matchedProperty, drillStateProperty, depth, matchedChildrenCount, matchedProperties) { | ||
getAncestorsOfNode(currentNode, outItems, nodeProperty, hierarchyDefinition, depth, matchedChildrenCount, matchedProperties) { | ||
var _a, _b; | ||
@@ -498,4 +519,4 @@ let descendantCount = 0; | ||
if (outItems.includes(currentNode)) { | ||
if (matchedDescendantsProperty) { | ||
currentNode[matchedDescendantsProperty] += matchedChildrenCount; | ||
if (hierarchyDefinition.matchedDescendantCountProperty) { | ||
currentNode[hierarchyDefinition.matchedDescendantCountProperty] += matchedChildrenCount; | ||
} | ||
@@ -505,24 +526,24 @@ } | ||
outItems.push(currentNode); | ||
if (matchedDescendantsProperty) { | ||
currentNode[matchedDescendantsProperty] = matchedChildrenCount; | ||
if (hierarchyDefinition.matchedDescendantCountProperty) { | ||
currentNode[hierarchyDefinition.matchedDescendantCountProperty] = matchedChildrenCount; | ||
} | ||
if (matchedProperty) { | ||
currentNode[matchedProperty] = !!matchedProperties.find((prop) => prop[nodeProperty] === currentNode[nodeProperty]); | ||
if (currentNode[matchedProperty]) { | ||
if (hierarchyDefinition.matchedProperty) { | ||
currentNode[hierarchyDefinition.matchedProperty] = !!matchedProperties.find((prop) => prop[nodeProperty] === currentNode[nodeProperty]); | ||
if (currentNode[hierarchyDefinition.matchedProperty]) { | ||
matchedChildrenCount++; | ||
} | ||
} | ||
if (distanceFromRootProperty) { | ||
currentNode[distanceFromRootProperty] = currentNode.$rootDistance; | ||
if (hierarchyDefinition.distanceFromRootProperty) { | ||
currentNode[hierarchyDefinition.distanceFromRootProperty] = currentNode.$rootDistance; | ||
} | ||
if (drillStateProperty) { | ||
if (hierarchyDefinition.drillStateProperty) { | ||
const includedChildrenCount = (_b = (_a = currentNode.$children) === null || _a === void 0 ? void 0 : _a.filter((child) => child.$inResultSet).length) !== null && _b !== void 0 ? _b : 0; | ||
if (isLastLevel && includedChildrenCount === 0) { | ||
currentNode[drillStateProperty] = 'leaf'; | ||
currentNode[hierarchyDefinition.drillStateProperty] = 'leaf'; | ||
} | ||
else if (isLastLevel) { | ||
currentNode[drillStateProperty] = 'collapsed'; | ||
currentNode[hierarchyDefinition.drillStateProperty] = 'collapsed'; | ||
} | ||
else { | ||
currentNode[drillStateProperty] = 'expanded'; | ||
currentNode[hierarchyDefinition.drillStateProperty] = 'expanded'; | ||
} | ||
@@ -532,3 +553,3 @@ } | ||
if (currentNode.$parent) { | ||
this.getAncestorsOfNode(currentNode.$parent, outItems, nodeProperty, distanceFromRootProperty, matchedDescendantsProperty, matchedProperty, drillStateProperty, depth - 1, matchedChildrenCount, matchedProperties); | ||
this.getAncestorsOfNode(currentNode.$parent, outItems, nodeProperty, hierarchyDefinition, depth - 1, matchedChildrenCount, matchedProperties); | ||
} | ||
@@ -541,3 +562,3 @@ descendantCount++; // also include yourself | ||
async getTopLevels(data, _parameters, _odataRequest) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; | ||
var _a, _b, _c, _d, _e, _f; | ||
const hierarchyQualifier = _parameters.HierarchyQualifier.substring(1, _parameters.HierarchyQualifier.length - 1); | ||
@@ -560,3 +581,4 @@ const outItems = []; | ||
adjustedData = adjustedData.concat(restOfData); | ||
const hierarchyNodes = this.buildHierarchyTree(hierarchyQualifier, adjustedData); | ||
const hierarchyDefinition = this.getHierarchyDefinition(hierarchyQualifier); | ||
const hierarchyNodes = this.buildHierarchyTree(hierarchyQualifier, adjustedData, hierarchyDefinition); | ||
const sourceReference = aggregationAnnotation.ParentNavigationProperty.$target.referentialConstraint[0].sourceProperty; | ||
@@ -575,15 +597,4 @@ // TODO Considering the input set the top level node is not necessarely the root node | ||
const depth = parseInt(_parameters.Levels, 10); | ||
const hierarchyAnnotation = (_d = (_c = this._entityType.annotations) === null || _c === void 0 ? void 0 : _c.Hierarchy) === null || _d === void 0 ? void 0 : _d[`RecursiveHierarchy#${hierarchyQualifier}`]; | ||
let distanceFromRootProperty; | ||
let matchedDescendantCountProperty; | ||
let limitedDescendantCountProperty; | ||
let drillStateProperty; | ||
if (hierarchyAnnotation) { | ||
distanceFromRootProperty = (_e = hierarchyAnnotation.DistanceFromRootProperty) === null || _e === void 0 ? void 0 : _e.$target.name; | ||
limitedDescendantCountProperty = (_f = hierarchyAnnotation.LimitedDescendantCountProperty) === null || _f === void 0 ? void 0 : _f.$target.name; | ||
matchedDescendantCountProperty = (_g = hierarchyAnnotation.MatchedDescendantCountProperty) === null || _g === void 0 ? void 0 : _g.$target.name; | ||
drillStateProperty = (_h = hierarchyAnnotation.DrillStateProperty) === null || _h === void 0 ? void 0 : _h.$target.name; | ||
} | ||
const toExpand = (_k = (_j = _parameters.Expand) === null || _j === void 0 ? void 0 : _j.map((expand) => expand.substring(1, expand.length - 1))) !== null && _k !== void 0 ? _k : []; | ||
const toShow = (_m = (_l = _parameters.Show) === null || _l === void 0 ? void 0 : _l.map((collapse) => collapse.substring(1, collapse.length - 1))) !== null && _m !== void 0 ? _m : []; | ||
const toExpand = (_d = (_c = _parameters.Expand) === null || _c === void 0 ? void 0 : _c.map((expand) => expand.substring(1, expand.length - 1))) !== null && _d !== void 0 ? _d : []; | ||
const toShow = (_f = (_e = _parameters.Show) === null || _e === void 0 ? void 0 : _e.map((collapse) => collapse.substring(1, collapse.length - 1))) !== null && _f !== void 0 ? _f : []; | ||
const toShowAncestors = []; | ||
@@ -609,3 +620,3 @@ for (const nodeId of toShow) { | ||
const hierarchy = this.buildTree(rootNode, hierarchyNodes, nodeProperty, sourceReference, 0, undefined); | ||
this.flattenTree(hierarchy, outItems, nodeProperty, distanceFromRootProperty, limitedDescendantCountProperty, matchedDescendantCountProperty, drillStateProperty, depth, toExpand, (_a = _parameters.Collapse) === null || _a === void 0 ? void 0 : _a.map((collapse) => collapse.substring(1, collapse.length - 1)), toShow, toShowAncestors); | ||
this.flattenTree(hierarchy, outItems, nodeProperty, hierarchyDefinition, depth, toExpand, (_a = _parameters.Collapse) === null || _a === void 0 ? void 0 : _a.map((collapse) => collapse.substring(1, collapse.length - 1)), toShow, toShowAncestors); | ||
}); | ||
@@ -616,6 +627,6 @@ let outData = []; | ||
if (subTreeData) { | ||
if (matchedDescendantCountProperty && | ||
drillStateProperty && | ||
item[matchedDescendantCountProperty] === 0) { | ||
item[drillStateProperty] = 'leaf'; | ||
if (hierarchyDefinition.matchedDescendantCountProperty && | ||
hierarchyDefinition.drillStateProperty && | ||
item[hierarchyDefinition.matchedDescendantCountProperty] === 0) { | ||
item[hierarchyDefinition.drillStateProperty] = 'leaf'; | ||
} | ||
@@ -643,17 +654,5 @@ outData.push({ ...subTreeData, ...item }); | ||
async getDescendants(inputSet, lastFilterTransformationResult, hierarchyFilter, entityType, _parameters, _odataRequest) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
var _a, _b; | ||
const aggregationAnnotation = (_b = (_a = this._entityType.annotations) === null || _a === void 0 ? void 0 : _a.Aggregation) === null || _b === void 0 ? void 0 : _b[`RecursiveHierarchy#${_parameters.qualifier}`]; | ||
const hierarchyAnnotation = (_d = (_c = this._entityType.annotations) === null || _c === void 0 ? void 0 : _c.Hierarchy) === null || _d === void 0 ? void 0 : _d[`RecursiveHierarchy#${_parameters.qualifier}`]; | ||
let distanceFromRootProperty; | ||
let limitedDescendantCountProperty; | ||
let matchedDescendantCountProperty; | ||
let drillStateProperty; | ||
let matchedProperty; | ||
if (hierarchyAnnotation) { | ||
distanceFromRootProperty = (_e = hierarchyAnnotation.DistanceFromRootProperty) === null || _e === void 0 ? void 0 : _e.$target.name; | ||
limitedDescendantCountProperty = (_f = hierarchyAnnotation.LimitedDescendantCountProperty) === null || _f === void 0 ? void 0 : _f.$target.name; | ||
matchedDescendantCountProperty = (_g = hierarchyAnnotation.MatchedDescendantCountProperty) === null || _g === void 0 ? void 0 : _g.$target.name; | ||
drillStateProperty = (_h = hierarchyAnnotation.DrillStateProperty) === null || _h === void 0 ? void 0 : _h.$target.name; | ||
matchedProperty = (_j = hierarchyAnnotation.MatchedProperty) === null || _j === void 0 ? void 0 : _j.$target.name; | ||
} | ||
const hierarchyDefinition = this.getHierarchyDefinition(_parameters.qualifier); | ||
if (aggregationAnnotation) { | ||
@@ -670,3 +669,3 @@ const nodeProperty = aggregationAnnotation.NodeProperty.$target.name; | ||
}); | ||
const hierarchyNodes = this.buildHierarchyTree(_parameters.qualifier, adjustedData); | ||
const hierarchyNodes = this.buildHierarchyTree(_parameters.qualifier, adjustedData, hierarchyDefinition); | ||
const sourceReference = aggregationAnnotation.ParentNavigationProperty.$target.referentialConstraint[0].sourceProperty; | ||
@@ -682,5 +681,5 @@ const rootNodes = hierarchyNodes['']; | ||
if (_parameters.keepStart) { | ||
if (matchedProperty) { | ||
if (hierarchyDefinition.matchedProperty) { | ||
// TODO compare with lastFilterTransformationResult | ||
currentNode[matchedProperty] = true; | ||
currentNode[hierarchyDefinition.matchedProperty] = true; | ||
} | ||
@@ -690,3 +689,3 @@ subTrees.push(currentNode); | ||
currentNode.$children.forEach((child) => { | ||
this.flattenTree(child, subTrees, nodeProperty, distanceFromRootProperty, limitedDescendantCountProperty, matchedDescendantCountProperty, drillStateProperty, _parameters.maximumDistance); | ||
this.flattenTree(child, subTrees, nodeProperty, hierarchyDefinition, _parameters.maximumDistance); | ||
}); | ||
@@ -698,6 +697,6 @@ }); | ||
if (subTreeData) { | ||
if (matchedDescendantCountProperty && | ||
drillStateProperty && | ||
item[matchedDescendantCountProperty] === 0) { | ||
subTreeData[drillStateProperty] = 'leaf'; | ||
if (hierarchyDefinition.matchedDescendantCountProperty && | ||
hierarchyDefinition.drillStateProperty && | ||
item[hierarchyDefinition.matchedDescendantCountProperty] === 0) { | ||
subTreeData[hierarchyDefinition.drillStateProperty] = 'leaf'; | ||
} | ||
@@ -713,16 +712,19 @@ outData.push({ ...item, ...subTreeData }); | ||
} | ||
getHierarchyDefinition(hierarchyQualifier) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
const hierarchyAnnotation = (_b = (_a = this._entityType.annotations) === null || _a === void 0 ? void 0 : _a.Hierarchy) === null || _b === void 0 ? void 0 : _b[`RecursiveHierarchy#${hierarchyQualifier}`]; | ||
const aggregationAnnotation = (_d = (_c = this._entityType.annotations) === null || _c === void 0 ? void 0 : _c.Aggregation) === null || _d === void 0 ? void 0 : _d[`RecursiveHierarchy#${hierarchyQualifier}`]; | ||
return { | ||
distanceFromRootProperty: (_e = hierarchyAnnotation === null || hierarchyAnnotation === void 0 ? void 0 : hierarchyAnnotation.DistanceFromRootProperty) === null || _e === void 0 ? void 0 : _e.$target.name, | ||
drillStateProperty: (_f = hierarchyAnnotation === null || hierarchyAnnotation === void 0 ? void 0 : hierarchyAnnotation.DrillStateProperty) === null || _f === void 0 ? void 0 : _f.$target.name, | ||
limitedDescendantCountProperty: (_g = hierarchyAnnotation === null || hierarchyAnnotation === void 0 ? void 0 : hierarchyAnnotation.LimitedDescendantCountProperty) === null || _g === void 0 ? void 0 : _g.$target.name, | ||
matchedDescendantCountProperty: (_h = hierarchyAnnotation === null || hierarchyAnnotation === void 0 ? void 0 : hierarchyAnnotation.MatchedDescendantCountProperty) === null || _h === void 0 ? void 0 : _h.$target.name, | ||
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 | ||
}; | ||
} | ||
async getAncestors(inputSet, lastFilterTransformationResult, limitedHierarchy, entityType, _parameters, _odataRequest) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
var _a, _b; | ||
const aggregationAnnotation = (_b = (_a = this._entityType.annotations) === null || _a === void 0 ? void 0 : _a.Aggregation) === null || _b === void 0 ? void 0 : _b[`RecursiveHierarchy#${_parameters.qualifier}`]; | ||
const hierarchyAnnotation = (_d = (_c = this._entityType.annotations) === null || _c === void 0 ? void 0 : _c.Hierarchy) === null || _d === void 0 ? void 0 : _d[`RecursiveHierarchy#${_parameters.qualifier}`]; | ||
let distanceFromRootProperty; | ||
let matchedDescendantCountProperty; | ||
let matchedProperty; | ||
let drillStateProperty; | ||
if (hierarchyAnnotation) { | ||
distanceFromRootProperty = (_e = hierarchyAnnotation.DistanceFromRootProperty) === null || _e === void 0 ? void 0 : _e.$target.name; | ||
drillStateProperty = (_f = hierarchyAnnotation.DrillStateProperty) === null || _f === void 0 ? void 0 : _f.$target.name; | ||
matchedDescendantCountProperty = (_g = hierarchyAnnotation.MatchedDescendantCountProperty) === null || _g === void 0 ? void 0 : _g.$target.name; | ||
matchedProperty = (_h = hierarchyAnnotation.MatchedProperty) === null || _h === void 0 ? void 0 : _h.$target.name; | ||
} | ||
const hierarchyDefinition = this.getHierarchyDefinition(_parameters.qualifier); | ||
if (aggregationAnnotation) { | ||
@@ -740,3 +742,3 @@ const nodeProperty = aggregationAnnotation.NodeProperty.$target.name; | ||
}); | ||
const hierarchyNodes = this.buildHierarchyTree(_parameters.qualifier, adjustedData); | ||
const hierarchyNodes = this.buildHierarchyTree(_parameters.qualifier, adjustedData, hierarchyDefinition); | ||
const rootNodes = hierarchyNodes['']; | ||
@@ -751,6 +753,6 @@ rootNodes.forEach((rootNode) => { | ||
if (_parameters.keepStart) { | ||
this.getAncestorsOfNode(currentNode, ancestors, nodeProperty, distanceFromRootProperty, matchedDescendantCountProperty, matchedProperty, drillStateProperty, _parameters.maximumDistance - 1, 0, lastFilterTransformationResult); | ||
this.getAncestorsOfNode(currentNode, ancestors, nodeProperty, hierarchyDefinition, _parameters.maximumDistance - 1, 0, lastFilterTransformationResult); | ||
} | ||
else if (currentNode && currentNode.$parent) { | ||
this.getAncestorsOfNode(currentNode.$parent, ancestors, nodeProperty, distanceFromRootProperty, matchedDescendantCountProperty, matchedProperty, drillStateProperty, _parameters.maximumDistance - 1, 1, lastFilterTransformationResult); | ||
this.getAncestorsOfNode(currentNode.$parent, ancestors, nodeProperty, hierarchyDefinition, _parameters.maximumDistance - 1, 1, lastFilterTransformationResult); | ||
} | ||
@@ -757,0 +759,0 @@ }); |
{ | ||
"name": "@sap-ux/fe-mockserver-core", | ||
"version": "1.1.80", | ||
"version": "1.1.81", | ||
"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
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
544868
6301