diff --git a/protos/plugin/v3/plugin.proto b/protos/plugin/v3/plugin.proto index 55484a8..8cbddcf 100644 --- a/protos/plugin/v3/plugin.proto +++ b/protos/plugin/v3/plugin.proto @@ -29,6 +29,8 @@ service Plugin { rpc Write(stream Write.Request) returns (Write.Response); // Transform resources. rpc Transform(stream Transform.Request) returns (stream Transform.Response); + // Transform schemas. + rpc TransformSchema(stream TransformSchema.Request) returns (stream TransformSchema.Response); // Send signal to flush and close open connections rpc Close(Close.Request) returns (Close.Response); // Validate and test the connections used by the plugin @@ -203,6 +205,17 @@ message Transform { } } +message TransformSchema { + message Request { + // marshalled arrow.Schema + bytes schema = 1; + } + message Response { + // marshalled arrow.Schema + bytes schema = 1; + } +} + message Close { message Request {} message Response {} diff --git a/protos/plugin/v3/plugin.ts b/protos/plugin/v3/plugin.ts index 4b2af20..df0f70e 100644 --- a/protos/plugin/v3/plugin.ts +++ b/protos/plugin/v3/plugin.ts @@ -2890,6 +2890,182 @@ export namespace cloudquery.plugin.v3 { } } } + export class TransformSchema extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | {}) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { } + } + static fromObject(data: {}): TransformSchema { + const message = new TransformSchema({}); + return message; + } + toObject() { + const data: {} = {}; + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TransformSchema { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new TransformSchema(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): TransformSchema { + return TransformSchema.deserialize(bytes); + } + } + export namespace TransformSchema { + export class Request extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + schema?: Uint8Array; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("schema" in data && data.schema != undefined) { + this.schema = data.schema; + } + } + } + get schema() { + return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array; + } + set schema(value: Uint8Array) { + pb_1.Message.setField(this, 1, value); + } + static fromObject(data: { + schema?: Uint8Array; + }): Request { + const message = new Request({}); + if (data.schema != null) { + message.schema = data.schema; + } + return message; + } + toObject() { + const data: { + schema?: Uint8Array; + } = {}; + if (this.schema != null) { + data.schema = this.schema; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.schema.length) + writer.writeBytes(1, this.schema); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Request { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Request(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.schema = reader.readBytes(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Request { + return Request.deserialize(bytes); + } + } + export class Response extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + schema?: Uint8Array; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("schema" in data && data.schema != undefined) { + this.schema = data.schema; + } + } + } + get schema() { + return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array; + } + set schema(value: Uint8Array) { + pb_1.Message.setField(this, 1, value); + } + static fromObject(data: { + schema?: Uint8Array; + }): Response { + const message = new Response({}); + if (data.schema != null) { + message.schema = data.schema; + } + return message; + } + toObject() { + const data: { + schema?: Uint8Array; + } = {}; + if (this.schema != null) { + data.schema = this.schema; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.schema.length) + writer.writeBytes(1, this.schema); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Response { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Response(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.schema = reader.readBytes(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Response { + return Response.deserialize(bytes); + } + } + } export class Close extends pb_1.Message { #one_of_decls: number[][] = []; constructor(data?: any[] | {}) { @@ -3341,6 +3517,15 @@ export namespace cloudquery.plugin.v3 { responseSerialize: (message: Transform.Response) => Buffer.from(message.serialize()), responseDeserialize: (bytes: Buffer) => Transform.Response.deserialize(new Uint8Array(bytes)) }, + TransformSchema: { + path: "/cloudquery.plugin.v3.Plugin/TransformSchema", + requestStream: true, + responseStream: true, + requestSerialize: (message: TransformSchema.Request) => Buffer.from(message.serialize()), + requestDeserialize: (bytes: Buffer) => TransformSchema.Request.deserialize(new Uint8Array(bytes)), + responseSerialize: (message: TransformSchema.Response) => Buffer.from(message.serialize()), + responseDeserialize: (bytes: Buffer) => TransformSchema.Response.deserialize(new Uint8Array(bytes)) + }, Close: { path: "/cloudquery.plugin.v3.Plugin/Close", requestStream: false, @@ -3370,6 +3555,7 @@ export namespace cloudquery.plugin.v3 { abstract Read(call: grpc_1.ServerWritableStream): void; abstract Write(call: grpc_1.ServerReadableStream, callback: grpc_1.sendUnaryData): void; abstract Transform(call: grpc_1.ServerDuplexStream): void; + abstract TransformSchema(call: grpc_1.ServerDuplexStream): void; abstract Close(call: grpc_1.ServerUnaryCall, callback: grpc_1.sendUnaryData): void; abstract TestConnection(call: grpc_1.ServerUnaryCall, callback: grpc_1.sendUnaryData): void; } @@ -3404,6 +3590,9 @@ export namespace cloudquery.plugin.v3 { Transform: GrpcChunkServiceInterface = (metadata?: grpc_1.Metadata | grpc_1.CallOptions, options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream => { return super.Transform(metadata, options); }; + TransformSchema: GrpcChunkServiceInterface = (metadata?: grpc_1.Metadata | grpc_1.CallOptions, options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream => { + return super.TransformSchema(metadata, options); + }; Close: GrpcUnaryServiceInterface = (message: Close.Request, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback, options?: grpc_1.CallOptions | grpc_1.requestCallback, callback?: grpc_1.requestCallback): grpc_1.ClientUnaryCall => { return super.Close(message, metadata, options, callback); };