From 7e11518ee6164028899bd906b54c7f7d36cb2cb1 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 13 Jun 2018 16:59:00 -0700 Subject: [PATCH 1/6] Update to v1.13.0-pre1 --- packages/grpc-native-core/deps/grpc | 2 +- packages/grpc-native-core/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/grpc-native-core/deps/grpc b/packages/grpc-native-core/deps/grpc index 6a2aaf09..3137d59b 160000 --- a/packages/grpc-native-core/deps/grpc +++ b/packages/grpc-native-core/deps/grpc @@ -1 +1 @@ -Subproject commit 6a2aaf096fc8baf1f73d4d531518cdefd3374c76 +Subproject commit 3137d59be9e476157de78016ab3f23a7d340d78f diff --git a/packages/grpc-native-core/package.json b/packages/grpc-native-core/package.json index a77bf6c7..0a13f36a 100644 --- a/packages/grpc-native-core/package.json +++ b/packages/grpc-native-core/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.13.0-dev", + "version": "1.13.0-pre1", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "https://grpc.io/", From b6be0d955fa71d889358ccc6175a6ed583ce3ba0 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 26 Jun 2018 01:21:35 +0200 Subject: [PATCH 2/6] Actually publish for arm32... --- .../tools/run_tests/artifacts/build_artifact_node_arm.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node_arm.sh b/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node_arm.sh index 34d9ffac..eee6ff8f 100755 --- a/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node_arm.sh +++ b/packages/grpc-native-core/tools/run_tests/artifacts/build_artifact_node_arm.sh @@ -33,6 +33,7 @@ do # Cross compile for ARM on x64 # Requires debian or ubuntu packages "g++-aarch64-linux-gnu" and "g++-arm-linux-gnueabihf". CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ LD=arm-linux-gnueabihf-g++ ./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --target=$version --target_arch=arm + cp -r build/stage/* "${ARTIFACTS_OUT}"/ CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ LD=aarch64-linux-gnu-g++ ./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --target=$version --target_arch=arm64 cp -r build/stage/* "${ARTIFACTS_OUT}"/ done From 7d8865003ce428afe163a691d91a11dd2ccb9d9f Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 2 Jul 2018 11:21:33 -0700 Subject: [PATCH 3/6] Update to v1.13.0 --- packages/grpc-native-core/deps/grpc | 2 +- packages/grpc-native-core/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/grpc-native-core/deps/grpc b/packages/grpc-native-core/deps/grpc index 3137d59b..5d57a8d0 160000 --- a/packages/grpc-native-core/deps/grpc +++ b/packages/grpc-native-core/deps/grpc @@ -1 +1 @@ -Subproject commit 3137d59be9e476157de78016ab3f23a7d340d78f +Subproject commit 5d57a8d09a7f7202ba8eaa56b3b88a5da05ad057 diff --git a/packages/grpc-native-core/package.json b/packages/grpc-native-core/package.json index 0a13f36a..92f2d791 100644 --- a/packages/grpc-native-core/package.json +++ b/packages/grpc-native-core/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.13.0-pre1", + "version": "1.13.0", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "https://grpc.io/", From 339f4c04332d121e5c4df1c66b18cabb15aba487 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 9 Jul 2018 19:09:44 +0200 Subject: [PATCH 4/6] Properly create slices from utf8 strings. Fixes #426. --- packages/grpc-native-core/ext/slice.cc | 2 +- .../grpc-native-core/test/surface_test.js | 32 ++++++++++++++++--- .../grpc-native-core/test/test_service.proto | 1 + test/interop/interop_client.js | 6 ++-- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/packages/grpc-native-core/ext/slice.cc b/packages/grpc-native-core/ext/slice.cc index 8806a61a..49bc05b0 100644 --- a/packages/grpc-native-core/ext/slice.cc +++ b/packages/grpc-native-core/ext/slice.cc @@ -51,7 +51,7 @@ void buffer_destroy_func(void *user_data) { grpc_slice CreateSliceFromString(const Local source) { Nan::HandleScope scope; Nan::Utf8String *utf8_value = new Nan::Utf8String(source); - return grpc_slice_new_with_user_data(**utf8_value, source->Length(), + return grpc_slice_new_with_user_data(**utf8_value, utf8_value->length(), string_destroy_func, utf8_value); } diff --git a/packages/grpc-native-core/test/surface_test.js b/packages/grpc-native-core/test/surface_test.js index 36179738..aa124620 100644 --- a/packages/grpc-native-core/test/surface_test.js +++ b/packages/grpc-native-core/test/surface_test.js @@ -839,8 +839,12 @@ describe('Other conditions', function() { unary: function(call, cb) { var req = call.request; if (req.error) { + var message = 'Requested error'; + if (req.message) { + message = req.message; + } cb({code: grpc.status.UNKNOWN, - details: 'Requested error'}, null, trailer_metadata); + details: message}, null, trailer_metadata); } else { cb(null, {count: 1}, trailer_metadata); } @@ -850,8 +854,12 @@ describe('Other conditions', function() { var errored; stream.on('data', function(data) { if (data.error) { + var message = 'Requested error'; + if (data.message) { + message = data.message; + } errored = true; - cb(new Error('Requested error'), null, trailer_metadata); + cb(new Error(message), null, trailer_metadata); } else { count += 1; } @@ -865,8 +873,12 @@ describe('Other conditions', function() { serverStream: function(stream) { var req = stream.request; if (req.error) { + var message = 'Requested error'; + if (req.message) { + message = req.message; + } var err = {code: grpc.status.UNKNOWN, - details: 'Requested error'}; + details: message}; err.metadata = trailer_metadata; stream.emit('error', err); } else { @@ -880,7 +892,11 @@ describe('Other conditions', function() { var count = 0; stream.on('data', function(data) { if (data.error) { - var err = new Error('Requested error'); + var message = 'Requested error'; + if (data.message) { + message = data.message; + } + var err = new Error(message); err.metadata = trailer_metadata.clone(); err.metadata.add('count', '' + count); stream.emit('error', err); @@ -1127,6 +1143,14 @@ describe('Other conditions', function() { done(); }); }); + it('for a UTF-8 error message', function(done) { + client.unary({error: true, message: '測試字符串'}, function(err, data) { + assert(err); + assert.strictEqual(err.code, grpc.status.UNKNOWN); + assert.strictEqual(err.details, '測試字符串'); + done(); + }); + }); }); describe('call.getPeer should return the peer', function() { it('for a unary call', function(done) { diff --git a/packages/grpc-native-core/test/test_service.proto b/packages/grpc-native-core/test/test_service.proto index b16dfecc..a0e49842 100644 --- a/packages/grpc-native-core/test/test_service.proto +++ b/packages/grpc-native-core/test/test_service.proto @@ -16,6 +16,7 @@ syntax = "proto3"; message Request { bool error = 1; + string message = 2; } message Response { diff --git a/test/interop/interop_client.js b/test/interop/interop_client.js index 195ef8d4..6bf68901 100644 --- a/test/interop/interop_client.js +++ b/test/interop/interop_client.js @@ -347,13 +347,13 @@ function statusCodeAndMessage(client, done) { var arg = { response_status: { code: 2, - message: 'test status message' + message: 'test status message - 測試字符串' } }; client.unaryCall(arg, function(err, resp) { assert(err); assert.strictEqual(err.code, 2); - assert.strictEqual(err.details, 'test status message'); + assert.strictEqual(err.details, 'test status message - 測試字符串'); done(); }); var duplex = client.fullDuplexCall(); @@ -361,7 +361,7 @@ function statusCodeAndMessage(client, done) { duplex.on('status', function(status) { assert(status); assert.strictEqual(status.code, 2); - assert.strictEqual(status.details, 'test status message'); + assert.strictEqual(status.details, 'test status message - 測試字符串'); done(); }); duplex.on('error', function(){}); From 25f49bee8bcf31d59157b531e999b8060bdbb859 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 23 Jul 2018 07:50:15 +0200 Subject: [PATCH 5/6] Stop using lodash's template generator. --- packages/grpc-native-core/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/grpc-native-core/index.js b/packages/grpc-native-core/index.js index c0d81055..c489517e 100644 --- a/packages/grpc-native-core/index.js +++ b/packages/grpc-native-core/index.js @@ -175,9 +175,14 @@ exports.loadPackageDefinition = function loadPackageDefintion(packageDef) { return result; }; -var log_template = _.template( - '{severity} {timestamp}\t{file}:{line}]\t{message}', - {interpolate: /{([\s\S]+?)}/g}); +var log_template = function(args) { + var file = args.file; + var line = args.line; + var severity = args.severity; + var message = args.message; + var timestamp = args.timestamp; + return `${severity} ${timestamp}\t${file}:${line}]\t${message}`; +}; /** * Sets the logger function for the gRPC module. For debugging purposes, the C From 88adf94cb61cc464947c4ff8114319eb40ab9a56 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 24 Jul 2018 22:41:41 +0200 Subject: [PATCH 6/6] Bumping to 1.13.1. --- packages/grpc-native-core/build.yaml | 1 + packages/grpc-native-core/package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/grpc-native-core/build.yaml b/packages/grpc-native-core/build.yaml index 49e36fdf..39db0640 100644 --- a/packages/grpc-native-core/build.yaml +++ b/packages/grpc-native-core/build.yaml @@ -1,2 +1,3 @@ settings: '#': It's possible to have node_version here as a key to override the core's version. + node_version: 1.13.1 \ No newline at end of file diff --git a/packages/grpc-native-core/package.json b/packages/grpc-native-core/package.json index 92f2d791..bb2d33cb 100644 --- a/packages/grpc-native-core/package.json +++ b/packages/grpc-native-core/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.13.0", + "version": "1.13.1", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "https://grpc.io/",