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
7
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 0.9.7 to 0.9.8

doc/ACTIONS.md

4

CHANGELOG.md
# Changelog
# 0.9.8
* 3147731 - [FEATURE] Bound action implementation - Norbert Volf
# 0.9.7

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

@@ -35,2 +35,24 @@ "use strict";

/**
* Append "/" to the beginning of the path (could be
* use out of url handling also)
*
* @example
*
* absolutizePath("foo"); //=> "/foo"
* absolutizePath("/foo/bar"); //=> "/foo/bar"
* absolutizePath("//foo/bar"); //=> "/foo/bar"
*
* @param {String} path content
*
* @return {String} absolutized path
*/
function absolutizePath(path) {
var retval = path;
if (_.isString(path)) {
retval = "/" + path.replace(/^\/*/, "");
}
return retval;
}
module.exports = {

@@ -73,2 +95,3 @@ base(inputUrl) {

appendSearch: appendSearch,
absolutizePath: absolutizePath,
};

@@ -93,4 +93,30 @@ "use strict";

}
/**
* Send request to bound ODataV4 action
*
* @public
* @param {engine.RequestDefinition} request odata definition
* @return {Promise} promise resolved when call is finished
* @memberof engine.EntitySet
*/
callAction(request) {
let defaultBatch = this.agent.batchManager.defaultBatch;
let defaultChangeSet = this.agent.batchManager.defaultChangeSet;
return defaultBatch
? this._handleBatchCall(() => {
request.header("Accept", "application/json");
return defaultBatch.post(
request._path,
request._headers,
defaultChangeSet
);
}, defaultBatch)
: this._handleAgentCall(() =>
this.agent.post(request._path, request._headers, undefined, false)
);
}
}
module.exports = EntitySet;
"use strict";
const _ = require("lodash");
const urlUtils = require("../agent/url");
const Filter = require("./entitySet/Filter");

@@ -226,2 +227,4 @@ const Sorter = require("./entitySet/Sorter");

this.populateActions(this._resource.entitySetModel.actions);
return this;

@@ -525,4 +528,42 @@ }

}
/**
* Populate actions to the service object
*
* @param {model.oasis.schema.Action[]} actions array of action defintions
*
* @memberof RequestDefinition
*/
populateActions(actions) {
this.actions = {};
_.each(actions, (action) => {
let schemaAlias = _.get(
this._resource.metadata.model.getSchema(),
"alias"
);
let name = action.name;
let fullName = schemaAlias ? `${schemaAlias}.${name}` : name;
this.actions[name] = function () {
let urlQuery = this._resource.urlQuery({
$format: "json",
});
this._path = urlUtils.absolutizePath(
`${this._resource.getSingleResourcePath()}/${fullName}?${urlQuery}`
);
this._payload = {};
return this._resource.callAction(this);
}.bind(this);
if (!this[name]) {
this[name] = this.actions[name];
} else {
this._resource.agent.logger.warn(
`Actions ${name} is not accessible as shorthand.`
);
}
});
}
}
module.exports = RequestDefinition;
"use strict";
const _ = require("lodash");
const AnnotationTarget = require("../annotations/AnnotationTarget");

@@ -25,2 +26,10 @@ const NavigationPropertyBinding = require("../schema/NavigationPropertyBinding");

let entityType = schema.resolveModelPath(rawMetadata.$.EntityType);
let navigationPropertyBindings = (
rawMetadata.NavigationPropertyBinding || []
).map((npb) => new NavigationPropertyBinding(npb));
let actions = _.filter(
schema.actions,
(action) => action.entityTypePath === rawMetadata.$.EntityType
);
Object.defineProperty(this, "entityType", {

@@ -34,8 +43,9 @@ get: () => entityType,

let navigationPropertyBindings = (
rawMetadata.NavigationPropertyBinding || []
).map((npb) => new NavigationPropertyBinding(npb));
Object.defineProperty(this, "navigationPropertyBindings", {
get: () => navigationPropertyBindings,
});
Object.defineProperty(this, "actions", {
get: () => actions,
});
}

@@ -42,0 +52,0 @@

@@ -46,2 +46,12 @@ "use strict";

Object.defineProperty(this, "entityTypePath", {
get: () => {
let parameterWithType = _.filter(
rawMetadata.Parameter,
(parameter) => parameter.$.Name === rawMetadata.$.EntitySetPath
);
return _.get(parameterWithType, "0.$.Type");
},
});
this._checkConsistency();

@@ -48,0 +58,0 @@ }

2

package.json
{
"name": "@sap_oss/odata-library",
"version": "0.9.7",
"version": "0.9.8",
"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