@sap-ux/annotation-converter
Advanced tools
Comparing version 0.5.15 to 0.5.16
# @sap-ux/annotation-converter | ||
## 0.5.16 | ||
### Patch Changes | ||
- e2bd72a: Singleton are properly resolved through the resolvePath method | ||
## 0.5.15 | ||
@@ -4,0 +10,0 @@ |
@@ -38,2 +38,5 @@ "use strict"; | ||
}); | ||
rawMetadata.schema.singletons.forEach((singleton) => { | ||
objectMap[singleton.fullyQualifiedName] = singleton; | ||
}); | ||
rawMetadata.schema.actions.forEach((action) => { | ||
@@ -180,3 +183,5 @@ objectMap[action.fullyQualifiedName] = action; | ||
// Empty Path after an entitySet means entityType | ||
if (currentValue && currentValue._type === 'EntitySet' && currentValue.entityType) { | ||
if (currentValue && | ||
(currentValue._type === 'EntitySet' || currentValue._type === 'Singleton') && | ||
currentValue.entityType) { | ||
if (includeVisitedObjects) { | ||
@@ -201,11 +206,13 @@ aVisitedObjects.push(currentValue); | ||
} | ||
else if (currentValue._type === 'EntitySet' && pathPart === '$Type') { | ||
else if ((currentValue._type === 'EntitySet' || currentValue._type === 'Singleton') && pathPart === '$Type') { | ||
currentValue = currentValue.targetType; | ||
return currentValue; | ||
} | ||
else if (currentValue._type === 'EntitySet' && pathPart === '$NavigationPropertyBinding') { | ||
else if ((currentValue._type === 'EntitySet' || currentValue._type === 'Singleton') && | ||
pathPart === '$NavigationPropertyBinding') { | ||
currentValue = currentValue.navigationPropertyBinding; | ||
return currentValue; | ||
} | ||
else if (currentValue._type === 'EntitySet' && currentValue.entityType) { | ||
else if ((currentValue._type === 'EntitySet' || currentValue._type === 'Singleton') && | ||
currentValue.entityType) { | ||
currentPath = combinePath(currentValue.entityTypeName, pathPart); | ||
@@ -272,2 +279,3 @@ } | ||
obj._type === 'EntitySet' || | ||
obj._type === 'Singleton' || | ||
obj._type === 'NavigationProperty'); | ||
@@ -895,3 +903,4 @@ if (currentContext) { | ||
const entitySet = convertedOutput.entitySets.find((et) => et.name === entitySetName); | ||
if (!entitySet) { | ||
const singleton = convertedOutput.singletons.find((et) => et.name === entitySetName); | ||
if (!entitySet && !singleton) { | ||
return { | ||
@@ -904,8 +913,8 @@ target: convertedOutput.entityContainer, | ||
return { | ||
target: entitySet, | ||
objectPath: [convertedOutput.entityContainer, entitySet] | ||
target: entitySet || singleton, | ||
objectPath: [convertedOutput.entityContainer, entitySet || singleton] | ||
}; | ||
} | ||
else { | ||
const targetResolution = _resolveTarget(objectMap, entitySet, '/' + aPathSplit.join('/'), false, true); | ||
const targetResolution = _resolveTarget(objectMap, entitySet || singleton, '/' + aPathSplit.join('/'), false, true); | ||
if (targetResolution.target) { | ||
@@ -912,0 +921,0 @@ targetResolution.visitedObjects.push(targetResolution.target); |
{ | ||
"name": "@sap-ux/annotation-converter", | ||
"version": "0.5.15", | ||
"version": "0.5.16", | ||
"description": "SAP Fiori OData - Annotation converter", | ||
@@ -17,4 +17,4 @@ "repository": { | ||
"devDependencies": { | ||
"@sap-ux/vocabularies-types": "0.6.1", | ||
"@sap-ux/edmx-parser": "0.5.7" | ||
"@sap-ux/vocabularies-types": "0.6.2", | ||
"@sap-ux/edmx-parser": "0.5.8" | ||
}, | ||
@@ -21,0 +21,0 @@ "scripts": { |
@@ -74,2 +74,5 @@ import type { | ||
}); | ||
rawMetadata.schema.singletons.forEach((singleton) => { | ||
objectMap[singleton.fullyQualifiedName] = singleton; | ||
}); | ||
rawMetadata.schema.actions.forEach((action) => { | ||
@@ -227,3 +230,7 @@ objectMap[action.fullyQualifiedName] = action; | ||
// Empty Path after an entitySet means entityType | ||
if (currentValue && currentValue._type === 'EntitySet' && currentValue.entityType) { | ||
if ( | ||
currentValue && | ||
(currentValue._type === 'EntitySet' || currentValue._type === 'Singleton') && | ||
currentValue.entityType | ||
) { | ||
if (includeVisitedObjects) { | ||
@@ -247,9 +254,15 @@ aVisitedObjects.push(currentValue); | ||
currentPath = pathPart; | ||
} else if (currentValue._type === 'EntitySet' && pathPart === '$Type') { | ||
} else if ((currentValue._type === 'EntitySet' || currentValue._type === 'Singleton') && pathPart === '$Type') { | ||
currentValue = currentValue.targetType; | ||
return currentValue; | ||
} else if (currentValue._type === 'EntitySet' && pathPart === '$NavigationPropertyBinding') { | ||
} else if ( | ||
(currentValue._type === 'EntitySet' || currentValue._type === 'Singleton') && | ||
pathPart === '$NavigationPropertyBinding' | ||
) { | ||
currentValue = currentValue.navigationPropertyBinding; | ||
return currentValue; | ||
} else if (currentValue._type === 'EntitySet' && currentValue.entityType) { | ||
} else if ( | ||
(currentValue._type === 'EntitySet' || currentValue._type === 'Singleton') && | ||
currentValue.entityType | ||
) { | ||
currentPath = combinePath(currentValue.entityTypeName, pathPart); | ||
@@ -316,2 +329,3 @@ } else if (currentValue._type === 'NavigationProperty') { | ||
obj._type === 'EntitySet' || | ||
obj._type === 'Singleton' || | ||
obj._type === 'NavigationProperty' | ||
@@ -1103,3 +1117,4 @@ ); | ||
const entitySet = convertedOutput.entitySets.find((et: EntitySet) => et.name === entitySetName); | ||
if (!entitySet) { | ||
const singleton = convertedOutput.singletons.find((et: Singleton) => et.name === entitySetName); | ||
if (!entitySet && !singleton) { | ||
return { | ||
@@ -1112,7 +1127,13 @@ target: convertedOutput.entityContainer, | ||
return { | ||
target: entitySet, | ||
objectPath: [convertedOutput.entityContainer, entitySet] | ||
target: entitySet || singleton, | ||
objectPath: [convertedOutput.entityContainer, entitySet || singleton] | ||
} as ResolutionTarget<T>; | ||
} else { | ||
const targetResolution: any = _resolveTarget(objectMap, entitySet, '/' + aPathSplit.join('/'), false, true); | ||
const targetResolution: any = _resolveTarget( | ||
objectMap, | ||
entitySet || singleton, | ||
'/' + aPathSplit.join('/'), | ||
false, | ||
true | ||
); | ||
if (targetResolution.target) { | ||
@@ -1119,0 +1140,0 @@ targetResolution.visitedObjects.push(targetResolution.target); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
277222
4163