@adempiere/grpc-api
Advanced tools
Comparing version 1.2.0 to 1.2.1
251
index.js
@@ -42,3 +42,4 @@ /************************************************************************************* | ||
this.initWorkflowService() | ||
this.initWDashboardService() | ||
this.initDashboardService() | ||
this.initCoreService() | ||
} | ||
@@ -122,3 +123,3 @@ | ||
// Init connection | ||
initWDashboardService() { | ||
initDashboardService() { | ||
var grpc = require('grpc'); | ||
@@ -129,2 +130,9 @@ var services = require('./src/grpc/proto/business_grpc_pb'); | ||
// Init connection | ||
initCoreService() { | ||
var grpc = require('grpc'); | ||
var services = require('./src/grpc/proto/core_functionality_grpc_pb'); | ||
this.core = new services.CoreFunctionalityClient(this.businessHost, grpc.credentials.createInsecure()); | ||
} | ||
// Get Access Service | ||
@@ -150,2 +158,3 @@ getAccessService() { | ||
// Get Dashboard | ||
getDashboardService() { | ||
@@ -155,2 +164,7 @@ return this.dashboard | ||
// Get Core | ||
getCoreService() { | ||
return this.core | ||
} | ||
// Get Business Service | ||
@@ -1376,3 +1390,236 @@ getBusinessService() { | ||
} | ||
// Core Functionality | ||
// Get Country | ||
getCountry({ | ||
token, | ||
uuid, | ||
id, | ||
language | ||
}, callback) { | ||
const { GetCountryRequest } = require('./src/grpc/proto/core_functionality_pb.js') | ||
const request = new GetCountryRequest() | ||
request.setUuid(uuid) | ||
request.setId(id) | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getCoreService().getCountry(request, callback) | ||
} | ||
// List Organizations | ||
listOrganizations({ | ||
token, | ||
roleUuid, | ||
roleId, | ||
pageSize, | ||
pageToken, | ||
language | ||
}, callback) { | ||
const { ListOrganizationsRequest } = require('./src/grpc/proto/core_functionality_pb.js') | ||
const request = new ListOrganizationsRequest() | ||
request.setRoleUuid(roleUuid) | ||
request.setRoleId(roleId) | ||
request.setPageSize(pageSize) | ||
request.setPageToken(pageToken) | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getCoreService().listOrganizations(request, callback) | ||
} | ||
// List Warehouses | ||
listWarehouses({ | ||
token, | ||
organizationUuid, | ||
organizationId, | ||
pageSize, | ||
pageToken, | ||
language | ||
}, callback) { | ||
const { ListWarehousesRequest } = require('./src/grpc/proto/core_functionality_pb.js') | ||
const request = new ListWarehousesRequest() | ||
request.setOrganizationUuid(organizationUuid) | ||
request.setOrganizationId(organizationId) | ||
request.setPageSize(pageSize) | ||
request.setPageToken(pageToken) | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getCoreService().listWarehouses(request, callback) | ||
} | ||
// List Languages | ||
listLanguages({ | ||
token, | ||
pageSize, | ||
pageToken, | ||
language | ||
}, callback) { | ||
const { ListLanguagesRequest } = require('./src/grpc/proto/core_functionality_pb.js') | ||
const request = new ListLanguagesRequest() | ||
request.setPageSize(pageSize) | ||
request.setPageToken(pageToken) | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getCoreService().listLanguages(request, callback) | ||
} | ||
// Get Business Partner | ||
getBusinessPartner({ | ||
token, | ||
searchValue, | ||
value, | ||
name, | ||
contactName, | ||
email, | ||
postalCode, | ||
phone, | ||
tableName, | ||
// DSL | ||
filters, | ||
// Custom Query | ||
query, | ||
whereClause, | ||
orderByClause, | ||
limit, | ||
language | ||
}, callback) { | ||
const { GetBusinessPartnerRequest } = require('./src/grpc/proto/core_functionality_pb.js') | ||
const request = new GetBusinessPartnerRequest() | ||
const { convertCriteriaToGRPC } = require('./lib/convertValues.js'); | ||
// TODO: Add support to all parameters | ||
request.setCriteria(convertCriteriaToGRPC({ | ||
tableName, | ||
filters, | ||
query, | ||
whereClause, | ||
orderByClause, | ||
limit | ||
})) | ||
request.setSearchValue(searchValue) | ||
request.setValue(value) | ||
request.setName(name) | ||
request.setContactName(contactName) | ||
request.setEmail(email) | ||
request.setPostalCode(postalCode) | ||
request.setPhone(phone) | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getCoreService().getBusinessPartner(request, callback) | ||
} | ||
// Create Business Partner | ||
createBusinessPartner({ | ||
token, | ||
value, | ||
taxId, | ||
duns, | ||
naics, | ||
name, | ||
lastName, | ||
description, | ||
contactName, | ||
email, | ||
phone, | ||
businessPartnerGroupUuid, | ||
address1, | ||
address2, | ||
address3, | ||
address4, | ||
cityUuid, | ||
cityName, | ||
postalCode, | ||
regionUuid, | ||
regionName, | ||
countryUuid, | ||
posUuid, | ||
language | ||
}, callback) { | ||
const { CreateBusinessPartnerRequest } = require('./src/grpc/proto/core_functionality_pb.js') | ||
const request = new CreateBusinessPartnerRequest() | ||
request.setValue(value) | ||
request.setTaxId(taxId) | ||
request.setDuns(duns) | ||
request.setNaics(naics) | ||
request.setName(name) | ||
request.setLastName(lastName) | ||
request.setDescription(description) | ||
request.setContactName(contactName) | ||
request.setEmail(email) | ||
request.setPhone(phone) | ||
request.setBusinessPartnerGroupUuid(businessPartnerGroupUuid) | ||
request.setAddress1(address1) | ||
request.setAddress2(address2) | ||
request.setAddress3(address3) | ||
request.setAddress4(address4) | ||
request.setCityUuid(cityUuid) | ||
request.setCityName(cityName) | ||
request.setPostalCode(postalCode) | ||
request.setRegionUuid(regionUuid) | ||
request.setRegionName(regionName) | ||
request.setCountryUuid(countryUuid) | ||
request.setPosUuid(posUuid) | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getCoreService().createBusinessPartner(request, callback) | ||
} | ||
// List Business Partner | ||
listBusinessPartners({ | ||
token, | ||
searchValue, | ||
value, | ||
name, | ||
contactName, | ||
email, | ||
postalCode, | ||
phone, | ||
tableName, | ||
// DSL | ||
filters, | ||
// Custom Query | ||
query, | ||
whereClause, | ||
orderByClause, | ||
limit, | ||
pageSize, | ||
pageToken, | ||
language | ||
}, callback) { | ||
const { ListBusinessPartnersRequest } = require('./src/grpc/proto/core_functionality_pb.js') | ||
const request = new ListBusinessPartnersRequest() | ||
const { convertCriteriaToGRPC } = require('./lib/convertValues.js'); | ||
// TODO: Add support to all parameters | ||
request.setCriteria(convertCriteriaToGRPC({ | ||
tableName, | ||
filters, | ||
query, | ||
whereClause, | ||
orderByClause, | ||
limit | ||
})) | ||
request.setSearchValue(searchValue) | ||
request.setValue(value) | ||
request.setName(name) | ||
request.setContactName(contactName) | ||
request.setEmail(email) | ||
request.setPostalCode(postalCode) | ||
request.setPhone(phone) | ||
request.setPageSize(pageSize) | ||
request.setPageToken(pageToken) | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getCoreService().listBusinessPartners(request, callback) | ||
} | ||
// Get Conversion Rate | ||
getConversionRate({ | ||
token, | ||
conversionTypeUuid, | ||
currencyFromUuid, | ||
currencyToUuid, | ||
conversionDate, | ||
language | ||
}, callback) { | ||
const { GetConversionRateRequest } = require('./src/grpc/proto/core_functionality_pb.js') | ||
const request = new GetConversionRateRequest() | ||
request.setConversionTypeUuid(conversionTypeUuid) | ||
request.setCurrencyFromUuid(currencyFromUuid) | ||
request.setCurrencyToUuid(currencyToUuid) | ||
request.setConversionDate(conversionDate) | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getCoreService().getConversionRate(request, callback) | ||
} | ||
} | ||
module.exports = Api; |
@@ -23,21 +23,21 @@ /************************************************************************************* | ||
uuid: countryToConvert.getUuid(), | ||
countryCode: countryToConvert.getCountryCode(), | ||
country_code: countryToConvert.getCountryCode(), | ||
name: countryToConvert.getName(), | ||
description: countryToConvert.getDescription(), | ||
hasRegion: countryToConvert.getHasRegion(), | ||
regionName: countryToConvert.getRegionName(), | ||
displaySequence: countryToConvert.getDisplaySequence(), | ||
isAddressLinesReverse: countryToConvert.getIsaddresslinesreverse(), | ||
captureSequence: countryToConvert.getCapturesequence(), | ||
displaySequenceLocal: countryToConvert.getDisplaySequencelocal(), | ||
isAddressLinesLocalReverse: countryToConvert.getIsaddresslineslocalreverse(), | ||
expressionPostal: countryToConvert.getExpressionpostal(), | ||
hasPostalAdd: countryToConvert.getHaspostaladd(), | ||
expressionPhone: countryToConvert.getExpressionphone(), | ||
mediaSize: countryToConvert.getMediasize(), | ||
expressionBankRoutingNo: countryToConvert.getExpressionbankroutingno(), | ||
expressionBankAccountNo: countryToConvert.getExpressionbankaccountno(), | ||
has_region: countryToConvert.getHasRegion(), | ||
region_name: countryToConvert.getRegionName(), | ||
display_sequence: countryToConvert.getDisplaySequence(), | ||
is_address_lines_reverse: countryToConvert.getIsAddressLinesReverse(), | ||
capture_sequence: countryToConvert.getCaptureSequence(), | ||
display_sequence_local: countryToConvert.getDisplaySequenceLocal(), | ||
is_address_lines_local_reverse: countryToConvert.getIsAddressLinesLocalReverse(), | ||
expression_postal: countryToConvert.getExpressionPostal(), | ||
has_postal_add: countryToConvert.getHasPostalAdd(), | ||
expression_phone: countryToConvert.getExpressionPhone(), | ||
media_size: countryToConvert.getMediaSize(), | ||
expression_bank_routing_no: countryToConvert.getExpressionBankRoutingNo(), | ||
expression_bank_account_no: countryToConvert.getExpressionBankAccountNo(), | ||
language: countryToConvert.getLanguage(), | ||
allowCitiesOutOfList: countryToConvert.getAllowcitiesoutoflist(), | ||
isPostcodeLookup: countryToConvert.getIspostcodelookup(), | ||
allow_cities_out_of_list: countryToConvert.getAllowCitiesOutOfList(), | ||
is_postcode_lookup: countryToConvert.getIsPostcodeLookup(), | ||
currency: convertCoreFunctionality.convertCurrencyFromGRPC( | ||
@@ -51,12 +51,12 @@ countryToConvert.getCurrency() | ||
convertCurrencyFromGRPC(currencyToConvert) { | ||
if(currencyToConvert) { | ||
convertCurrencyFromGRPC(currency) { | ||
if(currency) { | ||
return { | ||
currencyId: currencyToConvert.getId(), | ||
currencyUuid: currencyToConvert.getUuid(), | ||
iSOCode: currencyToConvert.getIsocode(), | ||
curSymbol: currencyToConvert.getCursymbol(), | ||
description: currencyToConvert.getDescription(), | ||
stdPrecision: currencyToConvert.getStdprecision(), | ||
costingPrecision: currencyToConvert.getCostingprecision() | ||
id: currency.getId(), | ||
uuid: currency.getUuid(), | ||
iso_code: currency.getIsoCode(), | ||
currency_symbol: currency.getCurSymbol(), | ||
description: currency.getDescription(), | ||
standard_precision: currency.getStandardPrecision(), | ||
costing_precision: currency.getCostingPrecision() | ||
}; | ||
@@ -67,15 +67,15 @@ } | ||
convertOrganizationFromGRPC(organizationToConvert) { | ||
if (organizationToConvert) { | ||
convertOrganizationFromGRPC(organization) { | ||
if (organization) { | ||
return { | ||
id: organizationToConvert.getId(), | ||
uuid: organizationToConvert.getUuid(), | ||
name: organizationToConvert.getName(), | ||
description: organizationToConvert.getDescription(), | ||
isReadOnly: organizationToConvert.getIsreadonly(), | ||
duns: organizationToConvert.getDuns(), | ||
taxId: organizationToConvert.getTaxid(), | ||
phone: organizationToConvert.getPhone(), | ||
phone2: organizationToConvert.getPhone2(), | ||
fax: organizationToConvert.getFax() | ||
id: organization.getId(), | ||
uuid: organization.getUuid(), | ||
name: organization.getName(), | ||
description: organization.getDescription(), | ||
is_read_only: organization.getIsReadOnly(), | ||
duns: organization.getDuns(), | ||
tax_id: organization.getTaxId(), | ||
phone: organization.getPhone(), | ||
phone2: organization.getPhone2(), | ||
fax: organization.getFax() | ||
}; | ||
@@ -133,7 +133,7 @@ } | ||
value: businessPartnerToConvert.getValue(), | ||
taxId: businessPartnerToConvert.getTaxid(), | ||
tax_id: businessPartnerToConvert.getTaxId(), | ||
duns: businessPartnerToConvert.getDuns(), | ||
naics: businessPartnerToConvert.getNaics(), | ||
name: businessPartnerToConvert.getName(), | ||
lastName: businessPartnerToConvert.getLastname(), | ||
last_name: businessPartnerToConvert.getLastName(), | ||
description: businessPartnerToConvert.getDescription() | ||
@@ -276,14 +276,14 @@ }; | ||
convertLanguageFromGRPC(languageToConvert) { | ||
if (languageToConvert) { | ||
convertLanguageFromGRPC(language) { | ||
if (language) { | ||
return { | ||
language: languageToConvert.getLanguage(), | ||
languageName: languageToConvert.getLanguagename(), | ||
languageISO: languageToConvert.getLanguageiso(), | ||
countryCode: languageToConvert.getCountryCode(), | ||
isBaseLanguage: languageToConvert.getIsbaselanguage(), | ||
isSystemLanguage: languageToConvert.getIssystemlanguage(), | ||
isDecimalPoint: languageToConvert.getIsdecimalpoint(), | ||
datePattern: languageToConvert.getDatepattern(), | ||
timePattern: languageToConvert.getTimepattern() | ||
language: language.getLanguage(), | ||
language_name: language.getLanguageName(), | ||
language_iso: language.getLanguageIso(), | ||
country_code: language.getCountryCode(), | ||
is_base_language: language.getIsBaseLanguage(), | ||
is_system_language: language.getIsSystemLanguage(), | ||
is_decimal_point: language.getIsDecimalPoint(), | ||
date_pattern: language.getDatePattern(), | ||
time_pattern: language.getTimePattern() | ||
}; | ||
@@ -349,23 +349,23 @@ } | ||
convertConversionRateFromGRPC(conversionRateToConvert) { | ||
if (conversionRateToConvert) { | ||
convertConversionRateFromGRPC(conversionRate) { | ||
if (conversionRate) { | ||
const { getDecimalFromGRPC } = require('./convertBaseDataType.js'); | ||
return { | ||
uuid: conversionRateToConvert.getUuid(), | ||
id: conversionRateToConvert.getId(), | ||
conversionTypeUuid: conversionRateToConvert.getConversiontypeuuid(), | ||
validFrom: conversionRateToConvert.getValidfrom(), | ||
validTo: conversionRateToConvert.getValidto(), | ||
currencyFrom: convertCoreFunctionality.convertCurrencyFromGRPC( | ||
conversionRateToConvert.getCurrencyfrom() | ||
uuid: conversionRate.getUuid(), | ||
id: conversionRate.getId(), | ||
conversion_type_uuid: conversionRate.getConversionTypeUuid(), | ||
valid_from: conversionRate.getValidFrom(), | ||
valid_to: conversionRate.getValidTo(), | ||
currency_from: convertCoreFunctionality.convertCurrencyFromGRPC( | ||
conversionRate.getCurrencyFrom() | ||
), | ||
currencyTo: convertCoreFunctionality.convertCurrencyFromGRPC( | ||
conversionRateToConvert.getCurrencyto() | ||
currency_to: convertCoreFunctionality.convertCurrencyFromGRPC( | ||
conversionRate.getCurrencyTo() | ||
), | ||
multiplyRate: getDecimalFromGRPC( | ||
conversionRateToConvert.getMultiplyrate() | ||
multiply_rate: getDecimalFromGRPC( | ||
conversionRate.getMultiplyRate() | ||
), | ||
divideRate: getDecimalFromGRPC( | ||
conversionRateToConvert.getDividerate() | ||
divide_rate: getDecimalFromGRPC( | ||
conversionRate.getDivideRate() | ||
) | ||
@@ -372,0 +372,0 @@ }; |
{ | ||
"name": "@adempiere/grpc-api", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "ADempiere Web Store write in Javascript for a node service", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -101,5 +101,5 @@ // GENERATED CODE -- DO NOT EDIT! | ||
function serialize_data_ListBusinessPartnerRequest(arg) { | ||
if (!(arg instanceof proto_core_functionality_pb.ListBusinessPartnerRequest)) { | ||
throw new Error('Expected argument of type data.ListBusinessPartnerRequest'); | ||
function serialize_data_ListBusinessPartnersRequest(arg) { | ||
if (!(arg instanceof proto_core_functionality_pb.ListBusinessPartnersRequest)) { | ||
throw new Error('Expected argument of type data.ListBusinessPartnersRequest'); | ||
} | ||
@@ -109,9 +109,9 @@ return Buffer.from(arg.serializeBinary()); | ||
function deserialize_data_ListBusinessPartnerRequest(buffer_arg) { | ||
return proto_core_functionality_pb.ListBusinessPartnerRequest.deserializeBinary(new Uint8Array(buffer_arg)); | ||
function deserialize_data_ListBusinessPartnersRequest(buffer_arg) { | ||
return proto_core_functionality_pb.ListBusinessPartnersRequest.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
function serialize_data_ListBusinessPartnerResponse(arg) { | ||
if (!(arg instanceof proto_core_functionality_pb.ListBusinessPartnerResponse)) { | ||
throw new Error('Expected argument of type data.ListBusinessPartnerResponse'); | ||
function serialize_data_ListBusinessPartnersResponse(arg) { | ||
if (!(arg instanceof proto_core_functionality_pb.ListBusinessPartnersResponse)) { | ||
throw new Error('Expected argument of type data.ListBusinessPartnersResponse'); | ||
} | ||
@@ -121,4 +121,4 @@ return Buffer.from(arg.serializeBinary()); | ||
function deserialize_data_ListBusinessPartnerResponse(buffer_arg) { | ||
return proto_core_functionality_pb.ListBusinessPartnerResponse.deserializeBinary(new Uint8Array(buffer_arg)); | ||
function deserialize_data_ListBusinessPartnersResponse(buffer_arg) { | ||
return proto_core_functionality_pb.ListBusinessPartnersResponse.deserializeBinary(new Uint8Array(buffer_arg)); | ||
} | ||
@@ -267,12 +267,12 @@ | ||
// List Business Partner | ||
listBusinessPartner: { | ||
path: '/data.CoreFunctionality/ListBusinessPartner', | ||
listBusinessPartners: { | ||
path: '/data.CoreFunctionality/ListBusinessPartners', | ||
requestStream: false, | ||
responseStream: false, | ||
requestType: proto_core_functionality_pb.ListBusinessPartnerRequest, | ||
responseType: proto_core_functionality_pb.ListBusinessPartnerResponse, | ||
requestSerialize: serialize_data_ListBusinessPartnerRequest, | ||
requestDeserialize: deserialize_data_ListBusinessPartnerRequest, | ||
responseSerialize: serialize_data_ListBusinessPartnerResponse, | ||
responseDeserialize: deserialize_data_ListBusinessPartnerResponse, | ||
requestType: proto_core_functionality_pb.ListBusinessPartnersRequest, | ||
responseType: proto_core_functionality_pb.ListBusinessPartnersResponse, | ||
requestSerialize: serialize_data_ListBusinessPartnersRequest, | ||
requestDeserialize: deserialize_data_ListBusinessPartnersRequest, | ||
responseSerialize: serialize_data_ListBusinessPartnersResponse, | ||
responseDeserialize: deserialize_data_ListBusinessPartnersResponse, | ||
}, | ||
@@ -279,0 +279,0 @@ // Get Currency Rate |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1819517
53292