@dashevo/dapi-grpc 0.25.0-dev.9 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,6 @@
1
1
  syntax = "proto3";
2
+ import "google/protobuf/wrappers.proto";
3
+ import "google/protobuf/struct.proto";
2
4
 
3
5
  package org.dash.platform.dapi.v0;
4
6
 
@@ -7,25 +9,38 @@ import "google/protobuf/timestamp.proto";
7
9
  service Platform {
8
10
  rpc broadcastStateTransition (BroadcastStateTransitionRequest) returns (BroadcastStateTransitionResponse);
9
11
  rpc getIdentity (GetIdentityRequest) returns (GetIdentityResponse);
12
+ rpc getIdentities (GetIdentitiesRequest) returns (GetIdentitiesResponse);
13
+ rpc getIdentityKeys (GetIdentityKeysRequest) returns (GetIdentityKeysResponse);
14
+ // rpc getIdentitiesKeys (GetIdentitiesKeysRequest) returns (GetIdentitiesKeysResponse);
15
+ rpc getIdentityBalance(GetIdentityRequest) returns (GetIdentityBalanceResponse);
16
+ rpc getIdentityBalanceAndRevision(GetIdentityRequest)
17
+ returns (GetIdentityBalanceAndRevisionResponse);
18
+ rpc getProofs (GetProofsRequest) returns (GetProofsResponse);
10
19
  rpc getDataContract (GetDataContractRequest) returns (GetDataContractResponse);
20
+ rpc getDataContractHistory (GetDataContractHistoryRequest) returns (GetDataContractHistoryResponse);
21
+ rpc getDataContracts (GetDataContractsRequest) returns (GetDataContractsResponse);
11
22
  rpc getDocuments (GetDocumentsRequest) returns (GetDocumentsResponse);
12
23
  rpc getIdentitiesByPublicKeyHashes (GetIdentitiesByPublicKeyHashesRequest) returns (GetIdentitiesByPublicKeyHashesResponse);
24
+ rpc getIdentityByPublicKeyHashes (GetIdentityByPublicKeyHashesRequest) returns (GetIdentityByPublicKeyHashesResponse);
13
25
  rpc waitForStateTransitionResult (WaitForStateTransitionResultRequest) returns (WaitForStateTransitionResultResponse);
14
26
  rpc getConsensusParams (GetConsensusParamsRequest) returns (GetConsensusParamsResponse);
15
27
  }
16
28
 
17
29
  message Proof {
18
- bytes merkle_proof = 1;
30
+ bytes grovedb_proof = 1;
19
31
  bytes quorum_hash = 2;
20
32
  bytes signature = 3;
21
33
  uint32 round = 4;
34
+ bytes block_id_hash = 5;
35
+ uint32 quorum_type = 6;
22
36
  }
23
37
 
24
38
  message ResponseMetadata {
25
- int64 height = 1;
39
+ uint64 height = 1;
26
40
  uint32 core_chain_locked_height = 2;
27
41
  uint64 time_ms = 3;
28
42
  uint32 protocol_version = 4;
43
+ string chain_id = 5;
29
44
  }
30
45
 
