Skip to content

Commit

Permalink
Merge pull request #1079 from murgatroid99/upmerge_from_1.23.x
Browse files Browse the repository at this point in the history
Upmerge from 1.23.x
  • Loading branch information
murgatroid99 committed Oct 21, 2019
2 parents 48178f7 + 029ecbe commit 69b19df
Show file tree
Hide file tree
Showing 14 changed files with 113 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/grpc-native-core/binding.gyp
Expand Up @@ -91,7 +91,7 @@
'GPR_BACKWARDS_COMPATIBILITY_MODE',
'GRPC_ARES=1',
'GRPC_UV',
'GRPC_NODE_VERSION="1.24.0"',
'GRPC_NODE_VERSION="1.24.1"',
'CARES_STATICLIB',
'CARES_SYMBOL_HIDING'
],
Expand Down
1 change: 1 addition & 0 deletions 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.24.1
2 changes: 1 addition & 1 deletion packages/grpc-native-core/deps/grpc
48 changes: 44 additions & 4 deletions packages/grpc-native-core/index.d.ts
@@ -1,3 +1,4 @@

/*
* Copyright 2019 gRPC authors.
*
Expand All @@ -15,11 +16,50 @@
*
*/

/// <reference types="bytebuffer" />

declare module "grpc" {
import { Message, Service as ProtobufService } from "protobufjs";
// add imports here, inside the "grpc" module, to keep it as an ambient module
import { EventEmitter } from "events";
import { Duplex, Readable, Writable } from "stream";
import { SecureContext } from "tls";

/* The Message interface is copied and slightly modified from @types/protobuf
* version 5.0.31, which was distributed under the following license:
*
* This project is licensed under the MIT license.
* Copyrights are respective of each contributor listed at the beginning of each definition file.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
export interface ProtobufMessage {
$add(key: string, value: any, noAssert?: boolean): ProtobufMessage;
$get<T>(key: string): T;
$set(key: string | {[key: string]: any}, value?: any | boolean, noAssert?: boolean): void;
add(key: string, value: any, noAssert?: boolean): ProtobufMessage;
calculate(): number;
encode(buffer?: ByteBuffer | boolean, noVerify?: boolean): ByteBuffer;
encode64(): string;
encodeAB(): ArrayBuffer;
encodeNB(): Buffer;
encodeHex(): string;
encodeJSON(): string;
encodeDelimited(buffer?: ByteBuffer | boolean, noVerify?: boolean): ByteBuffer;
get<T>(key: string, noAssert?: boolean): T;
set(key: string | {[key: string]: any}, value?: any | boolean, noAssert?: boolean): void;
toArrayBuffer(): ArrayBuffer;
toBase64(): string;
toBuffer(): Buffer;
toHex(): string;
toRaw(binaryAsBase64?: boolean, longsAsStrings?: boolean): {[key: string]: any};
toString(): string;
[field: string]: any;
}

/**
* Load a ProtoBuf.js object as a gRPC object.
* @param value The ProtoBuf.js reflection object to load
Expand Down Expand Up @@ -83,7 +123,7 @@ declare module "grpc" {
* - Anything else becomes the relevant reflection object that ProtoBuf.js would create
*/
export interface GrpcObject {
[name: string]: GrpcObject | typeof Client | Message;
[name: string]: GrpcObject | typeof Client | ProtobufMessage;
}

/**
Expand Down Expand Up @@ -341,7 +381,7 @@ declare module "grpc" {
/**
* An EventEmitter. Used for unary calls.
*/
export class ServerUnaryCall<RequestType> {
export class ServerUnaryCall<RequestType> extends EventEmitter {
/**
* Indicates if the call has been cancelled
*/
Expand Down Expand Up @@ -1231,7 +1271,7 @@ declare module "grpc" {
/**
* An EventEmitter. Used for unary calls.
*/
export class ClientUnaryCall {
export class ClientUnaryCall extends EventEmitter {
private constructor();

/**
Expand Down
4 changes: 3 additions & 1 deletion packages/grpc-native-core/index.js
Expand Up @@ -312,7 +312,9 @@ exports.Client = client.Client;
* @memberof grpc
* @param {string} target The address of the server to connect to
* @param {grpc.ChannelCredentials} credentials Channel credentials to use when connecting
* @param {grpc~ChannelOptions} options A map of channel options that will be passed to the core
* @param {grpc~ChannelOptions} options A map of channel options that will be passed to the core.
* The available options are listed in
* [this document]{@link https://grpc.github.io/grpc/core/group__grpc__arg__keys.html}.
*/
exports.Channel = grpc.Channel;

Expand Down
5 changes: 4 additions & 1 deletion packages/grpc-native-core/package.json
@@ -1,6 +1,6 @@
{
"name": "grpc",
"version": "1.24.0",
"version": "1.24.1",
"author": "Google Inc.",
"description": "gRPC Library for Node",
"homepage": "https://grpc.io/",
Expand Down Expand Up @@ -29,6 +29,7 @@
"node-pre-gyp"
],
"dependencies": {
"@types/bytebuffer": "^5.0.40",
"lodash.camelcase": "^4.3.0",
"lodash.clone": "^4.5.0",
"nan": "^2.13.2",
Expand Down Expand Up @@ -75,6 +76,8 @@
"deps/grpc/third_party/nanopb/*.{c,cc,h}",
"deps/grpc/third_party/upb/**/*.{c,h,inc}",
"deps/grpc/third_party/zlib/**/*.{c,cc,h}",
"deps/grpc/third_party/address_sorting/**/*.{c,h}",
"deps/grpc/third_party/cares/**/*.{c,h}",
"binding.gyp"
],
"main": "index.js",
Expand Down
50 changes: 49 additions & 1 deletion packages/grpc-native-core/src/client.js
Expand Up @@ -353,14 +353,62 @@ ClientDuplexStream.prototype.getPeer = getPeer;
* should be used to make this particular call.
*/

/**
* Properties of a call, for use with a {@link grpc.Client~callInvocationTransformer}.
* @typedef {Object} grpc.Client~CallProperties
* @property {*} argument The call argument. Only preset if the method is unary or server streaming.
* @property {grpc.Metadata} metadata The request metadata
* @property {grpc~Call} call The call object that will be returned by the client method
* @property {grpc.Channel} channel The channel that will be used to make a request
* @property {grpc~MethodDefinition} methodDefinition The MethodDefinition object that describes this method
* @property {grpc.Client~CallOptions} options The call options passed when making this request
* @property {grpc.Client~requestCallback} callback The callback that will handle the response.
* Only present if this method is unary or client streaming.
*/

/**
* Call invocation transformer. Has access to the full call properties before a
* call is processed and can modify most of those properties. Some modifications
* will have no effect or may cause problems.
* @name grpc.Client~callInvocationTransformer
* @function
* @param {grpc.Client~CallProperties} callProperties The original call properties
* @return {grpc.Client~CallProperties} The modified call properties.
*/

/**
* A function that functionally replaces the Channel constructor.
* @name grpc.Client~channelFactory
* @function
* @param {string} target The address of the server to connect to
* @param {grpc.ChannelCredentials} credentials Channel credentials to use when connecting
* @param {grpc~ChannelOptions} options A map of channel options that will be passed to the core.
* The available options are listed in
* [this document]{@link https://grpc.github.io/grpc/core/group__grpc__arg__keys.html}.
* @returns {grpc.Channel} This can either be an actual channel object, or an object with the
* same API.
*/

/**
* A generic gRPC client. Primarily useful as a base class for generated clients
* @memberof grpc
* @constructor
* @param {string} address Server address to connect to
* @param {grpc.credentials~ChannelCredentials} credentials Credentials to use
* to connect to the server
* @param {Object} options Options to apply to channel creation
* @param {Object} options Options to apply to channel creation. Any of
* [the channel arguments]{@link https://grpc.github.io/grpc/core/group__grpc__arg__keys.html}
* can be used here in addition to specific client options.
* @param {grpc~Interceptor[]} [options.interceptors] Interceptors to apply to each request
* @param {grpc~InterceptorProvider[]} [options.interceptor_providers] Interceptor providers
* to apply interceptors to each request depending on the method definition. At most
* one of the interceptors and interceptor_providers options may be set.
* @param {grpc.Client~callInvocationTransformer=} options.callInvocationTransformer
* @param {grpc.Channel=} options.channelOverride Channel to use instead of constructing a new one.
* If set, the address, credentials, channel arguments options, and channelFactoryOverride
* option will all be ignored.
* @param {grpc.Client~channelFactory} options.channelFactoryOverride Function to use instead of
* the Channel constructor when creating the Client's channel.
*/
function Client(address, credentials, options) {
var self = this;
Expand Down
3 changes: 2 additions & 1 deletion packages/grpc-native-core/src/server.js
Expand Up @@ -722,7 +722,8 @@ var streamHandlers = {
* @memberof grpc
* @constructor
* @param {Object=} options Options that should be passed to the internal server
* implementation
* implementation. The available options are listed in
* [this document]{@link https://grpc.github.io/grpc/core/group__grpc__arg__keys.html}.
* @example
* var server = new grpc.Server();
* server.addProtoService(protobuf_service_descriptor, service_implementation);
Expand Down
3 changes: 3 additions & 0 deletions packages/grpc-native-core/templates/package.json.template
Expand Up @@ -31,6 +31,7 @@
"node-pre-gyp"
],
"dependencies": {
"@types/bytebuffer": "^5.0.40",
"lodash.camelcase": "^4.3.0",
"lodash.clone": "^4.5.0",
"nan": "^2.13.2",
Expand Down Expand Up @@ -77,6 +78,8 @@
"deps/grpc/third_party/nanopb/*.{c,cc,h}",
"deps/grpc/third_party/upb/**/*.{c,h,inc}",
"deps/grpc/third_party/zlib/**/*.{c,cc,h}",
"deps/grpc/third_party/address_sorting/**/*.{c,h}",
"deps/grpc/third_party/cares/**/*.{c,h}",
"binding.gyp"
],
"main": "index.js",
Expand Down
Expand Up @@ -14,7 +14,7 @@

set arch_list=ia32 x64

set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 2.0.0 3.0.0 3.1.0 4.1.0 4.2.0 5.0.0
set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 2.0.0 3.0.0 3.1.0 4.1.0 4.2.0 5.0.0 6.0.0

set PATH=%PATH%;C:\Program Files\nodejs\;%APPDATA%\npm

Expand Down
Expand Up @@ -16,7 +16,7 @@
set -ex

arch_list=( ia32 x64 )
electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 2.0.0 3.0.0 3.1.0 4.1.0 4.2.0 5.0.0 )
electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 2.0.0 3.0.0 3.1.0 4.1.0 4.2.0 5.0.0 6.0.0 )

umask 022

Expand Down
2 changes: 1 addition & 1 deletion test/kokoro/windows-build-electron.cfg
Expand Up @@ -16,4 +16,4 @@

# Location of the continuous shell script in repository.
build_file: "grpc-node/tools/release/kokoro-electron.bat"
timeout_mins: 60
timeout_mins: 120
2 changes: 1 addition & 1 deletion tools/release/kokoro-electron.bat
Expand Up @@ -20,7 +20,7 @@ SET PATH=%APPDATA%\nvm-ps;%APPDATA%\nvm-ps\nodejs;%PATH%
call nvm install 10
call nvm use 10

call npm install -g npm
call npm install -g npm@6.10.x
@rem https://github.com/mapbox/node-pre-gyp/issues/362
call npm install -g node-gyp@3

Expand Down
2 changes: 1 addition & 1 deletion tools/release/kokoro-nodejs.bat
Expand Up @@ -20,7 +20,7 @@ SET PATH=%APPDATA%\nvm-ps;%APPDATA%\nvm-ps\nodejs;%PATH%
call nvm install 10
call nvm use 10

call npm install -g npm
call npm install -g npm@6.10.x
@rem https://github.com/mapbox/node-pre-gyp/issues/362
call npm install -g node-gyp@3

Expand Down

0 comments on commit 69b19df

Please sign in to comment.