protobuf-platform 1.2.58 → 1.2.59

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.
@@ -18,6 +18,8 @@ service Config {
18
18
  rpc generateText(PromptRequest) returns (GeneratedTextResponse);
19
19
  //Common data
20
20
  rpc getCountries(CommonCountriesRequest) returns (CommonCountriesResponse);
21
+ //File Uploads: R2
22
+ rpc uploadR2File(R2FileRequest) returns (R2FileResponse);
21
23
  }
22
24
 
23
25
  message PingRequest { string ping = 1; }
@@ -99,4 +101,15 @@ message CommonCountriesRequest {
99
101
  }
100
102
  message CommonCountriesResponse {
101
103
  repeated CountryItem countries = 1;
104
+ }
105
+ //File Uploads
106
+ message R2FileRequest {
107
+ bytes file = 1;
108
+ string type = 2;
109
+ optional string name = 3;
110
+ optional string folder = 4;
111
+ }
112
+ message R2FileResponse {
113
+ string key = 1;
114
+ string url = 2;
102
115
  }
@@ -158,6 +158,28 @@ function deserialize_config_PromptRequest(buffer_arg) {
158
158
  return config_pb.PromptRequest.deserializeBinary(new Uint8Array(buffer_arg));
159
159
  }
160
160
 
161
+ function serialize_config_R2FileRequest(arg) {
162
+ if (!(arg instanceof config_pb.R2FileRequest)) {
163
+ throw new Error('Expected argument of type config.R2FileRequest');
164
+ }
165
+ return Buffer.from(arg.serializeBinary());
166
+ }
167
+
168
+ function deserialize_config_R2FileRequest(buffer_arg) {
169
+ return config_pb.R2FileRequest.deserializeBinary(new Uint8Array(buffer_arg));
170
+ }
171
+
172
+ function serialize_config_R2FileResponse(arg) {
173
+ if (!(arg instanceof config_pb.R2FileResponse)) {
174
+ throw new Error('Expected argument of type config.R2FileResponse');
175
+ }
176
+ return Buffer.from(arg.serializeBinary());
177
+ }
178
+
179
+ function deserialize_config_R2FileResponse(buffer_arg) {
180
+ return config_pb.R2FileResponse.deserializeBinary(new Uint8Array(buffer_arg));
181
+ }
182
+
161
183
  function serialize_config_SettingsRequest(arg) {
162
184
  if (!(arg instanceof config_pb.SettingsRequest)) {
163
185
  throw new Error('Expected argument of type config.SettingsRequest');
@@ -287,6 +309,18 @@ getCountries: {
287
309
  responseSerialize: serialize_config_CommonCountriesResponse,
288
310
  responseDeserialize: deserialize_config_CommonCountriesResponse,
289
311
  },
312
+ // File Uploads: R2
313
+ uploadR2File: {
314
+ path: '/config.Config/uploadR2File',
315
+ requestStream: false,
316
+ responseStream: false,
317
+ requestType: config_pb.R2FileRequest,
318
+ responseType: config_pb.R2FileResponse,
319
+ requestSerialize: serialize_config_R2FileRequest,
320
+ requestDeserialize: deserialize_config_R2FileRequest,
321
+ responseSerialize: serialize_config_R2FileResponse,
322
+ responseDeserialize: deserialize_config_R2FileResponse,
323
+ },
290
324
  };
291
325
 
292
326
  exports.ConfigClient = grpc.makeGenericClientConstructor(ConfigService, 'Config');
@@ -36,6 +36,8 @@ goog.exportSymbol('proto.config.GlobalDataRequest', null, global);
36
36
  goog.exportSymbol('proto.config.PingRequest', null, global);
37
37
  goog.exportSymbol('proto.config.PongResponse', null, global);
38
38
  goog.exportSymbol('proto.config.PromptRequest', null, global);
39
+ goog.exportSymbol('proto.config.R2FileRequest', null, global);
40
+ goog.exportSymbol('proto.config.R2FileResponse', null, global);
39
41
  goog.exportSymbol('proto.config.SettingsRequest', null, global);
40
42
  goog.exportSymbol('proto.config.SettingsResponse', null, global);
41
43
  /**
@@ -395,6 +397,48 @@ if (goog.DEBUG && !COMPILED) {
395
397
  */
396
398
  proto.config.CommonCountriesResponse.displayName = 'proto.config.CommonCountriesResponse';
397
399
  }
