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

@sap-ux/edmx-parser

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap-ux/edmx-parser - npm Package Compare versions

Comparing version 0.5.5 to 0.5.6

6

CHANGELOG.md
# @sap-ux/edmx-parser
## 0.5.6
### Patch Changes
- 64a0fdf: Improve v2 services support
## 0.5.5

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

19

dist/parser.js

@@ -801,5 +801,2 @@ "use strict";

function mergeSchemas(schemas) {
if (schemas.length === 1) {
return schemas[0];
}
const associations = schemas.reduce((associationsToReduce, schema) => {

@@ -862,4 +859,16 @@ return associationsToReduce.concat(schema.associations);

const association = associations.find((assoc) => assoc.fullyQualifiedName === v2NavProp.relationship);
if (association && association.referentialConstraints) {
v2NavProp.referentialConstraint = association.referentialConstraints;
if (association && association.referentialConstraints && association.referentialConstraints.length > 0) {
if (association.referentialConstraints[0].sourceTypeName === entityType.fullyQualifiedName) {
v2NavProp.referentialConstraint = association.referentialConstraints;
}
else {
v2NavProp.referentialConstraint = association.referentialConstraints.map((refConstraint) => {
return {
sourceTypeName: refConstraint.targetTypeName,
sourceProperty: refConstraint.targetProperty,
targetTypeName: refConstraint.sourceTypeName,
targetProperty: refConstraint.sourceProperty
};
});
}
}

@@ -866,0 +875,0 @@ });

@@ -56,3 +56,3 @@ "use strict";

pushToAnnotations(attributes['sap:schema-version'] !== undefined, {
term: "Org.OData.Core.V1.SchemaVersion" /* SchemaVersion */,
term: "Org.OData.Core.V1.SchemaVersion" /* CoreAnnotationTerms.SchemaVersion */,
value: {

@@ -64,3 +64,3 @@ type: 'String',

pushToAnnotations(attributes['sap:searchable'] !== undefined, {
term: "Org.OData.Capabilities.V1.SearchRestrictions" /* SearchRestrictions */,
term: "Org.OData.Capabilities.V1.SearchRestrictions" /* CapabilitiesAnnotationTerms.SearchRestrictions */,
record: {

@@ -79,3 +79,3 @@ propertyValues: [

pushToAnnotations(attributes['sap:pageable'] !== undefined, {
term: "Org.OData.Capabilities.V1.TopSupported" /* TopSupported */,
term: "Org.OData.Capabilities.V1.TopSupported" /* CapabilitiesAnnotationTerms.TopSupported */,
value: {

@@ -87,3 +87,3 @@ type: 'Bool',

pushToAnnotations(attributes['sap:pageable'] !== undefined, {
term: "Org.OData.Capabilities.V1.SkipSupported" /* SkipSupported */,
term: "Org.OData.Capabilities.V1.SkipSupported" /* CapabilitiesAnnotationTerms.SkipSupported */,
value: {

@@ -95,3 +95,3 @@ type: 'Bool',

pushToAnnotations(attributes['sap:topable'] !== undefined, {
term: "Org.OData.Capabilities.V1.TopSupported" /* TopSupported */,
term: "Org.OData.Capabilities.V1.TopSupported" /* CapabilitiesAnnotationTerms.TopSupported */,
value: {

@@ -103,3 +103,3 @@ type: 'Bool',

pushToAnnotations(attributes['sap:requires-filter'] !== undefined, {
term: "Org.OData.Capabilities.V1.FilterRestrictions" /* FilterRestrictions */,
term: "Org.OData.Capabilities.V1.FilterRestrictions" /* CapabilitiesAnnotationTerms.FilterRestrictions */,
record: {

@@ -118,3 +118,3 @@ propertyValues: [

pushToAnnotations(attributes['sap:required-in-filter'] !== undefined, {
term: "Org.OData.Capabilities.V1.FilterRestrictions" /* FilterRestrictions */,
term: "Org.OData.Capabilities.V1.FilterRestrictions" /* CapabilitiesAnnotationTerms.FilterRestrictions */,
record: {

@@ -138,3 +138,3 @@ propertyValues: [

pushToAnnotations(attributes['sap:filter-restricton'] !== undefined, {
term: "Org.OData.Capabilities.V1.FilterRestrictions" /* FilterRestrictions */,
term: "Org.OData.Capabilities.V1.FilterRestrictions" /* CapabilitiesAnnotationTerms.FilterRestrictions */,
record: {

@@ -173,3 +173,3 @@ propertyValues: [

pushToAnnotations(attributes['sap:sortable'] === 'false', {
term: "Org.OData.Capabilities.V1.SortRestrictions" /* SortRestrictions */,
term: "Org.OData.Capabilities.V1.SortRestrictions" /* CapabilitiesAnnotationTerms.SortRestrictions */,
record: {

@@ -188,3 +188,3 @@ propertyValues: [

pushToAnnotations(attributes['sap:visible'] === 'false', {
term: "com.sap.vocabularies.UI.v1.Hidden" /* Hidden */,
term: "com.sap.vocabularies.UI.v1.Hidden" /* UIAnnotationTerms.Hidden */,
value: {

@@ -196,3 +196,3 @@ type: 'Bool',

pushToAnnotations(attributes['sap:label'] !== undefined, {
term: "com.sap.vocabularies.Common.v1.Label" /* Label */,
term: "com.sap.vocabularies.Common.v1.Label" /* CommonAnnotationTerms.Label */,
value: {

@@ -204,3 +204,3 @@ type: 'String',

pushToAnnotations(attributes['sap:heading'] !== undefined, {
term: "com.sap.vocabularies.Common.v1.Heading" /* Heading */,
term: "com.sap.vocabularies.Common.v1.Heading" /* CommonAnnotationTerms.Heading */,
value: {

@@ -212,3 +212,3 @@ type: 'String',

pushToAnnotations(attributes['sap:quickinfo'] !== undefined, {
term: "com.sap.vocabularies.Common.v1.QuickInfo" /* QuickInfo */,
term: "com.sap.vocabularies.Common.v1.QuickInfo" /* CommonAnnotationTerms.QuickInfo */,
value: {

@@ -220,3 +220,3 @@ type: 'String',

pushToAnnotations(attributes['sap:text'] !== undefined, {
term: "com.sap.vocabularies.Common.v1.Text" /* Text */,
term: "com.sap.vocabularies.Common.v1.Text" /* CommonAnnotationTerms.Text */,
value: {

@@ -228,3 +228,3 @@ type: 'Path',

pushToAnnotations(attributes['sap:unit'] !== undefined, {
term: "Org.OData.Measures.V1.Unit" /* Unit */,
term: "Org.OData.Measures.V1.Unit" /* MeasuresAnnotationTerms.Unit */,
value: {

@@ -236,3 +236,3 @@ type: 'Path',

pushToAnnotations(attributes['sap:unit'] !== undefined, {
term: "Org.OData.Measures.V1.ISOCurrency" /* ISOCurrency */,
term: "Org.OData.Measures.V1.ISOCurrency" /* MeasuresAnnotationTerms.ISOCurrency */,
value: {

@@ -244,3 +244,3 @@ type: 'Path',

pushToAnnotations(attributes['sap:precision'] !== undefined, {
term: "Org.OData.Measures.V1.Scale" /* Scale */,
term: "Org.OData.Measures.V1.Scale" /* MeasuresAnnotationTerms.Scale */,
value: {

@@ -252,3 +252,3 @@ type: 'Int',

pushToAnnotations(attributes['sap:value-list'] === 'fixed-value', {
term: "com.sap.vocabularies.Common.v1.ValueListWithFixedValues" /* ValueListWithFixedValues */,
term: "com.sap.vocabularies.Common.v1.ValueListWithFixedValues" /* CommonAnnotationTerms.ValueListWithFixedValues */,
value: {

@@ -260,3 +260,3 @@ type: 'Bool',

pushToAnnotations(attributes['sap:display-format'] === 'NonNegative', {
term: "com.sap.vocabularies.Common.v1.IsDigitSequence" /* IsDigitSequence */,
term: "com.sap.vocabularies.Common.v1.IsDigitSequence" /* CommonAnnotationTerms.IsDigitSequence */,
value: {

@@ -268,3 +268,3 @@ type: 'Bool',

pushToAnnotations(attributes['sap:display-format'] === 'UpperCase', {
term: "com.sap.vocabularies.Common.v1.IsUpperCase" /* IsUpperCase */,
term: "com.sap.vocabularies.Common.v1.IsUpperCase" /* CommonAnnotationTerms.IsUpperCase */,
value: {

@@ -296,3 +296,3 @@ type: 'Bool',

annotations.push({
term: "com.sap.vocabularies.Common.v1.Interval" /* Interval */,
term: "com.sap.vocabularies.Common.v1.Interval" /* CommonAnnotationTerms.Interval */,
record: {

@@ -304,3 +304,3 @@ propertyValues: pv

pushToAnnotations(attributes['sap:field-control'] !== undefined, {
term: "com.sap.vocabularies.Common.v1.FieldControl" /* FieldControl */,
term: "com.sap.vocabularies.Common.v1.FieldControl" /* CommonAnnotationTerms.FieldControl */,
value: {

@@ -312,3 +312,3 @@ type: 'Path',

pushToAnnotations(attributes['sap:applicable-path'] !== undefined, {
term: "Org.OData.Core.V1.OperationAvailable" /* OperationAvailable */,
term: "Org.OData.Core.V1.OperationAvailable" /* CoreAnnotationTerms.OperationAvailable */,
value: {

@@ -320,3 +320,3 @@ type: 'Path',

pushToAnnotations(attributes['sap:minoccurs'] !== undefined, {
term: "com.sap.vocabularies.Common.v1.MinOccurs" /* MinOccurs */,
term: "com.sap.vocabularies.Common.v1.MinOccurs" /* CommonAnnotationTerms.MinOccurs */,
value: {

@@ -328,3 +328,3 @@ type: 'Int',

pushToAnnotations(attributes['sap:maxoccurs'] !== undefined, {
term: "com.sap.vocabularies.Common.v1.MaxOccurs" /* MaxOccurs */,
term: "com.sap.vocabularies.Common.v1.MaxOccurs" /* CommonAnnotationTerms.MaxOccurs */,
value: {

@@ -336,17 +336,17 @@ type: 'Int',

pushToAnnotations(attributes['sap:parameter'] === 'mandatory', {
term: "com.sap.vocabularies.Common.v1.FieldControl" /* FieldControl */,
term: "com.sap.vocabularies.Common.v1.FieldControl" /* CommonAnnotationTerms.FieldControl */,
value: {
type: 'EnumMember',
EnumMember: "Common.FieldControlType/Mandatory" /* Mandatory */
EnumMember: "Common.FieldControlType/Mandatory" /* FieldControlType.Mandatory */
}
});
pushToAnnotations(attributes['sap:parameter'] === 'optional', {
term: "com.sap.vocabularies.Common.v1.FieldControl" /* FieldControl */,
term: "com.sap.vocabularies.Common.v1.FieldControl" /* CommonAnnotationTerms.FieldControl */,
value: {
type: 'EnumMember',
EnumMember: "Common.FieldControlType/Optional" /* Optional */
EnumMember: "Common.FieldControlType/Optional" /* FieldControlType.Optional */
}
});
pushToAnnotations(attributes['sap:attribute-for'] !== undefined, {
term: "com.sap.vocabularies.Common.v1.Attributes" /* Attributes */,
term: "com.sap.vocabularies.Common.v1.Attributes" /* CommonAnnotationTerms.Attributes */,
value: {

@@ -373,3 +373,3 @@ type: 'Collection',

annotations.push({
term: "Org.OData.Capabilities.V1.InsertRestrictions" /* InsertRestrictions */,
term: "Org.OData.Capabilities.V1.InsertRestrictions" /* CapabilitiesAnnotationTerms.InsertRestrictions */,
record: {

@@ -390,3 +390,3 @@ propertyValues: [

annotations.push({
term: "Org.OData.Capabilities.V1.UpdateRestrictions" /* UpdateRestrictions */,
term: "Org.OData.Capabilities.V1.UpdateRestrictions" /* CapabilitiesAnnotationTerms.UpdateRestrictions */,
record: {

@@ -407,3 +407,3 @@ propertyValues: [

annotations.push({
term: "Org.OData.Capabilities.V1.UpdateRestrictions" /* UpdateRestrictions */,
term: "Org.OData.Capabilities.V1.UpdateRestrictions" /* CapabilitiesAnnotationTerms.UpdateRestrictions */,
record: {

@@ -424,3 +424,3 @@ propertyValues: [

annotations.push({
term: "Org.OData.Capabilities.V1.DeleteRestrictions" /* DeleteRestrictions */,
term: "Org.OData.Capabilities.V1.DeleteRestrictions" /* CapabilitiesAnnotationTerms.DeleteRestrictions */,
record: {

@@ -441,3 +441,3 @@ propertyValues: [

annotations.push({
term: "Org.OData.Capabilities.V1.DeleteRestrictions" /* DeleteRestrictions */,
term: "Org.OData.Capabilities.V1.DeleteRestrictions" /* CapabilitiesAnnotationTerms.DeleteRestrictions */,
record: {

@@ -468,3 +468,3 @@ propertyValues: [

annotations.push({
term: "Org.OData.Capabilities.V1.NavigationRestrictions" /* NavigationRestrictions */,
term: "Org.OData.Capabilities.V1.NavigationRestrictions" /* CapabilitiesAnnotationTerms.NavigationRestrictions */,
record: {

@@ -505,3 +505,3 @@ propertyValues: [

annotations.push({
term: "Org.OData.Capabilities.V1.NavigationRestrictions" /* NavigationRestrictions */,
term: "Org.OData.Capabilities.V1.NavigationRestrictions" /* CapabilitiesAnnotationTerms.NavigationRestrictions */,
record: {

@@ -542,3 +542,3 @@ propertyValues: [

annotations.push({
term: "Org.OData.Capabilities.V1.NavigationRestrictions" /* NavigationRestrictions */,
term: "Org.OData.Capabilities.V1.NavigationRestrictions" /* CapabilitiesAnnotationTerms.NavigationRestrictions */,
record: {

@@ -599,3 +599,3 @@ propertyValues: [

annotations.push({
term: "Org.OData.Core.V1.Immutable" /* Immutable */,
term: "Org.OData.Core.V1.Immutable" /* CoreAnnotationTerms.Immutable */,
value: {

@@ -609,3 +609,3 @@ type: 'Bool',

annotations.push({
term: "Org.OData.Core.V1.Computed" /* Computed */,
term: "Org.OData.Core.V1.Computed" /* CoreAnnotationTerms.Computed */,
value: {

@@ -619,3 +619,3 @@ type: 'Bool',

annotations.push({
term: "com.sap.vocabularies.Common.v1.FieldControl" /* FieldControl */,
term: "com.sap.vocabularies.Common.v1.FieldControl" /* CommonAnnotationTerms.FieldControl */,
value: {

@@ -629,3 +629,3 @@ type: 'Path',

annotations.push({
term: "Org.OData.Capabilities.V1.FilterRestrictions" /* FilterRestrictions */,
term: "Org.OData.Capabilities.V1.FilterRestrictions" /* CapabilitiesAnnotationTerms.FilterRestrictions */,
record: {

@@ -660,3 +660,3 @@ propertyValues: [

annotations.push({
term: "Org.OData.Aggregation.V1.ApplySupported" /* ApplySupported */,
term: "Org.OData.Aggregation.V1.ApplySupported" /* AggregationAnnotationTerms.ApplySupported */,
record: {

@@ -663,0 +663,0 @@ propertyValues: [

{
"name": "@sap-ux/edmx-parser",
"version": "0.5.5",
"version": "0.5.6",
"description": "SAP Fiori OData - EDMX File parser",

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

"devDependencies": {
"@sap-ux/vocabularies-types": "0.5.6"
"@sap-ux/vocabularies-types": "0.6.0"
},

@@ -34,4 +34,3 @@ "scripts": {

"test-u": "jest --ci --forceExit --detectOpenHandles --colors -u"
},
"readme": "# @sap-ux/edmx-parser\n\nProvides a way to parse OData metadata document and annotations files into an object structure.\n\nThis structure can be used as is or can be then passed onto the `@sap-ux/annotation-converter` module that will provide an even more flexible and user friendly interface.\n\nThe parser also exposes a `merge` method to merge multiple metadata document together if required.\n\n\n## Installation\nnpm\n`npm install --save-dev @sap-ux/edmx-parser`\n\nyarn\n`yarn add @sap-ux/edmx-parser --dev`\n\npnpm\n`pnpm add @sap-ux/edmx-parser --dev`\n\n## Usage\n\nImport the `parse` or `merge` method from the module\n\n`import { parse, merge } from '@sap-ux/edmx-parser';`\n\nUse it on an edmx / annotation file\n\n```typescript\nconst myEdmxFile = await fs.readFile(...)\nconst myAnnotationFile = await fs.readFile(...)\nconst myParsedEdmx = parse(myEdmxFile);\nconst myParsedAnnotation = parse(myAnnotationFile);\n\nconst myMergedContent = merge(myParsedEdmx, myParsedAnnotation)\n```\n\n## Keywords\nMetadata Parser\n\n\n"
}
}

@@ -1077,5 +1077,2 @@ // eslint-disable-next-line @typescript-eslint/triple-slash-reference

function mergeSchemas(schemas: RawSchema[]): RawSchema {
if (schemas.length === 1) {
return schemas[0];
}
const associations = schemas.reduce((associationsToReduce: RawAssociation[], schema) => {

@@ -1146,4 +1143,15 @@ return associationsToReduce.concat(schema.associations);

const association = associations.find((assoc) => assoc.fullyQualifiedName === v2NavProp.relationship);
if (association && association.referentialConstraints) {
v2NavProp.referentialConstraint = association.referentialConstraints;
if (association && association.referentialConstraints && association.referentialConstraints.length > 0) {
if (association.referentialConstraints[0].sourceTypeName === entityType.fullyQualifiedName) {
v2NavProp.referentialConstraint = association.referentialConstraints;
} else {
v2NavProp.referentialConstraint = association.referentialConstraints.map((refConstraint) => {
return {
sourceTypeName: refConstraint.targetTypeName,
sourceProperty: refConstraint.targetProperty,
targetTypeName: refConstraint.sourceTypeName,
targetProperty: refConstraint.sourceProperty
};
});
}
}

@@ -1150,0 +1158,0 @@ });

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

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