Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing gRPC services over context bridge #38573

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions buf-ts.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
version: v1
plugins:
- name: typescript
out: gen/proto/ts
opt: long_type_number,eslint_disable,add_pb_suffix,client_grpc1,server_grpc1,ts_nocheck
path:
- npm
- exec
- --yes
- --package=@protobuf-ts/[email protected]
- --
- protoc-gen-ts
strategy: all
version: v1
plugins:
- name: typescript
out: gen/proto/ts
opt: long_type_number,eslint_disable,add_pb_suffix,server_grpc1,ts_nocheck
path:
- npm
- exec
- --yes
- --package=@protobuf-ts/[email protected]
- --
- protoc-gen-ts
strategy: all
2 changes: 1 addition & 1 deletion gen/proto/ts/google/protobuf/descriptor_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gen/proto/ts/google/protobuf/duration_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gen/proto/ts/google/protobuf/empty_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gen/proto/ts/google/protobuf/field_mask_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gen/proto/ts/google/protobuf/timestamp_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */
// @generated by protobuf-ts 2.9.3 with parameter long_type_number,eslint_disable,add_pb_suffix,client_grpc1,server_grpc1,ts_nocheck
// @generated by protobuf-ts 2.9.3 with parameter long_type_number,eslint_disable,add_pb_suffix,server_grpc1,ts_nocheck
// @generated from protobuf file "prehog/v1/teleport.proto" (package "prehog.v1", syntax proto3)
// tslint:disable
// @ts-nocheck
Expand All @@ -21,12 +21,14 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { TeleportReportingService } from "./teleport_pb";
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
import type { SubmitUsageReportsResponse } from "./teleport_pb";
import type { SubmitUsageReportsRequest } from "./teleport_pb";
import * as grpc from "@grpc/grpc-js";
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
/**
* @generated from protobuf service prehog.v1.TeleportReportingService
*/
Expand All @@ -44,19 +46,16 @@ export interface ITeleportReportingServiceClient {
*
* @generated from protobuf rpc: SubmitUsageReports(prehog.v1.SubmitUsageReportsRequest) returns (prehog.v1.SubmitUsageReportsResponse);
*/
submitUsageReports(input: SubmitUsageReportsRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: (err: grpc.ServiceError | null, value?: SubmitUsageReportsResponse) => void): grpc.ClientUnaryCall;
submitUsageReports(input: SubmitUsageReportsRequest, metadata: grpc.Metadata, callback: (err: grpc.ServiceError | null, value?: SubmitUsageReportsResponse) => void): grpc.ClientUnaryCall;
submitUsageReports(input: SubmitUsageReportsRequest, options: grpc.CallOptions, callback: (err: grpc.ServiceError | null, value?: SubmitUsageReportsResponse) => void): grpc.ClientUnaryCall;
submitUsageReports(input: SubmitUsageReportsRequest, callback: (err: grpc.ServiceError | null, value?: SubmitUsageReportsResponse) => void): grpc.ClientUnaryCall;
submitUsageReports(input: SubmitUsageReportsRequest, options?: RpcOptions): UnaryCall<SubmitUsageReportsRequest, SubmitUsageReportsResponse>;
}
/**
* @generated from protobuf service prehog.v1.TeleportReportingService
*/
export class TeleportReportingServiceClient extends grpc.Client implements ITeleportReportingServiceClient {
private readonly _binaryOptions: Partial<BinaryReadOptions & BinaryWriteOptions>;
constructor(address: string, credentials: grpc.ChannelCredentials, options: grpc.ClientOptions = {}, binaryOptions: Partial<BinaryReadOptions & BinaryWriteOptions> = {}) {
super(address, credentials, options);
this._binaryOptions = binaryOptions;
export class TeleportReportingServiceClient implements ITeleportReportingServiceClient, ServiceInfo {
typeName = TeleportReportingService.typeName;
methods = TeleportReportingService.methods;
options = TeleportReportingService.options;
constructor(private readonly _transport: RpcTransport) {
}
/**
* encodes and forwards usage reports to the PostHog event database; each
Expand All @@ -71,8 +70,8 @@ export class TeleportReportingServiceClient extends grpc.Client implements ITele
*
* @generated from protobuf rpc: SubmitUsageReports(prehog.v1.SubmitUsageReportsRequest) returns (prehog.v1.SubmitUsageReportsResponse);
*/
submitUsageReports(input: SubmitUsageReportsRequest, metadata: grpc.Metadata | grpc.CallOptions | ((err: grpc.ServiceError | null, value?: SubmitUsageReportsResponse) => void), options?: grpc.CallOptions | ((err: grpc.ServiceError | null, value?: SubmitUsageReportsResponse) => void), callback?: ((err: grpc.ServiceError | null, value?: SubmitUsageReportsResponse) => void)): grpc.ClientUnaryCall {
const method = TeleportReportingService.methods[0];
return this.makeUnaryRequest<SubmitUsageReportsRequest, SubmitUsageReportsResponse>(`/${TeleportReportingService.typeName}/${method.name}`, (value: SubmitUsageReportsRequest): Buffer => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value: Buffer): SubmitUsageReportsResponse => method.O.fromBinary(value, this._binaryOptions), input, (metadata as any), (options as any), (callback as any));
submitUsageReports(input: SubmitUsageReportsRequest, options?: RpcOptions): UnaryCall<SubmitUsageReportsRequest, SubmitUsageReportsResponse> {
const method = this.methods[0], opt = this._transport.mergeOptions(options);
return stackIntercept<SubmitUsageReportsRequest, SubmitUsageReportsResponse>("unary", this._transport, method, opt, input);
}
}
2 changes: 1 addition & 1 deletion gen/proto/ts/prehog/v1/teleport_pb.grpc-server.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions gen/proto/ts/prehog/v1/teleport_pb.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* eslint-disable */
// @generated by protobuf-ts 2.9.3 with parameter long_type_number,eslint_disable,add_pb_suffix,ts_nocheck,server_generic
// @generated from protobuf file "prehog/v1/teleport.proto" (package "prehog.v1", syntax proto3)
// tslint:disable
// @ts-nocheck
//
//
// Teleport
// Copyright (C) 2023 Gravitational, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
import { SubmitUsageReportsResponse } from "./teleport_pb";
import { SubmitUsageReportsRequest } from "./teleport_pb";
import { ServerCallContext } from "@protobuf-ts/runtime-rpc";
/**
* @generated from protobuf service prehog.v1.TeleportReportingService
*/
export interface ITeleportReportingService<T = ServerCallContext> {
/**
* encodes and forwards usage reports to the PostHog event database; each
* event is annotated with some properties that depend on the identity of the
* caller:
* - tp.account_id (UUID in string form, can be empty if missing from the
* license)
* - tp.license_name (should always be a UUID)
* - tp.license_authority (name of the authority that signed the license file
* used for authentication)
* - tp.is_cloud (boolean)
*
* @generated from protobuf rpc: SubmitUsageReports(prehog.v1.SubmitUsageReportsRequest) returns (prehog.v1.SubmitUsageReportsResponse);
*/
submitUsageReports(request: SubmitUsageReportsRequest, context: T): Promise<SubmitUsageReportsResponse>;
}
2 changes: 1 addition & 1 deletion gen/proto/ts/prehog/v1/teleport_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions gen/proto/ts/prehog/v1alpha/connect_pb.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* eslint-disable */
// @generated by protobuf-ts 2.9.3 with parameter long_type_number,eslint_disable,add_pb_suffix,server_grpc1,ts_nocheck
// @generated from protobuf file "prehog/v1alpha/connect.proto" (package "prehog.v1alpha", syntax proto3)
// tslint:disable
// @ts-nocheck
//
//
// Teleport
// Copyright (C) 2023 Gravitational, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { ConnectReportingService } from "./connect_pb";
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
import type { SubmitConnectEventResponse } from "./connect_pb";
import type { SubmitConnectEventRequest } from "./connect_pb";
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
/**
* @generated from protobuf service prehog.v1alpha.ConnectReportingService
*/
export interface IConnectReportingServiceClient {
/**
* @generated from protobuf rpc: SubmitConnectEvent(prehog.v1alpha.SubmitConnectEventRequest) returns (prehog.v1alpha.SubmitConnectEventResponse);
*/
submitConnectEvent(input: SubmitConnectEventRequest, options?: RpcOptions): UnaryCall<SubmitConnectEventRequest, SubmitConnectEventResponse>;
}
/**
* @generated from protobuf service prehog.v1alpha.ConnectReportingService
*/
export class ConnectReportingServiceClient implements IConnectReportingServiceClient, ServiceInfo {
typeName = ConnectReportingService.typeName;
methods = ConnectReportingService.methods;
options = ConnectReportingService.options;
constructor(private readonly _transport: RpcTransport) {
}
/**
* @generated from protobuf rpc: SubmitConnectEvent(prehog.v1alpha.SubmitConnectEventRequest) returns (prehog.v1alpha.SubmitConnectEventResponse);
*/
submitConnectEvent(input: SubmitConnectEventRequest, options?: RpcOptions): UnaryCall<SubmitConnectEventRequest, SubmitConnectEventResponse> {
const method = this.methods[0], opt = this._transport.mergeOptions(options);
return stackIntercept<SubmitConnectEventRequest, SubmitConnectEventResponse>("unary", this._transport, method, opt, input);
}
}
58 changes: 0 additions & 58 deletions gen/proto/ts/prehog/v1alpha/connect_pb.grpc-client.ts

This file was deleted.

2 changes: 1 addition & 1 deletion gen/proto/ts/prehog/v1alpha/connect_pb.grpc-server.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions gen/proto/ts/prehog/v1alpha/connect_pb.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* eslint-disable */
// @generated by protobuf-ts 2.9.3 with parameter long_type_number,eslint_disable,add_pb_suffix,ts_nocheck,server_generic
// @generated from protobuf file "prehog/v1alpha/connect.proto" (package "prehog.v1alpha", syntax proto3)
// tslint:disable
// @ts-nocheck
//
//
// Teleport
// Copyright (C) 2023 Gravitational, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
import { SubmitConnectEventResponse } from "./connect_pb";
import { SubmitConnectEventRequest } from "./connect_pb";
import { ServerCallContext } from "@protobuf-ts/runtime-rpc";
/**
* @generated from protobuf service prehog.v1alpha.ConnectReportingService
*/
export interface IConnectReportingService<T = ServerCallContext> {
/**
* @generated from protobuf rpc: SubmitConnectEvent(prehog.v1alpha.SubmitConnectEventRequest) returns (prehog.v1alpha.SubmitConnectEventResponse);
*/
submitConnectEvent(request: SubmitConnectEventRequest, context: T): Promise<SubmitConnectEventResponse>;
}
2 changes: 1 addition & 1 deletion gen/proto/ts/prehog/v1alpha/connect_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading