Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adempiere/grpc-api

Package Overview
Dependencies
Maintainers
4
Versions
405
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adempiere/grpc-api - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

proto/enrollment.proto

406

index.js

@@ -37,2 +37,3 @@ /*************************************************************************************

this.initAccessService()
this.initEnrollmentService()
this.initUIService()

@@ -88,2 +89,9 @@ this.initBusinessService()

// Init Enrollment
initEnrollmentService() {
var grpc = require('grpc');
var services = require('./src/grpc/proto/enrollment_grpc_pb');
this.enrollment = new services.RegisterClient(this.accessHost, grpc.credentials.createInsecure());
}
// Init connection

@@ -150,2 +158,7 @@ initDictionaryService() {

// Get Enrollment Service
getEnrollmentService() {
return this.enrollment
}
// Get UI Service

@@ -1621,3 +1634,396 @@ getUIService() {

}
// Get Point of Sales
getPointOfSales({
token,
pointOfSalesUuid,
language
}, callback) {
const { PointOfSalesRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new PointOfSalesRequest()
request.setPointOfSalesUuid(pointOfSalesUuid)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().getPointOfSales(request, callback)
}
// Get Point of Sales
getPointOfSales({
token,
posUuid,
language
}, callback) {
const { PointOfSalesRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new PointOfSalesRequest()
request.setPosUuid(posUuid)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().getPointOfSales(request, callback)
}
// Get Product Price
getProductPrice({
token,
searchValue,
upc,
value,
name,
priceListUuid,
businessPartnerUuid,
warehouseUuid,
validFrom,
language
}, callback) {
const { GetProductPriceRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new GetProductPriceRequest()
request.setSearchValue(searchValue)
request.setUpc(upc)
request.setValue(value)
request.setName(name)
request.setPriceListUuid(priceListUuid)
request.setBusinessPartnerUuid(businessPartnerUuid)
request.setWarehouseUuid(warehouseUuid)
request.setValidFrom(validFrom)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().getProductPrice(request, callback)
}
// List Product Price
listProductPrice({
token,
searchValue,
priceListUuid,
businessPartnerUuid,
warehouseUuid,
validFrom,
tableName,
// DSL
filters,
// Custom Query
query,
whereClause,
orderByClause,
limit,
pageSize,
pageToken,
language
}, callback) {
const { ListProductPriceRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new ListProductPriceRequest()
request.setSearchValue(searchValue)
request.setPriceListUuid(priceListUuid)
request.setBusinessPartnerUuid(businessPartnerUuid)
request.setWarehouseUuid(warehouseUuid)
request.setValidFrom(validFrom)
//
const { convertCriteriaToGRPC } = require('./lib/convertValues.js');
// TODO: Add support to all parameters
request.setCriteria(convertCriteriaToGRPC({
tableName,
filters,
query,
whereClause,
orderByClause,
limit
}))
request.setPageSize(pageSize)
request.setPageToken(pageToken)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().listProductPrice(request, callback)
}
// Create Sales Order
createOrder({
token,
posUuid,
customerUuid,
documentTypeUuid,
salesRepresentativeUuid,
language
}, callback) {
const { CreateOrderRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new CreateOrderRequest()
request.setPosUuid(posUuid)
request.setCustomerUuid(customerUuid)
request.setDocumentTypeUuid(documentTypeUuid)
request.setSalesRepresentativeUuid(salesRepresentativeUuid)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().createOrder(request, callback)
}
// Delete Sales Order
deleteOrder({
token,
orderUuid,
language
}, callback) {
const { DeleteOrderRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new DeleteOrderRequest()
request.setOrderUuid(orderUuid)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().deleteOrder(request, callback)
}
// Create Sales Order Line
createOrderLine({
token,
orderUuid,
productUuid,
chargeUuid,
description,
quantity,
price,
discountRate,
warehouseUuid,
language
}, callback) {
const { CreateOrderLineRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new CreateOrderLineRequest()
const { getDecimalFromNumber } = require('./lib/convertValues.js')
request.setOrderUuid(orderUuid)
request.setProductUuid(productUuid)
request.setChargeUuid(chargeUuid)
request.setDescription(description)
if(quantity) {
request.setQuantity(getDecimalFromNumber(quantity))
}
if(price) {
request.setPrice(getDecimalFromNumber(price))
}
if(discountRate) {
request.setDiscountRate(getDecimalFromNumber(discountRate))
}
request.setWarehouseUuid(warehouseUuid)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().createOrderLine(request, callback)
}
// Delete Sales Order Line
deleteOrderLine({
token,
orderLineUuid,
language
}, callback) {
const { DeleteOrderLineRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new DeleteOrderLineRequest()
request.setOrderLineUuid(orderLineUuid)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().deleteOrderLine(request, callback)
}
// Update Sales Order
updateOrder({
token,
orderUuid,
posUuid,
customerUuid,
documentTypeUuid,
salesRepresentativeUuid,
description,
language
}, callback) {
const { UpdateOrderRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new UpdateOrderRequest()
request.setOrderUuid(orderUuid)
request.setPosUuid(posUuid)
request.setCustomerUuid(customerUuid)
request.setDocumentTypeUuid(documentTypeUuid)
request.setDescription(description)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().updateOrder(request, callback)
}
// Update Sales Order Line
updateOrderLine({
token,
orderLineUuid,
description,
quantity,
price,
discountRate,
isAddQuantity,
language
}, callback) {
const { UpdateOrderLineRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new UpdateOrderLineRequest()
const { getDecimalFromNumber } = require('./lib/convertValues.js')
request.setOrderLineUuid(orderLineUuid)
request.setDescription(description)
if(quantity) {
request.setQuantity(getDecimalFromNumber(quantity))
}
if(price) {
request.setPrice(getDecimalFromNumber(price))
}
if(discountRate) {
request.setDiscountRate(getDecimalFromNumber(discountRate))
}
request.setIsAddQuantity(isAddQuantity)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().updateOrderLine(request, callback)
}
// Get Sales Order
getOrder({
token,
orderUuid,
language
}, callback) {
const { GetOrderRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new GetOrderRequest()
request.setOrderUuid(orderUuid)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().getOrder(request, callback)
}
// List Orders
listOrders({
token,
posUuid,
documentNo,
businessPartnerUuid,
grandTotal,
openAmount,
isPaid,
isProcessed,
isAisleSeller,
isInvoiced,
dateOrderedFrom,
dateOrderedTo,
salesRepresentativeUuid,
tableName,
// DSL
filters,
// Custom Query
query,
whereClause,
orderByClause,
limit,
pageSize,
pageToken,
language
}, callback) {
const { ListOrdersRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new ListOrdersRequest()
const { convertCriteriaToGRPC } = require('./lib/convertValues.js')
const { getDecimalFromNumber } = require('./lib/convertValues.js')
request.setCriteria(convertCriteriaToGRPC({
tableName,
filters,
query,
whereClause,
orderByClause,
limit
}))
request.setPosUuid(posUuid)
request.setDocumentNo(documentNo)
request.setBusinessPartnerUuid(businessPartnerUuid)
if(grandTotal) {
request.setGrandTotal(getDecimalFromNumber(grandTotal))
}
if(openAmount) {
request.setOpenAmount(getDecimalFromNumber(openAmount))
}
request.setIsPaid(isPaid)
request.setIsProcessed(isProcessed)
request.setIsAisleSeller(isAisleSeller)
request.setIsInvoiced(isInvoiced)
request.setDateOrderedFrom(dateOrderedFrom)
request.setDateOrderedTo(dateOrderedTo)
request.setSalesRepresentativeUuid(salesRepresentativeUuid)
request.setPageSize(pageSize)
request.setPageToken(pageToken)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().listOrders(request, callback)
}
// List Sales Order Lines
listOrderLines({
token,
orderUuid,
pageSize,
pageToken,
language
}, callback) {
const { ListOrderLinesRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new ListOrderLinesRequest()
request.setOrderUuid(orderUuid)
request.setPageSize(pageSize)
request.setPageToken(pageToken)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().listOrderLines(request, callback)
}
// Get Sales Order
getKeyLayout({
token,
keyLayoutUuid,
language
}, callback) {
const { GetKeyLayoutRequest } = require('./src/grpc/proto/point_of_sales_pb.js')
const request = new GetKeyLayoutRequest()
request.setKeyLayoutUuid(keyLayoutUuid)
request.setClientRequest(this.createClientRequest(token, language))
this.getPosService().getKeyLayout(request, callback)
}
// Enrollment service
// Enroll User
enrollUser({
userName,
name,
email,
clientVersion,
applicationType,
password
}, callback) {
const { EnrollUserRequest } = require('./src/grpc/proto/enrollment_pb.js')
const request = new EnrollUserRequest()
request.setUserName(userName)
request.setName(name)
request.setEmail(email)
request.setClientVersion(clientVersion)
request.setApplicationType(applicationType)
request.setPassword(password)
this.getEnrollmentService().enrollUser(request, callback)
}
// Reset Password
resetPassword({
userName,
email,
clientVersion
}, callback) {
const { ResetPasswordRequest } = require('./src/grpc/proto/enrollment_pb.js')
const request = new ResetPasswordRequest()
request.setUserName(userName)
request.setEmail(email)
request.setClientVersion(clientVersion)
this.getEnrollmentService().resetPassword(request, callback)
}
// Reset Password from Token
resetPasswordFromToken({
token,
password,
clientVersion
}, callback) {
const { ResetPasswordTokenRequest } = require('./src/grpc/proto/enrollment_pb.js')
const request = new ResetPasswordTokenRequest()
request.setToken(token)
request.setPassword(password)
request.setClientVersion(clientVersion)
this.getEnrollmentService().resetPasswordFromToken(request, callback)
}
// Activate User
activateUser({
token,
clientVersion
}, callback) {
const { ActivateUserRequest } = require('./src/grpc/proto/enrollment_pb.js')
const request = new ActivateUserRequest()
request.setToken(token)
request.setClientVersion(clientVersion)
this.getEnrollmentService().activateUser(request, callback)
}
}
module.exports = Api;

52

lib/convertCoreFunctionality.js

@@ -104,4 +104,4 @@ /*************************************************************************************

description: unitOfMeasureToConvert.getDescription(),
stdPrecision: unitOfMeasureToConvert.getStdprecision(),
costingPrecision: unitOfMeasureToConvert.getCostingprecision()
starndard_precision: unitOfMeasureToConvert.getStandardprecision(),
costing_precision: unitOfMeasureToConvert.getCostingPrecision()
};

@@ -148,3 +148,3 @@ }

name: documentTypeToConvert.getName(),
printName: documentTypeToConvert.getPrintName(),
print_name: documentTypeToConvert.getPrintName(),
description: documentTypeToConvert.getDescription()

@@ -217,13 +217,13 @@ };

convertTaxRateFromGRPC(taxRateToConvert) {
convertTaxRateFromGRPC(taxRate) {
// Tax rate
if (taxRateToConvert) {
if (taxRate) {
const { getDecimalFromGRPC } = require('./convertBaseDataType.js');
return {
name: taxRateToConvert.getName(),
description: taxRateToConvert.getDescription(),
tax_indicator: taxRateToConvert.getTaxindicator(),
name: taxRate.getName(),
description: taxRate.getDescription(),
tax_indicator: taxRate.getTaxIndicator(),
rate: getDecimalFromGRPC(
taxRateToConvert.getRate()
taxRate.getRate()
)

@@ -235,4 +235,4 @@ };

convertProductPriceFromGRPC(productPriceToConvert) {
if (productPriceToConvert) {
convertProductPriceFromGRPC(productPrice) {
if (productPrice) {
const { getDecimalFromGRPC } = require('./convertBaseDataType.js');

@@ -242,30 +242,30 @@

currency: convertCoreFunctionality.convertCurrencyFromGRPC(
productPriceToConvert.getCurrency()
productPrice.getCurrency()
),
taxRate: convertCoreFunctionality.convertTaxRateFromGRPC(
productPriceToConvert.getTaxRate()
tax_rate: convertCoreFunctionality.convertTaxRateFromGRPC(
productPrice.getTaxRate()
),
product: convertCoreFunctionality.convertProductFromGRPC(
productPriceToConvert.getProduct()
productPrice.getProduct()
),
price_list: getDecimalFromGRPC(
productPriceToConvert.getPriceList()
productPrice.getPriceList()
),
price_standard: getDecimalFromGRPC(productPriceToConvert.getPriceStandard()),
price_limit: getDecimalFromGRPC(productPriceToConvert.getPriceLimit()),
price_list_name: productPriceToConvert.getPriceListName(),
is_tax_included: productPriceToConvert.getIsTaxIncluded(),
valid_from: productPriceToConvert.getValidFrom(),
price_precision: productPriceToConvert.getPricePrecision(),
price_standard: getDecimalFromGRPC(productPrice.getPriceStandard()),
price_limit: getDecimalFromGRPC(productPrice.getPriceLimit()),
price_list_name: productPrice.getPriceListName(),
is_tax_included: productPrice.getIsTaxIncluded(),
valid_from: productPrice.getValidFrom(),
price_precision: productPrice.getPricePrecision(),
quantity_on_hand: getDecimalFromGRPC(
productPriceToConvert.getQuantityOnHand()
productPrice.getQuantityOnHand()
),
quantity_reserved: getDecimalFromGRPC(
productPriceToConvert.getQuantityReserved()
productPrice.getQuantityReserved()
),
quantity_ordered: getDecimalFromGRPC(
productPriceToConvert.getQuantityOrdered()
productPrice.getQuantityOrdered()
),
quantity_available: getDecimalFromGRPC(
productPriceToConvert.getQuantityAvailable()
productPrice.getQuantityAvailable()
)

@@ -272,0 +272,0 @@ };

@@ -75,3 +75,3 @@ /*************************************************************************************

uuid: orderLineToConvert.getUuid(),
orderUuid: orderLineToConvert.getOrderuuid(),
order_uuid: orderLineToConvert.getOrderUuid(),
line: orderLineToConvert.getLine(),

@@ -85,3 +85,3 @@ product: convertProductFromGRPC(

description: orderLineToConvert.getDescription(),
lineDescription: orderLineToConvert.getLinedescription(),
line_description: orderLineToConvert.getLineDescription(),
quantity: getDecimalFromGRPC(

@@ -93,10 +93,10 @@ orderLineToConvert.getQuantity()

),
discountRate: getDecimalFromGRPC(
orderLineToConvert.getDiscountrate()
discount_rate: getDecimalFromGRPC(
orderLineToConvert.getDiscountRate()
),
lineNetAmount: getDecimalFromGRPC(
orderLineToConvert.getLinenetamount()
line_net_amount: getDecimalFromGRPC(
orderLineToConvert.getLineNetAmount()
),
taxRate: convertTaxRateFromGRPC(
orderLineToConvert.getTaxrate()
tax_rate: convertTaxRateFromGRPC(
orderLineToConvert.getTaxRate()
),

@@ -111,4 +111,4 @@ warehouse: convertWarehouseFromGRPC(

convertOrderFromGRPC(orderToConvert) {
if (orderToConvert) {
convertOrderFromGRPC(order) {
if (order) {
const {

@@ -125,23 +125,23 @@ convertDocumentStatusFromGRPC,

return {
uuid: orderToConvert.getUuid(),
id: orderToConvert.getId(),
documentNo: orderToConvert.getDocumentno(),
documentType: convertDocumentTypeFromGRPC(
orderToConvert.getDocumenttype(),
uuid: order.getUuid(),
id: order.getId(),
document_no: order.getDocumentNo(),
document_type: convertDocumentTypeFromGRPC(
order.getDocumentType(),
),
salesRepresentative: convertSalesRepresentativeFromGRPC(
orderToConvert.getSalesrepresentative()
sales_representative: convertSalesRepresentativeFromGRPC(
order.getSalesRepresentative()
),
documentStatus: convertDocumentStatusFromGRPC(
orderToConvert.getDocumentstatus()
document_status: convertDocumentStatusFromGRPC(
order.getDocumentStatus()
),
totalLines: getDecimalFromGRPC(
orderToConvert.getTotallines()
total_lines: getDecimalFromGRPC(
order.getTotalLines()
),
grandTotal: getDecimalFromGRPC(
orderToConvert.getGrandtotal()
grand_total: getDecimalFromGRPC(
order.getGrandTotal()
),
dateOrdered: new Date(orderToConvert.getDateordered()),
businessPartner: convertBusinessPartnerFromGRPC(
orderToConvert.getBusinesspartner()
date_ordered: new Date(order.getDateOrdered()),
business_partner: convertBusinessPartnerFromGRPC(
order.getBusinessPartner()
)

@@ -153,4 +153,4 @@ };

convertKeyFromGRPC(keyToConvert) {
if (keyToConvert) {
convertKeyFromGRPC(key) {
if (key) {
const {

@@ -162,17 +162,17 @@ getDecimalFromGRPC,

return {
uuid: keyToConvert.getUuid(),
id: keyToConvert.getId(),
name: keyToConvert.getName(),
description: keyToConvert.getDescription(),
subKeyLayoutUuid: keyToConvert.getSubkeylayoutuuid(),
color: keyToConvert.getColor(),
sequence: keyToConvert.getSequence(),
spanX: keyToConvert.getSpanx(),
spanY: keyToConvert.getSpany(),
productUuid: keyToConvert.getProductuuid(),
uuid: key.getUuid(),
id: key.getId(),
name: key.getName(),
description: key.getDescription(),
sub_key_layout_uuid: key.getSubKeyLayoutUuid(),
color: key.getColor(),
sequence: key.getSequence(),
span_x: key.getSpanX(),
span_y: key.getSpanY(),
product_uuid: key.getProductUuid(),
quantity: getDecimalFromGRPC(
keyToConvert.getQuantity()
key.getQuantity()
),
resourceReference: convertResourceReferenceFromGRPC(
keyToConvert.getResourcereference()
resource_reference: convertResourceReferenceFromGRPC(
key.getResourceReference()
)

@@ -184,14 +184,14 @@ };

convertKeyLayoutFromGRPC(keyLayoutToConvert) {
if (keyLayoutToConvert) {
convertKeyLayoutFromGRPC(keyLayout) {
if (keyLayout) {
return {
uuid: keyLayoutToConvert.getUuid(),
id: keyLayoutToConvert.getId(),
name: keyLayoutToConvert.getName(),
description: keyLayoutToConvert.getDescription(),
help: keyLayoutToConvert.getHelp(),
layoutType: keyLayoutToConvert.getLayouttype(),
columns: keyLayoutToConvert.getColumns(),
color: keyLayoutToConvert.getColor(),
keysList: keyLayoutToConvert.getKeysList()
uuid: keyLayout.getUuid(),
id: keyLayout.getId(),
name: keyLayout.getName(),
description: keyLayout.getDescription(),
help: keyLayout.getHelp(),
layout_type: keyLayout.getLayoutType(),
columns: keyLayout.getColumns(),
color: keyLayout.getColor(),
keys: keyLayout.getKeysList()
.map(itemKey => {

@@ -198,0 +198,0 @@ return convertUtils.convertKeyFromGRPC(itemKey)

@@ -305,3 +305,2 @@ /*************************************************************************************

const convertedValue = new Value();
convertedValue.setValueType(ValueType.DECIMAL);

@@ -329,3 +328,2 @@ convertedValue.setDecimalValue(

convertedDecimalValue.setDecimalValue(numberValue.toString());
// Set scale

@@ -332,0 +330,0 @@ let scale = numberValue.toString().indexOf('.');

{
"name": "@adempiere/grpc-api",
"version": "1.2.2",
"version": "1.2.3",
"description": "ADempiere Web Store write in Javascript for a node service",

@@ -16,5 +16,5 @@ "main": "index.js",

"bugs": {
"url": "https://github.com/adempiere/gRPC-API/issues"
"url": "https://github.com/erpcya/gRPC-API/issues"
},
"homepage": "https://github.com/adempiere/gRPC-API#readme",
"homepage": "https://github.com/erpcya/gRPC-API#readme",
"dependencies": {

@@ -21,0 +21,0 @@ "google-protobuf": "^3.12.4",

@@ -32,4 +32,2 @@ # ADempiere Web backend API for gRPC

- workflow
- store
- pos
database:

@@ -77,3 +75,11 @@ host: localhost

Note: You can also install `protoc` and `protoc-gen-grpc-web` by going to the repository directory and run the command:
```Shell
sh install-protoc.sh
```
When installation is complete, check the version with
```Shell
protoc --version
```
After installed it just go to source code folder an run it:

@@ -85,5 +91,10 @@

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.proto proto/dictionary.proto proto/business.proto proto/point_of_sales.proto
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.proto proto/dictionary.proto proto/business.proto proto/point_of_sales.proto proto/enrollment.proto
```
Or run:
```Shell
sh generate-stub.sh
```
The result is generated on: src/grpc folder

@@ -93,13 +104,11 @@ - `access_grpc_web_pb.js`

- `client_pb.js`
- `client_grpc_pb.js`
- `client_grpc_web_pb.js`
- `base_data_type_pb.js`
- `base_data_type_grpc_pb.js`
- `base_data_type_grpc_web_pb.js`
- `core_functionality_pb.js`
- `core_functionality_grpc_pb.js`
- `core_functionality_grpc_web_pb.js`
- `dictionary_pb.js`
- `dictionary_grpc_pb.js`
- `dictionary_grpc_web_pb.js`
- `business_pb.js`
- `business_grpc_pb.js`
- `point_of_sales_pb.js`
- `point_of_sales_grpc_pb.js`
- `business_grpc_web_pb.js`

@@ -106,0 +115,0 @@ ## Sponsors

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc