ADempiere Access Client write in Javascript for gRPC service, use it for connect with ADempiere-gRPC-Server.
# installing via NPM
npm install @adempiere/grpc-access-client
# installing via Yarn
yarn add @adempiere/grpc-access-client
const Access = require('@adempiere/grpc-access-client');
// URL, Version
let access = new Access(GRPC_HOST, 'Version Epale');
const Access = require('@adempiere/grpc-access-client');
let access = new Access(GRPC_HOST, 'Version Epale');
// 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
Hola
// 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
None
// 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
None
For recreate stub class you must have follow:
- protobuf
- protoc
- Also you can see it: gRPC-web
- gRPC After installed it just go to source code folder an run it:
protoc proto/access.proto \
--js_out=import_style=commonjs:src/grpc \
--grpc-web_out=import_style=commonjs,mode=grpcwebtext:src/grpc
The result is generated on: src/grpc folder