Skip to content

Commit

Permalink
BLO-46 | add js and go publish response object
Browse files Browse the repository at this point in the history
  • Loading branch information
edutomesco committed Sep 24, 2024
1 parent 68c2ff2 commit e0794a4
Show file tree
Hide file tree
Showing 19 changed files with 311 additions and 186 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bloock-libs/metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ bloock-hasher = { path = "../hasher" }
bloock-keys = { path = "../keys" }
bloock-encrypter = { path = "../encrypter" }
pem = "3.0.4"
ring = "0.17.8"
ring = "0.16.20"
reqwest = { version = "0.12.5", default-features = false, features = ["blocking", "rustls-tls"] }
signature = { version = "2.2.0", features = ["std"] }
x509-certificate = {version = "0.19.0", features = ["test"]}
Expand Down
165 changes: 125 additions & 40 deletions languages/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion languages/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"base64-url": "^2.3.3",
"node-fetch": "^2.6.1",
"protobufjs": "^7.2.2",
"totp-generator": "^1.0.0",
"url": "^0.11.0",
"urlsafe-base64": "^1.0.0",
"util": "^0.12.4"
Expand All @@ -48,8 +49,8 @@
"@types/node": "^18.8.2",
"@types/node-fetch": "^2.6.2",
"@types/urlsafe-base64": "^1.0.31",
"grpc-tools": "^1.12.4",
"grpc_tools_node_protoc_ts": "^5.3.3",
"grpc-tools": "^1.12.4",
"jest": "^29.1.2",
"rollup-plugin-copy": "^3.4.0",
"size-limit": "^8.2.4",
Expand Down
24 changes: 21 additions & 3 deletions languages/js/src/bridge/proto/bloock_availability.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable */
import _m0 from "protobufjs/minimal";
import { Loader, Publisher } from "./bloock_availability_entities";
import { IpnsKey, Loader, Publisher } from "./bloock_availability_entities";
import { ConfigData } from "./bloock_config";
import { Record } from "./bloock_record_entities";
import { Error } from "./bloock_shared";
Expand All @@ -13,6 +13,7 @@ export interface PublishRequest {

export interface PublishResponse {
id: string;
ipnsKey?: IpnsKey | undefined;
error?: Error | undefined;
}

Expand Down Expand Up @@ -122,16 +123,19 @@ export const PublishRequest = {
};

function createBasePublishResponse(): PublishResponse {
return { id: "", error: undefined };
return { id: "", ipnsKey: undefined, error: undefined };
}

export const PublishResponse = {
encode(message: PublishResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.ipnsKey !== undefined) {
IpnsKey.encode(message.ipnsKey, writer.uint32(18).fork()).ldelim();
}
if (message.error !== undefined) {
Error.encode(message.error, writer.uint32(18).fork()).ldelim();
Error.encode(message.error, writer.uint32(26).fork()).ldelim();
}
return writer;
},
Expand All @@ -155,6 +159,13 @@ export const PublishResponse = {
break;
}

message.ipnsKey = IpnsKey.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
break;
}

message.error = Error.decode(reader, reader.uint32());
continue;
}
Expand All @@ -169,6 +180,7 @@ export const PublishResponse = {
fromJSON(object: any): PublishResponse {
return {
id: isSet(object.id) ? globalThis.String(object.id) : "",
ipnsKey: isSet(object.ipnsKey) ? IpnsKey.fromJSON(object.ipnsKey) : undefined,
error: isSet(object.error) ? Error.fromJSON(object.error) : undefined,
};
},
Expand All @@ -178,6 +190,9 @@ export const PublishResponse = {
if (message.id !== "") {
obj.id = message.id;
}
if (message.ipnsKey !== undefined) {
obj.ipnsKey = IpnsKey.toJSON(message.ipnsKey);
}
if (message.error !== undefined) {
obj.error = Error.toJSON(message.error);
}
Expand All @@ -190,6 +205,9 @@ export const PublishResponse = {
fromPartial<I extends Exact<DeepPartial<PublishResponse>, I>>(object: I): PublishResponse {
const message = createBasePublishResponse();
message.id = object.id ?? "";
message.ipnsKey = (object.ipnsKey !== undefined && object.ipnsKey !== null)
? IpnsKey.fromPartial(object.ipnsKey)
: undefined;
message.error = (object.error !== undefined && object.error !== null) ? Error.fromPartial(object.error) : undefined;
return message;
},
Expand Down
Loading

0 comments on commit e0794a4

Please sign in to comment.