Skip to content

Commit

Permalink
fix: Generate JavaScript Code from plugin-pb (#74)
Browse files Browse the repository at this point in the history
This PR was created by a scheduled workflow to regenerate the JavaScript code from `plugin-pb`.
  • Loading branch information
cq-bot authored Sep 17, 2024
1 parent 929442e commit a3b0ee4
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 3 deletions.
5 changes: 5 additions & 0 deletions protos/plugin/v3/plugin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,16 @@ message Sync {
string connection = 2;
}
message Request {
message Shard {
int32 num = 1;
int32 total = 2;
}
repeated string tables = 1;
repeated string skip_tables = 2;
bool skip_dependent_tables = 3;
bool deterministic_cq_id = 4;
BackendOptions backend = 5;
optional Shard shard = 6;
}
message Response {
oneof message {
Expand Down
134 changes: 131 additions & 3 deletions protos/plugin/v3/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1262,14 +1262,16 @@ export namespace cloudquery.plugin.v3 {
}
}
export class Request extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
#one_of_decls: number[][] = [[6]];
constructor(data?: any[] | ({
tables?: string[];
skip_tables?: string[];
skip_dependent_tables?: boolean;
deterministic_cq_id?: boolean;
backend?: Sync.BackendOptions;
}) {
} & (({
shard?: Sync.Request.Shard;
})))) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
Expand All @@ -1288,6 +1290,9 @@ export namespace cloudquery.plugin.v3 {
if ("backend" in data && data.backend != undefined) {
this.backend = data.backend;
}
if ("shard" in data && data.shard != undefined) {
this.shard = data.shard;
}
}
}
get tables() {
Expand Down Expand Up @@ -1323,12 +1328,31 @@ export namespace cloudquery.plugin.v3 {
get has_backend() {
return pb_1.Message.getField(this, 5) != null;
}
get shard() {
return pb_1.Message.getWrapperField(this, Sync.Request.Shard, 6) as Sync.Request.Shard;
}
set shard(value: Sync.Request.Shard) {
pb_1.Message.setOneofWrapperField(this, 6, this.#one_of_decls[0], value);
}
get has_shard() {
return pb_1.Message.getField(this, 6) != null;
}
get _shard() {
const cases: {
[index: number]: "none" | "shard";
} = {
0: "none",
6: "shard"
};
return cases[pb_1.Message.computeOneofCase(this, [6])];
}
static fromObject(data: {
tables?: string[];
skip_tables?: string[];
skip_dependent_tables?: boolean;
deterministic_cq_id?: boolean;
backend?: ReturnType<typeof Sync.BackendOptions.prototype.toObject>;
shard?: ReturnType<typeof Sync.Request.Shard.prototype.toObject>;
}): Request {
const message = new Request({});
if (data.tables != null) {
Expand All @@ -1346,6 +1370,9 @@ export namespace cloudquery.plugin.v3 {
if (data.backend != null) {
message.backend = Sync.BackendOptions.fromObject(data.backend);
}
if (data.shard != null) {
message.shard = Sync.Request.Shard.fromObject(data.shard);
}
return message;
}
toObject() {
Expand All @@ -1355,6 +1382,7 @@ export namespace cloudquery.plugin.v3 {
skip_dependent_tables?: boolean;
deterministic_cq_id?: boolean;
backend?: ReturnType<typeof Sync.BackendOptions.prototype.toObject>;
shard?: ReturnType<typeof Sync.Request.Shard.prototype.toObject>;
} = {};
if (this.tables != null) {
data.tables = this.tables;
Expand All @@ -1371,6 +1399,9 @@ export namespace cloudquery.plugin.v3 {
if (this.backend != null) {
data.backend = this.backend.toObject();
}
if (this.shard != null) {
data.shard = this.shard.toObject();
}
return data;
}
serialize(): Uint8Array;
Expand All @@ -1387,6 +1418,8 @@ export namespace cloudquery.plugin.v3 {
writer.writeBool(4, this.deterministic_cq_id);
if (this.has_backend)
writer.writeMessage(5, this.backend, () => this.backend.serialize(writer));
if (this.has_shard)
writer.writeMessage(6, this.shard, () => this.shard.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
Expand All @@ -1411,6 +1444,9 @@ export namespace cloudquery.plugin.v3 {
case 5:
reader.readMessage(message.backend, () => message.backend = Sync.BackendOptions.deserialize(reader));
break;
case 6:
reader.readMessage(message.shard, () => message.shard = Sync.Request.Shard.deserialize(reader));
break;
default: reader.skipField();
}
}
Expand All @@ -1423,6 +1459,98 @@ export namespace cloudquery.plugin.v3 {
return Request.deserialize(bytes);
}
}
export namespace Request {
export class Shard extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
num?: number;
total?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("num" in data && data.num != undefined) {
this.num = data.num;
}
if ("total" in data && data.total != undefined) {
this.total = data.total;
}
}
}
get num() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set num(value: number) {
pb_1.Message.setField(this, 1, value);
}
get total() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
set total(value: number) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
num?: number;
total?: number;
}): Shard {
const message = new Shard({});
if (data.num != null) {
message.num = data.num;
}
if (data.total != null) {
message.total = data.total;
}
return message;
}
toObject() {
const data: {
num?: number;
total?: number;
} = {};
if (this.num != null) {
data.num = this.num;
}
if (this.total != null) {
data.total = this.total;
}
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.num != 0)
writer.writeInt32(1, this.num);
if (this.total != 0)
writer.writeInt32(2, this.total);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Shard {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Shard();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.num = reader.readInt32();
break;
case 2:
message.total = reader.readInt32();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Shard {
return Shard.deserialize(bytes);
}
}
}
export class Response extends pb_1.Message {
#one_of_decls: number[][] = [[1, 2, 3]];
constructor(data?: any[] | ({} & (({
Expand Down

0 comments on commit a3b0ee4

Please sign in to comment.