protobuf-platform 1.0.7 → 1.0.9

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.
@@ -6,6 +6,8 @@ service Config {
6
6
  rpc checkConnection(PingRequest) returns (PongResponse);
7
7
  //Fetch settings for particular service
8
8
  rpc getConfigSettings(SettingsRequest) returns (SettingsResponse);
9
+ //Set config for particular customer
10
+ rpc setConfig(ConfigRequest) returns (ConfigStatusResponse);
9
11
  }
10
12
 
11
13
  message PingRequest { string ping = 1; }
@@ -21,4 +23,14 @@ message SettingsResponse {
21
23
  optional string mongo = 2;
22
24
  optional string my_sql = 3;
23
25
  optional string redis = 4;
26
+ }
27
+ //Config manipulating
28
+ message ConfigRequest {
29
+ string environment = 1;
30
+ string customer = 2;
31
+ string service_key = 3;
32
+ string service_data = 4;
33
+ }
34
+ message ConfigStatusResponse {
35
+ string status = 1;
24
36
  }
@@ -4,6 +4,28 @@
4
4
  var grpc = require('@grpc/grpc-js');
5
5
  var config_pb = require('./config_pb.js');
6
6
 
7
+ function serialize_config_ConfigRequest(arg) {
8
+ if (!(arg instanceof config_pb.ConfigRequest)) {
9
+ throw new Error('Expected argument of type config.ConfigRequest');
10
+ }
11
+ return Buffer.from(arg.serializeBinary());
12
+ }
13
+
14
+ function deserialize_config_ConfigRequest(buffer_arg) {
15
+ return config_pb.ConfigRequest.deserializeBinary(new Uint8Array(buffer_arg));
16
+ }
17
+
18
+ function serialize_config_ConfigStatusResponse(arg) {
19
+ if (!(arg instanceof config_pb.ConfigStatusResponse)) {
20
+ throw new Error('Expected argument of type config.ConfigStatusResponse');
21
+ }
22
+ return Buffer.from(arg.serializeBinary());
23
+ }
24
+
25
+ function deserialize_config_ConfigStatusResponse(buffer_arg) {
26
+ return config_pb.ConfigStatusResponse.deserializeBinary(new Uint8Array(buffer_arg));
27
+ }
28
+
7
29
  function serialize_config_PingRequest(arg) {
8
30
  if (!(arg instanceof config_pb.PingRequest)) {
9
31
  throw new Error('Expected argument of type config.PingRequest');
@@ -73,6 +95,18 @@ getConfigSettings: {
73
95
  responseSerialize: serialize_config_SettingsResponse,
74
96
  responseDeserialize: deserialize_config_SettingsResponse,
75
97
  },
98
+ // Set config for particular customer
99
+ setConfig: {
100
+ path: '/config.Config/setConfig',
101
+ requestStream: false,
102
+ responseStream: false,
103
+ requestType: config_pb.ConfigRequest,
104
+ responseType: config_pb.ConfigStatusResponse,
105
+ requestSerialize: serialize_config_ConfigRequest,
106
+ requestDeserialize: deserialize_config_ConfigRequest,
107
+ responseSerialize: serialize_config_ConfigStatusResponse,
108
+ responseDeserialize: deserialize_config_ConfigStatusResponse,
109
+ },
76
110
  };
77
111
 
78
112
  exports.ConfigClient = grpc.makeGenericClientConstructor(ConfigService);
@@ -21,6 +21,8 @@ var global = (function() {
21
21
  return Function('return this')();
22
22
  }.call(null));
23
23
 
24
+ goog.exportSymbol('proto.config.ConfigRequest', null, global);
25
+ goog.exportSymbol('proto.config.ConfigStatusResponse', null, global);
24
26
  goog.exportSymbol('proto.config.PingRequest', null, global);
25
27
  goog.exportSymbol('proto.config.PongResponse', null, global);
26
28
  goog.exportSymbol('proto.config.SettingsRequest', null, global);
@@ -109,6 +111,48 @@ if (goog.DEBUG && !COMPILED) {
109
111
  */
110
112
  proto.config.SettingsResponse.displayName = 'proto.config.SettingsResponse';
111
113
  }
114
+ /**
115
+ * Generated by JsPbCodeGenerator.
116
+ * @param {Array=} opt_data Optional initial data array, typically from a
117
+ * server response, or constructed directly in Javascript. The array is used
118
+ * in place and becomes part of the constructed object. It is not cloned.
119
+ * If no data is provided, the constructed object will be empty, but still
120
+ * valid.
121
+ * @extends {jspb.Message}
122
+ * @constructor
123
+ */
124
+ proto.config.ConfigRequest = function(opt_data) {
125
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
126
+ };
127
+ goog.inherits(proto.config.ConfigRequest, jspb.Message);
128
+ if (goog.DEBUG && !COMPILED) {
129
+ /**
130
+ * @public
131
+ * @override
132
+ */
133
+ proto.config.ConfigRequest.displayName = 'proto.config.ConfigRequest';
134
+ }
135
+ /**
136
+ * Generated by JsPbCodeGenerator.
137
+ * @param {Array=} opt_data Optional initial data array, typically from a
138
+ * server response, or constructed directly in Javascript. The array is used
139
+ * in place and becomes part of the constructed object. It is not cloned.
140
+ * If no data is provided, the constructed object will be empty, but still
141
+ * valid.
142
+ * @extends {jspb.Message}
143
+ * @constructor
144
+ */
145
+ proto.config.ConfigStatusResponse = function(opt_data) {
146
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
147
+ };
148
+ goog.inherits(proto.config.ConfigStatusResponse, jspb.Message);
149
+ if (goog.DEBUG && !COMPILED) {
150
+ /**
151
+ * @public
152
+ * @override
153
+ */
154
+ proto.config.ConfigStatusResponse.displayName = 'proto.config.ConfigStatusResponse';
155
+ }
112
156
 
113
157
 
114
158
 
@@ -821,4 +865,354 @@ proto.config.SettingsResponse.prototype.hasRedis = function() {
821
865
  };
822
866
 
823
867
 
868
+
869
+
870
+
871
+ if (jspb.Message.GENERATE_TO_OBJECT) {
872
+ /**
873
+ * Creates an object representation of this proto.
874
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
875
+ * Optional fields that are not set will be set to undefined.
876
+ * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
877
+ * For the list of reserved names please see:
878
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
879
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
880
+ * JSPB instance for transitional soy proto support:
881
+ * http://goto/soy-param-migration
882
+ * @return {!Object}
883
+ */
884
+ proto.config.ConfigRequest.prototype.toObject = function(opt_includeInstance) {
885
+ return proto.config.ConfigRequest.toObject(opt_includeInstance, this);
886
+ };
887
+
888
+
889
+ /**
890
+ * Static version of the {@see toObject} method.
891
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
892
+ * the JSPB instance for transitional soy proto support:
893
+ * http://goto/soy-param-migration
894
+ * @param {!proto.config.ConfigRequest} msg The msg instance to transform.
895
+ * @return {!Object}
896
+ * @suppress {unusedLocalVariables} f is only used for nested messages
897
+ */
898
+ proto.config.ConfigRequest.toObject = function(includeInstance, msg) {
899
+ var f, obj = {
900
+ environment: jspb.Message.getFieldWithDefault(msg, 1, ""),
901
+ customer: jspb.Message.getFieldWithDefault(msg, 2, ""),
902
+ serviceKey: jspb.Message.getFieldWithDefault(msg, 3, ""),
903
+ serviceData: jspb.Message.getFieldWithDefault(msg, 4, "")
904
+ };
905
+
906
+ if (includeInstance) {
907
+ obj.$jspbMessageInstance = msg;
908
+ }
909
+ return obj;
910
+ };
911
+ }
912
+
913
+
914
+ /**
915
+ * Deserializes binary data (in protobuf wire format).
916
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
917
+ * @return {!proto.config.ConfigRequest}
918
+ */
919
+ proto.config.ConfigRequest.deserializeBinary = function(bytes) {
920
+ var reader = new jspb.BinaryReader(bytes);
921
+ var msg = new proto.config.ConfigRequest;
922
+ return proto.config.ConfigRequest.deserializeBinaryFromReader(msg, reader);
923
+ };
924
+
925
+
926
+ /**
927
+ * Deserializes binary data (in protobuf wire format) from the
928
+ * given reader into the given message object.
929
+ * @param {!proto.config.ConfigRequest} msg The message object to deserialize into.
930
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
931
+ * @return {!proto.config.ConfigRequest}
932
+ */
933
+ proto.config.ConfigRequest.deserializeBinaryFromReader = function(msg, reader) {
934
+ while (reader.nextField()) {
935
+ if (reader.isEndGroup()) {
936
+ break;
937
+ }
938
+ var field = reader.getFieldNumber();
939
+ switch (field) {
940
+ case 1:
941
+ var value = /** @type {string} */ (reader.readString());
942
+ msg.setEnvironment(value);
943
+ break;
944
+ case 2:
945
+ var value = /** @type {string} */ (reader.readString());
946
+ msg.setCustomer(value);
947
+ break;
948
+ case 3:
949
+ var value = /** @type {string} */ (reader.readString());
950
+ msg.setServiceKey(value);
951
+ break;
952
+ case 4:
953
+ var value = /** @type {string} */ (reader.readString());
954
+ msg.setServiceData(value);
955
+ break;
956
+ default:
957
+ reader.skipField();
958
+ break;
959
+ }
960
+ }
961
+ return msg;
962
+ };
963
+
964
+
965
+ /**
966
+ * Serializes the message to binary data (in protobuf wire format).
967
+ * @return {!Uint8Array}
968
+ */
969
+ proto.config.ConfigRequest.prototype.serializeBinary = function() {
970
+ var writer = new jspb.BinaryWriter();
971
+ proto.config.ConfigRequest.serializeBinaryToWriter(this, writer);
972
+ return writer.getResultBuffer();
973
+ };
974
+
975
+
976
+ /**
977
+ * Serializes the given message to binary data (in protobuf wire
978
+ * format), writing to the given BinaryWriter.
979
+ * @param {!proto.config.ConfigRequest} message
980
+ * @param {!jspb.BinaryWriter} writer
981
+ * @suppress {unusedLocalVariables} f is only used for nested messages
982
+ */
983
+ proto.config.ConfigRequest.serializeBinaryToWriter = function(message, writer) {
984
+ var f = undefined;
985
+ f = message.getEnvironment();
986
+ if (f.length > 0) {
987
+ writer.writeString(
988
+ 1,
989
+ f
990
+ );
991
+ }
992
+ f = message.getCustomer();
993
+ if (f.length > 0) {
994
+ writer.writeString(
995
+ 2,
996
+ f
997
+ );
998
+ }
999
+ f = message.getServiceKey();
1000
+ if (f.length > 0) {
1001
+ writer.writeString(
1002
+ 3,
1003
+ f
1004
+ );
1005
+ }
1006
+ f = message.getServiceData();
1007
+ if (f.length > 0) {
1008
+ writer.writeString(
1009
+ 4,
1010
+ f
1011
+ );
1012
+ }
1013
+ };
1014
+
1015
+
1016
+ /**
1017
+ * optional string environment = 1;
1018
+ * @return {string}
1019
+ */
1020
+ proto.config.ConfigRequest.prototype.getEnvironment = function() {
1021
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
1022
+ };
1023
+
1024
+
1025
+ /**
1026
+ * @param {string} value
1027
+ * @return {!proto.config.ConfigRequest} returns this
1028
+ */
1029
+ proto.config.ConfigRequest.prototype.setEnvironment = function(value) {
1030
+ return jspb.Message.setProto3StringField(this, 1, value);
1031
+ };
1032
+
1033
+
1034
+ /**
1035
+ * optional string customer = 2;
1036
+ * @return {string}
1037
+ */
1038
+ proto.config.ConfigRequest.prototype.getCustomer = function() {
1039
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
1040
+ };
1041
+
1042
+
1043
+ /**
1044
+ * @param {string} value
1045
+ * @return {!proto.config.ConfigRequest} returns this
1046
+ */
1047
+ proto.config.ConfigRequest.prototype.setCustomer = function(value) {
1048
+ return jspb.Message.setProto3StringField(this, 2, value);
1049
+ };
1050
+
1051
+
1052
+ /**
1053
+ * optional string service_key = 3;
1054
+ * @return {string}
1055
+ */
1056
+ proto.config.ConfigRequest.prototype.getServiceKey = function() {
1057
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
1058
+ };
1059
+
1060
+
1061
+ /**
1062
+ * @param {string} value
1063
+ * @return {!proto.config.ConfigRequest} returns this
1064
+ */
1065
+ proto.config.ConfigRequest.prototype.setServiceKey = function(value) {
1066
+ return jspb.Message.setProto3StringField(this, 3, value);
1067
+ };
1068
+
1069
+
1070
+ /**
1071
+ * optional string service_data = 4;
1072
+ * @return {string}
1073
+ */
1074
+ proto.config.ConfigRequest.prototype.getServiceData = function() {
1075
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
1076
+ };
1077
+
1078
+
1079
+ /**
1080
+ * @param {string} value
1081
+ * @return {!proto.config.ConfigRequest} returns this
1082
+ */
1083
+ proto.config.ConfigRequest.prototype.setServiceData = function(value) {
1084
+ return jspb.Message.setProto3StringField(this, 4, value);
1085
+ };
1086
+
1087
+
1088
+
1089
+
1090
+
1091
+ if (jspb.Message.GENERATE_TO_OBJECT) {
1092
+ /**
1093
+ * Creates an object representation of this proto.
1094
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
1095
+ * Optional fields that are not set will be set to undefined.
1096
+ * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
1097
+ * For the list of reserved names please see:
1098
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
1099
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
1100
+ * JSPB instance for transitional soy proto support:
1101
+ * http://goto/soy-param-migration
1102
+ * @return {!Object}
1103
+ */
1104
+ proto.config.ConfigStatusResponse.prototype.toObject = function(opt_includeInstance) {
1105
+ return proto.config.ConfigStatusResponse.toObject(opt_includeInstance, this);
1106
+ };
1107
+
1108
+
1109
+ /**
1110
+ * Static version of the {@see toObject} method.
1111
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
1112
+ * the JSPB instance for transitional soy proto support:
1113
+ * http://goto/soy-param-migration
1114
+ * @param {!proto.config.ConfigStatusResponse} msg The msg instance to transform.
1115
+ * @return {!Object}
1116
+ * @suppress {unusedLocalVariables} f is only used for nested messages
1117
+ */
1118
+ proto.config.ConfigStatusResponse.toObject = function(includeInstance, msg) {
1119
+ var f, obj = {
1120
+ status: jspb.Message.getFieldWithDefault(msg, 1, "")
1121
+ };
1122
+
1123
+ if (includeInstance) {
1124
+ obj.$jspbMessageInstance = msg;
1125
+ }
1126
+ return obj;
1127
+ };
1128
+ }
1129
+
1130
+
1131
+ /**
1132
+ * Deserializes binary data (in protobuf wire format).
1133
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
1134
+ * @return {!proto.config.ConfigStatusResponse}
1135
+ */
1136
+ proto.config.ConfigStatusResponse.deserializeBinary = function(bytes) {
1137
+ var reader = new jspb.BinaryReader(bytes);
1138
+ var msg = new proto.config.ConfigStatusResponse;
1139
+ return proto.config.ConfigStatusResponse.deserializeBinaryFromReader(msg, reader);
1140
+ };
1141
+
1142
+
1143
+ /**
1144
+ * Deserializes binary data (in protobuf wire format) from the
1145
+ * given reader into the given message object.
1146
+ * @param {!proto.config.ConfigStatusResponse} msg The message object to deserialize into.
1147
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
1148
+ * @return {!proto.config.ConfigStatusResponse}
1149
+ */
1150
+ proto.config.ConfigStatusResponse.deserializeBinaryFromReader = function(msg, reader) {
1151
+ while (reader.nextField()) {
1152
+ if (reader.isEndGroup()) {
1153
+ break;
1154
+ }
1155
+ var field = reader.getFieldNumber();
1156
+ switch (field) {
1157
+ case 1:
1158
+ var value = /** @type {string} */ (reader.readString());
1159
+ msg.setStatus(value);
1160
+ break;
1161
+ default:
1162
+ reader.skipField();
1163
+ break;
1164
+ }
1165
+ }
1166
+ return msg;
1167
+ };
1168
+
1169
+
1170
+ /**
1171
+ * Serializes the message to binary data (in protobuf wire format).
1172
+ * @return {!Uint8Array}
1173
+ */
1174
+ proto.config.ConfigStatusResponse.prototype.serializeBinary = function() {
1175
+ var writer = new jspb.BinaryWriter();
1176
+ proto.config.ConfigStatusResponse.serializeBinaryToWriter(this, writer);
1177
+ return writer.getResultBuffer();
1178
+ };
1179
+
1180
+
1181
+ /**
1182
+ * Serializes the given message to binary data (in protobuf wire
1183
+ * format), writing to the given BinaryWriter.
1184
+ * @param {!proto.config.ConfigStatusResponse} message
1185
+ * @param {!jspb.BinaryWriter} writer
1186
+ * @suppress {unusedLocalVariables} f is only used for nested messages
1187
+ */
1188
+ proto.config.ConfigStatusResponse.serializeBinaryToWriter = function(message, writer) {
1189
+ var f = undefined;
1190
+ f = message.getStatus();
1191
+ if (f.length > 0) {
1192
+ writer.writeString(
1193
+ 1,
1194
+ f
1195
+ );
1196
+ }
1197
+ };
1198
+
1199
+
1200
+ /**
1201
+ * optional string status = 1;
1202
+ * @return {string}
1203
+ */
1204
+ proto.config.ConfigStatusResponse.prototype.getStatus = function() {
1205
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
1206
+ };
1207
+
1208
+
1209
+ /**
1210
+ * @param {string} value
1211
+ * @return {!proto.config.ConfigStatusResponse} returns this
1212
+ */
1213
+ proto.config.ConfigStatusResponse.prototype.setStatus = function(value) {
1214
+ return jspb.Message.setProto3StringField(this, 1, value);
1215
+ };
1216
+
1217
+
824
1218
  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.7",
3
+ "version": "1.0.9",
4
4
  "description": "Protobuf structures",
5
5
  "main": "index.js",
6
6
  "scripts": {