From 0ace77c778593f455b7d0c8e1f31d1fa762e94da Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Mon, 2 Jan 2023 17:44:06 +0530 Subject: [PATCH] versioning record attributes --- .../registry/v1beta1/attributes.proto | 2 + .../vulcanize/registry/v1beta1/attributes.ts | 46 +++++++++++++++++++ src/testing/data/watcher.yml | 1 + src/testing/helper.ts | 6 +-- 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/proto/vulcanize/registry/v1beta1/attributes.proto b/proto/vulcanize/registry/v1beta1/attributes.proto index 8ec3b6a..c5d2702 100644 --- a/proto/vulcanize/registry/v1beta1/attributes.proto +++ b/proto/vulcanize/registry/v1beta1/attributes.proto @@ -10,6 +10,7 @@ message ServiceProviderRegistration { string laconic_id = 2 [(gogoproto.moretags) = "json:\"laconicId\" yaml:\"laconicId\""]; X500 x500 = 3 [(gogoproto.moretags) = "json:\"x500\" yaml:\"x500\""]; string type = 4 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""]; + string version = 6 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""]; } message X500 { @@ -28,4 +29,5 @@ message WebsiteRegistrationRecord { string build_artifact_cid = 3 [(gogoproto.moretags) = "json:\"buildArtifactCID\" yaml:\"buildArtifactCID\""]; string tls_cert_cid = 4 [(gogoproto.moretags) = "json:\"TLSCertCID\" yaml:\"TLSCertCID\""]; string type = 5 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""]; + string version = 6 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""]; } \ No newline at end of file diff --git a/src/proto/vulcanize/registry/v1beta1/attributes.ts b/src/proto/vulcanize/registry/v1beta1/attributes.ts index dfe131e..c9aff83 100644 --- a/src/proto/vulcanize/registry/v1beta1/attributes.ts +++ b/src/proto/vulcanize/registry/v1beta1/attributes.ts @@ -15,6 +15,7 @@ export namespace vulcanize.registry.v1beta1 { laconic_id?: string; x500?: X500; type?: string; + version?: string; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -31,6 +32,9 @@ export namespace vulcanize.registry.v1beta1 { if ("type" in data && data.type != undefined) { this.type = data.type; } + if ("version" in data && data.version != undefined) { + this.version = data.version; + } } } get bond_id() { @@ -60,11 +64,18 @@ export namespace vulcanize.registry.v1beta1 { set type(value: string) { pb_1.Message.setField(this, 4, value); } + get version() { + return pb_1.Message.getFieldWithDefault(this, 6, "") as string; + } + set version(value: string) { + pb_1.Message.setField(this, 6, value); + } static fromObject(data: { bond_id?: string; laconic_id?: string; x500?: ReturnType; type?: string; + version?: string; }): ServiceProviderRegistration { const message = new ServiceProviderRegistration({}); if (data.bond_id != null) { @@ -79,6 +90,9 @@ export namespace vulcanize.registry.v1beta1 { if (data.type != null) { message.type = data.type; } + if (data.version != null) { + message.version = data.version; + } return message; } toObject() { @@ -87,6 +101,7 @@ export namespace vulcanize.registry.v1beta1 { laconic_id?: string; x500?: ReturnType; type?: string; + version?: string; } = {}; if (this.bond_id != null) { data.bond_id = this.bond_id; @@ -100,6 +115,9 @@ export namespace vulcanize.registry.v1beta1 { if (this.type != null) { data.type = this.type; } + if (this.version != null) { + data.version = this.version; + } return data; } serialize(): Uint8Array; @@ -114,6 +132,8 @@ export namespace vulcanize.registry.v1beta1 { writer.writeMessage(3, this.x500, () => this.x500.serialize(writer)); if (this.type.length) writer.writeString(4, this.type); + if (this.version.length) + writer.writeString(6, this.version); if (!w) return writer.getResultBuffer(); } @@ -135,6 +155,9 @@ export namespace vulcanize.registry.v1beta1 { case 4: message.type = reader.readString(); break; + case 6: + message.version = reader.readString(); + break; default: reader.skipField(); } } @@ -337,6 +360,7 @@ export namespace vulcanize.registry.v1beta1 { build_artifact_cid?: string; tls_cert_cid?: string; type?: string; + version?: string; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -356,6 +380,9 @@ export namespace vulcanize.registry.v1beta1 { if ("type" in data && data.type != undefined) { this.type = data.type; } + if ("version" in data && data.version != undefined) { + this.version = data.version; + } } } get url() { @@ -388,12 +415,19 @@ export namespace vulcanize.registry.v1beta1 { set type(value: string) { pb_1.Message.setField(this, 5, value); } + get version() { + return pb_1.Message.getFieldWithDefault(this, 6, "") as string; + } + set version(value: string) { + pb_1.Message.setField(this, 6, value); + } static fromObject(data: { url?: string; repo_registration_record_cid?: string; build_artifact_cid?: string; tls_cert_cid?: string; type?: string; + version?: string; }): WebsiteRegistrationRecord { const message = new WebsiteRegistrationRecord({}); if (data.url != null) { @@ -411,6 +445,9 @@ export namespace vulcanize.registry.v1beta1 { if (data.type != null) { message.type = data.type; } + if (data.version != null) { + message.version = data.version; + } return message; } toObject() { @@ -420,6 +457,7 @@ export namespace vulcanize.registry.v1beta1 { build_artifact_cid?: string; tls_cert_cid?: string; type?: string; + version?: string; } = {}; if (this.url != null) { data.url = this.url; @@ -436,6 +474,9 @@ export namespace vulcanize.registry.v1beta1 { if (this.type != null) { data.type = this.type; } + if (this.version != null) { + data.version = this.version; + } return data; } serialize(): Uint8Array; @@ -452,6 +493,8 @@ export namespace vulcanize.registry.v1beta1 { writer.writeString(4, this.tls_cert_cid); if (this.type.length) writer.writeString(5, this.type); + if (this.version.length) + writer.writeString(6, this.version); if (!w) return writer.getResultBuffer(); } @@ -476,6 +519,9 @@ export namespace vulcanize.registry.v1beta1 { case 5: message.type = reader.readString(); break; + case 6: + message.version = reader.readString(); + break; default: reader.skipField(); } } diff --git a/src/testing/data/watcher.yml b/src/testing/data/watcher.yml index 06d66eb..36d06fa 100644 --- a/src/testing/data/watcher.yml +++ b/src/testing/data/watcher.yml @@ -4,3 +4,4 @@ record: repo_registration_record_cid: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D build_artifact_cid: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9 tls_cert_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR + version: 1.0.11 diff --git a/src/testing/helper.ts b/src/testing/helper.ts index 9db61ce..86cde9f 100644 --- a/src/testing/helper.ts +++ b/src/testing/helper.ts @@ -7,15 +7,15 @@ import { DEFAULT_CHAIN_ID, Registry } from '../index'; export const ensureUpdatedConfig = async (path: string) => { const conf = await yaml.read(path); - // conf.record.version = semver.inc(conf.record.version, 'patch'); - // await yaml.write(path, conf); + conf.record.version = semver.inc(conf.record.version, 'patch'); + await yaml.write(path, conf); return conf; }; export const getBaseConfig = async (path: string) => { const conf = await yaml.read(path); - // conf.record.version = '0.0.1'; + conf.record.version = '0.0.1'; return conf; };