protobuf-platform 1.0.9 → 1.0.11

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.
@@ -8,6 +8,7 @@ service Config {
8
8
  rpc getConfigSettings(SettingsRequest) returns (SettingsResponse);
9
9
  //Set config for particular customer
10
10
  rpc setConfig(ConfigRequest) returns (ConfigStatusResponse);
11
+ rpc getConfig(ConfigRequest) returns (ConfigDataResponse);
11
12
  }
12
13
 
13
14
  message PingRequest { string ping = 1; }
@@ -29,8 +30,11 @@ message ConfigRequest {
29
30
  string environment = 1;
30
31
  string customer = 2;
31
32
  string service_key = 3;
32
- string service_data = 4;
33
+ optional string service_data = 4;
33
34
  }
34
35
  message ConfigStatusResponse {
35
36
  string status = 1;
37
+ }
38
+ message ConfigDataResponse {
39
+ string data = 1;
36
40
  }
@@ -4,6 +4,17 @@
4
4
  var grpc = require('@grpc/grpc-js');
5
5
  var config_pb = require('./config_pb.js');
6
6
 
7
+ function serialize_config_ConfigDataResponse(arg) {
8
+ if (!(arg instanceof config_pb.ConfigDataResponse)) {
9
+ throw new Error('Expected argument of type config.ConfigDataResponse');
10
+ }
11
+ return Buffer.from(arg.serializeBinary());
12
+ }
13
+
14
+ function deserialize_config_ConfigDataResponse(buffer_arg) {
15
+ return config_pb.ConfigDataResponse.deserializeBinary(new Uint8Array(buffer_arg));
16
+ }
17
+
7
18
  function serialize_config_ConfigRequest(arg) {
8
19
  if (!(arg instanceof config_pb.ConfigRequest)) {
9
20
  throw new Error('Expected argument of type config.ConfigRequest');
@@ -107,6 +118,17 @@ setConfig: {
107
118
  responseSerialize: serialize_config_ConfigStatusResponse,
108
119
  responseDeserialize: deserialize_config_ConfigStatusResponse,
109
120
  },
121
+ getConfig: {
122
+ path: '/config.Config/getConfig',
123
+ requestStream: false,
124
+ responseStream: false,
125
+ requestType: config_pb.ConfigRequest,
126
+ responseType: config_pb.ConfigDataResponse,
127
+ requestSerialize: serialize_config_ConfigRequest,
128
+ requestDeserialize: deserialize_config_ConfigRequest,
129
+ responseSerialize: serialize_config_ConfigDataResponse,
130
+ responseDeserialize: deserialize_config_ConfigDataResponse,
131
+ },
110
132
  };
111
133
 
112
134
  exports.ConfigClient = grpc.makeGenericClientConstructor(ConfigService);
@@ -21,6 +21,7 @@ var global = (function() {
21
21
  return Function('return this')();
22
22
  }.call(null));
23
23
 
24
+ goog.exportSymbol('proto.config.ConfigDataResponse', null, global);
24
25
  goog.exportSymbol('proto.config.ConfigRequest', null, global);
25
26
  goog.exportSymbol('proto.config.ConfigStatusResponse', null, global);
26
27
  goog.exportSymbol('proto.config.PingRequest', null, global);
@@ -153,6 +154,27 @@ if (goog.DEBUG && !COMPILED) {
153
154
  */
154
155
  proto.config.ConfigStatusResponse.displayName = 'proto.config.ConfigStatusResponse';
155
156
  }
157
+ /**
158
+ * Generated by JsPbCodeGenerator.
159
+ * @param {Array=} opt_data Optional initial data array, typically from a
160
+ * server response, or constructed directly in Javascript. The array is used
161
+ * in place and becomes part of the constructed object. It is not cloned.
162
+ * If no data is provided, the constructed object will be empty, but still
163
+ * valid.
164
+ * @extends {jspb.Message}
165
+ * @constructor
166
+ */
167
+ proto.config.ConfigDataResponse = function(opt_data) {
168
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
169
+ };
170
+ goog.inherits(proto.config.ConfigDataResponse, jspb.Message);
171
+ if (goog.DEBUG && !COMPILED) {
172
+ /**
173
+ * @public
174
+ * @override
175
+ */
176
+ proto.config.ConfigDataResponse.displayName = 'proto.config.ConfigDataResponse';
177
+ }
156
178
 
157
179
 
158
180
 
@@ -1003,8 +1025,8 @@ proto.config.ConfigRequest.serializeBinaryToWriter = function(message, writer) {
1003
1025
  f
1004
1026
  );
1005
1027
  }
