grpc-js: Separate xds code into a separate plugin package

This commit is contained in:
Michael Lumish 2020-10-20 10:38:00 -07:00
parent bbd7617ba7
commit a6a8639343
282 changed files with 1600 additions and 594 deletions

16
.gitmodules vendored
View File

@ -1,15 +1,15 @@
[submodule "packages/grpc-tools/deps/protobuf"]
path = packages/grpc-tools/deps/protobuf
url = https://github.com/protocolbuffers/protobuf
[submodule "packages/grpc-js/deps/envoy-api"]
path = packages/grpc-js/deps/envoy-api
[submodule "packages/grpc-js-xds/deps/envoy-api"]
path = packages/grpc-js-xds/deps/envoy-api
url = https://github.com/envoyproxy/data-plane-api.git
[submodule "packages/grpc-js/deps/udpa"]
path = packages/grpc-js/deps/udpa
[submodule "packages/grpc-js-xds/deps/udpa"]
path = packages/grpc-js-xds/deps/udpa
url = https://github.com/cncf/udpa.git
[submodule "packages/grpc-js/deps/googleapis"]
path = packages/grpc-js/deps/googleapis
[submodule "packages/grpc-js-xds/deps/googleapis"]
path = packages/grpc-js-xds/deps/googleapis
url = https://github.com/googleapis/googleapis.git
[submodule "packages/grpc-js/deps/protoc-gen-validate"]
path = packages/grpc-js/deps/protoc-gen-validate
[submodule "packages/grpc-js-xds/deps/protoc-gen-validate"]
path = packages/grpc-js-xds/deps/protoc-gen-validate
url = https://github.com/envoyproxy/protoc-gen-validate.git

View File

@ -1,6 +1,6 @@
// Original file: proto/grpc/testing/test.proto
import * as grpc from '../../../../src'
import * as grpc from '@grpc/grpc-js'
import { LoadBalancerStatsRequest as _grpc_testing_LoadBalancerStatsRequest, LoadBalancerStatsRequest__Output as _grpc_testing_LoadBalancerStatsRequest__Output } from '../../grpc/testing/LoadBalancerStatsRequest';
import { LoadBalancerStatsResponse as _grpc_testing_LoadBalancerStatsResponse, LoadBalancerStatsResponse__Output as _grpc_testing_LoadBalancerStatsResponse__Output } from '../../grpc/testing/LoadBalancerStatsResponse';

View File

@ -1,6 +1,6 @@
// Original file: proto/grpc/testing/test.proto
import * as grpc from '../../../../src'
import * as grpc from '@grpc/grpc-js'
import { Empty as _grpc_testing_Empty, Empty__Output as _grpc_testing_Empty__Output } from '../../grpc/testing/Empty';
import { ReconnectInfo as _grpc_testing_ReconnectInfo, ReconnectInfo__Output as _grpc_testing_ReconnectInfo__Output } from '../../grpc/testing/ReconnectInfo';
import { ReconnectParams as _grpc_testing_ReconnectParams, ReconnectParams__Output as _grpc_testing_ReconnectParams__Output } from '../../grpc/testing/ReconnectParams';

View File

@ -1,6 +1,6 @@
// Original file: proto/grpc/testing/test.proto
import * as grpc from '../../../../src'
import * as grpc from '@grpc/grpc-js'
import { Empty as _grpc_testing_Empty, Empty__Output as _grpc_testing_Empty__Output } from '../../grpc/testing/Empty';
import { SimpleRequest as _grpc_testing_SimpleRequest, SimpleRequest__Output as _grpc_testing_SimpleRequest__Output } from '../../grpc/testing/SimpleRequest';
import { SimpleResponse as _grpc_testing_SimpleResponse, SimpleResponse__Output as _grpc_testing_SimpleResponse__Output } from '../../grpc/testing/SimpleResponse';

View File

