From 0e19902647a5cb332d8a80976e49593a68e71c54 Mon Sep 17 00:00:00 2001
From: murgatroid99 <mlumish@google.com>
Date: Mon, 11 May 2015 13:34:32 -0700
Subject: [PATCH] Updated ProtoBuf.js dependency. Updated protos to proto3

---
 src/node/examples/math.proto        | 14 +++++------
 src/node/examples/route_guide.proto | 24 +++++++++----------
 src/node/examples/stock.proto       |  8 +++----
 src/node/interop/empty.proto        |  2 +-
 src/node/interop/messages.proto     | 36 ++++++++++++++---------------
 src/node/interop/test.proto         |  3 ++-
 src/node/package.json               |  2 +-
 src/node/test/test_service.proto    |  6 ++---
 8 files changed, 48 insertions(+), 47 deletions(-)

diff --git a/src/node/examples/math.proto b/src/node/examples/math.proto
index e34ad5e967..311e148c02 100644
--- a/src/node/examples/math.proto
+++ b/src/node/examples/math.proto
@@ -33,25 +33,25 @@ syntax = "proto3";
 package math;
 
 message DivArgs {
-  optional int64 dividend = 1;
-  optional int64 divisor = 2;
+  int64 dividend = 1;
+  int64 divisor = 2;
 }
 
 message DivReply {
-  optional int64 quotient = 1;
-  optional int64 remainder = 2;
+  int64 quotient = 1;
+  int64 remainder = 2;
 }
 
 message FibArgs {
-  optional int64 limit = 1;
+  int64 limit = 1;
 }
 
 message Num {
-  optional int64 num = 1;
+  int64 num = 1;
 }
 
 message FibReply {
-  optional int64 count = 1;
+  int64 count = 1;
 }
 
 service Math {
diff --git a/src/node/examples/route_guide.proto b/src/node/examples/route_guide.proto
index 442112823e..fceb632a97 100644
--- a/src/node/examples/route_guide.proto
+++ b/src/node/examples/route_guide.proto
@@ -66,18 +66,18 @@ service RouteGuide {
 // Latitudes should be in the range +/- 90 degrees and longitude should be in
 // the range +/- 180 degrees (inclusive).
 message Point {
-  optional int32 latitude = 1;
-  optional int32 longitude = 2;
+  int32 latitude = 1;
+  int32 longitude = 2;
 }
 
 // A latitude-longitude rectangle, represented as two diagonally opposite
 // points "lo" and "hi".
 message Rectangle {
   // One corner of the rectangle.
-  optional Point lo = 1;
+  Point lo = 1;
 
   // The other corner of the rectangle.
-  optional Point hi = 2;
+  Point hi = 2;
 }
 
 // A feature names something at a given point.
@@ -85,19 +85,19 @@ message Rectangle {
 // If a feature could not be named, the name is empty.
 message Feature {
   // The name of the feature.
-  optional string name = 1;
+  string name = 1;
 
   // The point where the feature is detected.
-  optional Point location = 2;
+  Point location = 2;
 }
 
 // A RouteNote is a message sent while at a given point.
 message RouteNote {
   // The location from which the message is sent.
-  optional Point location = 1;
+  Point location = 1;
 
   // The message to be sent.
-  optional string message = 2;
+  string message = 2;
 }
 
 // A RouteSummary is received in response to a RecordRoute rpc.
@@ -107,14 +107,14 @@ message RouteNote {
 // the distance between each point.
 message RouteSummary {
   // The number of points received.
-  optional int32 point_count = 1;
+  int32 point_count = 1;
 
   // The number of known features passed while traversing the route.
-  optional int32 feature_count = 2;
+  int32 feature_count = 2;
 
   // The distance covered in metres.
-  optional int32 distance = 3;
+  int32 distance = 3;
 
   // The duration of the traversal in seconds.
-  optional int32 elapsed_time = 4;
+  int32 elapsed_time = 4;
 }
diff --git a/src/node/examples/stock.proto b/src/node/examples/stock.proto
index 328e050aef..de7ee939e2 100644
--- a/src/node/examples/stock.proto
+++ b/src/node/examples/stock.proto
@@ -33,13 +33,13 @@ package examples;
 
 // Protocol type definitions
 message StockRequest {
-  optional string symbol = 1;
-  optional int32 num_trades_to_watch = 2 [default=0];
+  string symbol = 1;
+  int32 num_trades_to_watch = 2 [default=0];
 }
 
 message StockReply {
-  optional float price = 1;
-  optional string symbol = 2;
+  float price = 1;
+  string symbol = 2;
 }
 
 
diff --git a/src/node/interop/empty.proto b/src/node/interop/empty.proto
index 4295a0a960..6d0eb937d6 100644
--- a/src/node/interop/empty.proto
+++ b/src/node/interop/empty.proto
@@ -28,7 +28,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-syntax = "proto2";
+syntax = "proto3";
 
 package grpc.testing;
 
diff --git a/src/node/interop/messages.proto b/src/node/interop/messages.proto
index de0b1a2320..7df85e3c13 100644
--- a/src/node/interop/messages.proto
+++ b/src/node/interop/messages.proto
@@ -30,7 +30,7 @@
 
 // Message definitions to be used by integration test service definitions.
 
-syntax = "proto2";
+syntax = "proto3";
 
 package grpc.testing;
 
@@ -49,46 +49,46 @@ enum PayloadType {
 // A block of data, to simply increase gRPC message size.
 message Payload {
   // The type of data in body.
-  optional PayloadType type = 1 [default = COMPRESSABLE];
+  PayloadType type = 1;
   // Primary contents of payload.
-  optional bytes body = 2;
+  bytes body = 2;
 }
 
 // Unary request.
 message SimpleRequest {
   // Desired payload type in the response from the server.
   // If response_type is RANDOM, server randomly chooses one from other formats.
-  optional PayloadType response_type = 1 [default = COMPRESSABLE];
+  PayloadType response_type = 1;
 
   // Desired payload size in the response from the server.
   // If response_type is COMPRESSABLE, this denotes the size before compression.
-  optional int32 response_size = 2;
+  int32 response_size = 2;
 
   // Optional input payload sent along with the request.
-  optional Payload payload = 3;
+  Payload payload = 3;
 
   // Whether SimpleResponse should include username.
-  optional bool fill_username = 4;
+  bool fill_username = 4;
 
   // Whether SimpleResponse should include OAuth scope.
-  optional bool fill_oauth_scope = 5;
+  bool fill_oauth_scope = 5;
 }
 
 // Unary response, as configured by the request.
 message SimpleResponse {
   // Payload to increase message size.
-  optional Payload payload = 1;
+  Payload payload = 1;
   // The user the request came from, for verifying authentication was
   // successful when the client expected it.
-  optional string username = 2;
+  string username = 2;
   // OAuth scope.
-  optional string oauth_scope = 3;
+  string oauth_scope = 3;
 }
 
 // Client-streaming request.
 message StreamingInputCallRequest {
   // Optional input payload sent along with the request.
-  optional Payload payload = 1;
+  Payload payload = 1;
 
   // Not expecting any payload from the response.
 }
@@ -96,18 +96,18 @@ message StreamingInputCallRequest {
 // Client-streaming response.
 message StreamingInputCallResponse {
   // Aggregated size of payloads received from the client.
-  optional int32 aggregated_payload_size = 1;
+  int32 aggregated_payload_size = 1;
 }
 
 // Configuration for a particular response.
 message ResponseParameters {
   // Desired payload sizes in responses from the server.
   // If response_type is COMPRESSABLE, this denotes the size before compression.
-  optional int32 size = 1;
+  int32 size = 1;
 
   // Desired interval between consecutive responses in the response stream in
   // microseconds.
-  optional int32 interval_us = 2;
+  int32 interval_us = 2;
 }
 
 // Server-streaming request.
@@ -116,17 +116,17 @@ message StreamingOutputCallRequest {
   // If response_type is RANDOM, the payload from each response in the stream
   // might be of different types. This is to simulate a mixed type of payload
   // stream.
-  optional PayloadType response_type = 1 [default = COMPRESSABLE];
+  PayloadType response_type = 1;
 
   // Configuration for each expected response message.
   repeated ResponseParameters response_parameters = 2;
 
   // Optional input payload sent along with the request.
-  optional Payload payload = 3;
+  Payload payload = 3;
 }
 
 // Server-streaming response, as configured by the request and parameters.
 message StreamingOutputCallResponse {
   // Payload to increase response size.
-  optional Payload payload = 1;
+  Payload payload = 1;
 }
diff --git a/src/node/interop/test.proto b/src/node/interop/test.proto
index 927a3a83aa..d2c3f9befe 100644
--- a/src/node/interop/test.proto
+++ b/src/node/interop/test.proto
@@ -30,7 +30,8 @@
 
 // An integration test service that covers all the method signature permutations
 // of unary/streaming requests/responses.
-syntax = "proto2";
+
+syntax = "proto3";
 
 import "empty.proto";
 import "messages.proto";
diff --git a/src/node/package.json b/src/node/package.json
index 0bb3c3d1fd..4033bc59cf 100644
--- a/src/node/package.json
+++ b/src/node/package.json
@@ -26,7 +26,7 @@
   "dependencies": {
     "bindings": "^1.2.0",
     "nan": "^1.5.0",
-    "protobufjs": "^4.0.0-b2",
+    "protobufjs": "dcodeIO/ProtoBuf.js",
     "underscore": "^1.6.0",
     "underscore.string": "^3.0.0"
   },
diff --git a/src/node/test/test_service.proto b/src/node/test/test_service.proto
index 5d3d891841..564169829c 100644
--- a/src/node/test/test_service.proto
+++ b/src/node/test/test_service.proto
@@ -27,14 +27,14 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-syntax = "proto2";
+syntax = "proto3";
 
 message Request {
-  optional bool error = 1;
+  bool error = 1;
 }
 
 message Response {
-  optional int32 count = 1;
+  int32 count = 1;
 }
 
 service TestService {
-- 
GitLab