Skip to content
This repository was archived by the owner on Sep 2, 2023. It is now read-only.

Commit 666baa1

Browse files
Add ADempiere Import File Loader (#157)
* Add ADempiere Import File Loader * minimal changes * Add Service * Update package.json * Update ImportFileLoader.js --------- Co-authored-by: Edwin Betancourt <[email protected]>
1 parent 298c189 commit 666baa1

File tree

5 files changed

+3277
-3
lines changed

5 files changed

+3277
-3
lines changed

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
{
22
"name": "@adempiere/grpc-api",
3-
"version": "4.5.5",
3+
"version": "4.5.6",
44
"description": "ADempiere Web write in Javascript for a node service",
55
"author": "Yamel Senih",
66
"contributors": [
77
{
88
"name": "Edwin Betancourt",
99
"email": "[email protected]",
1010
"url": "https://github.com/EdwinBetanc0urt/"
11+
},
12+
{
13+
"name": "Elsio Sanchez",
14+
"email": "[email protected]",
15+
"url": "https://github.com/elsiosanchez"
1116
}
1217
],
1318
"main": "index.js",
@@ -21,8 +26,8 @@
2126
},
2227
"scripts": {
2328
"ci": "yarn install --frozen-lockfile",
24-
"stub": "npm run stub:base_data_type && npm run stub:business && npm run stub:business_partner && npm run stub:core_functionality && npm run stub:dashboarding && npm run stub:dictionary && npm run stub:enrollment && npm run stub:express_movement && npm run stub:express_receipt && npm run stub:express_shipment && npm run stub:file_management && npm run stub:general_ledger && npm run stub:in_out && npm run stub:invoice && npm run stub:issue_management && npm run stub:logs && npm run stub:material_management && npm run stub:match_po_receipt_invoice && npm run stub:order && npm run stub:payment && npm run stub:payment_allocation && npm run stub:payment_print_export && npm run stub:payroll_action_notice && npm run stub:point_of_sales && npm run stub:product && npm run stub:security && npm run stub:time_control && npm run stub:time_record && npm run stub:user_customization && npm run stub:workflow",
25-
"stub:all": "grpc_tools_node_protoc --js_out=import_style=commonjs,binary:src/grpc/ --grpc_out=grpc_js:src/grpc/ proto/base_data_type.proto proto/business.proto proto/business_partner.proto proto/core_functionality.proto proto/dashboarding.proto proto/dictionary.proto proto/enrollment.proto proto/express_movement.proto proto/express_receipt.proto proto/express_shipment.proto proto/file_management.proto proto/general_ledger.proto proto/in_out.proto proto/invoice.proto proto/issue_management.proto proto/logs.proto proto/material_management.proto proto/match_po_receipt_invoice.proto proto/order.proto proto/payment.proto proto/payment_allocation.proto proto/payment_print_export.proto proto/payroll_action_notice.proto proto/point_of_sales.proto proto/product.proto proto/security.proto proto/time_control.proto proto/time_record.proto proto/user_customization.proto proto/workflow.proto",
29+
"stub": "npm run stub:base_data_type && npm run stub:business && npm run stub:business_partner && npm run stub:core_functionality && npm run stub:dashboarding && npm run stub:dictionary && npm run stub:enrollment && npm run stub:express_movement && npm run stub:express_receipt && npm run stub:express_shipment && npm run stub:file_management && npm run stub:general_ledger && npm run stub:import_file_loader && npm run stub:in_out && npm run stub:invoice && npm run stub:issue_management && npm run stub:logs && npm run stub:material_management && npm run stub:match_po_receipt_invoice && npm run stub:order && npm run stub:payment && npm run stub:payment_allocation && npm run stub:payment_print_export && npm run stub:payroll_action_notice && npm run stub:point_of_sales && npm run stub:product && npm run stub:security && npm run stub:time_control && npm run stub:time_record && npm run stub:user_customization && npm run stub:workflow",
30+
"stub:all": "grpc_tools_node_protoc --js_out=import_style=commonjs,binary:src/grpc/ --grpc_out=grpc_js:src/grpc/ proto/base_data_type.proto proto/business.proto proto/business_partner.proto proto/core_functionality.proto proto/dashboarding.proto proto/dictionary.proto proto/enrollment.proto proto/express_movement.proto proto/express_receipt.proto proto/express_shipment.proto proto/file_management.proto proto/general_ledger.proto proto/import_file_loader.proto proto/in_out.proto proto/invoice.proto proto/issue_management.proto proto/logs.proto proto/material_management.proto proto/match_po_receipt_invoice.proto proto/order.proto proto/payment.proto proto/payment_allocation.proto proto/payment_print_export.proto proto/payroll_action_notice.proto proto/point_of_sales.proto proto/product.proto proto/security.proto proto/time_control.proto proto/time_record.proto proto/user_customization.proto proto/workflow.proto",
2631
"stub:base_data_type": "grpc_tools_node_protoc proto/base_data_type.proto --js_out=import_style=commonjs,binary:src/grpc/ --grpc_out=grpc_js:src/grpc/",
2732
"stub:business": "grpc_tools_node_protoc proto/business.proto --js_out=import_style=commonjs,binary:src/grpc/ --grpc_out=grpc_js:src/grpc/",
2833
"stub:business_partner": "grpc_tools_node_protoc proto/business_partner.proto --js_out=import_style=commonjs,binary:src/grpc/ --grpc_out=grpc_js:src/grpc/",
@@ -35,6 +40,7 @@
3540
"stub:express_shipment": "grpc_tools_node_protoc proto/express_shipment.proto --js_out=import_style=commonjs,binary:src/grpc/ --grpc_out=grpc_js:src/grpc/",
3641
"stub:file_management": "grpc_tools_node_protoc proto/file_management.proto --js_out=import_style=commonjs,binary:src/grpc/ --grpc_out=grpc_js:src/grpc/",
3742
"stub:general_ledger": "grpc_tools_node_protoc proto/general_ledger.proto --js_out=import_style=commonjs,binary:src/grpc/ --grpc_out=grpc_js:src/grpc/",
43+
"stub:import_file_loader": "grpc_tools_node_protoc proto/import_file_loader.proto --js_out=import_style=commonjs,binary:src/grpc/ --grpc_out=grpc_js:src/grpc/",
3844
"stub:in_out": "grpc_tools_node_protoc proto/in_out.proto --js_out=import_style=commonjs,binary:src/grpc/ --grpc_out=grpc_js:src/grpc/",
3945
"stub:invoice": "grpc_tools_node_protoc proto/invoice.proto --js_out=import_style=commonjs,binary:src/grpc/ --grpc_out=grpc_js:src/grpc/",
4046
"stub:issue_management": "grpc_tools_node_protoc proto/issue_management.proto --js_out=import_style=commonjs,binary:src/grpc/ --grpc_out=grpc_js:src/grpc/",

proto/import_file_loader.proto

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/************************************************************************************
2+
* Copyright (C) 2018-2023 E.R.P. Consultores y Asociados, C.A. *
3+
* Contributor(s): Edwin Betancourt [email protected] *
4+
* This program is free software: you can redistribute it and/or modify *
5+
* it under the terms of the GNU General Public License as published by *
6+
* the Free Software Foundation, either version 2 of the License, or *
7+
* (at your option) any later version. *
8+
* This program is distributed in the hope that it will be useful, *
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
11+
* GNU General Public License for more details. *
12+
* You should have received a copy of the GNU General Public License *
13+
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
14+
************************************************************************************/
15+
syntax = "proto3";
16+
17+
option java_multiple_files = true;
18+
option java_package = "org.spin.backend.grpc.form.import_file_loader";
19+
option java_outer_classname = "ADempiereImportFileLoader";
20+
21+
import "proto/base_data_type.proto";
22+
import "proto/business.proto";
23+
24+
package import_file_loader;
25+
26+
service ImportFileLoader {
27+
rpc ListCharsets(ListCharsetsRequest) returns (data.ListLookupItemsResponse) {}
28+
rpc ListImportFormats(ListImportFormatsRequest) returns (data.ListLookupItemsResponse) {}
29+
rpc GetImportFromat(GetImportFromatRequest) returns (ImportFormat) {}
30+
rpc LoadImportFile(stream LoadImportFileRequest) returns (ResourceReference) {}
31+
rpc ListFilePreview(ListFilePreviewRequest) returns (data.ListEntitiesResponse) {}
32+
rpc ProcessImport(ProcessImportRequest) returns (ProcessImportResponse) {}
33+
}
34+
35+
// Charset
36+
message ListCharsetsRequest {
37+
int32 page_size = 1;
38+
string page_token = 2;
39+
// filters
40+
string search_value = 3;
41+
}
42+
43+
44+
// Import Format
45+
message ListImportFormatsRequest {
46+
int32 page_size = 1;
47+
string page_token = 2;
48+
// filters
49+
string search_value = 3;
50+
}
51+
52+
message ImportFormat {
53+
int32 id = 1;
54+
string uuid = 2;
55+
string name = 3;
56+
string description = 4;
57+
string table_name = 5;
58+
string format_type = 6;
59+
string separator_character = 7;
60+
repeated FormatField format_fields = 8;
61+
}
62+
63+
message FormatField {
64+
int32 id = 1;
65+
string uuid = 2;
66+
string name = 3;
67+
int32 sequence = 4;
68+
string column_name = 5;
69+
string data_type = 6;
70+
int32 start_no = 7;
71+
int32 end_no = 8;
72+
string default_value = 9;
73+
// number
74+
string defimal_point = 10;
75+
bool is_divide_by_100 = 11;
76+
// date
77+
string date_format = 12;
78+
// constant
79+
string constant_value = 13;
80+
}
81+
82+
// Format Field
83+
message GetImportFromatRequest {
84+
int32 id = 1;
85+
}
86+
87+
// Load Import File
88+
message ResourceReference {
89+
int32 resource_id = 1;
90+
string resource_uuid = 2;
91+
string file_name = 3;
92+
data.Decimal file_size = 4;
93+
string description = 5;
94+
string text_msg = 6;
95+
string content_type = 7;
96+
}
97+
98+
message LoadImportFileRequest {
99+
bytes data = 1;
100+
string resource_uuid = 2;
101+
data.Decimal file_size = 3;
102+
}
103+
104+
105+
// Preview File
106+
message ListFilePreviewRequest {
107+
int32 page_size = 1;
108+
string page_token = 2;
109+
// filters
110+
string search_value = 3;
111+
int32 import_format_id = 4;
112+
int32 resource_reference_id = 5;
113+
}
114+
115+
// Process Import
116+
message ProcessImportRequest {
117+
int32 import_format_id = 1;
118+
}
119+
120+
message ProcessImportResponse {
121+
string message = 1;
122+
}
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
// GENERATED CODE -- DO NOT EDIT!
2+
3+
// Original file comments:
4+
// ***********************************************************************************
5+
// Copyright (C) 2018-2023 E.R.P. Consultores y Asociados, C.A. *
6+
// Contributor(s): Edwin Betancourt [email protected] *
7+
// This program is free software: you can redistribute it and/or modify *
8+
// it under the terms of the GNU General Public License as published by *
9+
// the Free Software Foundation, either version 2 of the License, or *
10+
// (at your option) any later version. *
11+
// This program is distributed in the hope that it will be useful, *
12+
// but WITHOUT ANY WARRANTY; without even the implied warranty of *
13+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14+
// GNU General Public License for more details. *
15+
// You should have received a copy of the GNU General Public License *
16+
// along with this program. If not, see <https://www.gnu.org/licenses/>. *
17+
// **********************************************************************************
18+
'use strict';
19+
var grpc = require('@grpc/grpc-js');
20+
var proto_import_file_loader_pb = require('../proto/import_file_loader_pb.js');
21+
var proto_base_data_type_pb = require('../proto/base_data_type_pb.js');
22+
var proto_business_pb = require('../proto/business_pb.js');
23+
24+
function serialize_data_ListEntitiesResponse(arg) {
25+
if (!(arg instanceof proto_business_pb.ListEntitiesResponse)) {
26+
throw new Error('Expected argument of type data.ListEntitiesResponse');
27+
}
28+
return Buffer.from(arg.serializeBinary());
29+
}
30+
31+
function deserialize_data_ListEntitiesResponse(buffer_arg) {
32+
return proto_business_pb.ListEntitiesResponse.deserializeBinary(new Uint8Array(buffer_arg));
33+
}
34+
35+
function serialize_data_ListLookupItemsResponse(arg) {
36+
if (!(arg instanceof proto_business_pb.ListLookupItemsResponse)) {
37+
throw new Error('Expected argument of type data.ListLookupItemsResponse');
38+
}
39+
return Buffer.from(arg.serializeBinary());
40+
}
41+
42+
function deserialize_data_ListLookupItemsResponse(buffer_arg) {
43+
return proto_business_pb.ListLookupItemsResponse.deserializeBinary(new Uint8Array(buffer_arg));
44+
}
45+
46+
function serialize_import_file_loader_GetImportFromatRequest(arg) {
47+
if (!(arg instanceof proto_import_file_loader_pb.GetImportFromatRequest)) {
48+
throw new Error('Expected argument of type import_file_loader.GetImportFromatRequest');
49+
}
50+
return Buffer.from(arg.serializeBinary());
51+
}
52+
53+
function deserialize_import_file_loader_GetImportFromatRequest(buffer_arg) {
54+
return proto_import_file_loader_pb.GetImportFromatRequest.deserializeBinary(new Uint8Array(buffer_arg));
55+
}
56+
57+
function serialize_import_file_loader_ImportFormat(arg) {
58+
if (!(arg instanceof proto_import_file_loader_pb.ImportFormat)) {
59+
throw new Error('Expected argument of type import_file_loader.ImportFormat');
60+
}
61+
return Buffer.from(arg.serializeBinary());
62+
}
63+
64+
function deserialize_import_file_loader_ImportFormat(buffer_arg) {
65+
return proto_import_file_loader_pb.ImportFormat.deserializeBinary(new Uint8Array(buffer_arg));
66+
}
67+
68+
function serialize_import_file_loader_ListCharsetsRequest(arg) {
69+
if (!(arg instanceof proto_import_file_loader_pb.ListCharsetsRequest)) {
70+
throw new Error('Expected argument of type import_file_loader.ListCharsetsRequest');
71+
}
72+
return Buffer.from(arg.serializeBinary());
73+
}
74+
75+
function deserialize_import_file_loader_ListCharsetsRequest(buffer_arg) {
76+
return proto_import_file_loader_pb.ListCharsetsRequest.deserializeBinary(new Uint8Array(buffer_arg));
77+
}
78+
79+
function serialize_import_file_loader_ListFilePreviewRequest(arg) {
80+
if (!(arg instanceof proto_import_file_loader_pb.ListFilePreviewRequest)) {
81+
throw new Error('Expected argument of type import_file_loader.ListFilePreviewRequest');
82+
}
83+
return Buffer.from(arg.serializeBinary());
84+
}
85+
86+
function deserialize_import_file_loader_ListFilePreviewRequest(buffer_arg) {
87+
return proto_import_file_loader_pb.ListFilePreviewRequest.deserializeBinary(new Uint8Array(buffer_arg));
88+
}
89+
90+
function serialize_import_file_loader_ListImportFormatsRequest(arg) {
91+
if (!(arg instanceof proto_import_file_loader_pb.ListImportFormatsRequest)) {
92+
throw new Error('Expected argument of type import_file_loader.ListImportFormatsRequest');
93+
}
94+
return Buffer.from(arg.serializeBinary());
95+
}
96+
97+
function deserialize_import_file_loader_ListImportFormatsRequest(buffer_arg) {
98+
return proto_import_file_loader_pb.ListImportFormatsRequest.deserializeBinary(new Uint8Array(buffer_arg));
99+
}
100+
101+
function serialize_import_file_loader_LoadImportFileRequest(arg) {
102+
if (!(arg instanceof proto_import_file_loader_pb.LoadImportFileRequest)) {
103+
throw new Error('Expected argument of type import_file_loader.LoadImportFileRequest');
104+
}
105+
return Buffer.from(arg.serializeBinary());
106+
}
107+
108+
function deserialize_import_file_loader_LoadImportFileRequest(buffer_arg) {
109+
return proto_import_file_loader_pb.LoadImportFileRequest.deserializeBinary(new Uint8Array(buffer_arg));
110+
}
111+
112+
function serialize_import_file_loader_ProcessImportRequest(arg) {
113+
if (!(arg instanceof proto_import_file_loader_pb.ProcessImportRequest)) {
114+
throw new Error('Expected argument of type import_file_loader.ProcessImportRequest');
115+
}
116+
return Buffer.from(arg.serializeBinary());
117+
}
118+
119+
function deserialize_import_file_loader_ProcessImportRequest(buffer_arg) {
120+
return proto_import_file_loader_pb.ProcessImportRequest.deserializeBinary(new Uint8Array(buffer_arg));
121+
}
122+
123+
function serialize_import_file_loader_ProcessImportResponse(arg) {
124+
if (!(arg instanceof proto_import_file_loader_pb.ProcessImportResponse)) {
125+
throw new Error('Expected argument of type import_file_loader.ProcessImportResponse');
126+
}
127+
return Buffer.from(arg.serializeBinary());
128+
}
129+
130+
function deserialize_import_file_loader_ProcessImportResponse(buffer_arg) {
131+
return proto_import_file_loader_pb.ProcessImportResponse.deserializeBinary(new Uint8Array(buffer_arg));
132+
}
133+
134+
function serialize_import_file_loader_ResourceReference(arg) {
135+
if (!(arg instanceof proto_import_file_loader_pb.ResourceReference)) {
136+
throw new Error('Expected argument of type import_file_loader.ResourceReference');
137+
}
138+
return Buffer.from(arg.serializeBinary());
139+
}
140+
141+
function deserialize_import_file_loader_ResourceReference(buffer_arg) {
142+
return proto_import_file_loader_pb.ResourceReference.deserializeBinary(new Uint8Array(buffer_arg));
143+
}
144+
145+
146+
var ImportFileLoaderService = exports.ImportFileLoaderService = {
147+
listCharsets: {
148+
path: '/import_file_loader.ImportFileLoader/ListCharsets',
149+
requestStream: false,
150+
responseStream: false,
151+
requestType: proto_import_file_loader_pb.ListCharsetsRequest,
152+
responseType: proto_business_pb.ListLookupItemsResponse,
153+
requestSerialize: serialize_import_file_loader_ListCharsetsRequest,
154+
requestDeserialize: deserialize_import_file_loader_ListCharsetsRequest,
155+
responseSerialize: serialize_data_ListLookupItemsResponse,
156+
responseDeserialize: deserialize_data_ListLookupItemsResponse,
157+
},
158+
listImportFormats: {
159+
path: '/import_file_loader.ImportFileLoader/ListImportFormats',
160+
requestStream: false,
161+
responseStream: false,
162+
requestType: proto_import_file_loader_pb.ListImportFormatsRequest,
163+
responseType: proto_business_pb.ListLookupItemsResponse,
164+
requestSerialize: serialize_import_file_loader_ListImportFormatsRequest,
165+
requestDeserialize: deserialize_import_file_loader_ListImportFormatsRequest,
166+
responseSerialize: serialize_data_ListLookupItemsResponse,
167+
responseDeserialize: deserialize_data_ListLookupItemsResponse,
168+
},
169+
getImportFromat: {
170+
path: '/import_file_loader.ImportFileLoader/GetImportFromat',
171+
requestStream: false,
172+
responseStream: false,
173+
requestType: proto_import_file_loader_pb.GetImportFromatRequest,
174+
responseType: proto_import_file_loader_pb.ImportFormat,
175+
requestSerialize: serialize_import_file_loader_GetImportFromatRequest,
176+
requestDeserialize: deserialize_import_file_loader_GetImportFromatRequest,
177+
responseSerialize: serialize_import_file_loader_ImportFormat,
178+
responseDeserialize: deserialize_import_file_loader_ImportFormat,
179+
},
180+
loadImportFile: {
181+
path: '/import_file_loader.ImportFileLoader/LoadImportFile',
182+
requestStream: true,
183+
responseStream: false,
184+
requestType: proto_import_file_loader_pb.LoadImportFileRequest,
185+
responseType: proto_import_file_loader_pb.ResourceReference,
186+
requestSerialize: serialize_import_file_loader_LoadImportFileRequest,
187+
requestDeserialize: deserialize_import_file_loader_LoadImportFileRequest,
188+
responseSerialize: serialize_import_file_loader_ResourceReference,
189+
responseDeserialize: deserialize_import_file_loader_ResourceReference,
190+
},
191+
listFilePreview: {
192+
path: '/import_file_loader.ImportFileLoader/ListFilePreview',
193+
requestStream: false,
194+
responseStream: false,
195+
requestType: proto_import_file_loader_pb.ListFilePreviewRequest,
196+
responseType: proto_business_pb.ListEntitiesResponse,
197+
requestSerialize: serialize_import_file_loader_ListFilePreviewRequest,
198+
requestDeserialize: deserialize_import_file_loader_ListFilePreviewRequest,
199+
responseSerialize: serialize_data_ListEntitiesResponse,
200+
responseDeserialize: deserialize_data_ListEntitiesResponse,
201+
},
202+
processImport: {
203+
path: '/import_file_loader.ImportFileLoader/ProcessImport',
204+
requestStream: false,
205+
responseStream: false,
206+
requestType: proto_import_file_loader_pb.ProcessImportRequest,
207+
responseType: proto_import_file_loader_pb.ProcessImportResponse,
208+
requestSerialize: serialize_import_file_loader_ProcessImportRequest,
209+
requestDeserialize: deserialize_import_file_loader_ProcessImportRequest,
210+
responseSerialize: serialize_import_file_loader_ProcessImportResponse,
211+
responseDeserialize: deserialize_import_file_loader_ProcessImportResponse,
212+
},
213+
};
214+
215+
exports.ImportFileLoaderClient = grpc.makeGenericClientConstructor(ImportFileLoaderService);

0 commit comments

Comments
 (0)