@dashevo/dapi-grpc 0.25.0-dev.2 → 0.25.0-dev.21

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"
@@ -20,25 +28,27 @@ PLATFORM_PYTHON_OUT_PATH="$PLATFORM_CLIENTS_PATH/python"
20
28
 
21
29
  PROTOC_IMAGE="rvolosatovs/protoc:4.0.0"
22
30
 
31
+ set -ex
32
+
23
33
  #################################################
24
34
  # Generate JavaScript client for `Core` service #
25
35
  #################################################
26
36
 
27
- rm -rf "$CORE_WEB_OUT_PATH/*"
37
+ rm -rf "${CORE_WEB_OUT_PATH:?}/*" || true
28
38
 
29
39
  docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
30
- -v "$CORE_WEB_OUT_PATH:$CORE_WEB_OUT_PATH" \
31
- --rm \
32
- "$PROTOC_IMAGE" \
33
- --js_out="import_style=commonjs:$CORE_WEB_OUT_PATH" \
34
- --ts_out="service=grpc-web:$CORE_WEB_OUT_PATH" \
35
- -I="$CORE_PROTO_PATH" \
36
- "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"
37
47
 
38
48
  # Clean node message classes
39
49
 
40
- rm -rf "$CORE_CLIENTS_PATH/nodejs/*_protoc.js"
41
- 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
42
52
 
43
53
  # Copy compiled modules with message classes
44
54
 
@@ -56,21 +66,21 @@ pbjs \
56
66
  # Generate JavaScript client for `Platform` service #
57
67
  #####################################################
58
68
 
59
- rm -rf "$PLATFORM_WEB_OUT_PATH/*"
69
+ rm -rf "${PLATFORM_WEB_OUT_PATH:?}/*" || true
60
70
 
61
71
  docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
62
- -v "$PLATFORM_WEB_OUT_PATH:$PLATFORM_WEB_OUT_PATH" \
63
- --rm \
64
- "$PROTOC_IMAGE" \
65
- --js_out="import_style=commonjs:$PLATFORM_WEB_OUT_PATH" \
66
- --ts_out="service=grpc-web:$PLATFORM_WEB_OUT_PATH" \
67
- -I="$PLATFORM_PROTO_PATH" \
68
- "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"
69
79
 
70
80
  # Clean node message classes
71
81
 
72
- rm -rf "$PLATFORM_CLIENTS_PATH/nodejs/*_protoc.js"
73
- 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
74
84
 
75
85
  # Copy compiled modules with message classes
76
86
 
@@ -87,98 +97,101 @@ pbjs \
87
97
  # Generate Java client for `Core` #
88
98
  ###################################
89
99
 
90
- rm -rf "$CORE_JAVA_OUT_PATH/*"
100
+ rm -rf "${CORE_JAVA_OUT_PATH:?}/*" || true
91
101
 
92
102
  docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
93
- -v "$CORE_JAVA_OUT_PATH:$CORE_JAVA_OUT_PATH" \
94
- --rm \
95
- "$PROTOC_IMAGE" \
96
- --plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-java \
97
- --grpc-java_out="$CORE_JAVA_OUT_PATH" \
98
- --proto_path="$CORE_PROTO_PATH" \
99
- -I="$CORE_PROTO_PATH" \
100
- "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"
101
111
 
102
112
  #######################################
103
113
  # Generate Java client for `Platform` #
104
114
  #######################################
105
115
 
106
- rm -rf "$PLATFORM_JAVA_OUT_PATH/*"
116
+ rm -rf "${PLATFORM_JAVA_OUT_PATH:?}/*" || true
107
117
 
108
118
  docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
109
- -v "$PLATFORM_JAVA_OUT_PATH:$PLATFORM_JAVA_OUT_PATH" \
110
- --rm \
111
- "$PROTOC_IMAGE" \
112
- --plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-java \
113
- --grpc-java_out="$PLATFORM_JAVA_OUT_PATH" \
114
- --proto_path="$PLATFORM_PROTO_PATH" \
115
- -I="$PLATFORM_PROTO_PATH" \
116
- "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"
117
127
 
