btp-business-rules 0.1.2
Install from the command line:
Learn more about npm packages
$ npm install @cit-focus/btp-business-rules@0.1.2
Install via package.json:
"@cit-focus/btp-business-rules": "0.1.2"
About this version
Promise based node.js client library to support the usage of Business Rule Service within a CF destination-service or direct access
The Business Rule Service (BRS) is part of SAPs portfolio with utility services running on Business Technology Platform (BTP). It is based on some kind of BRF+ framework to support easy controlling and customizing with easy UI5 configurable tables. You can deploy business rules to S/4 HANA or on BTP and use the REST API published by the service. This node.js module is enabling you to easy use the REST API and make calls to it with your request vocabulary and rule-service-ID.
- Use destination service to access BRS
- Use username (clientId) and userpassword (clientSecret) to access BRS
- Execute BRS-Calls and retrieve the result
$ npm i @cit-focus/btp-business-rules
Here is a very simple example on how to import and create your first Business Rules Service client within a configured destination (bound to the container):
import { DestinationConfig, BusinessRuleService } from '@cit-focus/btp-business-rules';
const destinationConfig: DestinationConfig = {
name: 'myDestination123'
};
const ruleServiceId: string = 'd1ffc4403f634cf4b1a79f6e2718b123';
var vocabulary: any = [
{
"importingStructure": {
"bo": "engagement",
"boCompCode": "DE01",
"boKey": ""
}
}
];
const busRuleService = new BusinessRuleService({destinationConfig, ruleServiceId});
const result = await busRuleService.executeRuleService(vocabulary);
Example on how to execute BRS requests via BusinessRuleService client using an existing destination on your destination-service.
You need to maintain the name of the destination, and optional an additional path. The full-path is concatenated following this logic: <url_from_destination>/workingset-rule-services .
const configDest: DestinationConfig = {
name: 'myDestination123',
path: 'myAdditionalPath'
};
Sometimes it's easier or necessary to get rid of a destination. This is the way to do it without a configured destination:
import { DirectConfig, BusinessRuleService } from '@cit-focus/btp-business-rules';
const directConfig: DirectConfig = {
runtimeUrl: 'https://bpmruleruntime.cfapps.eu10.hana.ondemand.com',
auth: {
oAuthTokenUrl: 'https://<yourInstance>.authentication.eu10.hana.ondemand.com',
username: 'sb-clone-123456789abcdefgh|bpmrulebroker!b23456',
password: '350c19e-my-client-secretQy0V7Hnoiaeo='
}
};
const ruleServiceId: string = 'd1ffc4403f634cf4b1a79f6e2718b123';
var vocabulary: any = [
{
"importingStructure": {
"bo": "engagement",
"boCompCode": "DE01",
"boKey": ""
}
}
];
const busRuleService = new BusinessRuleService({directConfig, ruleServiceId});
const result = await busRuleService.executeRuleService(vocabulary);
Continious Learning is more required then ever for all around the BTP. This library is filling a gap of SAPs pre-provided libraries portfolio and is based on Alert Notification Service Client by SAP. Beside the missing gap we identified and we had to fill for projects, we wanted to deep-dive into node.js, typescript and SAP's great mission around the BTP and BTP-Services. It was fun setting it up and improve it every time we had to reuse it. Now it's time to share and give-back to this great SAP Community!
Please, let us know by filing a new Issue on github or start contributing. We really appreciate any suggestions or updates.
This project is run under the licensing terms of Apache License 2.0.
Details
- btp-business-rules
- CIT-FOCUS
- almost 3 years ago
- Apache-2.0
- 13 dependencies
Assets
- btp-business-rules-0.1.2-npm.tgz
Download activity
- Total downloads 0
- Last 30 days 0
- Last week 0
- Today 0