400
+ /**
401
+ * Generated by JsPbCodeGenerator.
402
+ * @param {Array=} opt_data Optional initial data array, typically from a
403
+ * server response, or constructed directly in Javascript. The array is used
404
+ * in place and becomes part of the constructed object. It is not cloned.
405
+ * If no data is provided, the constructed object will be empty, but still
406
+ * valid.
407
+ * @extends {jspb.Message}
408
+ * @constructor
409
+ */
410
+ proto.config.R2FileRequest = function(opt_data) {
411
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
412
+ };
413
+ goog.inherits(proto.config.R2FileRequest, jspb.Message);
414
+ if (goog.DEBUG && !COMPILED) {
415
+ /**
416
+ * @public
417
+ * @override
418
+ */
419
+ proto.config.R2FileRequest.displayName = 'proto.config.R2FileRequest';
420
+ }
421
+ /**
422
+ * Generated by JsPbCodeGenerator.
423
+ * @param {Array=} opt_data Optional initial data array, typically from a
424
+ * server response, or constructed directly in Javascript. The array is used
425
+ * in place and becomes part of the constructed object. It is not cloned.
426
+ * If no data is provided, the constructed object will be empty, but still
427
+ * valid.
428
+ * @extends {jspb.Message}
429
+ * @constructor
430
+ */
431
+ proto.config.R2FileResponse = function(opt_data) {
432
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
433
+ };
434
+ goog.inherits(proto.config.R2FileResponse, jspb.Message);
435
+ if (goog.DEBUG && !COMPILED) {
436
+ /**
437
+ * @public
438
+ * @override
439
+ */
440
+ proto.config.R2FileResponse.displayName = 'proto.config.R2FileResponse';
441
+ }
398
442
 
399
443
 
400
444
 
@@ -3714,4 +3758,444 @@ proto.config.CommonCountriesResponse.prototype.clearCountriesList = function() {
3714
3758
  };
3715
3759
 
3716
3760
 