31
46
  message StateTransitionBroadcastError {
@@ -48,19 +63,237 @@ message GetIdentityRequest {
48
63
  }
49
64
 
50
65
  message GetIdentityResponse {
51
- bytes identity = 1;
52
- Proof proof = 2;
66
+ oneof result {
67
+ bytes identity = 1;
68
+ Proof proof = 2;
69
+ }
70
+ ResponseMetadata metadata = 3;
71
+ }
72
+
73
+ message GetIdentitiesRequest {
74
+ repeated bytes ids = 1;
75
+ bool prove = 2;
76
+ }
77
+
78
+ message GetIdentitiesResponse {
79
+ message IdentityValue {
80
+ bytes value = 1;
81
+ }
82
+
83
+ message IdentityEntry {
84
+ bytes key = 1;
85
+ IdentityValue value = 2;
86
+ }
87
+
88
+ message Identities {
89
+ repeated IdentityEntry identity_entries = 1;
90
+ }
91
+
92
+ oneof result {
93
+ Identities identities = 1;
94
+ Proof proof = 2;
95
+ }
96
+ ResponseMetadata metadata = 3;
97
+ }
98
+
99
+ message GetIdentityBalanceResponse {
100
+ oneof result {
101
+ google.protobuf.UInt64Value balance = 1;
102
+ Proof proof = 2;
103
+ }
104
+ ResponseMetadata metadata = 3;
105
+ }
106
+
107
+ message GetIdentityBalanceAndRevisionResponse {
108
+ message BalanceAndRevision {
109
+ google.protobuf.UInt64Value balance = 1;
110
+ google.protobuf.UInt64Value revision = 2;
111
+ }
112
+
113
+ oneof result {
114
+ BalanceAndRevision balance_and_revision = 1;
115
+ Proof proof = 2;
116
+ }
117
+ ResponseMetadata metadata = 3;
118
+ }
119
+
120
+ message KeyRequestType {
121
+ oneof request {
122
+ AllKeys all_keys = 1;
123
+ SpecificKeys specific_keys = 2;
124
+ SearchKey search_key = 3;
125
+ }
126
+ }
127
+
128
+ message AllKeys {
129
+ }
130
+
131
+ message SpecificKeys {
132
+ repeated uint32 key_ids = 1;
133
+ }
134
+
135
+ message SearchKey {
136
+ map<uint32, SecurityLevelMap> purpose_map = 1;
137
+ }
138
+
139
+ message SecurityLevelMap {
140
+ enum KeyKindRequestType {
141
+ CURRENT_KEY_OF_KIND_REQUEST = 0;
142
+ ALL_KEYS_OF_KIND_REQUEST = 1;
143
+ }
144
+ map<uint32, KeyKindRequestType> security_level_map = 1;
145
+ }
146
+
147
+ message GetIdentityKeysRequest {
148
+ bytes identity_id = 1;
149
+ KeyRequestType request_type = 2;
150
+ google.protobuf.UInt32Value limit = 3;
151
+ google.protobuf.UInt32Value offset = 4;
152
+ bool prove = 5;
153
+ }
154
+
155
+ message GetIdentityKeysResponse {
156
+ message Keys {
157
+ repeated bytes keys_bytes = 1;
158
+ }
159
+ oneof result {
160
+ Keys keys = 1;
161
+ Proof proof = 2;
162
+ }
163
+ ResponseMetadata metadata = 3;
164
+ }
165
+
166
+
167
+ message GetIdentitiesKeysRequest {
168
+ repeated bytes identity_ids = 1;
169
+ KeyRequestType request_type = 2;
170
+ google.protobuf.UInt32Value limit = 3;
171
+ google.protobuf.UInt32Value offset = 4;
172
+ bool prove = 5;
173
+
174
+ message SecurityLevelMap {
175
+ enum KeyKindRequestType {
176
+ CURRENT_KEY_OF_KIND_REQUEST = 0;
177
+ }
178
+ map<uint32, KeyKindRequestType> security_level_map = 1;
179
+ }
180
+ }
181
+
182
+ message GetIdentitiesKeysResponse {
183
+ message PublicKey {
184
+ bytes value = 1;
185
+ }
186
+
187
+ message PublicKeyEntry {
188
+ bytes key = 1;
189
+ PublicKey value = 2;
190
+ }
191
+
192
+ message PublicKeyEntries {
193
+ repeated PublicKeyEntry public_key_entries = 1;
194
+ }
195
+
196
+ oneof result {
197
+ PublicKeyEntries public_keys = 1;
198
+ Proof proof = 2;
199
+ }
53
200
  ResponseMetadata metadata = 3;
54
201
  }
55
202
 
56
- message GetDataContractRequest {
203
+ message GetProofsRequest {
204
+ message DocumentRequest {
205
+ bytes contract_id = 1;
206
+ string document_type = 2;
207
+ bool document_type_keeps_history = 3;
208
+ bytes document_id = 4;
209
+ }
210
+
211
+ message IdentityRequest {
212
+ enum Type {
213
+ FULL_IDENTITY = 0;
214
+ BALANCE = 1;
215
+ KEYS = 2;
216
+ }
217
+ bytes identity_id = 1;
218
+ Type request_type = 2;
219
+ }
220
+
221
+ message ContractRequest {
222
+ bytes contract_id = 1;
223
+ }
224
+
225
+ repeated IdentityRequest identities = 1;
226
+ repeated ContractRequest contracts = 2;
227
+ repeated DocumentRequest documents = 3;
228
+ }
229
+
230
+ message GetProofsResponse {
231
+ Proof proof = 1;
232
+ ResponseMetadata metadata = 2;
233
+ }
234
+
235
+ message GetDataContractRequest {
57
236
  bytes id = 1;
58
237
  bool prove = 2;
59
238
  }
60
239
 
61
240
  message GetDataContractResponse {
62
- bytes data_contract = 1;
63
- Proof proof = 2;
241
+ oneof result {
242
+ bytes data_contract = 1;
243
+ Proof proof = 2;
244
+ }
245
+ ResponseMetadata metadata = 3;
246
+ }
247
+
248
+ message GetDataContractsRequest {
249
+ repeated bytes ids = 1;
250
+ bool prove = 2;
251
+ }
252
+
253
+ message GetDataContractsResponse {
254
+ message DataContractValue {
255
+ bytes value = 1;
256
+ }
257
+
258
+ message DataContractEntry {
259
+ bytes key = 1;
260
+ DataContractValue value = 2;
261
+ }
262
+
263
+ message DataContracts {
264
+ repeated DataContractEntry data_contract_entries = 1;
265
+ }
266
+
267
+ oneof result {
268
+ DataContracts data_contracts = 1;
269
+ Proof proof = 2;
270
+ }
271
+ ResponseMetadata metadata = 3;
272
+ }
273
+
274
+ message GetDataContractHistoryRequest {
275
+ bytes id = 1;
276
+ google.protobuf.UInt32Value limit = 2;
277
+ google.protobuf.UInt32Value offset = 3;
278
+ uint64 start_at_ms = 4;
279
+ bool prove = 5;
280
+ }
281
+
282
+ message GetDataContractHistoryResponse {
283
+ message DataContractHistoryEntry {
284
+ uint64 date = 1;
285
+ bytes value = 2;
286
+ }
287
+
288
+ message DataContractHistory {
289
+ repeated DataContractHistoryEntry data_contract_entries = 1;
290
+ }
291
+
292
+ oneof result {
293
+ DataContractHistory data_contract_history = 1;
294
+ Proof proof = 2;
295
+ }
296
+
64
297
  ResponseMetadata metadata = 3;
65
298
  }
66
299
 
@@ -73,17 +306,23 @@ message GetDocumentsRequest {
73
306
 
74
307
  uint32 limit = 5;
75
308
 
76
- oneof start {
77
- bytes start_after = 6;
78
- bytes start_at = 7;
79
- }
309
+ oneof start {
310
+ bytes start_after = 6;
311
+ bytes start_at = 7;
312
+ }
80
313
 
81
314
  bool prove = 8;
82
315
  }
83
316
 
84
317
  message GetDocumentsResponse {
85
- repeated bytes documents = 1;
86
- Proof proof = 2;
318
+ message Documents {
319
+ repeated bytes documents = 1;
320
+ }
321
+
322
+ oneof result {
323
+ Documents documents = 1;
324
+ Proof proof = 2;
325
+ }
87
326
  ResponseMetadata metadata = 3;
88
327
  }
89
328
 
@@ -93,8 +332,27 @@ message GetIdentitiesByPublicKeyHashesRequest {
93
332
  }
94
333
 
95
334
  message GetIdentitiesByPublicKeyHashesResponse {
96
- repeated bytes identities = 1;
97
- Proof proof = 2;
335
+ message Identities {
336
+ repeated bytes identities = 1;
337
+ }
338
+
339
+ oneof result {
340
+ Identities identities = 1;
341
+ Proof proof = 2;
342
+ }
343
+ ResponseMetadata metadata = 3;
344
+ }
345
+
346
+ message GetIdentityByPublicKeyHashesRequest {
347
+ bytes public_key_hash = 1;
348
+ bool prove = 2;
349
+ }
350
+
351
+ message GetIdentityByPublicKeyHashesResponse {
352
+ oneof result {
353
+ bytes identity = 1;
354
+ Proof proof = 2;
355
+ }
98
356
  ResponseMetadata metadata = 3;
99
357
  }
100
358
 
@@ -104,7 +362,7 @@ message WaitForStateTransitionResultRequest {
104
362
  }
105
363
 
106
364
  message WaitForStateTransitionResultResponse {
107
- oneof responses {
365
+ oneof result {
108
366
  StateTransitionBroadcastError error = 1;
109
367
  Proof proof = 2;
110
368
  }
package/scripts/build.sh CHANGED
@@ -1,4 +1,12 @@
1
1
  #!/usr/bin/env bash
2
+ # shellcheck disable=SC2250
3
+ #
4
+
5
+ SKIP_GRPC_PROTO_BUILD=${SKIP_GRPC_PROTO_BUILD:-0}
6
+ if [[ "${SKIP_GRPC_PROTO_BUILD}" == "1" ]]; then
7
+ echo WARN: Skipping GRPC protobuf definitions rebuild
8
+ exit 0
9
+ fi
2
10
 
3
11
  CORE_PROTO_PATH="$PWD/protos/core/v0"
4
12
  CORE_CLIENTS_PATH="$PWD/clients/core/v0"
@@ -18,30 +26,29 @@ PLATFORM_OBJ_C_OUT_PATH="$PLATFORM_CLIENTS_PATH/objective-c"
18
26
  CORE_PYTHON_OUT_PATH="$CORE_CLIENTS_PATH/python"
19
27
  PLATFORM_PYTHON_OUT_PATH="$PLATFORM_CLIENTS_PATH/python"
20
28
 
21
- CORE_RUST_OUT_PATH="$CORE_CLIENTS_PATH/rust"
22
- PLATFORM_RUST_OUT_PATH="$PLATFORM_CLIENTS_PATH/rust"
23
-
24
29
  PROTOC_IMAGE="rvolosatovs/protoc:4.0.0"
25
30
 
31
+ set -ex
32
+
26
33
  #################################################
27
34
  # Generate JavaScript client for `Core` service #
28
35
  #################################################
29
36
 
30
- rm -rf "$CORE_WEB_OUT_PATH/*"
37
+ rm -rf "${CORE_WEB_OUT_PATH:?}/*" || true
31
38
 
32
39
  docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
33
- -v "$CORE_WEB_OUT_PATH:$CORE_WEB_OUT_PATH" \
34
- --rm \
35
- "$PROTOC_IMAGE" \
36
- --js_out="import_style=commonjs:$CORE_WEB_OUT_PATH" \
37
- --ts_out="service=grpc-web:$CORE_WEB_OUT_PATH" \
38
- -I="$CORE_PROTO_PATH" \
39
- "core.proto"
40
+ -v "$CORE_WEB_OUT_PATH:$CORE_WEB_OUT_PATH" \
41
+ --rm \
42
+ "$PROTOC_IMAGE" \
43
+ --js_out="import_style=commonjs:$CORE_WEB_OUT_PATH" \
44
+ --ts_out="service=grpc-web:$CORE_WEB_OUT_PATH" \
45
+ -I="$CORE_PROTO_PATH" \
46
+ "core.proto"
40
47
 
41
48
  # Clean node message classes
42
49
 
43
- rm -rf "$CORE_CLIENTS_PATH/nodejs/*_protoc.js"
44
- rm -rf "$CORE_CLIENTS_PATH/nodejs/*_pbjs.js"
50
+ rm -rf "$CORE_CLIENTS_PATH/nodejs/*_protoc.js" || true
51
+ rm -rf "$CORE_CLIENTS_PATH/nodejs/*_pbjs.js" || true
45
52
 
46
53
  # Copy compiled modules with message classes
47
54
 
@@ -59,21 +66,21 @@ pbjs \
59
66
  # Generate JavaScript client for `Platform` service #
60
67
  #####################################################
61
68
 
62
- rm -rf "$PLATFORM_WEB_OUT_PATH/*"
69
+ rm -rf "${PLATFORM_WEB_OUT_PATH:?}/*" || true
63
70
 
64
71
  docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
65
- -v "$PLATFORM_WEB_OUT_PATH:$PLATFORM_WEB_OUT_PATH" \
66
- --rm \
67
- "$PROTOC_IMAGE" \
68
- --js_out="import_style=commonjs:$PLATFORM_WEB_OUT_PATH" \
69
- --ts_out="service=grpc-web:$PLATFORM_WEB_OUT_PATH" \
70
- -I="$PLATFORM_PROTO_PATH" \
71
- "platform.proto"
72
+ -v "$PLATFORM_WEB_OUT_PATH:$PLATFORM_WEB_OUT_PATH" \
73
+ --rm \
74
+ "$PROTOC_IMAGE" \
75
+ --js_out="import_style=commonjs:$PLATFORM_WEB_OUT_PATH" \
76
+ --ts_out="service=grpc-web:$PLATFORM_WEB_OUT_PATH" \
77
+ -I="$PLATFORM_PROTO_PATH" \
78
+ "platform.proto"
72
79
 
73
80
  # Clean node message classes
74
81
 
75
- rm -rf "$PLATFORM_CLIENTS_PATH/nodejs/*_protoc.js"
76
- rm -rf "$PLATFORM_CLIENTS_PATH/nodejs/*_pbjs.js"
82
+ rm -rf "$PLATFORM_CLIENTS_PATH/nodejs/*_protoc.js" || true
83
+ rm -rf "$PLATFORM_CLIENTS_PATH/nodejs/*_pbjs.js" || true
77
84
 
78
85
  # Copy compiled modules with message classes
79
86
 
@@ -90,132 +97,101 @@ pbjs \
90
97
  # Generate Java client for `Core` #
91
98
  ###################################
92
99
 
93
- rm -rf "$CORE_JAVA_OUT_PATH/*"
100
+ rm -rf "${CORE_JAVA_OUT_PATH:?}/*" || true
94
101
 
95
102
  docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
96
- -v "$CORE_JAVA_OUT_PATH:$CORE_JAVA_OUT_PATH" \
97
- --rm \
98
- "$PROTOC_IMAGE" \
99
- --plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-java \
100
- --grpc-java_out="$CORE_JAVA_OUT_PATH" \
101
- --proto_path="$CORE_PROTO_PATH" \
102
- -I="$CORE_PROTO_PATH" \
103
- "core.proto"
103
+ -v "$CORE_JAVA_OUT_PATH:$CORE_JAVA_OUT_PATH" \
104
+ --rm \
105
+ "$PROTOC_IMAGE" \
106
+ --plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-java \
107
+ --grpc-java_out="$CORE_JAVA_OUT_PATH" \
108
+ --proto_path="$CORE_PROTO_PATH" \
109
+ -I="$CORE_PROTO_PATH" \
110
+ "core.proto"
104
111
 
105
112
  #######################################
106
113
  # Generate Java client for `Platform` #
107
114
  #######################################
108
115
 
109
- rm -rf "$PLATFORM_JAVA_OUT_PATH/*"
116
+ rm -rf "${PLATFORM_JAVA_OUT_PATH:?}/*" || true
110
117
 
111
118
  docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
112
- -v "$PLATFORM_JAVA_OUT_PATH:$PLATFORM_JAVA_OUT_PATH" \
113
- --rm \
114
- "$PROTOC_IMAGE" \
115
- --plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-java \
116
- --grpc-java_out="$PLATFORM_JAVA_OUT_PATH" \
117
- --proto_path="$PLATFORM_PROTO_PATH" \
118
- -I="$PLATFORM_PROTO_PATH" \
119
- "platform.proto"
119
+ -v "$PLATFORM_JAVA_OUT_PATH:$PLATFORM_JAVA_OUT_PATH" \
120
+ --rm \
121
+ "$PROTOC_IMAGE" \
122
+ --plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-java \
123
+ --grpc-java_out="$PLATFORM_JAVA_OUT_PATH" \
124
+ --proto_path="$PLATFORM_PROTO_PATH" \
125
+ -I="$PLATFORM_PROTO_PATH" \
126
+ "platform.proto"
120
127
 
121
128
  ##########################################
122
129
  # Generate Objective-C client for `Core` #
123
130
  ##########################################
124
131
 
125
- rm -rf "$CORE_OBJ_C_OUT_PATH/*"
132
+ rm -rf "${CORE_OBJ_C_OUT_PATH:?}/*" || true
126
133
 
127
134
  docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
128
- -v "$CORE_OBJ_C_OUT_PATH:$CORE_OBJ_C_OUT_PATH" \
129
- --rm \
130
- "$PROTOC_IMAGE" \
131
- --plugin=protoc-gen-grpc=/usr/bin/grpc_objective_c_plugin \
132
- --objc_out="$CORE_OBJ_C_OUT_PATH" \
133
- --grpc_out="$CORE_OBJ_C_OUT_PATH" \
134
- --proto_path="$CORE_PROTO_PATH" \
135
- -I="$CORE_PROTO_PATH" \
136
- "core.proto"
135
+ -v "$CORE_OBJ_C_OUT_PATH:$CORE_OBJ_C_OUT_PATH" \
136
+ --rm \
137
+ "$PROTOC_IMAGE" \
138
+ --plugin=protoc-gen-grpc=/usr/bin/grpc_objective_c_plugin \
139
+ --objc_out="$CORE_OBJ_C_OUT_PATH" \
140
+ --grpc_out="$CORE_OBJ_C_OUT_PATH" \
141
+ --proto_path="$CORE_PROTO_PATH" \
142
+ -I="$CORE_PROTO_PATH" \
143
+ "core.proto"
137
144
 
138
145
  ##############################################
139
146
  # Generate Objective-C client for `Platform` #
140
147
  ##############################################
141
148
 
142
- rm -rf "$PLATFORM_OBJ_C_OUT_PATH/*"
149
+ rm -rf "${PLATFORM_OBJ_C_OUT_PATH:?}/*" || true
143
150
 
144
151
  docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
145
- -v "$PLATFORM_OBJ_C_OUT_PATH:$PLATFORM_OBJ_C_OUT_PATH" \
146
- --rm \
147
- "$PROTOC_IMAGE" \
148
- --plugin=protoc-gen-grpc=/usr/bin/grpc_objective_c_plugin \
149
- --objc_out="$PLATFORM_OBJ_C_OUT_PATH" \
150
- --grpc_out="$PLATFORM_OBJ_C_OUT_PATH" \
151
- --proto_path="$PLATFORM_PROTO_PATH" \
152
- -I="$PLATFORM_PROTO_PATH" \
153
- "platform.proto"
152
+ -v "$PLATFORM_OBJ_C_OUT_PATH:$PLATFORM_OBJ_C_OUT_PATH" \
153
+ --rm \
154
+ "$PROTOC_IMAGE" \
155
+ --plugin=protoc-gen-grpc=/usr/bin/grpc_objective_c_plugin \
156
+ --objc_out="$PLATFORM_OBJ_C_OUT_PATH" \
157
+ --grpc_out="$PLATFORM_OBJ_C_OUT_PATH" \
158
+ --proto_path="$PLATFORM_PROTO_PATH" \
159
+ -I="$PLATFORM_PROTO_PATH" \
160
+ "platform.proto"
154
161
 
155
162
  #####################################
156
163
  # Generate Python client for `Core` #
157
164
  #####################################
158
165
 
159
- rm -rf "$CORE_PYTHON_OUT_PATH/*"
166
+ rm -rf "${CORE_PYTHON_OUT_PATH:?}/*" || true
160
167
 
161
168
  docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
162
- -v "$CORE_PYTHON_OUT_PATH:$CORE_PYTHON_OUT_PATH" \
163
- --rm \
164
- "$PROTOC_IMAGE" \
165
- --plugin=protoc-gen-grpc=/usr/bin/grpc_python_plugin \
166
- --python_out="$CORE_PYTHON_OUT_PATH" \
167
- --grpc_out="$CORE_PYTHON_OUT_PATH" \
168
- --proto_path="$CORE_PROTO_PATH" \
169
- -I="$CORE_PROTO_PATH" \
170
- "core.proto"
169
+ -v "$CORE_PYTHON_OUT_PATH:$CORE_PYTHON_OUT_PATH" \
170
+ --rm \
171
+ "$PROTOC_IMAGE" \
172
+ --plugin=protoc-gen-grpc=/usr/bin/grpc_python_plugin \
173
+ --python_out="$CORE_PYTHON_OUT_PATH" \
174
+ --grpc_out="$CORE_PYTHON_OUT_PATH" \
175
+ --proto_path="$CORE_PROTO_PATH" \
176
+ -I="$CORE_PROTO_PATH" \
177
+ "core.proto"
171
178
 
172
179
  #########################################
173
180
  # Generate Python client for `Platform` #
174
181
  #########################################
175
182
 
176
- rm -rf "$PLATFORM_PYTHON_OUT_PATH/*"
177
-
178
- docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
179
- -v "$PLATFORM_PYTHON_OUT_PATH:$PLATFORM_PYTHON_OUT_PATH" \
180
- --rm \
181
- "$PROTOC_IMAGE" \
182
- --plugin=protoc-gen-grpc=/usr/bin/grpc_python_plugin \
183
- --python_out="$PLATFORM_PYTHON_OUT_PATH" \
184
- --grpc_out="$PLATFORM_PYTHON_OUT_PATH" \
185
- --proto_path="$PLATFORM_PROTO_PATH" \
186
- -I="$PLATFORM_PROTO_PATH" \
187
- "platform.proto"
188
-
189
- ###################################
190
- # Generate Rust client for `Core` #
191
- ###################################
192
-
193
- rm -rf "$CORE_RUST_OUT_PATH/*"
194
-
195
- docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
196
- -v "$CORE_RUST_OUT_PATH:$CORE_RUST_OUT_PATH" \
197
- --rm \
198
- "$PROTOC_IMAGE" \
199
- --plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-rust \
200
- --rust_out="$CORE_RUST_OUT_PATH" \
201
- --grpc_out="$CORE_RUST_OUT_PATH" \
202
- --proto_path="$CORE_PROTO_PATH" \
203
- -I="$CORE_PROTO_PATH" \
204
- "core.proto"
205
-
206
- #######################################
207
- # Generate Rust client for `Platform` #
208
- #######################################
209
-
210
- rm -rf "$PLATFORM_RUST_OUT_PATH/*"
183
+ rm -rf "${PLATFORM_PYTHON_OUT_PATH:?}/*" || true
211
184
 
212
185
  docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
213
- -v "$PLATFORM_RUST_OUT_PATH:$PLATFORM_RUST_OUT_PATH" \
214
- --rm \
215
- "$PROTOC_IMAGE" \
216
- --plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-rust \
217
- --rust_out="$PLATFORM_RUST_OUT_PATH" \
218
- --grpc_out="$PLATFORM_RUST_OUT_PATH" \
219
- --proto_path="$PLATFORM_PROTO_PATH" \
220
- -I="$PLATFORM_PROTO_PATH" \
221
- "platform.proto"
186
+ -v "$PLATFORM_PYTHON_OUT_PATH:$PLATFORM_PYTHON_OUT_PATH" \
187
+ --rm \
188
+ "$PROTOC_IMAGE" \
189
+ --plugin=protoc-gen-grpc=/usr/bin/grpc_python_plugin \
190
+ --python_out="$PLATFORM_PYTHON_OUT_PATH" \
191
+ --grpc_out="$PLATFORM_PYTHON_OUT_PATH" \
192
+ --proto_path="$PLATFORM_PROTO_PATH" \
193
+ -I="$PLATFORM_PROTO_PATH" \
194
+ "platform.proto"
195
+
196
+ # Patch generated protobuf files
197
+ exec "${PWD}/scripts/patch-protobuf-js.sh"
@@ -1,21 +1,22 @@
1
1
  #!/bin/bash
2
+ # shellcheck disable=SC2250
3
+ set -e
2
4
 
3
5
  files=$(find "$PWD/clients/core/v0/web" "$PWD/clients/core/v0/nodejs" "$PWD/clients/platform/v0/web" "$PWD/clients/platform/v0/nodejs" -name "*_pb.js" -o -name "*_protoc.js")
4
6
  OS=$(uname)
5
7
 
6
8
  function replace_in_file() {
7
- if [ "$OS" = 'Darwin' ]; then
8
- # for MacOS
9
- sed -i '' -e "$1" "$2"
10
- else
11
- # for Linux and Windows
12
- sed -i'' -e "$1" "$2"
13
- fi
9
+ if [[ "$OS" = 'Darwin' ]]; then
10
+ # for MacOS
11
+ sed -i '' -e "$1" "$2"
12
+ else
13
+ # for Linux and Windows
14
+ sed -i'' -e "$1" "$2"
15
+ fi
14
16
  }
15
17
 
16
18
  # Loop over the files
17
- for file in $files
18
- do
19
+ for file in $files; do
19
20
 
20
21
  replace_in_file 's/var global = Function('\''return this'\'')();/const proto = {};/g' "$file"
21
22
  if grep -qrE "[^a-zA-Z]Function\(" "$file"; then