New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sap-ux/annotation-converter

Package Overview
Dependencies
Maintainers
0
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap-ux/annotation-converter - npm Package Compare versions

Comparing version 0.10.1 to 0.10.2

6

CHANGELOG.md
# @sap-ux/annotation-converter
## 0.10.2
### Patch Changes
- ca0aa14: "Flag" enum are now properly converted back to single value instead of a collection
## 0.10.1

@@ -4,0 +10,0 @@

25

dist/writeback.js

@@ -16,6 +16,23 @@ "use strict";

if (Array.isArray(value)) {
result = {
type: 'Collection',
Collection: value.map((anno) => revertCollectionItemToRawType(references, anno))
};
// Special case of flag enum type
const firstValue = value[0];
let isEnumFlags = false;
if (firstValue && typeof firstValue === 'string') {
const valueMatches = firstValue.valueOf().split('.');
if (valueMatches.length > 1 && references.find((ref) => ref.alias === valueMatches[0])) {
isEnumFlags = utils_1.EnumIsFlag[(0, utils_1.substringBeforeFirst)(firstValue, '/')];
}
}
if (isEnumFlags) {
result = {
type: 'EnumMember',
EnumMember: value.map((val) => val.valueOf()).join(' ')
};
}
else {
result = {
type: 'Collection',
Collection: value.map((anno) => revertCollectionItemToRawType(references, anno))
};
}
}

@@ -22,0 +39,0 @@ else if ((_a = value.isDecimal) === null || _a === void 0 ? void 0 : _a.call(value)) {

2

package.json
{
"name": "@sap-ux/annotation-converter",
"version": "0.10.1",
"version": "0.10.2",
"description": "SAP Fiori OData - Annotation converter",

@@ -5,0 +5,0 @@ "repository": {

@@ -13,3 +13,3 @@ import type {

} from '@sap-ux/vocabularies-types';
import { unalias } from './utils';
import { EnumIsFlag, substringBeforeFirst, unalias } from './utils';

@@ -26,6 +26,22 @@ /**

if (Array.isArray(value)) {
result = {
type: 'Collection',
Collection: value.map((anno) => revertCollectionItemToRawType(references, anno)) as any[]
};
// Special case of flag enum type
const firstValue = value[0];
let isEnumFlags = false;
if (firstValue && typeof firstValue === 'string') {
const valueMatches = firstValue.valueOf().split('.');
if (valueMatches.length > 1 && references.find((ref) => ref.alias === valueMatches[0])) {
isEnumFlags = EnumIsFlag[substringBeforeFirst(firstValue, '/')];
}
}
if (isEnumFlags) {
result = {
type: 'EnumMember',
EnumMember: value.map((val) => val.valueOf()).join(' ')
};
} else {
result = {
type: 'Collection',
Collection: value.map((anno) => revertCollectionItemToRawType(references, anno)) as any[]
};
}
} else if (value.isDecimal?.()) {

@@ -32,0 +48,0 @@ result = {

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