ADempiere POS Client for gRPC
ADempiere POS Client write in Javascript for gRPC service, use it for connect with ADempiere-gRPC-Server.
Requirements
Using it
# installing via NPM
npm i @adempiere/grpc-pos-client
# installing via Yarn
yarn add @adempiere/grpc-pos-client
A Example
Declare POS
const POS = require('@adempiere/grpc-data-client');
let data = new POS(GRPC_HOST, 'Session UUID');
Declare POS with specific language
const POS = require('@adempiere/grpc-data-client');
let data = new POS(GRPC_HOST, 'Session UUID', 'es_VE');
Request a simple Object based on Table and UUID
// Request a single Object
data.getEntity('AD_Element', '8cc49692-fb40-11e8-a479-7a0060f0aa01')
.then(valueObject => {
console.log("Object with single UUID");
// Value
let map = valueObject.getValuesMap();
console.log("ColumnName: " + map.get("ColumnName").getStringvalue());
console.log("Name: " + map.get("Name").getStringvalue());
console.log("Display Type: " + map.get("AD_Reference_ID").getIntvalue());
console.log("Value Type: " + map.get("AD_Reference_ID").getValuetype());
})
.catch(err => console.log("Error: " + err.message));
Output
Object with single UUID
ColumnName: HR_JobOpening_ID
Name: Job Openings
Display Type: 13
Value Type: 0
Recreate proto stub class (only for contribute to project)
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/businessdata.proto \
--js_out=import_style=commonjs:src/grpc \
--grpc-web_out=import_style=commonjs,mode=grpcwebtext:src/grpc
And run it for POS
protoc proto/point_of_sales.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