@ -1,6 +1,6 @@
// Original file: proto/grpc/testing/test.proto
import * as grpc from '../../../../src'
import * as grpc from '@grpc/grpc-js'
import { Empty as _grpc_testing_Empty, Empty__Output as _grpc_testing_Empty__Output } from '../../grpc/testing/Empty';
/**

View File

@ -1,6 +1,6 @@
// Original file: proto/grpc/testing/test.proto
import * as grpc from '../../../../src'
import * as grpc from '@grpc/grpc-js'
import { Empty as _grpc_testing_Empty, Empty__Output as _grpc_testing_Empty__Output } from '../../grpc/testing/Empty';
/**

View File

@ -1,4 +1,4 @@
import * as grpc from '../../src';
import * as grpc from '@grpc/grpc-js';
import { ServiceDefinition, EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader';
import { LoadBalancerStatsServiceClient as _grpc_testing_LoadBalancerStatsServiceClient } from './grpc/testing/LoadBalancerStatsService';

View File

@ -15,7 +15,9 @@
*
*/
import * as grpc from '../src';
import * as grpc from '@grpc/grpc-js';
import * as grpc_xds from '../src';
import { ProtoGrpcType } from './generated/test';
@ -25,6 +27,8 @@ import { LoadBalancerStatsResponse } from './generated/grpc/testing/LoadBalancer
import * as yargs from 'yargs';
import { LoadBalancerStatsServiceHandlers } from './generated/grpc/testing/LoadBalancerStatsService';
grpc_xds.register();
const packageDefinition = protoLoader.loadSync('grpc/testing/test.proto', {
keepCase: true,
defaults: true,

View File

@ -11,7 +11,9 @@
"fix": "gts fix",
"prepare": "npm run compile",
"pretest": "npm run compile",
"posttest": "npm run check"
"posttest": "npm run check",
"generate-types": "proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --json --includeComments --includeDirs deps/envoy-api/ deps/udpa/ deps/googleapis/ deps/protoc-gen-validate/ -O src/generated/ --grpcLib @grpc/grpc-js envoy/service/discovery/v2/ads.proto envoy/service/load_stats/v2/lrs.proto envoy/api/v2/listener.proto envoy/api/v2/route.proto envoy/api/v2/cluster.proto envoy/api/v2/endpoint.proto envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.proto",
"generate-interop-types": "proto-loader-gen-types --keep-case --longs String --enums String --defaults --oneofs --json --includeComments --includeDirs proto/ -O interop/generated --grpcLib @grpc/grpc-js grpc/testing/test.proto"
},
"repository": {
"type": "git",
@ -31,10 +33,15 @@
"devDependencies": {
"gts": "^2.0.2",
"typescript": "^3.8.3",
"@types/gulp": "^4.0.6",
"@types/gulp-mocha": "0.0.32",
"@types/mocha": "^5.2.6",
"@types/node": "^13.11.1",
"@types/yargs": "^15.0.5",
"yargs": "^15.4.1"
},
"dependencies": {
"@grpc/grpc-js": "file:../grpc-js",
"@grpc/proto-loader": "^0.6.0-pre14",
"google-auth-library": "^6.1.1"
}

View File

@ -34,6 +34,10 @@ echo "source $NVM_DIR/nvm.sh" > ~/.profile
echo "source $NVM_DIR/nvm.sh" > ~/.shrc
export ENV=~/.shrc
cd $base/../grpc-js
npm install
# grpc-js-xds has a dev dependency on "../grpc-js", so it should pull that in automatically
cd $base
git submodule update --init --recursive
npm install

View File

@ -1,4 +1,4 @@
import * as grpc from '../index';
import * as grpc from '@grpc/grpc-js';
import { ServiceDefinition, EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader';
import { AggregatedDiscoveryServiceClient as _envoy_service_discovery_v2_AggregatedDiscoveryServiceClient } from './envoy/service/discovery/v2/AggregatedDiscoveryService';
@ -6,7 +6,7 @@ import { AggregatedDiscoveryServiceClient as _envoy_service_discovery_v2_Aggrega
type ConstructorArguments<Constructor> = Constructor extends new (...args: infer Args) => any ? Args: never;
type SubtypeConstructor<Constructor, Subtype> = {
new(...args: ConstructorArguments<Constructor>): Subtype;
}
};
export interface ProtoGrpcType {
envoy: {

View File

@ -1,11 +1,11 @@
import * as grpc from '../index';
import * as grpc from '@grpc/grpc-js';
import { ServiceDefinition, EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader';
type ConstructorArguments<Constructor> = Constructor extends new (...args: infer Args) => any ? Args: never;
type SubtypeConstructor<Constructor, Subtype> = {
new(...args: ConstructorArguments<Constructor>): Subtype;
}
};
export interface ProtoGrpcType {
envoy: {

View File

@ -1,11 +1,11 @@
import * as grpc from '../index';
import * as grpc from '@grpc/grpc-js';
import { ServiceDefinition, EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader';
type ConstructorArguments<Constructor> = Constructor extends new (...args: infer Args) => any ? Args: never;
type SubtypeConstructor<Constructor, Subtype> = {
new(...args: ConstructorArguments<Constructor>): Subtype;
}
};
export interface ProtoGrpcType {
envoy: {

Some files were not shown because too many files have changed in this diff Show More