Skip to content

Commit 97268e4

Browse files
authored
fix: Generate JavaScript Code from plugin-pb (#57)
This PR was created by a scheduled workflow to regenerate the JavaScript code from `plugin-pb`.
1 parent cccda54 commit 97268e4

File tree

2 files changed

+248
-0
lines changed

2 files changed

+248
-0
lines changed

protos/plugin/v3/plugin.proto

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ service Plugin {
2929
rpc Write(stream Write.Request) returns (Write.Response);
3030
// Send signal to flush and close open connections
3131
rpc Close(Close.Request) returns (Close.Response);
32+
// Validate and test the connections used by the plugin
33+
rpc TestConnection(TestConnection.Request) returns (TestConnection.Response);
3234
}
3335

3436
message GetName {
@@ -192,3 +194,14 @@ message Close {
192194
message Request {}
193195
message Response {}
194196
}
197+
198+
message TestConnection {
199+
message Request{
200+
bytes spec = 1; // Internal plugin-specific spec
201+
}
202+
message Response{
203+
bool success = 1;
204+
string failure_code = 2;
205+
string failure_description = 3;
206+
}
207+
}

protos/plugin/v3/plugin.ts

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2836,6 +2836,228 @@ export namespace cloudquery.plugin.v3 {
28362836
}
28372837
}
28382838
}
2839+
export class TestConnection extends pb_1.Message {
2840+
#one_of_decls: number[][] = [];
2841+
constructor(data?: any[] | {}) {
2842+
super();
2843+
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
2844+
if (!Array.isArray(data) && typeof data == "object") { }
2845+
}
2846+
static fromObject(data: {}): TestConnection {
2847+
const message = new TestConnection({});
2848+
return message;
2849+
}
2850+
toObject() {
2851+
const data: {} = {};
2852+
return data;
2853+
}
2854+
serialize(): Uint8Array;
2855+
serialize(w: pb_1.BinaryWriter): void;
2856+
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
2857+
const writer = w || new pb_1.BinaryWriter();
2858+
if (!w)
2859+
return writer.getResultBuffer();
2860+
}
2861+
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TestConnection {
2862+
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TestConnection();
2863+
while (reader.nextField()) {
2864+
if (reader.isEndGroup())
2865+
break;
2866+
switch (reader.getFieldNumber()) {
2867+
default: reader.skipField();
2868+
}
2869+
}
2870+
return message;
2871+
}
2872+
serializeBinary(): Uint8Array {
2873+
return this.serialize();
2874+
}
2875+
static deserializeBinary(bytes: Uint8Array): TestConnection {
2876+
return TestConnection.deserialize(bytes);
2877+
}
2878+
}
2879+
export namespace TestConnection {
2880+
export class Request extends pb_1.Message {
2881+
#one_of_decls: number[][] = [];
2882+
constructor(data?: any[] | {
2883+
spec?: Uint8Array;
2884+
}) {
2885+
super();
2886+
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
2887+
if (!Array.isArray(data) && typeof data == "object") {
2888+
if ("spec" in data && data.spec != undefined) {
2889+
this.spec = data.spec;
2890+
}
2891+
}
2892+
}
2893+
get spec() {
2894+
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array;
2895+
}
2896+
set spec(value: Uint8Array) {
2897+
pb_1.Message.setField(this, 1, value);
2898+
}
2899+
static fromObject(data: {
2900+
spec?: Uint8Array;
2901+
}): Request {
2902+
const message = new Request({});
2903+
if (data.spec != null) {
2904+
message.spec = data.spec;
2905+
}
2906+
return message;
2907+
}
2908+
toObject() {
2909+
const data: {
2910+
spec?: Uint8Array;
2911+
} = {};
2912+
if (this.spec != null) {
2913+
data.spec = this.spec;
2914+
}
2915+
return data;
2916+
}
2917+
serialize(): Uint8Array;
2918+
serialize(w: pb_1.BinaryWriter): void;
2919+
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
2920+
const writer = w || new pb_1.BinaryWriter();
2921+
if (this.spec.length)
2922+
writer.writeBytes(1, this.spec);
2923+
if (!w)
2924+
return writer.getResultBuffer();
2925+
}
2926+
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Request {
2927+
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Request();
2928+
while (reader.nextField()) {
2929+
if (reader.isEndGroup())
2930+
break;
2931+
switch (reader.getFieldNumber()) {
2932+
case 1:
2933+
message.spec = reader.readBytes();
2934+
break;
2935+
default: reader.skipField();
2936+
}
2937+
}
2938+
return message;
2939+
}
2940+
serializeBinary(): Uint8Array {
2941+
return this.serialize();
2942+
}
2943+
static deserializeBinary(bytes: Uint8Array): Request {
2944+
return Request.deserialize(bytes);
2945+
}
2946+
}
2947+
export class Response extends pb_1.Message {
2948+
#one_of_decls: number[][] = [];
2949+
constructor(data?: any[] | {
2950+
success?: boolean;
2951+
failure_code?: string;
2952+
failure_description?: string;
2953+
}) {
2954+
super();
2955+
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
2956+
if (!Array.isArray(data) && typeof data == "object") {
2957+
if ("success" in data && data.success != undefined) {
2958+
this.success = data.success;
2959+
}
2960+
if ("failure_code" in data && data.failure_code != undefined) {
2961+
this.failure_code = data.failure_code;
2962+
}
2963+
if ("failure_description" in data && data.failure_description != undefined) {
2964+
this.failure_description = data.failure_description;
2965+
}
2966+
}
2967+
}
2968+
get success() {
2969+
return pb_1.Message.getFieldWithDefault(this, 1, false) as boolean;
2970+
}
2971+
set success(value: boolean) {
2972+
pb_1.Message.setField(this, 1, value);
2973+
}
2974+
get failure_code() {
2975+
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
2976+
}
2977+
set failure_code(value: string) {
2978+
pb_1.Message.setField(this, 2, value);
2979+
}
2980+
get failure_description() {
2981+
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
2982+
}
2983+
set failure_description(value: string) {
2984+
pb_1.Message.setField(this, 3, value);
2985+
}
2986+
static fromObject(data: {
2987+
success?: boolean;
2988+
failure_code?: string;
2989+
failure_description?: string;
2990+
}): Response {
2991+
const message = new Response({});
2992+
if (data.success != null) {
2993+
message.success = data.success;
2994+
}
2995+
if (data.failure_code != null) {
2996+
message.failure_code = data.failure_code;
2997+
}
2998+
if (data.failure_description != null) {
2999+
message.failure_description = data.failure_description;
3000+
}
3001+
return message;
3002+
}
3003+
toObject() {
3004+
const data: {
3005+
success?: boolean;
3006+
failure_code?: string;
3007+
failure_description?: string;
3008+
} = {};
3009+
if (this.success != null) {
3010+
data.success = this.success;
3011+
}
3012+
if (this.failure_code != null) {
3013+
data.failure_code = this.failure_code;
3014+
}
3015+
if (this.failure_description != null) {
3016+
data.failure_description = this.failure_description;
3017+
}
3018+
return data;
3019+
}
3020+
serialize(): Uint8Array;
3021+
serialize(w: pb_1.BinaryWriter): void;
3022+
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
3023+
const writer = w || new pb_1.BinaryWriter();
3024+
if (this.success != false)
3025+
writer.writeBool(1, this.success);
3026+
if (this.failure_code.length)
3027+
writer.writeString(2, this.failure_code);
3028+
if (this.failure_description.length)
3029+
writer.writeString(3, this.failure_description);
3030+
if (!w)
3031+
return writer.getResultBuffer();
3032+
}
3033+
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Response {
3034+
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Response();
3035+
while (reader.nextField()) {
3036+
if (reader.isEndGroup())
3037+
break;
3038+
switch (reader.getFieldNumber()) {
3039+
case 1:
3040+
message.success = reader.readBool();
3041+
break;
3042+
case 2:
3043+
message.failure_code = reader.readString();
3044+
break;
3045+
case 3:
3046+
message.failure_description = reader.readString();
3047+
break;
3048+
default: reader.skipField();
3049+
}
3050+
}
3051+
return message;
3052+
}
3053+
serializeBinary(): Uint8Array {
3054+
return this.serialize();
3055+
}
3056+
static deserializeBinary(bytes: Uint8Array): Response {
3057+
return Response.deserialize(bytes);
3058+
}
3059+
}
3060+
}
28393061
interface GrpcUnaryServiceInterface<P, R> {
28403062
(message: P, metadata: grpc_1.Metadata, options: grpc_1.CallOptions, callback: grpc_1.requestCallback<R>): grpc_1.ClientUnaryCall;
28413063
(message: P, metadata: grpc_1.Metadata, callback: grpc_1.requestCallback<R>): grpc_1.ClientUnaryCall;
@@ -2942,6 +3164,15 @@ export namespace cloudquery.plugin.v3 {
29423164
requestDeserialize: (bytes: Buffer) => Close.Request.deserialize(new Uint8Array(bytes)),
29433165
responseSerialize: (message: Close.Response) => Buffer.from(message.serialize()),
29443166
responseDeserialize: (bytes: Buffer) => Close.Response.deserialize(new Uint8Array(bytes))
3167+
},
3168+
TestConnection: {
3169+
path: "/cloudquery.plugin.v3.Plugin/TestConnection",
3170+
requestStream: false,
3171+
responseStream: false,
3172+
requestSerialize: (message: TestConnection.Request) => Buffer.from(message.serialize()),
3173+
requestDeserialize: (bytes: Buffer) => TestConnection.Request.deserialize(new Uint8Array(bytes)),
3174+
responseSerialize: (message: TestConnection.Response) => Buffer.from(message.serialize()),
3175+
responseDeserialize: (bytes: Buffer) => TestConnection.Response.deserialize(new Uint8Array(bytes))
29453176
}
29463177
};
29473178
[method: string]: grpc_1.UntypedHandleCall;
@@ -2954,6 +3185,7 @@ export namespace cloudquery.plugin.v3 {
29543185
abstract Read(call: grpc_1.ServerWritableStream<Read.Request, Read.Response>): void;
29553186
abstract Write(call: grpc_1.ServerReadableStream<Write.Request, Write.Response>, callback: grpc_1.sendUnaryData<Write.Response>): void;
29563187
abstract Close(call: grpc_1.ServerUnaryCall<Close.Request, Close.Response>, callback: grpc_1.sendUnaryData<Close.Response>): void;
3188+
abstract TestConnection(call: grpc_1.ServerUnaryCall<TestConnection.Request, TestConnection.Response>, callback: grpc_1.sendUnaryData<TestConnection.Response>): void;
29573189
}
29583190
export class PluginClient extends grpc_1.makeGenericClientConstructor(UnimplementedPluginService.definition, "Plugin", {}) {
29593191
constructor(address: string, credentials: grpc_1.ChannelCredentials, options?: Partial<grpc_1.ChannelOptions>) {
@@ -2986,5 +3218,8 @@ export namespace cloudquery.plugin.v3 {
29863218
Close: GrpcUnaryServiceInterface<Close.Request, Close.Response> = (message: Close.Request, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<Close.Response>, options?: grpc_1.CallOptions | grpc_1.requestCallback<Close.Response>, callback?: grpc_1.requestCallback<Close.Response>): grpc_1.ClientUnaryCall => {
29873219
return super.Close(message, metadata, options, callback);
29883220
};
3221+
TestConnection: GrpcUnaryServiceInterface<TestConnection.Request, TestConnection.Response> = (message: TestConnection.Request, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback<TestConnection.Response>, options?: grpc_1.CallOptions | grpc_1.requestCallback<TestConnection.Response>, callback?: grpc_1.requestCallback<TestConnection.Response>): grpc_1.ClientUnaryCall => {
3222+
return super.TestConnection(message, metadata, options, callback);
3223+
};
29893224
}
29903225
}

0 commit comments

Comments
 (0)