Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap-ux/annotation-converter

Package Overview
Dependencies
Maintainers
3
Versions
76
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.6.14 to 0.6.15

6

CHANGELOG.md
# @sap-ux/annotation-converter
## 0.6.15
### Patch Changes
- 3116cd5: The annotation converter now returns the correct references
## 0.6.14

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

31

dist/converter.js

@@ -1018,27 +1018,2 @@ "use strict";

}
function getReferences(converter, rawMetadataReferences) {
if (rawMetadataReferences.length === 0) {
return VocabularyReferences_1.VocabularyReferences;
}
const references = [];
const duplicates = new Set();
const collides = (a, b) => a.namespace === b.namespace || a.alias === b.alias;
// process the raw references, making sure they are unique (first one wins)
for (const reference of rawMetadataReferences) {
const collisions = references.filter((existingReference) => collides(existingReference, reference));
if (collisions.length > 0) {
collisions.forEach((reference) => duplicates.add(reference));
duplicates.add(reference);
}
else {
references.push(reference);
}
}
// add default vocabulary references (if not there already). Do not report conflicts as errors.
references.push(...VocabularyReferences_1.VocabularyReferences.filter((reference) => references.every((existingReference) => !collides(existingReference, reference))));
if (duplicates.size > 0) {
converter.logError(`The following references are not unique. Check if they are imported multiple times.\n${JSON.stringify(Array.from(duplicates), null, 2)}`);
}
return references;
}
/**

@@ -1056,7 +1031,11 @@ * Convert a RawMetadata into an object representation to be used to easily navigate a metadata object and its annotation.

annotations: rawMetadata.schema.annotations,
references: VocabularyReferences_1.VocabularyReferences,
diagnostics: []
};
// fall back on the default references if the caller does not specify any
if (rawMetadata.references.length === 0) {
rawMetadata.references = VocabularyReferences_1.VocabularyReferences;
}
// Converter
const converter = new Converter(rawMetadata, convertedOutput);
(0, utils_1.lazy)(convertedOutput, 'references', () => getReferences(converter, rawMetadata.references));
(0, utils_1.lazy)(convertedOutput, 'entityContainer', converter.convert(converter.rawSchema.entityContainer, convertEntityContainer));

@@ -1063,0 +1042,0 @@ (0, utils_1.lazy)(convertedOutput, 'entitySets', converter.convert(converter.rawSchema.entitySets, convertEntitySet));

{
"name": "@sap-ux/annotation-converter",
"version": "0.6.14",
"version": "0.6.15",
"description": "SAP Fiori OData - Annotation converter",

@@ -20,3 +20,3 @@ "repository": {

"devDependencies": {
"@sap-ux/edmx-parser": "0.5.15"
"@sap-ux/edmx-parser": "0.5.16"
},

@@ -23,0 +23,0 @@ "scripts": {

@@ -36,3 +36,2 @@ import type {

RawV4NavigationProperty,
Reference,
RemoveAnnotationAndType,

@@ -1546,44 +1545,2 @@ ResolutionTarget,

function getReferences(converter: Converter, rawMetadataReferences: Reference[]) {
if (rawMetadataReferences.length === 0) {
return VocabularyReferences;
}
const references: Reference[] = [];
const duplicates = new Set<Reference>();
const collides = (a: Reference, b: Reference) => a.namespace === b.namespace || a.alias === b.alias;
// process the raw references, making sure they are unique (first one wins)
for (const reference of rawMetadataReferences) {
const collisions = references.filter((existingReference) => collides(existingReference, reference));
if (collisions.length > 0) {
collisions.forEach((reference) => duplicates.add(reference));
duplicates.add(reference);
} else {
references.push(reference);
}
}
// add default vocabulary references (if not there already). Do not report conflicts as errors.
references.push(
...VocabularyReferences.filter((reference) =>
references.every((existingReference) => !collides(existingReference, reference))
)
);
if (duplicates.size > 0) {
converter.logError(
`The following references are not unique. Check if they are imported multiple times.\n${JSON.stringify(
Array.from(duplicates),
null,
2
)}`
);
}
return references;
}
/**

@@ -1601,10 +1558,14 @@ * Convert a RawMetadata into an object representation to be used to easily navigate a metadata object and its annotation.

annotations: rawMetadata.schema.annotations,
references: VocabularyReferences,
diagnostics: []
} as any;
// fall back on the default references if the caller does not specify any
if (rawMetadata.references.length === 0) {
rawMetadata.references = VocabularyReferences;
}
// Converter
const converter = new Converter(rawMetadata, convertedOutput);
lazy(convertedOutput, 'references', () => getReferences(converter, rawMetadata.references));
lazy(

@@ -1611,0 +1572,0 @@ convertedOutput,

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