@sap-ux/annotation-converter
Advanced tools
Comparing version 0.5.19 to 0.5.20
# @sap-ux/annotation-converter | ||
## 0.5.20 | ||
### Patch Changes | ||
- 29a4f8c: feat: support reverting primitive object to its raw type | ||
## 0.5.19 | ||
@@ -4,0 +10,0 @@ |
@@ -13,3 +13,3 @@ "use strict"; | ||
function revertObjectToRawType(references, value) { | ||
var _a, _b; | ||
var _a, _b, _c, _d, _e, _f; | ||
let result; | ||
@@ -29,3 +29,3 @@ if (Array.isArray(value)) { | ||
else if ((_b = value.isString) === null || _b === void 0 ? void 0 : _b.call(value)) { | ||
const valueMatches = value.split('.'); | ||
const valueMatches = value.valueOf().split('.'); | ||
if (valueMatches.length > 1 && references.find((ref) => ref.alias === valueMatches[0])) { | ||
@@ -44,2 +44,26 @@ result = { | ||
} | ||
else if ((_c = value.isInt) === null || _c === void 0 ? void 0 : _c.call(value)) { | ||
result = { | ||
type: 'Int', | ||
Int: value.valueOf() | ||
}; | ||
} | ||
else if ((_d = value.isFloat) === null || _d === void 0 ? void 0 : _d.call(value)) { | ||
result = { | ||
type: 'Float', | ||
Float: value.valueOf() | ||
}; | ||
} | ||
else if ((_e = value.isDate) === null || _e === void 0 ? void 0 : _e.call(value)) { | ||
result = { | ||
type: 'Date', | ||
Date: value.valueOf() | ||
}; | ||
} | ||
else if ((_f = value.isBoolean) === null || _f === void 0 ? void 0 : _f.call(value)) { | ||
result = { | ||
type: 'Bool', | ||
Bool: value.valueOf() === 'true' | ||
}; | ||
} | ||
else if (value.type === 'Path') { | ||
@@ -46,0 +70,0 @@ result = { |
{ | ||
"name": "@sap-ux/annotation-converter", | ||
"version": "0.5.19", | ||
"version": "0.5.20", | ||
"description": "SAP Fiori OData - Annotation converter", | ||
@@ -17,4 +17,4 @@ "repository": { | ||
"devDependencies": { | ||
"@sap-ux/vocabularies-types": "0.6.5", | ||
"@sap-ux/edmx-parser": "0.5.11" | ||
"@sap-ux/vocabularies-types": "0.6.8", | ||
"@sap-ux/edmx-parser": "0.5.13" | ||
}, | ||
@@ -21,0 +21,0 @@ "scripts": { |
@@ -26,3 +26,2 @@ import type { | ||
ConvertedMetadata, | ||
ServiceObjectAndAnnotation, | ||
ResolutionTarget, | ||
@@ -1102,6 +1101,3 @@ EntityContainer, | ||
function createGlobalResolve(convertedOutput: ConvertedMetadata, objectMap: Record<string, any>) { | ||
return function resolvePath<T extends ServiceObjectAndAnnotation>( | ||
sPath: string, | ||
resolveDirectly: boolean = false | ||
): ResolutionTarget<T> { | ||
return function resolvePath<T>(sPath: string, resolveDirectly: boolean = false): ResolutionTarget<T> { | ||
if (resolveDirectly) { | ||
@@ -1108,0 +1104,0 @@ let targetPath = sPath; |
@@ -34,3 +34,3 @@ import type { | ||
} else if (value.isString?.()) { | ||
const valueMatches = value.split('.'); | ||
const valueMatches = value.valueOf().split('.'); | ||
if (valueMatches.length > 1 && references.find((ref) => ref.alias === valueMatches[0])) { | ||
@@ -47,2 +47,22 @@ result = { | ||
} | ||
} else if (value.isInt?.()) { | ||
result = { | ||
type: 'Int', | ||
Int: value.valueOf() | ||
}; | ||
} else if (value.isFloat?.()) { | ||
result = { | ||
type: 'Float', | ||
Float: value.valueOf() | ||
}; | ||
} else if (value.isDate?.()) { | ||
result = { | ||
type: 'Date', | ||
Date: value.valueOf() | ||
}; | ||
} else if (value.isBoolean?.()) { | ||
result = { | ||
type: 'Bool', | ||
Bool: value.valueOf() === 'true' | ||
}; | ||
} else if (value.type === 'Path') { | ||
@@ -49,0 +69,0 @@ result = { |
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
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
280643
4224