@adempiere/grpc-api
Advanced tools
Comparing version 1.1.3 to 1.1.4
188
index.js
@@ -284,34 +284,34 @@ /************************************************************************************* | ||
// Convert value from gRPC | ||
convertAccessValuesFromGRPC(value) { | ||
const { ContextValue } = require('./src/grpc/proto/access_pb.js') | ||
const { ValueType } = ContextValue | ||
// // Convert value from gRPC | ||
// convertAccessValuesFromGRPC(value) { | ||
// const { ContextValue } = require('./src/grpc/proto/access_pb.js') | ||
// const { ValueType } = ContextValue | ||
// | ||
// if (!value) { | ||
// return undefined | ||
// } | ||
// let returnValue | ||
// switch (value.getValueType()) { | ||
// case ValueType.INTEGER: | ||
// returnValue = value.getIntValue() | ||
// break | ||
// // data type Boolean | ||
// case ValueType.BOOLEAN: | ||
// returnValue = value.getBooleanValue() | ||
// break | ||
// // data type Boolean | ||
// case ValueType.DATE: | ||
// returnValue = new Date(value.getLongValue()) | ||
// break | ||
// // data type String | ||
// case ValueType.STRING: | ||
// returnValue = value.getStringValue() | ||
// break | ||
// case ValueType.UNKNOWN: | ||
// returnValue = undefined; | ||
// break | ||
// } | ||
// return returnValue | ||
// } | ||
if (!value) { | ||
return undefined | ||
} | ||
let returnValue | ||
switch (value.getValueType()) { | ||
case ValueType.INTEGER: | ||
returnValue = value.getIntValue() | ||
break | ||
// data type Boolean | ||
case ValueType.BOOLEAN: | ||
returnValue = value.getBooleanValue() | ||
break | ||
// data type Boolean | ||
case ValueType.DATE: | ||
returnValue = new Date(value.getLongValue()) | ||
break | ||
// data type String | ||
case ValueType.STRING: | ||
returnValue = value.getStringValue() | ||
break | ||
case ValueType.UNKNOWN: | ||
returnValue = undefined; | ||
break | ||
} | ||
return returnValue | ||
} | ||
// Dictionary | ||
@@ -930,3 +930,129 @@ // Get Window | ||
} | ||
// List Lookup Items | ||
listLookupItems({ | ||
token, | ||
tableName, | ||
// DSL | ||
filters, | ||
// Custom Query | ||
query, | ||
whereClause, | ||
orderByClause, | ||
limit, | ||
pageSize, | ||
pageToken, | ||
language | ||
}, callback) { | ||
const { ListLookupItemsRequest } = require('./src/grpc/proto/business_pb.js') | ||
const request = new ListLookupItemsRequest() | ||
const { convertCriteriaToGRPC } = require('./lib/convertValues.js'); | ||
request.setCriteria(convertCriteriaToGRPC({ | ||
tableName, | ||
filters, | ||
query, | ||
whereClause, | ||
orderByClause, | ||
limit | ||
})) | ||
request.setPageSize(pageSize) | ||
request.setPageToken(pageToken) | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getUIService().listLookupItems(request, callback) | ||
} | ||
// List translations | ||
listTranslations({ | ||
token, | ||
tableName, | ||
uuid, | ||
id, | ||
pageSize, | ||
pageToken, | ||
language | ||
}, callback) { | ||
const { ListTranslationsRequest } = require('./src/grpc/proto/business_pb.js') | ||
const request = new ListTranslationsRequest() | ||
request.setTableName(tableName) | ||
request.setUuid(uuid) | ||
request.setId(id) | ||
request.setPageSize(pageSize) | ||
request.setPageToken(pageToken) | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getUIService().listTranslations(request, callback) | ||
} | ||
// Get Default Value | ||
getDefaultValue({ | ||
token, | ||
query, | ||
language | ||
}, callback) { | ||
const { GetDefaultValueRequest } = require('./src/grpc/proto/business_pb.js') | ||
const request = new GetDefaultValueRequest() | ||
request.setQuery(query) | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getUIService().getDefaultValue(request, callback) | ||
} | ||
// Run a callout to server | ||
runCallout({ | ||
token, | ||
language, | ||
tableName, | ||
windowUuid, | ||
tabUuid, | ||
callout, | ||
columnName, | ||
oldValue, | ||
value, | ||
windowNo, | ||
attributes | ||
}, callback) { | ||
const { RunCalloutRequest } = require('./src/grpc/proto/business_pb.js') | ||
const { convertParameterToGRPC, convertValueToGRPC } = require('./lib/convertValues.js'); | ||
const request = new RunCalloutRequest() | ||
request.setTableName(tableName) | ||
request.setWindowUuid(windowUuid) | ||
request.setTabUuid(tabUuid) | ||
request.setCallout(callout) | ||
request.setColumnName(columnName) | ||
request.setOldValue(convertValueToGRPC({ | ||
value: oldValue | ||
})) | ||
request.setValue(convertValueToGRPC({ | ||
value | ||
})) | ||
request.setWindowNo(windowNo) | ||
if(attributes) { | ||
attributes.forEach(attribute => { | ||
request.addAttributes(convertParameterToGRPC({ | ||
columnName: attribute.key, | ||
value: attribute.value | ||
})) | ||
}) | ||
} | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getUIService().runCallout(request, callback) | ||
} | ||
// Rollback a value from entity | ||
rollbackEntity({ | ||
token, | ||
language, | ||
tableName, | ||
id, | ||
uuid, | ||
logId | ||
}, callback) { | ||
const { RollbackEntityRequest } = require('./src/grpc/proto/business_pb.js') | ||
const request = new RollbackEntityRequest() | ||
request.setTableName(tableName) | ||
request.setId(id) | ||
request.setUuid(uuid) | ||
request.setLogId(logId) | ||
request.setClientRequest(this.createClientRequest(token, language)) | ||
this.getUIService().rollbackEntity(request, callback) | ||
} | ||
} | ||
module.exports = Api; |
@@ -243,21 +243,2 @@ /************************************************************************************* | ||
// convertEntityFromGRPC({ entityToConvert, formatToConvert = 'array' }) { | ||
// if (entityToConvert) { | ||
// const { convertValuesMapFromGRPC } = require('./convertValues.js'); | ||
// | ||
// return { | ||
// id: entityToConvert.getId(), | ||
// uuid: entityToConvert.getUuid(), | ||
// tableName: entityToConvert.getTableName(), | ||
// values: convertValuesMapFromGRPC({ | ||
// mapToConvert: entityToConvert.getValuesMap(), | ||
// returnType: formatToConvert, | ||
// keyName: 'columnName', | ||
// valueName: 'value' | ||
// }) | ||
// }; | ||
// } | ||
// return undefined; | ||
// }, | ||
// Convert Entity | ||
@@ -327,11 +308,11 @@ convertEntityFromGRPC (entity) { | ||
convertTranslationFromGRPC(translationToConvert) { | ||
if (translationToConvert) { | ||
convertTranslationFromGRPC(translation) { | ||
if (translation) { | ||
const { convertValuesMapFromGRPC } = require('./convertValues.js'); | ||
return { | ||
language: translationToConvert.getLanguage(), | ||
translationUuid: translationToConvert.getTranslationuuid(), | ||
language: translation.getLanguage(), | ||
translation_uuid: translation.getTranslationUuid(), | ||
values: convertValuesMapFromGRPC({ | ||
mapToConvert: translationToConvert.getValuesMap(), | ||
mapToConvert: translation.getValuesMap(), | ||
returnType: 'object' | ||
@@ -338,0 +319,0 @@ }) |
@@ -18,12 +18,12 @@ /************************************************************************************* | ||
const convertBusinessData = { | ||
convertLookupFromGRPC(lookupToConvert) { | ||
if (lookupToConvert) { | ||
convertLookupFromGRPC(lookup) { | ||
if (lookup) { | ||
const { convertValuesMapFromGRPC } = require('./convertValues.js'); | ||
return { | ||
id: lookupToConvert.getId(), | ||
uuid: lookupToConvert.getUuid(), | ||
tableName: lookupToConvert.getTablename(), | ||
id: lookup.getId(), | ||
uuid: lookup.getUuid(), | ||
table_name: lookup.getTableName(), | ||
values: convertValuesMapFromGRPC({ | ||
mapToConvert: lookupToConvert.getValuesMap(), | ||
mapToConvert: lookup.getValuesMap(), | ||
returnType: 'object' | ||
@@ -36,2 +36,16 @@ }) | ||
convertCalloutFromGRPC(callout) { | ||
if (callout) { | ||
const { convertValuesMapFromGRPC } = require('./convertValues.js'); | ||
return { | ||
result: callout.getResult(), | ||
values: convertValuesMapFromGRPC({ | ||
mapToConvert: callout.getValuesMap(), | ||
returnType: 'object' | ||
}) | ||
}; | ||
} | ||
return undefined; | ||
}, | ||
convertPrivateAccessFromGRPC(privateAccess) { | ||
@@ -38,0 +52,0 @@ if (privateAccess) { |
{ | ||
"name": "@adempiere/grpc-api", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "ADempiere Web Store write in Javascript for a node service", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
1796015
52358