versioning record attributes

This commit is contained in:
0xmuralik
2023-01-02 17:44:06 +05:30
parent 1793a890d9
commit 0ace77c778
4 changed files with 52 additions and 3 deletions
@@ -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<typeof X500.prototype.toObject>;
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<typeof X500.prototype.toObject>;
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();
}
}
+1
View File
@@ -4,3 +4,4 @@ record:
repo_registration_record_cid: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D
build_artifact_cid: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9
tls_cert_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
version: 1.0.11
+3 -3
View File
@@ -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;
};