3761
+
3762
+
3763
+
3764
+ if (jspb.Message.GENERATE_TO_OBJECT) {
3765
+ /**
3766
+ * Creates an object representation of this proto.
3767
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
3768
+ * Optional fields that are not set will be set to undefined.
3769
+ * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
3770
+ * For the list of reserved names please see:
3771
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
3772
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
3773
+ * JSPB instance for transitional soy proto support:
3774
+ * http://goto/soy-param-migration
3775
+ * @return {!Object}
3776
+ */
3777
+ proto.config.R2FileRequest.prototype.toObject = function(opt_includeInstance) {
3778
+ return proto.config.R2FileRequest.toObject(opt_includeInstance, this);
3779
+ };
3780
+
3781
+
3782
+ /**
3783
+ * Static version of the {@see toObject} method.
3784
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
3785
+ * the JSPB instance for transitional soy proto support:
3786
+ * http://goto/soy-param-migration
3787
+ * @param {!proto.config.R2FileRequest} msg The msg instance to transform.
3788
+ * @return {!Object}
3789
+ * @suppress {unusedLocalVariables} f is only used for nested messages
3790
+ */
3791
+ proto.config.R2FileRequest.toObject = function(includeInstance, msg) {
3792
+ var f, obj = {
3793
+ file: msg.getFile_asB64(),
3794
+ type: jspb.Message.getFieldWithDefault(msg, 2, ""),
3795
+ name: jspb.Message.getFieldWithDefault(msg, 3, ""),
3796
+ folder: jspb.Message.getFieldWithDefault(msg, 4, "")
3797
+ };
3798
+
3799
+ if (includeInstance) {
3800
+ obj.$jspbMessageInstance = msg;
3801
+ }
3802
+ return obj;
3803
+ };
3804
+ }
3805
+
3806
+
3807
+ /**
3808
+ * Deserializes binary data (in protobuf wire format).
3809
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
3810
+ * @return {!proto.config.R2FileRequest}
3811
+ */
3812
+ proto.config.R2FileRequest.deserializeBinary = function(bytes) {
3813
+ var reader = new jspb.BinaryReader(bytes);
3814
+ var msg = new proto.config.R2FileRequest;
3815
+ return proto.config.R2FileRequest.deserializeBinaryFromReader(msg, reader);
3816
+ };
3817
+
3818
+
3819
+ /**
3820
+ * Deserializes binary data (in protobuf wire format) from the
3821
+ * given reader into the given message object.
3822
+ * @param {!proto.config.R2FileRequest} msg The message object to deserialize into.
3823
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
3824
+ * @return {!proto.config.R2FileRequest}
3825
+ */
3826
+ proto.config.R2FileRequest.deserializeBinaryFromReader = function(msg, reader) {
3827
+ while (reader.nextField()) {
3828
+ if (reader.isEndGroup()) {
3829
+ break;
3830
+ }
3831
+ var field = reader.getFieldNumber();
3832
+ switch (field) {
3833
+ case 1:
3834
+ var value = /** @type {!Uint8Array} */ (reader.readBytes());
3835
+ msg.setFile(value);
3836
+ break;
3837
+ case 2:
3838
+ var value = /** @type {string} */ (reader.readString());
3839
+ msg.setType(value);
3840
+ break;
3841
+ case 3:
3842
+ var value = /** @type {string} */ (reader.readString());
3843
+ msg.setName(value);
3844
+ break;
3845
+ case 4:
3846
+ var value = /** @type {string} */ (reader.readString());
3847
+ msg.setFolder(value);
3848
+ break;
3849
+ default:
3850
+ reader.skipField();
3851
+ break;
3852
+ }
3853
+ }
3854
+ return msg;
3855
+ };
3856
+
3857
+
3858
+ /**
3859
+ * Serializes the message to binary data (in protobuf wire format).
3860
+ * @return {!Uint8Array}
3861
+ */
3862
+ proto.config.R2FileRequest.prototype.serializeBinary = function() {
3863
+ var writer = new jspb.BinaryWriter();
3864
+ proto.config.R2FileRequest.serializeBinaryToWriter(this, writer);
3865
+ return writer.getResultBuffer();
3866
+ };
3867
+
3868
+
3869
+ /**
3870
+ * Serializes the given message to binary data (in protobuf wire
3871
+ * format), writing to the given BinaryWriter.
3872
+ * @param {!proto.config.R2FileRequest} message
3873
+ * @param {!jspb.BinaryWriter} writer
3874
+ * @suppress {unusedLocalVariables} f is only used for nested messages
3875
+ */
3876
+ proto.config.R2FileRequest.serializeBinaryToWriter = function(message, writer) {
3877
+ var f = undefined;
3878
+ f = message.getFile_asU8();
3879
+ if (f.length > 0) {
3880
+ writer.writeBytes(
3881
+ 1,
3882
+ f
3883
+ );
3884
+ }
3885
+ f = message.getType();
3886
+ if (f.length > 0) {
3887
+ writer.writeString(
3888
+ 2,
3889
+ f
3890
+ );
3891
+ }
3892
+ f = /** @type {string} */ (jspb.Message.getField(message, 3));
3893
+ if (f != null) {
3894
+ writer.writeString(
3895
+ 3,
3896
+ f
3897
+ );
3898
+ }
3899
+ f = /** @type {string} */ (jspb.Message.getField(message, 4));
3900
+ if (f != null) {
3901
+ writer.writeString(
3902
+ 4,
3903
+ f
3904
+ );
3905
+ }
3906
+ };
3907
+
3908
+
3909
+ /**
3910
+ * optional bytes file = 1;
3911
+ * @return {!(string|Uint8Array)}
3912
+ */
3913
+ proto.config.R2FileRequest.prototype.getFile = function() {
3914
+ return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
3915
+ };
3916
+
3917
+
3918
+ /**
3919
+ * optional bytes file = 1;
3920
+ * This is a type-conversion wrapper around `getFile()`
3921
+ * @return {string}
3922
+ */
3923
+ proto.config.R2FileRequest.prototype.getFile_asB64 = function() {
3924
+ return /** @type {string} */ (jspb.Message.bytesAsB64(
3925
+ this.getFile()));
3926
+ };
3927
+
3928
+
3929
+ /**
3930
+ * optional bytes file = 1;
3931
+ * Note that Uint8Array is not supported on all browsers.
3932
+ * @see http://caniuse.com/Uint8Array
3933
+ * This is a type-conversion wrapper around `getFile()`
3934
+ * @return {!Uint8Array}
3935
+ */
3936
+ proto.config.R2FileRequest.prototype.getFile_asU8 = function() {
3937
+ return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
3938
+ this.getFile()));
3939
+ };
3940
+
3941
+
3942
+ /**
3943
+ * @param {!(string|Uint8Array)} value
3944
+ * @return {!proto.config.R2FileRequest} returns this
3945
+ */
3946
+ proto.config.R2FileRequest.prototype.setFile = function(value) {
3947
+ return jspb.Message.setProto3BytesField(this, 1, value);
3948
+ };
3949
+
3950
+
3951
+ /**
3952
+ * optional string type = 2;
3953
+ * @return {string}
3954
+ */
3955
+ proto.config.R2FileRequest.prototype.getType = function() {
3956
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
3957
+ };
3958
+
3959
+
3960
+ /**
3961
+ * @param {string} value
3962
+ * @return {!proto.config.R2FileRequest} returns this
3963
+ */
3964
+ proto.config.R2FileRequest.prototype.setType = function(value) {
3965
+ return jspb.Message.setProto3StringField(this, 2, value);
3966
+ };
3967
+
3968
+
3969
+ /**
3970
+ * optional string name = 3;
3971
+ * @return {string}
3972
+ */
3973
+ proto.config.R2FileRequest.prototype.getName = function() {
3974
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
3975
+ };
3976
+
3977
+
3978
+ /**
3979
+ * @param {string} value
3980
+ * @return {!proto.config.R2FileRequest} returns this
3981
+ */
3982
+ proto.config.R2FileRequest.prototype.setName = function(value) {
3983
+ return jspb.Message.setField(this, 3, value);
3984
+ };
3985
+
3986
+
3987
+ /**
3988
+ * Clears the field making it undefined.
3989
+ * @return {!proto.config.R2FileRequest} returns this
3990
+ */
3991
+ proto.config.R2FileRequest.prototype.clearName = function() {
3992
+ return jspb.Message.setField(this, 3, undefined);
3993
+ };
3994
+
3995
+
3996
+ /**
3997
+ * Returns whether this field is set.
3998
+ * @return {boolean}
3999
+ */
4000
+ proto.config.R2FileRequest.prototype.hasName = function() {
4001
+ return jspb.Message.getField(this, 3) != null;
4002
+ };
4003
+
4004
+
4005
+ /**
4006
+ * optional string folder = 4;
4007
+ * @return {string}
4008
+ */
4009
+ proto.config.R2FileRequest.prototype.getFolder = function() {
4010
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
4011
+ };
4012
+
4013
+
4014
+ /**
4015
+ * @param {string} value
4016
+ * @return {!proto.config.R2FileRequest} returns this
4017
+ */
4018
+ proto.config.R2FileRequest.prototype.setFolder = function(value) {
4019
+ return jspb.Message.setField(this, 4, value);
4020
+ };
4021
+
4022
+
4023
+ /**
4024
+ * Clears the field making it undefined.
4025
+ * @return {!proto.config.R2FileRequest} returns this
4026
+ */
4027
+ proto.config.R2FileRequest.prototype.clearFolder = function() {
4028
+ return jspb.Message.setField(this, 4, undefined);
4029
+ };
4030
+
4031
+
4032
+ /**
4033
+ * Returns whether this field is set.
4034
+ * @return {boolean}
4035
+ */
4036
+ proto.config.R2FileRequest.prototype.hasFolder = function() {
4037
+ return jspb.Message.getField(this, 4) != null;
4038
+ };
4039
+
4040
+
4041
+
4042
+
4043
+
4044
+ if (jspb.Message.GENERATE_TO_OBJECT) {
4045
+ /**
4046
+ * Creates an object representation of this proto.
4047
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
4048
+ * Optional fields that are not set will be set to undefined.
4049
+ * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
4050
+ * For the list of reserved names please see:
4051
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
4052
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
4053
+ * JSPB instance for transitional soy proto support:
4054
+ * http://goto/soy-param-migration
4055
+ * @return {!Object}
4056
+ */
4057
+ proto.config.R2FileResponse.prototype.toObject = function(opt_includeInstance) {
4058
+ return proto.config.R2FileResponse.toObject(opt_includeInstance, this);
4059
+ };
4060
+
4061
+
4062
+ /**
4063
+ * Static version of the {@see toObject} method.
4064
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
4065
+ * the JSPB instance for transitional soy proto support:
4066
+ * http://goto/soy-param-migration
4067
+ * @param {!proto.config.R2FileResponse} msg The msg instance to transform.
4068
+ * @return {!Object}
4069
+ * @suppress {unusedLocalVariables} f is only used for nested messages
4070
+ */
4071
+ proto.config.R2FileResponse.toObject = function(includeInstance, msg) {
4072
+ var f, obj = {
4073
+ key: jspb.Message.getFieldWithDefault(msg, 1, ""),
4074
+ url: jspb.Message.getFieldWithDefault(msg, 2, "")
4075
+ };
4076
+
4077
+ if (includeInstance) {
4078
+ obj.$jspbMessageInstance = msg;
4079
+ }
4080
+ return obj;
4081
+ };
4082
+ }
4083
+
4084
+
4085
+ /**
4086
+ * Deserializes binary data (in protobuf wire format).
4087
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
4088
+ * @return {!proto.config.R2FileResponse}
4089
+ */
4090
+ proto.config.R2FileResponse.deserializeBinary = function(bytes) {
4091
+ var reader = new jspb.BinaryReader(bytes);
4092
+ var msg = new proto.config.R2FileResponse;
4093
+ return proto.config.R2FileResponse.deserializeBinaryFromReader(msg, reader);
4094
+ };
4095
+
4096
+
4097
+ /**
4098
+ * Deserializes binary data (in protobuf wire format) from the
4099
+ * given reader into the given message object.
4100
+ * @param {!proto.config.R2FileResponse} msg The message object to deserialize into.
4101
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
4102
+ * @return {!proto.config.R2FileResponse}
4103
+ */
4104
+ proto.config.R2FileResponse.deserializeBinaryFromReader = function(msg, reader) {
4105
+ while (reader.nextField()) {
4106
+ if (reader.isEndGroup()) {
4107
+ break;
4108
+ }
4109
+ var field = reader.getFieldNumber();
4110
+ switch (field) {
4111
+ case 1:
4112
+ var value = /** @type {string} */ (reader.readString());
4113
+ msg.setKey(value);
4114
+ break;
4115
+ case 2:
4116
+ var value = /** @type {string} */ (reader.readString());
4117
+ msg.setUrl(value);
4118
+ break;
4119
+ default:
4120
+ reader.skipField();
4121
+ break;
4122
+ }
4123
+ }
4124
+ return msg;
4125
+ };
4126
+
4127
+
4128
+ /**
4129
+ * Serializes the message to binary data (in protobuf wire format).
4130
+ * @return {!Uint8Array}
4131
+ */
4132
+ proto.config.R2FileResponse.prototype.serializeBinary = function() {
4133
+ var writer = new jspb.BinaryWriter();
4134
+ proto.config.R2FileResponse.serializeBinaryToWriter(this, writer);
4135
+ return writer.getResultBuffer();
4136
+ };
4137
+
4138
+
4139
+ /**
4140
+ * Serializes the given message to binary data (in protobuf wire
4141
+ * format), writing to the given BinaryWriter.
4142
+ * @param {!proto.config.R2FileResponse} message
4143
+ * @param {!jspb.BinaryWriter} writer
4144
+ * @suppress {unusedLocalVariables} f is only used for nested messages
4145
+ */
4146
+ proto.config.R2FileResponse.serializeBinaryToWriter = function(message, writer) {
4147
+ var f = undefined;
4148
+ f = message.getKey();
4149
+ if (f.length > 0) {
4150
+ writer.writeString(
4151
+ 1,
4152
+ f
4153
+ );
4154
+ }
4155
+ f = message.getUrl();
4156
+ if (f.length > 0) {
4157
+ writer.writeString(
4158
+ 2,
4159
+ f
4160
+ );
4161
+ }
4162
+ };
4163
+
4164
+
4165
+ /**
4166
+ * optional string key = 1;
4167
+ * @return {string}
4168
+ */
4169
+ proto.config.R2FileResponse.prototype.getKey = function() {
4170
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
4171
+ };
4172
+
4173
+
4174
+ /**
4175
+ * @param {string} value
4176
+ * @return {!proto.config.R2FileResponse} returns this
4177
+ */
4178
+ proto.config.R2FileResponse.prototype.setKey = function(value) {
4179
+ return jspb.Message.setProto3StringField(this, 1, value);
4180
+ };
4181
+
4182
+
4183
+ /**
4184
+ * optional string url = 2;
4185
+ * @return {string}
4186
+ */
4187
+ proto.config.R2FileResponse.prototype.getUrl = function() {
4188
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
4189
+ };
4190
+
4191
+
4192
+ /**
4193
+ * @param {string} value
4194
+ * @return {!proto.config.R2FileResponse} returns this
4195
+ */
4196
+ proto.config.R2FileResponse.prototype.setUrl = function(value) {
4197
+ return jspb.Message.setProto3StringField(this, 2, value);
4198
+ };
4199
+
4200
+
3717
4201
  goog.object.extend(exports, proto.config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "protobuf-platform",
3
- "version": "1.2.58",
3
+ "version": "1.2.59",
4
4
  "description": "Protobuf structures",
5
5
  "main": "index.js",
6
6
  "scripts": {