Package Exports
- @adempiere/grpc-api
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@adempiere/grpc-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ADempiere Web Store backend API for gRPC
ADempiere Web Store Client write in Javascript for gRPC service, use it for connect with ADempiere-gRPC-Server.
Requirements
Using it
# installing via NPM
npm install @adempiere/grpc-api --save# installing via Yarn
yarn add @adempiere/grpc-apiA Example
Declare Data
const Access = require('@adempiere/grpc-api');
// URL, Version
let access = new Access(GRPC_HOST, 'Version Epale');Declare Data with specific language
const Access = require('@adempiere/grpc-api');
let access = new Access(GRPC_HOST, 'Version Epale');Request Roles for a user
// Request User Roles
// UserName, UserPass
access.requestUserRoles('SuperUser', 'System')
.then(userRoles => {
console.log('Object with Role List' + userRoles);
})
.catch(err => console.log("Error: " + err.message));Output
HolaRequest Login
// Request Login for User
// UserName, UserPass, Language
access.requestUserLogin('SuperUser', 'System', 'es_VE')
.then(session => {
console.log('Object with Session values' + session);
})
.catch(err => console.log("Error: " + err.message));Output
NoneRequest Logout
// Request Logout for User
// SessionUuid
access.requestUserLogout('8cc49692-fb40-11e8-a479-7a0060f0aa01')
.then(session => {
console.log('Object with Logout Session' + session);
})
.catch(err => console.log("Error: " + err.message));Output
NoneRecreate proto stub class (only for contribute to project)
For recreate stub class you must have follow:
Note: You can also install protoc and protoc-gen-grpc-web by going to the repository directory and run the command:
sh install-protoc.shWhen installation is complete, check the version with
protoc --versionAfter installed it just go to source code folder an run it:
Run Access gRPC
cd ../../protos
yarn global add grpc-tools
grpc_tools_node_protoc --js_out=import_style=commonjs,binary:src/grpc --grpc_out=src/grpc --plugin=protoc-gen-grpc=`which grpc_tools_node_protoc_plugin` proto/access.proto proto/client.proto proto/base_data_type.proto proto/core_functionality.protoOr run:
sh generate-stub.shThe result is generated on: src/grpc folder
access_grpc_web_pb.jsaccess_pb.js