From a3b0ee4280618433753f1003670101ad0bd0334f Mon Sep 17 00:00:00 2001 From: CloudQuery Bot <102256036+cq-bot@users.noreply.github.com> Date: Tue, 17 Sep 2024 19:59:47 +0300 Subject: [PATCH 1/2] fix: Generate JavaScript Code from `plugin-pb` (#74) This PR was created by a scheduled workflow to regenerate the JavaScript code from `plugin-pb`. --- protos/plugin/v3/plugin.proto | 5 ++ protos/plugin/v3/plugin.ts | 134 +++++++++++++++++++++++++++++++++- 2 files changed, 136 insertions(+), 3 deletions(-) diff --git a/protos/plugin/v3/plugin.proto b/protos/plugin/v3/plugin.proto index 3dd5189..62050ed 100644 --- a/protos/plugin/v3/plugin.proto +++ b/protos/plugin/v3/plugin.proto @@ -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 { diff --git a/protos/plugin/v3/plugin.ts b/protos/plugin/v3/plugin.ts index afd64d9..da0a80a 100644 --- a/protos/plugin/v3/plugin.ts +++ b/protos/plugin/v3/plugin.ts @@ -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") { @@ -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() { @@ -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; + shard?: ReturnType; }): Request { const message = new Request({}); if (data.tables != null) { @@ -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() { @@ -1355,6 +1382,7 @@ export namespace cloudquery.plugin.v3 { skip_dependent_tables?: boolean; deterministic_cq_id?: boolean; backend?: ReturnType; + shard?: ReturnType; } = {}; if (this.tables != null) { data.tables = this.tables; @@ -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; @@ -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(); } @@ -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(); } } @@ -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[] | ({} & (({ From 7dcdd8e981a838270487ca76c7101b18bc88022c Mon Sep 17 00:00:00 2001 From: CloudQuery Bot <102256036+cq-bot@users.noreply.github.com> Date: Tue, 17 Sep 2024 20:04:09 +0300 Subject: [PATCH 2/2] chore(main): Release v0.0.26 (#75) :robot: I have created a release *beep* *boop* --- ## [0.0.26](https://github.com/cloudquery/plugin-pb-javascript/compare/v0.0.25...v0.0.26) (2024-09-17) ### Bug Fixes * Generate JavaScript Code from `plugin-pb` ([#74](https://github.com/cloudquery/plugin-pb-javascript/issues/74)) ([a3b0ee4](https://github.com/cloudquery/plugin-pb-javascript/commit/a3b0ee4280618433753f1003670101ad0bd0334f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6e0e77b..dba10b1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.25" + ".": "0.0.26" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d337b4..45d9419 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.0.26](https://github.com/cloudquery/plugin-pb-javascript/compare/v0.0.25...v0.0.26) (2024-09-17) + + +### Bug Fixes + +* Generate JavaScript Code from `plugin-pb` ([#74](https://github.com/cloudquery/plugin-pb-javascript/issues/74)) ([a3b0ee4](https://github.com/cloudquery/plugin-pb-javascript/commit/a3b0ee4280618433753f1003670101ad0bd0334f)) + ## [0.0.25](https://github.com/cloudquery/plugin-pb-javascript/compare/v0.0.24...v0.0.25) (2024-08-01) diff --git a/package-lock.json b/package-lock.json index b99fbed..5e347f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@cloudquery/plugin-pb-javascript", - "version": "0.0.25", + "version": "0.0.26", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@cloudquery/plugin-pb-javascript", - "version": "0.0.25", + "version": "0.0.26", "license": "MPL-2.0", "dependencies": { "google-protobuf": "^3.21.2" diff --git a/package.json b/package.json index b96c41f..c79d085 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cloudquery/plugin-pb-javascript", - "version": "0.0.25", + "version": "0.0.26", "files": [ "dist" ],