1006
- f = message.getServiceData();
1007
- if (f.length > 0) {
1028
+ f = /** @type {string} */ (jspb.Message.getField(message, 4));
1029
+ if (f != null) {
1008
1030
  writer.writeString(
1009
1031
  4,
1010
1032
  f
@@ -1081,7 +1103,25 @@ proto.config.ConfigRequest.prototype.getServiceData = function() {
1081
1103
  * @return {!proto.config.ConfigRequest} returns this
1082
1104
  */
1083
1105
  proto.config.ConfigRequest.prototype.setServiceData = function(value) {
1084
- return jspb.Message.setProto3StringField(this, 4, value);
1106
+ return jspb.Message.setField(this, 4, value);
1107
+ };
1108
+
1109
+
1110
+ /**
1111
+ * Clears the field making it undefined.
1112
+ * @return {!proto.config.ConfigRequest} returns this
1113
+ */
1114
+ proto.config.ConfigRequest.prototype.clearServiceData = function() {
1115
+ return jspb.Message.setField(this, 4, undefined);
1116
+ };
1117
+
1118
+
1119
+ /**
1120
+ * Returns whether this field is set.
1121
+ * @return {boolean}
1122
+ */
1123
+ proto.config.ConfigRequest.prototype.hasServiceData = function() {
1124
+ return jspb.Message.getField(this, 4) != null;
1085
1125
  };
1086
1126
 
1087
1127
 
@@ -1215,4 +1255,134 @@ proto.config.ConfigStatusResponse.prototype.setStatus = function(value) {
1215
1255
  };
1216
1256
 
1217
1257
 
1258
+
1259
+
1260
+
1261
+ if (jspb.Message.GENERATE_TO_OBJECT) {
1262
+ /**
1263
+ * Creates an object representation of this proto.
1264
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
1265
+ * Optional fields that are not set will be set to undefined.
1266
+ * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
1267
+ * For the list of reserved names please see:
1268
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
1269
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
1270
+ * JSPB instance for transitional soy proto support:
1271
+ * http://goto/soy-param-migration
1272
+ * @return {!Object}
1273
+ */
1274
+ proto.config.ConfigDataResponse.prototype.toObject = function(opt_includeInstance) {
1275
+ return proto.config.ConfigDataResponse.toObject(opt_includeInstance, this);
1276
+ };
1277
+
1278
+
1279
+ /**
1280
+ * Static version of the {@see toObject} method.
1281
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
1282
+ * the JSPB instance for transitional soy proto support:
1283
+ * http://goto/soy-param-migration
1284
+ * @param {!proto.config.ConfigDataResponse} msg The msg instance to transform.
1285
+ * @return {!Object}
1286
+ * @suppress {unusedLocalVariables} f is only used for nested messages
1287
+ */
1288
+ proto.config.ConfigDataResponse.toObject = function(includeInstance, msg) {
1289
+ var f, obj = {
1290
+ data: jspb.Message.getFieldWithDefault(msg, 1, "")
1291
+ };
1292
+
1293
+ if (includeInstance) {
1294
+ obj.$jspbMessageInstance = msg;
1295
+ }
1296
+ return obj;
1297
+ };
1298
+ }
1299
+
1300
+
1301
+ /**
1302
+ * Deserializes binary data (in protobuf wire format).
1303
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
1304
+ * @return {!proto.config.ConfigDataResponse}
1305
+ */
1306
+ proto.config.ConfigDataResponse.deserializeBinary = function(bytes) {
1307
+ var reader = new jspb.BinaryReader(bytes);
1308
+ var msg = new proto.config.ConfigDataResponse;
1309
+ return proto.config.ConfigDataResponse.deserializeBinaryFromReader(msg, reader);
1310
+ };
1311
+
1312
+
1313
+ /**
1314
+ * Deserializes binary data (in protobuf wire format) from the
1315
+ * given reader into the given message object.
1316
+ * @param {!proto.config.ConfigDataResponse} msg The message object to deserialize into.
1317
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
1318
+ * @return {!proto.config.ConfigDataResponse}
1319
+ */
1320
+ proto.config.ConfigDataResponse.deserializeBinaryFromReader = function(msg, reader) {
1321
+ while (reader.nextField()) {
1322
+ if (reader.isEndGroup()) {
1323
+ break;
1324
+ }
1325
+ var field = reader.getFieldNumber();
1326
+ switch (field) {
1327
+ case 1:
1328
+ var value = /** @type {string} */ (reader.readString());
1329
+ msg.setData(value);
1330
+ break;
1331
+ default:
1332
+ reader.skipField();
1333
+ break;
1334
+ }
1335
+ }
1336
+ return msg;
1337
+ };
1338
+
1339
+
1340
+ /**
1341
+ * Serializes the message to binary data (in protobuf wire format).
1342
+ * @return {!Uint8Array}
1343
+ */
1344
+ proto.config.ConfigDataResponse.prototype.serializeBinary = function() {
1345
+ var writer = new jspb.BinaryWriter();
1346
+ proto.config.ConfigDataResponse.serializeBinaryToWriter(this, writer);
1347
+ return writer.getResultBuffer();
1348
+ };
1349
+
1350
+
1351
+ /**
1352
+ * Serializes the given message to binary data (in protobuf wire
1353
+ * format), writing to the given BinaryWriter.
1354
+ * @param {!proto.config.ConfigDataResponse} message
1355
+ * @param {!jspb.BinaryWriter} writer
1356
+ * @suppress {unusedLocalVariables} f is only used for nested messages
1357
+ */
1358
+ proto.config.ConfigDataResponse.serializeBinaryToWriter = function(message, writer) {
1359
+ var f = undefined;
1360
+ f = message.getData();
1361
+ if (f.length > 0) {
1362
+ writer.writeString(
1363
+ 1,
1364
+ f
1365
+ );
1366
+ }
1367
+ };
1368
+
1369
+
1370
+ /**
1371
+ * optional string data = 1;
1372
+ * @return {string}
1373
+ */
1374
+ proto.config.ConfigDataResponse.prototype.getData = function() {
1375
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
1376
+ };
1377
+
1378
+
1379
+ /**
1380
+ * @param {string} value
1381
+ * @return {!proto.config.ConfigDataResponse} returns this
1382
+ */
1383
+ proto.config.ConfigDataResponse.prototype.setData = function(value) {
1384
+ return jspb.Message.setProto3StringField(this, 1, value);
1385
+ };
1386
+
1387
+
1218
1388
  goog.object.extend(exports, proto.config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "protobuf-platform",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Protobuf structures",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- grpc_tools_node_protoc --js_out=import_style=commonjs,binary:config --grpc_out=grpc_js:config --proto_path=./config ./config/*.proto
3
+ grpc_tools_node_protoc --js_out=import_style=commonjs,binary:config --grpc_out=grpc_js:config --proto_path=./config ./config/*.proto &&
4
+ grpc_tools_node_protoc --js_out=import_style=commonjs,binary:user --grpc_out=grpc_js:user --proto_path=./user ./user/*.proto
@@ -0,0 +1,50 @@
1
+ syntax = "proto3";
2
+
3
+ package user;
4
+
5
+ service Config {
6
+ rpc checkConnection(PingRequest) returns (PongResponse);
7
+ //Fetch settings for particular service
8
+ rpc signUp(RegistrationRequest) returns (LoggedInResponse);
9
+ rpc signIn(LoginRequest) returns (LoggedInResponse);
10
+ rpc getUserData(UserDataRequest) returns (UserDataResponse);
11
+ }
12
+
13
+ message PingRequest { string ping = 1; }
14
+ message PongResponse { string pong = 1; }
15
+
16
+ //Auth [Registration & Login]
17
+ message RegistrationRequest {
18
+ string email = 1;
19
+ string password = 2;
20
+ string currency = 3;
21
+ string country = 4;
22
+ optional string first_name = 5;
23
+ optional string last_name = 6;
24
+ optional string birthday = 7;
25
+ optional string locale = 8;
26
+ }
27
+ message LoggedInResponse {
28
+ int32 id = 1;
29
+ string public_id = 2;
30
+ string currency = 3;
31
+ string country = 4;
32
+ }
33
+ message LoginRequest {
34
+ string email = 1;
35
+ string password = 2;
36
+ }
37
+ message UserDataRequest {
38
+ int32 id = 1;
39
+ }
40
+ message UserDataResponse {
41
+ int32 id = 1;
42
+ string public_id = 2;
43
+ string email = 3;
44
+ optional string currency = 4;
45
+ optional string country = 5;
46
+ optional string first_name = 6;
47
+ optional string last_name = 7;
48
+ optional string birthday = 8;
49
+ optional string locale = 9;
50
+ }
@@ -0,0 +1,133 @@
1
+ // GENERATED CODE -- DO NOT EDIT!
2
+
3
+ 'use strict';
4
+ var grpc = require('@grpc/grpc-js');
5
+ var user_pb = require('./user_pb.js');
6
+
7
+ function serialize_user_LoggedInResponse(arg) {
8
+ if (!(arg instanceof user_pb.LoggedInResponse)) {
9
+ throw new Error('Expected argument of type user.LoggedInResponse');
10
+ }
11
+ return Buffer.from(arg.serializeBinary());
12
+ }
13
+
14
+ function deserialize_user_LoggedInResponse(buffer_arg) {
15
+ return user_pb.LoggedInResponse.deserializeBinary(new Uint8Array(buffer_arg));
16
+ }
17
+
18
+ function serialize_user_LoginRequest(arg) {
19
+ if (!(arg instanceof user_pb.LoginRequest)) {
20
+ throw new Error('Expected argument of type user.LoginRequest');
21
+ }
22
+ return Buffer.from(arg.serializeBinary());
23
+ }
24
+
25
+ function deserialize_user_LoginRequest(buffer_arg) {
26
+ return user_pb.LoginRequest.deserializeBinary(new Uint8Array(buffer_arg));
27
+ }
28
+
29
+ function serialize_user_PingRequest(arg) {
30
+ if (!(arg instanceof user_pb.PingRequest)) {
31
+ throw new Error('Expected argument of type user.PingRequest');
32
+ }
33
+ return Buffer.from(arg.serializeBinary());
34
+ }
35
+
36
+ function deserialize_user_PingRequest(buffer_arg) {
37
+ return user_pb.PingRequest.deserializeBinary(new Uint8Array(buffer_arg));
38
+ }
39
+
40
+ function serialize_user_PongResponse(arg) {
41
+ if (!(arg instanceof user_pb.PongResponse)) {
42
+ throw new Error('Expected argument of type user.PongResponse');
43
+ }
44
+ return Buffer.from(arg.serializeBinary());
45
+ }
46
+
47
+ function deserialize_user_PongResponse(buffer_arg) {
48
+ return user_pb.PongResponse.deserializeBinary(new Uint8Array(buffer_arg));
49
+ }
50
+
51
+ function serialize_user_RegistrationRequest(arg) {
52
+ if (!(arg instanceof user_pb.RegistrationRequest)) {
53
+ throw new Error('Expected argument of type user.RegistrationRequest');
54
+ }
55
+ return Buffer.from(arg.serializeBinary());
56
+ }
57
+
58
+ function deserialize_user_RegistrationRequest(buffer_arg) {
59
+ return user_pb.RegistrationRequest.deserializeBinary(new Uint8Array(buffer_arg));
60
+ }
61
+
62
+ function serialize_user_UserDataRequest(arg) {
63
+ if (!(arg instanceof user_pb.UserDataRequest)) {
64
+ throw new Error('Expected argument of type user.UserDataRequest');
65
+ }
66
+ return Buffer.from(arg.serializeBinary());
67
+ }
68
+
69
+ function deserialize_user_UserDataRequest(buffer_arg) {
70
+ return user_pb.UserDataRequest.deserializeBinary(new Uint8Array(buffer_arg));
71
+ }
72
+
73
+ function serialize_user_UserDataResponse(arg) {
74
+ if (!(arg instanceof user_pb.UserDataResponse)) {
75
+ throw new Error('Expected argument of type user.UserDataResponse');
76
+ }
77
+ return Buffer.from(arg.serializeBinary());
78
+ }
79
+
80
+ function deserialize_user_UserDataResponse(buffer_arg) {
81
+ return user_pb.UserDataResponse.deserializeBinary(new Uint8Array(buffer_arg));
82
+ }
83
+
84
+
85
+ var ConfigService = exports.ConfigService = {
86
+ checkConnection: {
87
+ path: '/user.Config/checkConnection',
88
+ requestStream: false,
89
+ responseStream: false,
90
+ requestType: user_pb.PingRequest,
91
+ responseType: user_pb.PongResponse,
92
+ requestSerialize: serialize_user_PingRequest,
93
+ requestDeserialize: deserialize_user_PingRequest,
94
+ responseSerialize: serialize_user_PongResponse,
95
+ responseDeserialize: deserialize_user_PongResponse,
96
+ },
97
+ // Fetch settings for particular service
98
+ signUp: {
99
+ path: '/user.Config/signUp',
100
+ requestStream: false,
101
+ responseStream: false,
102
+ requestType: user_pb.RegistrationRequest,
103
+ responseType: user_pb.LoggedInResponse,
104
+ requestSerialize: serialize_user_RegistrationRequest,
105
+ requestDeserialize: deserialize_user_RegistrationRequest,
106
+ responseSerialize: serialize_user_LoggedInResponse,
107
+ responseDeserialize: deserialize_user_LoggedInResponse,
108
+ },
109
+ signIn: {
110
+ path: '/user.Config/signIn',
111
+ requestStream: false,
112
+ responseStream: false,
113
+ requestType: user_pb.LoginRequest,
114
+ responseType: user_pb.LoggedInResponse,
115
+ requestSerialize: serialize_user_LoginRequest,
116
+ requestDeserialize: deserialize_user_LoginRequest,
117
+ responseSerialize: serialize_user_LoggedInResponse,
118
+ responseDeserialize: deserialize_user_LoggedInResponse,
119
+ },
120
+ getUserData: {
121
+ path: '/user.Config/getUserData',
122
+ requestStream: false,
123
+ responseStream: false,
124
+ requestType: user_pb.UserDataRequest,
125
+ responseType: user_pb.UserDataResponse,
126
+ requestSerialize: serialize_user_UserDataRequest,
127
+ requestDeserialize: deserialize_user_UserDataRequest,
128
+ responseSerialize: serialize_user_UserDataResponse,
129
+ responseDeserialize: deserialize_user_UserDataResponse,
130
+ },
131
+ };
132
+
133
+ exports.ConfigClient = grpc.makeGenericClientConstructor(ConfigService);