118
128
  ##########################################
119
129
  # Generate Objective-C client for `Core` #
120
130
  ##########################################
121
131
 
122
- rm -rf "$CORE_OBJ_C_OUT_PATH/*"
132
+ rm -rf "${CORE_OBJ_C_OUT_PATH:?}/*" || true
123
133
 
124
134
  docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
125
- -v "$CORE_OBJ_C_OUT_PATH:$CORE_OBJ_C_OUT_PATH" \
126
- --rm \
127
- "$PROTOC_IMAGE" \
128
- --plugin=protoc-gen-grpc=/usr/bin/grpc_objective_c_plugin \
129
- --objc_out="$CORE_OBJ_C_OUT_PATH" \
130
- --grpc_out="$CORE_OBJ_C_OUT_PATH" \
131
- --proto_path="$CORE_PROTO_PATH" \
132
- -I="$CORE_PROTO_PATH" \
133
- "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"
134
144
 
135
145
  ##############################################
136
146
  # Generate Objective-C client for `Platform` #
137
147
  ##############################################
138
148
 
139
- rm -rf "$PLATFORM_OBJ_C_OUT_PATH/*"
149
+ rm -rf "${PLATFORM_OBJ_C_OUT_PATH:?}/*" || true
140
150
 
141
151
  docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
142
- -v "$PLATFORM_OBJ_C_OUT_PATH:$PLATFORM_OBJ_C_OUT_PATH" \
143
- --rm \
144
- "$PROTOC_IMAGE" \
145
- --plugin=protoc-gen-grpc=/usr/bin/grpc_objective_c_plugin \
146
- --objc_out="$PLATFORM_OBJ_C_OUT_PATH" \
147
- --grpc_out="$PLATFORM_OBJ_C_OUT_PATH" \
148
- --proto_path="$PLATFORM_PROTO_PATH" \
149
- -I="$PLATFORM_PROTO_PATH" \
150
- "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"
151
161
 
152
162
  #####################################
153
163
  # Generate Python client for `Core` #
154
164
  #####################################
155
165
 
156
- rm -rf "$CORE_PYTHON_OUT_PATH/*"
166
+ rm -rf "${CORE_PYTHON_OUT_PATH:?}/*" || true
157
167
 
158
168
  docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
159
- -v "$CORE_PYTHON_OUT_PATH:$CORE_PYTHON_OUT_PATH" \
160
- --rm \
161
- "$PROTOC_IMAGE" \
162
- --plugin=protoc-gen-grpc=/usr/bin/grpc_python_plugin \
163
- --python_out="$CORE_PYTHON_OUT_PATH" \
164
- --grpc_out="$CORE_PYTHON_OUT_PATH" \
165
- --proto_path="$CORE_PROTO_PATH" \
166
- -I="$CORE_PROTO_PATH" \
167
- "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"
168
178
 
169
179
  #########################################
170
180
  # Generate Python client for `Platform` #
171
181
  #########################################
172
182
 
173
- rm -rf "$PLATFORM_PYTHON_OUT_PATH/*"
183
+ rm -rf "${PLATFORM_PYTHON_OUT_PATH:?}/*" || true
174
184
 
175
185
  docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
176
- -v "$PLATFORM_PYTHON_OUT_PATH:$PLATFORM_PYTHON_OUT_PATH" \
177
- --rm \
178
- "$PROTOC_IMAGE" \
179
- --plugin=protoc-gen-grpc=/usr/bin/grpc_python_plugin \
180
- --python_out="$PLATFORM_PYTHON_OUT_PATH" \
181
- --grpc_out="$PLATFORM_PYTHON_OUT_PATH" \
182
- --proto_path="$PLATFORM_PROTO_PATH" \
183
- -I="$PLATFORM_PROTO_PATH" \
184
- "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