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

@sap_oss/odata-library

Package Overview
Dependencies
Maintainers
19
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap_oss/odata-library - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

4

CHANGELOG.md
# Changelog
# 1.0.4
- [FEATURE] Send navigation properties for v4 - Norbert Volf
# 1.0.3

@@ -4,0 +8,0 @@

32

lib/engine/QueryableResource.js

@@ -487,4 +487,3 @@ "use strict";

navigationProperty,
entityTypeProperties,
entityTypeModel
entityTypeProperties
)

@@ -500,12 +499,16 @@ )

processNavigationPropertyItems(
navigationProperty,
entityTypeProperties,
entityTypeModelStart
) {
let assoociationEnd = entityTypeModelStart.navigationPropertyAssociationTo(
navigationProperty.name
);
let entityTypeModelEnd = _.get(assoociationEnd, "type");
let navigationPropertyItems = entityTypeProperties[navigationProperty.name];
/**
* Go thru navigation propert items for active operations
* (post, merge, put)
*
* @param {NavigationProperty} navigationProperty object which represents
* navigation property definition for v2 or v4
* @param {Object} entityTypeProperties data for navigation properties
*
* @returns {Object} checked navigation properties items
*/
processNavigationPropertyItems(navigationProperty, entityTypeProperties) {
const entityTypeModelEnd = _.get(navigationProperty, "type.elementType");
const navigationPropertyItems =
entityTypeProperties[navigationProperty.name];
let navigationPropertyItemsProcessed;

@@ -519,6 +522,3 @@

if (
assoociationEnd.multiplicity === "*" &&
_.isArray(navigationPropertyItems)
) {
if (navigationProperty.isCollection && _.isArray(navigationPropertyItems)) {
navigationPropertyItemsProcessed = _.map(

@@ -525,0 +525,0 @@ navigationPropertyItems,

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

let navigationProperties = _.get(this.raw, "NavigationProperty", []).map(
(p) => new NavigationProperty(p)
(p) => new NavigationProperty(p, model)
);

@@ -150,50 +150,4 @@ Object.defineProperty(this, "navigationProperties", {

}
/**
* Find association
*
* @param {String} navigationPropertyName name of the navigation property
*
* @returns {AssociationEnd} association endpoint to the navigation property entity type
*
* @memberof EntityType
*
* @private
*/
navigationPropertyAssociationTo(navigationPropertyName) {
let association;
let associationEnd;
let navigationPropertyDefinition = _.find(
this.navigationProperties,
(navigationProperty) => navigationProperty.name === navigationPropertyName
);
if (!navigationPropertyDefinition) {
throw new Error(
`Navigation property ${navigationPropertyName} does not exists in the ${this.name} EntityType.`
);
}
association = this.model.resolveModelPath(
navigationPropertyDefinition.relationship
);
if (!association) {
throw new Error(
`Association for navigation property ${navigationPropertyName} from EntityType ${this.name} does not exists.`
);
}
associationEnd = association.findEnd(navigationPropertyDefinition.toRole);
if (!associationEnd) {
throw new Error(
`Association endpoint for navigation property ${navigationPropertyName} from EntityType ${this.name} does not exists.`
);
}
return associationEnd;
}
}
module.exports = EntityType;

@@ -22,4 +22,5 @@ "use strict";

*/
constructor(rawMetadata) {
super(rawMetadata);
constructor(...args) {
const rawMetadata = args[0];
super(...args);

@@ -37,2 +38,42 @@ Object.defineProperty(this, "relationship", {

});
Object.defineProperty(this, "association", {
get: () => {
const association = this.model.resolveModelPath(this.relationship);
if (!association) {
throw new Error(
`Association for navigation property ${this.name} does not exists.`
);
}
return association;
},
});
Object.defineProperty(this, "associationEnd", {
get: () => {
const associationEnd = this.association.findEnd(this.toRole);
if (!associationEnd) {
throw new Error(
`Association endpoint for navigation property ${this.name} does not exists.`
);
}
return associationEnd;
},
});
Object.defineProperty(this, "type", {
get: () => {
return {
elementType: this.associationEnd.type,
};
},
});
Object.defineProperty(this, "isCollection", {
get: () => {
return this.associationEnd.multiplicity === "*";
},
});
}

@@ -39,0 +80,0 @@

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

new EdmSimpleType("DateTimeOffset", formatDateTime, formatDateTime),
new EdmSimpleType("Decimal"),
new EdmSimpleType("Decimal", _.toNumber, _.toNumber),
new EdmSimpleType("Double"),

@@ -142,0 +142,0 @@ new EdmSimpleType("Duration"),

{
"name": "@sap_oss/odata-library",
"version": "1.0.3",
"version": "1.0.4",
"description": "OData client for testing Netweawer OData services.",

@@ -5,0 +5,0 @@ "main": "index.js",

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