@adempiere/grpc-pos-client

ADempiere POS Client write in Javascript for gRPC service


Keywords
compiere, adempiere, erp, grpc, grpc-web, pos, java, web, data
License
CNRI-Python-GPL-Compatible
Install
npm install @adempiere/grpc-pos-client@1.3.3

Documentation

ADempiere POS Client for gRPC

npm version License Downloads

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:

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