diff --git a/.github/workflows/reusable/cached-build/action.yml b/.github/workflows/reusable/cached-build/action.yml index c633d5f1e0..3199597c6e 100644 --- a/.github/workflows/reusable/cached-build/action.yml +++ b/.github/workflows/reusable/cached-build/action.yml @@ -26,9 +26,11 @@ runs: key: cache-build-${{ github.sha }} path: | packages/*/dist - packages/proto-rpc/src/proto - packages/dht/src/proto - packages/trackerless-network/src/proto + packages/sdk/src/generated + packages/autocertifier-client/generated + packages/proto-rpc/generated + packages/dht/generated + packages/trackerless-network/generated - name: ci if: steps.cache-node-modules.outputs.cache-hit != 'true' run: diff --git a/Dockerfile.node b/Dockerfile.node index d478aa3598..4e0b10f1aa 100644 --- a/Dockerfile.node +++ b/Dockerfile.node @@ -3,6 +3,10 @@ FROM node:${NODE_VERSION}-bullseye AS build WORKDIR /usr/src/network COPY . . RUN --mount=type=cache,target=/root/.npm \ + npm run bootstrap-pkg --package=@streamr/proto-rpc && \ + npm run bootstrap-pkg --package=@streamr/autocertifier-client && \ + npm run bootstrap-pkg --package=@streamr/dht && \ + npm run bootstrap-pkg --package=@streamr/trackerless-network && \ npm run bootstrap-pkg --package=@streamr/sdk && \ npm run bootstrap-pkg --package=@streamr/node && \ npm run prune-pkg -- @streamr/node diff --git a/packages/autocertifier-client/.gitignore b/packages/autocertifier-client/.gitignore index 8d67a86cda..0d7f68be5f 100644 --- a/packages/autocertifier-client/.gitignore +++ b/packages/autocertifier-client/.gitignore @@ -1,3 +1,4 @@ .DS_Store node_modules dist +generated diff --git a/packages/autocertifier-client/generated/packages/autocertifier-client/protos/AutoCertifier.client.ts b/packages/autocertifier-client/generated/packages/autocertifier-client/protos/AutoCertifier.client.ts deleted file mode 100644 index 3ae40257f0..0000000000 --- a/packages/autocertifier-client/generated/packages/autocertifier-client/protos/AutoCertifier.client.ts +++ /dev/null @@ -1,37 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/autocertifier-client/protos/AutoCertifier.proto" (syntax proto3) -// tslint:disable -import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; -import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; -import { AutoCertifierRpc } from "./AutoCertifier"; -import { stackIntercept } from "@protobuf-ts/runtime-rpc"; -import type { HasSessionResponse } from "./AutoCertifier"; -import type { HasSessionRequest } from "./AutoCertifier"; -import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; -import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service AutoCertifierRpc - */ -export interface IAutoCertifierRpcClient { - /** - * @generated from protobuf rpc: hasSession(HasSessionRequest) returns (HasSessionResponse); - */ - hasSession(input: HasSessionRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service AutoCertifierRpc - */ -export class AutoCertifierRpcClient implements IAutoCertifierRpcClient, ServiceInfo { - typeName = AutoCertifierRpc.typeName; - methods = AutoCertifierRpc.methods; - options = AutoCertifierRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: hasSession(HasSessionRequest) returns (HasSessionResponse); - */ - hasSession(input: HasSessionRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} diff --git a/packages/autocertifier-client/generated/packages/autocertifier-client/protos/AutoCertifier.server.ts b/packages/autocertifier-client/generated/packages/autocertifier-client/protos/AutoCertifier.server.ts deleted file mode 100644 index 12c6ee3873..0000000000 --- a/packages/autocertifier-client/generated/packages/autocertifier-client/protos/AutoCertifier.server.ts +++ /dev/null @@ -1,15 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/autocertifier-client/protos/AutoCertifier.proto" (syntax proto3) -// tslint:disable -import { HasSessionResponse } from "./AutoCertifier"; -import { HasSessionRequest } from "./AutoCertifier"; -import { ServerCallContext } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service AutoCertifierRpc - */ -export interface IAutoCertifierRpc { - /** - * @generated from protobuf rpc: hasSession(HasSessionRequest) returns (HasSessionResponse); - */ - hasSession(request: HasSessionRequest, context: T): Promise; -} diff --git a/packages/autocertifier-client/generated/packages/autocertifier-client/protos/AutoCertifier.ts b/packages/autocertifier-client/generated/packages/autocertifier-client/protos/AutoCertifier.ts deleted file mode 100644 index bb3e05bd6a..0000000000 --- a/packages/autocertifier-client/generated/packages/autocertifier-client/protos/AutoCertifier.ts +++ /dev/null @@ -1,47 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/autocertifier-client/protos/AutoCertifier.proto" (syntax proto3) -// tslint:disable -import { ServiceType } from "@protobuf-ts/runtime-rpc"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * @generated from protobuf message HasSessionRequest - */ -export interface HasSessionRequest { - /** - * @generated from protobuf field: string sessionId = 1; - */ - sessionId: string; -} -/** - * @generated from protobuf message HasSessionResponse - */ -export interface HasSessionResponse { -} -// @generated message type with reflection information, may provide speed optimized methods -class HasSessionRequest$Type extends MessageType { - constructor() { - super("HasSessionRequest", [ - { no: 1, name: "sessionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message HasSessionRequest - */ -export const HasSessionRequest = new HasSessionRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class HasSessionResponse$Type extends MessageType { - constructor() { - super("HasSessionResponse", []); - } -} -/** - * @generated MessageType for protobuf message HasSessionResponse - */ -export const HasSessionResponse = new HasSessionResponse$Type(); -/** - * @generated ServiceType for protobuf service AutoCertifierRpc - */ -export const AutoCertifierRpc = new ServiceType("AutoCertifierRpc", [ - { name: "hasSession", options: {}, I: HasSessionRequest, O: HasSessionResponse } -]); diff --git a/packages/autocertifier-client/package.json b/packages/autocertifier-client/package.json index 56bfa35898..e878c3f708 100644 --- a/packages/autocertifier-client/package.json +++ b/packages/autocertifier-client/package.json @@ -12,7 +12,7 @@ "license": "STREAMR NETWORK OPEN SOURCE LICENSE", "author": "Streamr Network AG ", "scripts": { - "generate-protoc-code": "./proto.sh", + "prebuild": "./proto.sh", "build": "tsc -b tsconfig.node.json", "check": "tsc -p ./tsconfig.jest.json", "clean": "jest --clearCache || true; rm -rf dist *.tsbuildinfo node_modules/.cache || true", diff --git a/packages/dht/.gitignore b/packages/dht/.gitignore index d2d886a5db..bd356c5a13 100644 --- a/packages/dht/.gitignore +++ b/packages/dht/.gitignore @@ -2,5 +2,6 @@ node_modules dist coverage +generated test/data/nodeids.json test/data/orderedneighbors.json diff --git a/packages/dht/generated/google/protobuf/any.ts b/packages/dht/generated/google/protobuf/any.ts deleted file mode 100644 index e4b27234d8..0000000000 --- a/packages/dht/generated/google/protobuf/any.ts +++ /dev/null @@ -1,326 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "google/protobuf/any.proto" (package "google.protobuf", syntax proto3) -// tslint:disable -// -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { WireType } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { isJsonObject } from "@protobuf-ts/runtime"; -import { typeofJsonValue } from "@protobuf-ts/runtime"; -import type { JsonValue } from "@protobuf-ts/runtime"; -import { jsonWriteOptions } from "@protobuf-ts/runtime"; -import type { JsonReadOptions } from "@protobuf-ts/runtime"; -import type { JsonWriteOptions } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IMessageType } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * `Any` contains an arbitrary serialized protocol buffer message along with a - * URL that describes the type of the serialized message. - * - * Protobuf library provides support to pack/unpack Any values in the form - * of utility functions or additional generated methods of the Any type. - * - * Example 1: Pack and unpack a message in C++. - * - * Foo foo = ...; - * Any any; - * any.PackFrom(foo); - * ... - * if (any.UnpackTo(&foo)) { - * ... - * } - * - * Example 2: Pack and unpack a message in Java. - * - * Foo foo = ...; - * Any any = Any.pack(foo); - * ... - * if (any.is(Foo.class)) { - * foo = any.unpack(Foo.class); - * } - * // or ... - * if (any.isSameTypeAs(Foo.getDefaultInstance())) { - * foo = any.unpack(Foo.getDefaultInstance()); - * } - * - * Example 3: Pack and unpack a message in Python. - * - * foo = Foo(...) - * any = Any() - * any.Pack(foo) - * ... - * if any.Is(Foo.DESCRIPTOR): - * any.Unpack(foo) - * ... - * - * Example 4: Pack and unpack a message in Go - * - * foo := &pb.Foo{...} - * any, err := anypb.New(foo) - * if err != nil { - * ... - * } - * ... - * foo := &pb.Foo{} - * if err := any.UnmarshalTo(foo); err != nil { - * ... - * } - * - * The pack methods provided by protobuf library will by default use - * 'type.googleapis.com/full.type.name' as the type URL and the unpack - * methods only use the fully qualified type name after the last '/' - * in the type URL, for example "foo.bar.com/x/y.z" will yield type - * name "y.z". - * - * JSON - * ==== - * The JSON representation of an `Any` value uses the regular - * representation of the deserialized, embedded message, with an - * additional field `@type` which contains the type URL. Example: - * - * package google.profile; - * message Person { - * string first_name = 1; - * string last_name = 2; - * } - * - * { - * "@type": "type.googleapis.com/google.profile.Person", - * "firstName": , - * "lastName": - * } - * - * If the embedded message type is well-known and has a custom JSON - * representation, that representation will be embedded adding a field - * `value` which holds the custom JSON in addition to the `@type` - * field. Example (for message [google.protobuf.Duration][]): - * - * { - * "@type": "type.googleapis.com/google.protobuf.Duration", - * "value": "1.212s" - * } - * - * - * @generated from protobuf message google.protobuf.Any - */ -export interface Any { - /** - * A URL/resource name that uniquely identifies the type of the serialized - * protocol buffer message. This string must contain at least - * one "/" character. The last segment of the URL's path must represent - * the fully qualified name of the type (as in - * `path/google.protobuf.Duration`). The name should be in a canonical form - * (e.g., leading "." is not accepted). - * - * In practice, teams usually precompile into the binary all types that they - * expect it to use in the context of Any. However, for URLs which use the - * scheme `http`, `https`, or no scheme, one can optionally set up a type - * server that maps type URLs to message definitions as follows: - * - * * If no scheme is provided, `https` is assumed. - * * An HTTP GET on the URL must yield a [google.protobuf.Type][] - * value in binary format, or produce an error. - * * Applications are allowed to cache lookup results based on the - * URL, or have them precompiled into a binary to avoid any - * lookup. Therefore, binary compatibility needs to be preserved - * on changes to types. (Use versioned type names to manage - * breaking changes.) - * - * Note: this functionality is not currently available in the official - * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. As of May 2023, there are no widely used type server - * implementations and no plans to implement one. - * - * Schemes other than `http`, `https` (or the empty scheme) might be - * used with implementation specific semantics. - * - * - * @generated from protobuf field: string type_url = 1; - */ - typeUrl: string; - /** - * Must be a valid serialized protocol buffer of the above specified type. - * - * @generated from protobuf field: bytes value = 2; - */ - value: Uint8Array; -} -// @generated message type with reflection information, may provide speed optimized methods -class Any$Type extends MessageType { - constructor() { - super("google.protobuf.Any", [ - { no: 1, name: "type_url", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "value", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } - ]); - } - /** - * Pack the message into a new `Any`. - * - * Uses 'type.googleapis.com/full.type.name' as the type URL. - */ - pack(message: T, type: IMessageType): Any { - return { - typeUrl: this.typeNameToUrl(type.typeName), value: type.toBinary(message), - }; - } - /** - * Unpack the message from the `Any`. - */ - unpack(any: Any, type: IMessageType, options?: Partial): T { - if (!this.contains(any, type)) - throw new Error("Cannot unpack google.protobuf.Any with typeUrl '" + any.typeUrl + "' as " + type.typeName + "."); - return type.fromBinary(any.value, options); - } - /** - * Does the given `Any` contain a packed message of the given type? - */ - contains(any: Any, type: IMessageType | string): boolean { - if (!any.typeUrl.length) - return false; - let wants = typeof type == "string" ? type : type.typeName; - let has = this.typeUrlToName(any.typeUrl); - return wants === has; - } - /** - * Convert the message to canonical JSON value. - * - * You have to provide the `typeRegistry` option so that the - * packed message can be converted to JSON. - * - * The `typeRegistry` option is also required to read - * `google.protobuf.Any` from JSON format. - */ - internalJsonWrite(any: Any, options: JsonWriteOptions): JsonValue { - if (any.typeUrl === "") - return {}; - let typeName = this.typeUrlToName(any.typeUrl); - let opt = jsonWriteOptions(options); - let type = opt.typeRegistry?.find(t => t.typeName === typeName); - if (!type) - throw new globalThis.Error("Unable to convert google.protobuf.Any with typeUrl '" + any.typeUrl + "' to JSON. The specified type " + typeName + " is not available in the type registry."); - let value = type.fromBinary(any.value, { readUnknownField: false }); - let json = type.internalJsonWrite(value, opt); - if (typeName.startsWith("google.protobuf.") || !isJsonObject(json)) - json = { value: json }; - json["@type"] = any.typeUrl; - return json; - } - internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Any): Any { - if (!isJsonObject(json)) - throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON " + typeofJsonValue(json) + "."); - if (typeof json["@type"] != "string" || json["@type"] == "") - return this.create(); - let typeName = this.typeUrlToName(json["@type"]); - let type = options?.typeRegistry?.find(t => t.typeName == typeName); - if (!type) - throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON. The specified type " + typeName + " is not available in the type registry."); - let value; - if (typeName.startsWith("google.protobuf.") && json.hasOwnProperty("value")) - value = type.fromJson(json["value"], options); - else { - let copy = Object.assign({}, json); - delete copy["@type"]; - value = type.fromJson(copy, options); - } - if (target === undefined) - target = this.create(); - target.typeUrl = json["@type"]; - target.value = type.toBinary(value); - return target; - } - typeNameToUrl(name: string): string { - if (!name.length) - throw new Error("invalid type name: " + name); - return "type.googleapis.com/" + name; - } - typeUrlToName(url: string): string { - if (!url.length) - throw new Error("invalid type url: " + url); - let slash = url.lastIndexOf("/"); - let name = slash > 0 ? url.substring(slash + 1) : url; - if (!name.length) - throw new Error("invalid type url: " + url); - return name; - } - create(value?: PartialMessage): Any { - const message = globalThis.Object.create((this.messagePrototype!)); - message.typeUrl = ""; - message.value = new Uint8Array(0); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Any): Any { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* string type_url */ 1: - message.typeUrl = reader.string(); - break; - case /* bytes value */ 2: - message.value = reader.bytes(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Any, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* string type_url = 1; */ - if (message.typeUrl !== "") - writer.tag(1, WireType.LengthDelimited).string(message.typeUrl); - /* bytes value = 2; */ - if (message.value.length) - writer.tag(2, WireType.LengthDelimited).bytes(message.value); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message google.protobuf.Any - */ -export const Any = new Any$Type(); diff --git a/packages/dht/generated/google/protobuf/empty.ts b/packages/dht/generated/google/protobuf/empty.ts deleted file mode 100644 index 76f8eb3fa7..0000000000 --- a/packages/dht/generated/google/protobuf/empty.ts +++ /dev/null @@ -1,81 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "google/protobuf/empty.proto" (package "google.protobuf", syntax proto3) -// tslint:disable -// -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * A generic empty message that you can re-use to avoid defining duplicated - * empty messages in your APIs. A typical example is to use it as the request - * or the response type of an API method. For instance: - * - * service Foo { - * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - * } - * - * - * @generated from protobuf message google.protobuf.Empty - */ -export interface Empty { -} -// @generated message type with reflection information, may provide speed optimized methods -class Empty$Type extends MessageType { - constructor() { - super("google.protobuf.Empty", []); - } - create(value?: PartialMessage): Empty { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Empty): Empty { - return target ?? this.create(); - } - internalBinaryWrite(message: Empty, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message google.protobuf.Empty - */ -export const Empty = new Empty$Type(); diff --git a/packages/dht/generated/google/protobuf/timestamp.ts b/packages/dht/generated/google/protobuf/timestamp.ts deleted file mode 100644 index 3faca940c6..0000000000 --- a/packages/dht/generated/google/protobuf/timestamp.ts +++ /dev/null @@ -1,287 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "google/protobuf/timestamp.proto" (package "google.protobuf", syntax proto3) -// tslint:disable -// -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { WireType } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { typeofJsonValue } from "@protobuf-ts/runtime"; -import type { JsonValue } from "@protobuf-ts/runtime"; -import type { JsonReadOptions } from "@protobuf-ts/runtime"; -import type { JsonWriteOptions } from "@protobuf-ts/runtime"; -import { PbLong } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * A Timestamp represents a point in time independent of any time zone or local - * calendar, encoded as a count of seconds and fractions of seconds at - * nanosecond resolution. The count is relative to an epoch at UTC midnight on - * January 1, 1970, in the proleptic Gregorian calendar which extends the - * Gregorian calendar backwards to year one. - * - * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - * second table is needed for interpretation, using a [24-hour linear - * smear](https://developers.google.com/time/smear). - * - * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - * restricting to that range, we ensure that we can convert to and from [RFC - * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - * - * # Examples - * - * Example 1: Compute Timestamp from POSIX `time()`. - * - * Timestamp timestamp; - * timestamp.set_seconds(time(NULL)); - * timestamp.set_nanos(0); - * - * Example 2: Compute Timestamp from POSIX `gettimeofday()`. - * - * struct timeval tv; - * gettimeofday(&tv, NULL); - * - * Timestamp timestamp; - * timestamp.set_seconds(tv.tv_sec); - * timestamp.set_nanos(tv.tv_usec * 1000); - * - * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - * - * FILETIME ft; - * GetSystemTimeAsFileTime(&ft); - * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - * - * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - * Timestamp timestamp; - * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - * - * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - * - * long millis = System.currentTimeMillis(); - * - * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - * .setNanos((int) ((millis % 1000) * 1000000)).build(); - * - * Example 5: Compute Timestamp from Java `Instant.now()`. - * - * Instant now = Instant.now(); - * - * Timestamp timestamp = - * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - * .setNanos(now.getNano()).build(); - * - * Example 6: Compute Timestamp from current time in Python. - * - * timestamp = Timestamp() - * timestamp.GetCurrentTime() - * - * # JSON Mapping - * - * In JSON format, the Timestamp type is encoded as a string in the - * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the - * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" - * where {year} is always expressed using four digits while {month}, {day}, - * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional - * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), - * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone - * is required. A proto3 JSON serializer should always use UTC (as indicated by - * "Z") when printing the Timestamp type and a proto3 JSON parser should be - * able to accept both UTC and other timezones (as indicated by an offset). - * - * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past - * 01:30 UTC on January 15, 2017. - * - * In JavaScript, one can convert a Date object to this format using the - * standard - * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - * method. In Python, a standard `datetime.datetime` object can be converted - * to this format using - * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with - * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use - * the Joda Time's [`ISODateTimeFormat.dateTime()`]( - * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() - * ) to obtain a formatter capable of generating timestamps in this format. - * - * - * @generated from protobuf message google.protobuf.Timestamp - */ -export interface Timestamp { - /** - * Represents seconds of UTC time since Unix epoch - * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - * 9999-12-31T23:59:59Z inclusive. - * - * @generated from protobuf field: int64 seconds = 1; - */ - seconds: number; - /** - * Non-negative fractions of a second at nanosecond resolution. Negative - * second values with fractions must still have non-negative nanos values - * that count forward in time. Must be from 0 to 999,999,999 - * inclusive. - * - * @generated from protobuf field: int32 nanos = 2; - */ - nanos: number; -} -// @generated message type with reflection information, may provide speed optimized methods -class Timestamp$Type extends MessageType { - constructor() { - super("google.protobuf.Timestamp", [ - { no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ }, - { no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ } - ]); - } - /** - * Creates a new `Timestamp` for the current time. - */ - now(): Timestamp { - const msg = this.create(); - const ms = Date.now(); - msg.seconds = PbLong.from(Math.floor(ms / 1000)).toNumber(); - msg.nanos = (ms % 1000) * 1000000; - return msg; - } - /** - * Converts a `Timestamp` to a JavaScript Date. - */ - toDate(message: Timestamp): Date { - return new Date(PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000)); - } - /** - * Converts a JavaScript Date to a `Timestamp`. - */ - fromDate(date: Date): Timestamp { - const msg = this.create(); - const ms = date.getTime(); - msg.seconds = PbLong.from(Math.floor(ms / 1000)).toNumber(); - msg.nanos = (ms % 1000) * 1000000; - return msg; - } - /** - * In JSON format, the `Timestamp` type is encoded as a string - * in the RFC 3339 format. - */ - internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue { - let ms = PbLong.from(message.seconds).toNumber() * 1000; - if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) - throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."); - if (message.nanos < 0) - throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative."); - let z = "Z"; - if (message.nanos > 0) { - let nanosStr = (message.nanos + 1000000000).toString().substring(1); - if (nanosStr.substring(3) === "000000") - z = "." + nanosStr.substring(0, 3) + "Z"; - else if (nanosStr.substring(6) === "000") - z = "." + nanosStr.substring(0, 6) + "Z"; - else - z = "." + nanosStr + "Z"; - } - return new Date(ms).toISOString().replace(".000Z", z); - } - /** - * In JSON format, the `Timestamp` type is encoded as a string - * in the RFC 3339 format. - */ - internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp { - if (typeof json !== "string") - throw new Error("Unable to parse Timestamp from JSON " + typeofJsonValue(json) + "."); - let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/); - if (!matches) - throw new Error("Unable to parse Timestamp from JSON. Invalid format."); - let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z")); - if (Number.isNaN(ms)) - throw new Error("Unable to parse Timestamp from JSON. Invalid value."); - if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) - throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."); - if (!target) - target = this.create(); - target.seconds = PbLong.from(ms / 1000).toNumber(); - target.nanos = 0; - if (matches[7]) - target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000); - return target; - } - create(value?: PartialMessage): Timestamp { - const message = globalThis.Object.create((this.messagePrototype!)); - message.seconds = 0; - message.nanos = 0; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Timestamp): Timestamp { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 seconds */ 1: - message.seconds = reader.int64().toNumber(); - break; - case /* int32 nanos */ 2: - message.nanos = reader.int32(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Timestamp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 seconds = 1; */ - if (message.seconds !== 0) - writer.tag(1, WireType.Varint).int64(message.seconds); - /* int32 nanos = 2; */ - if (message.nanos !== 0) - writer.tag(2, WireType.Varint).int32(message.nanos); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message google.protobuf.Timestamp - */ -export const Timestamp = new Timestamp$Type(); diff --git a/packages/dht/generated/packages/dht/protos/DhtRpc.client.ts b/packages/dht/generated/packages/dht/protos/DhtRpc.client.ts deleted file mode 100644 index f4c5b44977..0000000000 --- a/packages/dht/generated/packages/dht/protos/DhtRpc.client.ts +++ /dev/null @@ -1,419 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/dht/protos/DhtRpc.proto" (package "dht", syntax proto3) -// tslint:disable -import { ExternalApiRpc } from "./DhtRpc"; -import type { ExternalStoreDataResponse } from "./DhtRpc"; -import type { ExternalStoreDataRequest } from "./DhtRpc"; -import type { ExternalFetchDataResponse } from "./DhtRpc"; -import type { ExternalFetchDataRequest } from "./DhtRpc"; -import { ConnectionLockRpc } from "./DhtRpc"; -import type { SetPrivateRequest } from "./DhtRpc"; -import type { DisconnectNotice } from "./DhtRpc"; -import type { UnlockRequest } from "./DhtRpc"; -import type { LockResponse } from "./DhtRpc"; -import type { LockRequest } from "./DhtRpc"; -import { WebrtcConnectorRpc } from "./DhtRpc"; -import type { IceCandidate } from "./DhtRpc"; -import type { RtcAnswer } from "./DhtRpc"; -import type { RtcOffer } from "./DhtRpc"; -import type { WebrtcConnectionRequest } from "./DhtRpc"; -import { WebsocketClientConnectorRpc } from "./DhtRpc"; -import type { WebsocketConnectionRequest } from "./DhtRpc"; -import { RecursiveOperationSessionRpc } from "./DhtRpc"; -import type { RecursiveOperationResponse } from "./DhtRpc"; -import { StoreRpc } from "./DhtRpc"; -import type { ReplicateDataRequest } from "./DhtRpc"; -import type { StoreDataResponse } from "./DhtRpc"; -import type { StoreDataRequest } from "./DhtRpc"; -import { RecursiveOperationRpc } from "./DhtRpc"; -import { RouterRpc } from "./DhtRpc"; -import type { RouteMessageAck } from "./DhtRpc"; -import type { RouteMessageWrapper } from "./DhtRpc"; -import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; -import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; -import { DhtNodeRpc } from "./DhtRpc"; -import type { Empty } from "../../../google/protobuf/empty"; -import type { LeaveNotice } from "./DhtRpc"; -import type { PingResponse } from "./DhtRpc"; -import type { PingRequest } from "./DhtRpc"; -import type { ClosestRingPeersResponse } from "./DhtRpc"; -import type { ClosestRingPeersRequest } from "./DhtRpc"; -import { stackIntercept } from "@protobuf-ts/runtime-rpc"; -import type { ClosestPeersResponse } from "./DhtRpc"; -import type { ClosestPeersRequest } from "./DhtRpc"; -import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; -import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service dht.DhtNodeRpc - */ -export interface IDhtNodeRpcClient { - /** - * TODO rename to getClosestNeighbors (breaking change) - * - * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse); - */ - getClosestPeers(input: ClosestPeersRequest, options?: RpcOptions): UnaryCall; - /** - * TODO rename to getClosestRingContacts (breaking change) - * - * @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse); - */ - getClosestRingPeers(input: ClosestRingPeersRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse); - */ - ping(input: PingRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty); - */ - leaveNotice(input: LeaveNotice, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.DhtNodeRpc - */ -export class DhtNodeRpcClient implements IDhtNodeRpcClient, ServiceInfo { - typeName = DhtNodeRpc.typeName; - methods = DhtNodeRpc.methods; - options = DhtNodeRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * TODO rename to getClosestNeighbors (breaking change) - * - * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse); - */ - getClosestPeers(input: ClosestPeersRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * TODO rename to getClosestRingContacts (breaking change) - * - * @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse); - */ - getClosestRingPeers(input: ClosestRingPeersRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse); - */ - ping(input: PingRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[2], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty); - */ - leaveNotice(input: LeaveNotice, options?: RpcOptions): UnaryCall { - const method = this.methods[3], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.RouterRpc - */ -export interface IRouterRpcClient { - /** - * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - routeMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - forwardMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.RouterRpc - */ -export class RouterRpcClient implements IRouterRpcClient, ServiceInfo { - typeName = RouterRpc.typeName; - methods = RouterRpc.methods; - options = RouterRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - routeMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - forwardMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.RecursiveOperationRpc - */ -export interface IRecursiveOperationRpcClient { - /** - * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - routeRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.RecursiveOperationRpc - */ -export class RecursiveOperationRpcClient implements IRecursiveOperationRpcClient, ServiceInfo { - typeName = RecursiveOperationRpc.typeName; - methods = RecursiveOperationRpc.methods; - options = RecursiveOperationRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - routeRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.StoreRpc - */ -export interface IStoreRpcClient { - /** - * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse); - */ - storeData(input: StoreDataRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: replicateData(dht.ReplicateDataRequest) returns (google.protobuf.Empty); - */ - replicateData(input: ReplicateDataRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.StoreRpc - */ -export class StoreRpcClient implements IStoreRpcClient, ServiceInfo { - typeName = StoreRpc.typeName; - methods = StoreRpc.methods; - options = StoreRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse); - */ - storeData(input: StoreDataRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: replicateData(dht.ReplicateDataRequest) returns (google.protobuf.Empty); - */ - replicateData(input: ReplicateDataRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.RecursiveOperationSessionRpc - */ -export interface IRecursiveOperationSessionRpcClient { - /** - * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty); - */ - sendResponse(input: RecursiveOperationResponse, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.RecursiveOperationSessionRpc - */ -export class RecursiveOperationSessionRpcClient implements IRecursiveOperationSessionRpcClient, ServiceInfo { - typeName = RecursiveOperationSessionRpc.typeName; - methods = RecursiveOperationSessionRpc.methods; - options = RecursiveOperationSessionRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty); - */ - sendResponse(input: RecursiveOperationResponse, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.WebsocketClientConnectorRpc - */ -export interface IWebsocketClientConnectorRpcClient { - /** - * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty); - */ - requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.WebsocketClientConnectorRpc - */ -export class WebsocketClientConnectorRpcClient implements IWebsocketClientConnectorRpcClient, ServiceInfo { - typeName = WebsocketClientConnectorRpc.typeName; - methods = WebsocketClientConnectorRpc.methods; - options = WebsocketClientConnectorRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty); - */ - requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.WebrtcConnectorRpc - */ -export interface IWebrtcConnectorRpcClient { - /** - * @generated from protobuf rpc: requestConnection(dht.WebrtcConnectionRequest) returns (google.protobuf.Empty); - */ - requestConnection(input: WebrtcConnectionRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty); - */ - rtcOffer(input: RtcOffer, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty); - */ - rtcAnswer(input: RtcAnswer, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty); - */ - iceCandidate(input: IceCandidate, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.WebrtcConnectorRpc - */ -export class WebrtcConnectorRpcClient implements IWebrtcConnectorRpcClient, ServiceInfo { - typeName = WebrtcConnectorRpc.typeName; - methods = WebrtcConnectorRpc.methods; - options = WebrtcConnectorRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: requestConnection(dht.WebrtcConnectionRequest) returns (google.protobuf.Empty); - */ - requestConnection(input: WebrtcConnectionRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty); - */ - rtcOffer(input: RtcOffer, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty); - */ - rtcAnswer(input: RtcAnswer, options?: RpcOptions): UnaryCall { - const method = this.methods[2], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty); - */ - iceCandidate(input: IceCandidate, options?: RpcOptions): UnaryCall { - const method = this.methods[3], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.ConnectionLockRpc - */ -export interface IConnectionLockRpcClient { - /** - * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse); - */ - lockRequest(input: LockRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty); - */ - unlockRequest(input: UnlockRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty); - */ - gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: setPrivate(dht.SetPrivateRequest) returns (google.protobuf.Empty); - */ - setPrivate(input: SetPrivateRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.ConnectionLockRpc - */ -export class ConnectionLockRpcClient implements IConnectionLockRpcClient, ServiceInfo { - typeName = ConnectionLockRpc.typeName; - methods = ConnectionLockRpc.methods; - options = ConnectionLockRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse); - */ - lockRequest(input: LockRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty); - */ - unlockRequest(input: UnlockRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty); - */ - gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall { - const method = this.methods[2], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: setPrivate(dht.SetPrivateRequest) returns (google.protobuf.Empty); - */ - setPrivate(input: SetPrivateRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[3], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.ExternalApiRpc - */ -export interface IExternalApiRpcClient { - /** - * @generated from protobuf rpc: externalFetchData(dht.ExternalFetchDataRequest) returns (dht.ExternalFetchDataResponse); - */ - externalFetchData(input: ExternalFetchDataRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: externalStoreData(dht.ExternalStoreDataRequest) returns (dht.ExternalStoreDataResponse); - */ - externalStoreData(input: ExternalStoreDataRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.ExternalApiRpc - */ -export class ExternalApiRpcClient implements IExternalApiRpcClient, ServiceInfo { - typeName = ExternalApiRpc.typeName; - methods = ExternalApiRpc.methods; - options = ExternalApiRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: externalFetchData(dht.ExternalFetchDataRequest) returns (dht.ExternalFetchDataResponse); - */ - externalFetchData(input: ExternalFetchDataRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: externalStoreData(dht.ExternalStoreDataRequest) returns (dht.ExternalStoreDataResponse); - */ - externalStoreData(input: ExternalStoreDataRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} diff --git a/packages/dht/generated/packages/dht/protos/DhtRpc.server.ts b/packages/dht/generated/packages/dht/protos/DhtRpc.server.ts deleted file mode 100644 index f82e1dad64..0000000000 --- a/packages/dht/generated/packages/dht/protos/DhtRpc.server.ts +++ /dev/null @@ -1,165 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/dht/protos/DhtRpc.proto" (package "dht", syntax proto3) -// tslint:disable -import { ExternalStoreDataResponse } from "./DhtRpc"; -import { ExternalStoreDataRequest } from "./DhtRpc"; -import { ExternalFetchDataResponse } from "./DhtRpc"; -import { ExternalFetchDataRequest } from "./DhtRpc"; -import { SetPrivateRequest } from "./DhtRpc"; -import { DisconnectNotice } from "./DhtRpc"; -import { UnlockRequest } from "./DhtRpc"; -import { LockResponse } from "./DhtRpc"; -import { LockRequest } from "./DhtRpc"; -import { IceCandidate } from "./DhtRpc"; -import { RtcAnswer } from "./DhtRpc"; -import { RtcOffer } from "./DhtRpc"; -import { WebrtcConnectionRequest } from "./DhtRpc"; -import { WebsocketConnectionRequest } from "./DhtRpc"; -import { RecursiveOperationResponse } from "./DhtRpc"; -import { ReplicateDataRequest } from "./DhtRpc"; -import { StoreDataResponse } from "./DhtRpc"; -import { StoreDataRequest } from "./DhtRpc"; -import { RouteMessageAck } from "./DhtRpc"; -import { RouteMessageWrapper } from "./DhtRpc"; -import { Empty } from "../../../google/protobuf/empty"; -import { LeaveNotice } from "./DhtRpc"; -import { PingResponse } from "./DhtRpc"; -import { PingRequest } from "./DhtRpc"; -import { ClosestRingPeersResponse } from "./DhtRpc"; -import { ClosestRingPeersRequest } from "./DhtRpc"; -import { ClosestPeersResponse } from "./DhtRpc"; -import { ClosestPeersRequest } from "./DhtRpc"; -import { ServerCallContext } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service dht.DhtNodeRpc - */ -export interface IDhtNodeRpc { - /** - * TODO rename to getClosestNeighbors (breaking change) - * - * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse); - */ - getClosestPeers(request: ClosestPeersRequest, context: T): Promise; - /** - * TODO rename to getClosestRingContacts (breaking change) - * - * @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse); - */ - getClosestRingPeers(request: ClosestRingPeersRequest, context: T): Promise; - /** - * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse); - */ - ping(request: PingRequest, context: T): Promise; - /** - * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty); - */ - leaveNotice(request: LeaveNotice, context: T): Promise; -} -/** - * @generated from protobuf service dht.RouterRpc - */ -export interface IRouterRpc { - /** - * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - routeMessage(request: RouteMessageWrapper, context: T): Promise; - /** - * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - forwardMessage(request: RouteMessageWrapper, context: T): Promise; -} -/** - * @generated from protobuf service dht.RecursiveOperationRpc - */ -export interface IRecursiveOperationRpc { - /** - * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - routeRequest(request: RouteMessageWrapper, context: T): Promise; -} -/** - * @generated from protobuf service dht.StoreRpc - */ -export interface IStoreRpc { - /** - * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse); - */ - storeData(request: StoreDataRequest, context: T): Promise; - /** - * @generated from protobuf rpc: replicateData(dht.ReplicateDataRequest) returns (google.protobuf.Empty); - */ - replicateData(request: ReplicateDataRequest, context: T): Promise; -} -/** - * @generated from protobuf service dht.RecursiveOperationSessionRpc - */ -export interface IRecursiveOperationSessionRpc { - /** - * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty); - */ - sendResponse(request: RecursiveOperationResponse, context: T): Promise; -} -/** - * @generated from protobuf service dht.WebsocketClientConnectorRpc - */ -export interface IWebsocketClientConnectorRpc { - /** - * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty); - */ - requestConnection(request: WebsocketConnectionRequest, context: T): Promise; -} -/** - * @generated from protobuf service dht.WebrtcConnectorRpc - */ -export interface IWebrtcConnectorRpc { - /** - * @generated from protobuf rpc: requestConnection(dht.WebrtcConnectionRequest) returns (google.protobuf.Empty); - */ - requestConnection(request: WebrtcConnectionRequest, context: T): Promise; - /** - * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty); - */ - rtcOffer(request: RtcOffer, context: T): Promise; - /** - * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty); - */ - rtcAnswer(request: RtcAnswer, context: T): Promise; - /** - * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty); - */ - iceCandidate(request: IceCandidate, context: T): Promise; -} -/** - * @generated from protobuf service dht.ConnectionLockRpc - */ -export interface IConnectionLockRpc { - /** - * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse); - */ - lockRequest(request: LockRequest, context: T): Promise; - /** - * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty); - */ - unlockRequest(request: UnlockRequest, context: T): Promise; - /** - * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty); - */ - gracefulDisconnect(request: DisconnectNotice, context: T): Promise; - /** - * @generated from protobuf rpc: setPrivate(dht.SetPrivateRequest) returns (google.protobuf.Empty); - */ - setPrivate(request: SetPrivateRequest, context: T): Promise; -} -/** - * @generated from protobuf service dht.ExternalApiRpc - */ -export interface IExternalApiRpc { - /** - * @generated from protobuf rpc: externalFetchData(dht.ExternalFetchDataRequest) returns (dht.ExternalFetchDataResponse); - */ - externalFetchData(request: ExternalFetchDataRequest, context: T): Promise; - /** - * @generated from protobuf rpc: externalStoreData(dht.ExternalStoreDataRequest) returns (dht.ExternalStoreDataResponse); - */ - externalStoreData(request: ExternalStoreDataRequest, context: T): Promise; -} diff --git a/packages/dht/generated/packages/proto-rpc/protos/ProtoRpc.ts b/packages/dht/generated/packages/proto-rpc/protos/ProtoRpc.ts deleted file mode 100644 index 7cfcf25ce6..0000000000 --- a/packages/dht/generated/packages/proto-rpc/protos/ProtoRpc.ts +++ /dev/null @@ -1,108 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/proto-rpc/protos/ProtoRpc.proto" (package "protorpc", syntax proto3) -// tslint:disable -import { MessageType } from "@protobuf-ts/runtime"; -import { Empty } from "../../../google/protobuf/empty"; -import { Any } from "../../../google/protobuf/any"; -/** - * @generated from protobuf message protorpc.RpcMessage - */ -export interface RpcMessage { - /** - * @generated from protobuf field: map header = 1; - */ - header: { - [key: string]: string; - }; - /** - * @generated from protobuf field: google.protobuf.Any body = 2; - */ - body?: Any; - /** - * @generated from protobuf field: string requestId = 3; - */ - requestId: string; - /** - * @generated from protobuf field: optional protorpc.RpcErrorType errorType = 4; - */ - errorType?: RpcErrorType; - /** - * @generated from protobuf field: optional string errorClassName = 5; - */ - errorClassName?: string; - /** - * @generated from protobuf field: optional string errorCode = 6; - */ - errorCode?: string; - /** - * @generated from protobuf field: optional string errorMessage = 7; - */ - errorMessage?: string; -} -// Dummy message to force the generation of the typescript class "google.prototype.Empty" -// We need this generated class in RpcCommunicator - -/** - * @generated from protobuf message protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq - */ -export interface Mnfo2uhnf92hvqi2nviouq2hv9puhq { - /** - * @generated from protobuf field: google.protobuf.Empty empty = 1; - */ - empty?: Empty; -} -/** - * @generated from protobuf enum protorpc.RpcErrorType - */ -export enum RpcErrorType { - /** - * @generated from protobuf enum value: SERVER_TIMEOUT = 0; - */ - SERVER_TIMEOUT = 0, - /** - * @generated from protobuf enum value: CLIENT_TIMEOUT = 1; - */ - CLIENT_TIMEOUT = 1, - /** - * @generated from protobuf enum value: UNKNOWN_RPC_METHOD = 2; - */ - UNKNOWN_RPC_METHOD = 2, - /** - * @generated from protobuf enum value: CLIENT_ERROR = 3; - */ - CLIENT_ERROR = 3, - /** - * @generated from protobuf enum value: SERVER_ERROR = 4; - */ - SERVER_ERROR = 4 -} -// @generated message type with reflection information, may provide speed optimized methods -class RpcMessage$Type extends MessageType { - constructor() { - super("protorpc.RpcMessage", [ - { no: 1, name: "header", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } }, - { no: 2, name: "body", kind: "message", T: () => Any }, - { no: 3, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 4, name: "errorType", kind: "enum", opt: true, T: () => ["protorpc.RpcErrorType", RpcErrorType] }, - { no: 5, name: "errorClassName", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 6, name: "errorCode", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 7, name: "errorMessage", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message protorpc.RpcMessage - */ -export const RpcMessage = new RpcMessage$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Mnfo2uhnf92hvqi2nviouq2hv9puhq$Type extends MessageType { - constructor() { - super("protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq", [ - { no: 1, name: "empty", kind: "message", T: () => Empty } - ]); - } -} -/** - * @generated MessageType for protobuf message protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq - */ -export const Mnfo2uhnf92hvqi2nviouq2hv9puhq = new Mnfo2uhnf92hvqi2nviouq2hv9puhq$Type(); diff --git a/packages/dht/package.json b/packages/dht/package.json index b904e27c62..88c9c6e94c 100644 --- a/packages/dht/package.json +++ b/packages/dht/package.json @@ -12,7 +12,7 @@ "license": "STREAMR NETWORK OPEN SOURCE LICENSE", "author": "Streamr Network AG ", "scripts": { - "generate-protoc-code": "./proto.sh", + "prebuild": "./proto.sh", "build": "tsc -b tsconfig.node.json", "build-browser": "webpack --mode=development --progress", "check": "tsc -p ./tsconfig.jest.json", diff --git a/packages/proto-rpc/.gitignore b/packages/proto-rpc/.gitignore index c5ec5fd0ba..822b349821 100644 --- a/packages/proto-rpc/.gitignore +++ b/packages/proto-rpc/.gitignore @@ -7,5 +7,7 @@ lerna-debug.log oldsrc dist coverage +generated test/simulation/data/nodeids.json test/simulation/data/orderedneighbors.json +test/proto/ \ No newline at end of file diff --git a/packages/proto-rpc/generated/ProtoRpc.ts b/packages/proto-rpc/generated/ProtoRpc.ts deleted file mode 100644 index a7955c0f96..0000000000 --- a/packages/proto-rpc/generated/ProtoRpc.ts +++ /dev/null @@ -1,108 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies -// @generated from protobuf file "ProtoRpc.proto" (package "protorpc", syntax proto3) -// tslint:disable -import { MessageType } from "@protobuf-ts/runtime"; -import { Empty } from "./google/protobuf/empty"; -import { Any } from "./google/protobuf/any"; -/** - * @generated from protobuf message protorpc.RpcMessage - */ -export interface RpcMessage { - /** - * @generated from protobuf field: map header = 1; - */ - header: { - [key: string]: string; - }; - /** - * @generated from protobuf field: google.protobuf.Any body = 2; - */ - body?: Any; - /** - * @generated from protobuf field: string requestId = 3; - */ - requestId: string; - /** - * @generated from protobuf field: optional protorpc.RpcErrorType errorType = 4; - */ - errorType?: RpcErrorType; - /** - * @generated from protobuf field: optional string errorClassName = 5; - */ - errorClassName?: string; - /** - * @generated from protobuf field: optional string errorCode = 6; - */ - errorCode?: string; - /** - * @generated from protobuf field: optional string errorMessage = 7; - */ - errorMessage?: string; -} -// Dummy message to force the generation of the typescript class "google.prototype.Empty" -// We need this generated class in RpcCommunicator - -/** - * @generated from protobuf message protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq - */ -export interface Mnfo2uhnf92hvqi2nviouq2hv9puhq { - /** - * @generated from protobuf field: google.protobuf.Empty empty = 1; - */ - empty?: Empty; -} -/** - * @generated from protobuf enum protorpc.RpcErrorType - */ -export enum RpcErrorType { - /** - * @generated from protobuf enum value: SERVER_TIMEOUT = 0; - */ - SERVER_TIMEOUT = 0, - /** - * @generated from protobuf enum value: CLIENT_TIMEOUT = 1; - */ - CLIENT_TIMEOUT = 1, - /** - * @generated from protobuf enum value: UNKNOWN_RPC_METHOD = 2; - */ - UNKNOWN_RPC_METHOD = 2, - /** - * @generated from protobuf enum value: CLIENT_ERROR = 3; - */ - CLIENT_ERROR = 3, - /** - * @generated from protobuf enum value: SERVER_ERROR = 4; - */ - SERVER_ERROR = 4 -} -// @generated message type with reflection information, may provide speed optimized methods -class RpcMessage$Type extends MessageType { - constructor() { - super("protorpc.RpcMessage", [ - { no: 1, name: "header", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } }, - { no: 2, name: "body", kind: "message", T: () => Any }, - { no: 3, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 4, name: "errorType", kind: "enum", opt: true, T: () => ["protorpc.RpcErrorType", RpcErrorType] }, - { no: 5, name: "errorClassName", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 6, name: "errorCode", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 7, name: "errorMessage", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message protorpc.RpcMessage - */ -export const RpcMessage = new RpcMessage$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Mnfo2uhnf92hvqi2nviouq2hv9puhq$Type extends MessageType { - constructor() { - super("protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq", [ - { no: 1, name: "empty", kind: "message", T: () => Empty } - ]); - } -} -/** - * @generated MessageType for protobuf message protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq - */ -export const Mnfo2uhnf92hvqi2nviouq2hv9puhq = new Mnfo2uhnf92hvqi2nviouq2hv9puhq$Type(); diff --git a/packages/proto-rpc/generated/google/protobuf/any.ts b/packages/proto-rpc/generated/google/protobuf/any.ts deleted file mode 100644 index ce5b63bc4d..0000000000 --- a/packages/proto-rpc/generated/google/protobuf/any.ts +++ /dev/null @@ -1,326 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies -// @generated from protobuf file "google/protobuf/any.proto" (package "google.protobuf", syntax proto3) -// tslint:disable -// -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { WireType } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { isJsonObject } from "@protobuf-ts/runtime"; -import { typeofJsonValue } from "@protobuf-ts/runtime"; -import type { JsonValue } from "@protobuf-ts/runtime"; -import { jsonWriteOptions } from "@protobuf-ts/runtime"; -import type { JsonReadOptions } from "@protobuf-ts/runtime"; -import type { JsonWriteOptions } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IMessageType } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * `Any` contains an arbitrary serialized protocol buffer message along with a - * URL that describes the type of the serialized message. - * - * Protobuf library provides support to pack/unpack Any values in the form - * of utility functions or additional generated methods of the Any type. - * - * Example 1: Pack and unpack a message in C++. - * - * Foo foo = ...; - * Any any; - * any.PackFrom(foo); - * ... - * if (any.UnpackTo(&foo)) { - * ... - * } - * - * Example 2: Pack and unpack a message in Java. - * - * Foo foo = ...; - * Any any = Any.pack(foo); - * ... - * if (any.is(Foo.class)) { - * foo = any.unpack(Foo.class); - * } - * // or ... - * if (any.isSameTypeAs(Foo.getDefaultInstance())) { - * foo = any.unpack(Foo.getDefaultInstance()); - * } - * - * Example 3: Pack and unpack a message in Python. - * - * foo = Foo(...) - * any = Any() - * any.Pack(foo) - * ... - * if any.Is(Foo.DESCRIPTOR): - * any.Unpack(foo) - * ... - * - * Example 4: Pack and unpack a message in Go - * - * foo := &pb.Foo{...} - * any, err := anypb.New(foo) - * if err != nil { - * ... - * } - * ... - * foo := &pb.Foo{} - * if err := any.UnmarshalTo(foo); err != nil { - * ... - * } - * - * The pack methods provided by protobuf library will by default use - * 'type.googleapis.com/full.type.name' as the type URL and the unpack - * methods only use the fully qualified type name after the last '/' - * in the type URL, for example "foo.bar.com/x/y.z" will yield type - * name "y.z". - * - * JSON - * ==== - * The JSON representation of an `Any` value uses the regular - * representation of the deserialized, embedded message, with an - * additional field `@type` which contains the type URL. Example: - * - * package google.profile; - * message Person { - * string first_name = 1; - * string last_name = 2; - * } - * - * { - * "@type": "type.googleapis.com/google.profile.Person", - * "firstName": , - * "lastName": - * } - * - * If the embedded message type is well-known and has a custom JSON - * representation, that representation will be embedded adding a field - * `value` which holds the custom JSON in addition to the `@type` - * field. Example (for message [google.protobuf.Duration][]): - * - * { - * "@type": "type.googleapis.com/google.protobuf.Duration", - * "value": "1.212s" - * } - * - * - * @generated from protobuf message google.protobuf.Any - */ -export interface Any { - /** - * A URL/resource name that uniquely identifies the type of the serialized - * protocol buffer message. This string must contain at least - * one "/" character. The last segment of the URL's path must represent - * the fully qualified name of the type (as in - * `path/google.protobuf.Duration`). The name should be in a canonical form - * (e.g., leading "." is not accepted). - * - * In practice, teams usually precompile into the binary all types that they - * expect it to use in the context of Any. However, for URLs which use the - * scheme `http`, `https`, or no scheme, one can optionally set up a type - * server that maps type URLs to message definitions as follows: - * - * * If no scheme is provided, `https` is assumed. - * * An HTTP GET on the URL must yield a [google.protobuf.Type][] - * value in binary format, or produce an error. - * * Applications are allowed to cache lookup results based on the - * URL, or have them precompiled into a binary to avoid any - * lookup. Therefore, binary compatibility needs to be preserved - * on changes to types. (Use versioned type names to manage - * breaking changes.) - * - * Note: this functionality is not currently available in the official - * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. As of May 2023, there are no widely used type server - * implementations and no plans to implement one. - * - * Schemes other than `http`, `https` (or the empty scheme) might be - * used with implementation specific semantics. - * - * - * @generated from protobuf field: string type_url = 1; - */ - typeUrl: string; - /** - * Must be a valid serialized protocol buffer of the above specified type. - * - * @generated from protobuf field: bytes value = 2; - */ - value: Uint8Array; -} -// @generated message type with reflection information, may provide speed optimized methods -class Any$Type extends MessageType { - constructor() { - super("google.protobuf.Any", [ - { no: 1, name: "type_url", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "value", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } - ]); - } - /** - * Pack the message into a new `Any`. - * - * Uses 'type.googleapis.com/full.type.name' as the type URL. - */ - pack(message: T, type: IMessageType): Any { - return { - typeUrl: this.typeNameToUrl(type.typeName), value: type.toBinary(message), - }; - } - /** - * Unpack the message from the `Any`. - */ - unpack(any: Any, type: IMessageType, options?: Partial): T { - if (!this.contains(any, type)) - throw new Error("Cannot unpack google.protobuf.Any with typeUrl '" + any.typeUrl + "' as " + type.typeName + "."); - return type.fromBinary(any.value, options); - } - /** - * Does the given `Any` contain a packed message of the given type? - */ - contains(any: Any, type: IMessageType | string): boolean { - if (!any.typeUrl.length) - return false; - let wants = typeof type == "string" ? type : type.typeName; - let has = this.typeUrlToName(any.typeUrl); - return wants === has; - } - /** - * Convert the message to canonical JSON value. - * - * You have to provide the `typeRegistry` option so that the - * packed message can be converted to JSON. - * - * The `typeRegistry` option is also required to read - * `google.protobuf.Any` from JSON format. - */ - internalJsonWrite(any: Any, options: JsonWriteOptions): JsonValue { - if (any.typeUrl === "") - return {}; - let typeName = this.typeUrlToName(any.typeUrl); - let opt = jsonWriteOptions(options); - let type = opt.typeRegistry?.find(t => t.typeName === typeName); - if (!type) - throw new globalThis.Error("Unable to convert google.protobuf.Any with typeUrl '" + any.typeUrl + "' to JSON. The specified type " + typeName + " is not available in the type registry."); - let value = type.fromBinary(any.value, { readUnknownField: false }); - let json = type.internalJsonWrite(value, opt); - if (typeName.startsWith("google.protobuf.") || !isJsonObject(json)) - json = { value: json }; - json["@type"] = any.typeUrl; - return json; - } - internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Any): Any { - if (!isJsonObject(json)) - throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON " + typeofJsonValue(json) + "."); - if (typeof json["@type"] != "string" || json["@type"] == "") - return this.create(); - let typeName = this.typeUrlToName(json["@type"]); - let type = options?.typeRegistry?.find(t => t.typeName == typeName); - if (!type) - throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON. The specified type " + typeName + " is not available in the type registry."); - let value; - if (typeName.startsWith("google.protobuf.") && json.hasOwnProperty("value")) - value = type.fromJson(json["value"], options); - else { - let copy = Object.assign({}, json); - delete copy["@type"]; - value = type.fromJson(copy, options); - } - if (target === undefined) - target = this.create(); - target.typeUrl = json["@type"]; - target.value = type.toBinary(value); - return target; - } - typeNameToUrl(name: string): string { - if (!name.length) - throw new Error("invalid type name: " + name); - return "type.googleapis.com/" + name; - } - typeUrlToName(url: string): string { - if (!url.length) - throw new Error("invalid type url: " + url); - let slash = url.lastIndexOf("/"); - let name = slash > 0 ? url.substring(slash + 1) : url; - if (!name.length) - throw new Error("invalid type url: " + url); - return name; - } - create(value?: PartialMessage): Any { - const message = globalThis.Object.create((this.messagePrototype!)); - message.typeUrl = ""; - message.value = new Uint8Array(0); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Any): Any { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* string type_url */ 1: - message.typeUrl = reader.string(); - break; - case /* bytes value */ 2: - message.value = reader.bytes(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Any, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* string type_url = 1; */ - if (message.typeUrl !== "") - writer.tag(1, WireType.LengthDelimited).string(message.typeUrl); - /* bytes value = 2; */ - if (message.value.length) - writer.tag(2, WireType.LengthDelimited).bytes(message.value); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message google.protobuf.Any - */ -export const Any = new Any$Type(); diff --git a/packages/proto-rpc/generated/google/protobuf/empty.ts b/packages/proto-rpc/generated/google/protobuf/empty.ts deleted file mode 100644 index aa12116b9c..0000000000 --- a/packages/proto-rpc/generated/google/protobuf/empty.ts +++ /dev/null @@ -1,81 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies -// @generated from protobuf file "google/protobuf/empty.proto" (package "google.protobuf", syntax proto3) -// tslint:disable -// -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * A generic empty message that you can re-use to avoid defining duplicated - * empty messages in your APIs. A typical example is to use it as the request - * or the response type of an API method. For instance: - * - * service Foo { - * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - * } - * - * - * @generated from protobuf message google.protobuf.Empty - */ -export interface Empty { -} -// @generated message type with reflection information, may provide speed optimized methods -class Empty$Type extends MessageType { - constructor() { - super("google.protobuf.Empty", []); - } - create(value?: PartialMessage): Empty { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Empty): Empty { - return target ?? this.create(); - } - internalBinaryWrite(message: Empty, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message google.protobuf.Empty - */ -export const Empty = new Empty$Type(); diff --git a/packages/proto-rpc/package.json b/packages/proto-rpc/package.json index 2512c5d7b5..3f25453843 100644 --- a/packages/proto-rpc/package.json +++ b/packages/proto-rpc/package.json @@ -12,16 +12,16 @@ "license": "(Apache-2.0 AND BSD-3-Clause)", "author": "Streamr Network AG ", "scripts": { - "generate-protoc-code": "./proto.sh", + "prebuild": "./proto.sh", "build": "tsc -b tsconfig.node.json", "build-browser": "webpack --mode=development --progress", - "check": "tsc -p ./tsconfig.jest.json", + "check": "./test-proto.sh && tsc -p ./tsconfig.jest.json", "clean": "jest --clearCache || true; rm -rf dist *.tsbuildinfo node_modules/.cache || true", - "eslint": "eslint --cache --cache-location=node_modules/.cache/.eslintcache/ '*/**/*.{js,ts}'", - "test": "npm run test-unit && npm run test-integration", - "test-browser": "karma start karma.config.js", - "test-unit": "jest test/unit", - "test-integration": "jest --bail test/integration" + "eslint": "./test-proto.sh && eslint --cache --cache-location=node_modules/.cache/.eslintcache/ '*/**/*.{js,ts}'", + "test": "./test-proto.sh && npm run test-unit && npm run test-integration", + "test-browser": "./test-proto.sh && karma start karma.config.js", + "test-unit": "./test-proto.sh && jest test/unit", + "test-integration": "./test-proto.sh && jest --bail test/integration" }, "dependencies": { "@protobuf-ts/runtime": "^2.8.2", diff --git a/packages/proto-rpc/proto.sh b/packages/proto-rpc/proto.sh index d858684022..6fa49562cf 100755 --- a/packages/proto-rpc/proto.sh +++ b/packages/proto-rpc/proto.sh @@ -1,4 +1,2 @@ mkdir -p ./generated npx protoc --ts_out ./generated --ts_opt server_generic,generate_dependencies --proto_path protos protos/ProtoRpc.proto --experimental_allow_proto3_optional -mkdir -p ./test/proto -npx protoc --ts_out ./test/proto --ts_opt server_generic,generate_dependencies --proto_path test/protos test/protos/*.proto --experimental_allow_proto3_optional diff --git a/packages/proto-rpc/test-proto.sh b/packages/proto-rpc/test-proto.sh new file mode 100755 index 0000000000..5c602334dd --- /dev/null +++ b/packages/proto-rpc/test-proto.sh @@ -0,0 +1,2 @@ +mkdir -p ./test/proto +npx protoc --ts_out ./test/proto --ts_opt server_generic,generate_dependencies --proto_path test/protos test/protos/*.proto --experimental_allow_proto3_optional diff --git a/packages/proto-rpc/test/proto/HelloRpc.client.ts b/packages/proto-rpc/test/proto/HelloRpc.client.ts deleted file mode 100644 index 4748c42ac3..0000000000 --- a/packages/proto-rpc/test/proto/HelloRpc.client.ts +++ /dev/null @@ -1,37 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies -// @generated from protobuf file "HelloRpc.proto" (syntax proto3) -// tslint:disable -import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; -import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; -import { HelloRpcService } from "./HelloRpc"; -import { stackIntercept } from "@protobuf-ts/runtime-rpc"; -import type { HelloResponse } from "./HelloRpc"; -import type { HelloRequest } from "./HelloRpc"; -import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; -import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service HelloRpcService - */ -export interface IHelloRpcServiceClient { - /** - * @generated from protobuf rpc: sayHello(HelloRequest) returns (HelloResponse); - */ - sayHello(input: HelloRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service HelloRpcService - */ -export class HelloRpcServiceClient implements IHelloRpcServiceClient, ServiceInfo { - typeName = HelloRpcService.typeName; - methods = HelloRpcService.methods; - options = HelloRpcService.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: sayHello(HelloRequest) returns (HelloResponse); - */ - sayHello(input: HelloRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} diff --git a/packages/proto-rpc/test/proto/HelloRpc.server.ts b/packages/proto-rpc/test/proto/HelloRpc.server.ts deleted file mode 100644 index a2072b65ab..0000000000 --- a/packages/proto-rpc/test/proto/HelloRpc.server.ts +++ /dev/null @@ -1,15 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies -// @generated from protobuf file "HelloRpc.proto" (syntax proto3) -// tslint:disable -import { HelloResponse } from "./HelloRpc"; -import { HelloRequest } from "./HelloRpc"; -import { ServerCallContext } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service HelloRpcService - */ -export interface IHelloRpcService { - /** - * @generated from protobuf rpc: sayHello(HelloRequest) returns (HelloResponse); - */ - sayHello(request: HelloRequest, context: T): Promise; -} diff --git a/packages/proto-rpc/test/proto/HelloRpc.ts b/packages/proto-rpc/test/proto/HelloRpc.ts deleted file mode 100644 index 95529f0a17..0000000000 --- a/packages/proto-rpc/test/proto/HelloRpc.ts +++ /dev/null @@ -1,53 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies -// @generated from protobuf file "HelloRpc.proto" (syntax proto3) -// tslint:disable -import { ServiceType } from "@protobuf-ts/runtime-rpc"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * @generated from protobuf message HelloRequest - */ -export interface HelloRequest { - /** - * @generated from protobuf field: string myName = 1; - */ - myName: string; -} -/** - * @generated from protobuf message HelloResponse - */ -export interface HelloResponse { - /** - * @generated from protobuf field: string greeting = 1; - */ - greeting: string; -} -// @generated message type with reflection information, may provide speed optimized methods -class HelloRequest$Type extends MessageType { - constructor() { - super("HelloRequest", [ - { no: 1, name: "myName", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message HelloRequest - */ -export const HelloRequest = new HelloRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class HelloResponse$Type extends MessageType { - constructor() { - super("HelloResponse", [ - { no: 1, name: "greeting", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message HelloResponse - */ -export const HelloResponse = new HelloResponse$Type(); -/** - * @generated ServiceType for protobuf service HelloRpcService - */ -export const HelloRpcService = new ServiceType("HelloRpcService", [ - { name: "sayHello", options: {}, I: HelloRequest, O: HelloResponse } -]); diff --git a/packages/proto-rpc/test/proto/TestProtos.client.ts b/packages/proto-rpc/test/proto/TestProtos.client.ts deleted file mode 100644 index 70563ce58b..0000000000 --- a/packages/proto-rpc/test/proto/TestProtos.client.ts +++ /dev/null @@ -1,92 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies -// @generated from protobuf file "TestProtos.proto" (syntax proto3) -// tslint:disable -import { OptionalService } from "./TestProtos"; -import type { OptionalResponse } from "./TestProtos"; -import type { OptionalRequest } from "./TestProtos"; -import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; -import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; -import { DhtRpcService } from "./TestProtos"; -import type { RouteMessageAck } from "./TestProtos"; -import type { RouteMessageWrapper } from "./TestProtos"; -import type { PingResponse } from "./TestProtos"; -import type { PingRequest } from "./TestProtos"; -import { stackIntercept } from "@protobuf-ts/runtime-rpc"; -import type { ClosestPeersResponse } from "./TestProtos"; -import type { ClosestPeersRequest } from "./TestProtos"; -import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; -import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service DhtRpcService - */ -export interface IDhtRpcServiceClient { - /** - * @generated from protobuf rpc: getClosestPeers(ClosestPeersRequest) returns (ClosestPeersResponse); - */ - getClosestPeers(input: ClosestPeersRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: ping(PingRequest) returns (PingResponse); - */ - ping(input: PingRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: routeMessage(RouteMessageWrapper) returns (RouteMessageAck); - */ - routeMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service DhtRpcService - */ -export class DhtRpcServiceClient implements IDhtRpcServiceClient, ServiceInfo { - typeName = DhtRpcService.typeName; - methods = DhtRpcService.methods; - options = DhtRpcService.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: getClosestPeers(ClosestPeersRequest) returns (ClosestPeersResponse); - */ - getClosestPeers(input: ClosestPeersRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: ping(PingRequest) returns (PingResponse); - */ - ping(input: PingRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: routeMessage(RouteMessageWrapper) returns (RouteMessageAck); - */ - routeMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall { - const method = this.methods[2], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service OptionalService - */ -export interface IOptionalServiceClient { - /** - * @generated from protobuf rpc: getOptional(OptionalRequest) returns (OptionalResponse); - */ - getOptional(input: OptionalRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service OptionalService - */ -export class OptionalServiceClient implements IOptionalServiceClient, ServiceInfo { - typeName = OptionalService.typeName; - methods = OptionalService.methods; - options = OptionalService.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: getOptional(OptionalRequest) returns (OptionalResponse); - */ - getOptional(input: OptionalRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} diff --git a/packages/proto-rpc/test/proto/TestProtos.server.ts b/packages/proto-rpc/test/proto/TestProtos.server.ts deleted file mode 100644 index e9bdcf3308..0000000000 --- a/packages/proto-rpc/test/proto/TestProtos.server.ts +++ /dev/null @@ -1,38 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies -// @generated from protobuf file "TestProtos.proto" (syntax proto3) -// tslint:disable -import { OptionalResponse } from "./TestProtos"; -import { OptionalRequest } from "./TestProtos"; -import { RouteMessageAck } from "./TestProtos"; -import { RouteMessageWrapper } from "./TestProtos"; -import { PingResponse } from "./TestProtos"; -import { PingRequest } from "./TestProtos"; -import { ClosestPeersResponse } from "./TestProtos"; -import { ClosestPeersRequest } from "./TestProtos"; -import { ServerCallContext } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service DhtRpcService - */ -export interface IDhtRpcService { - /** - * @generated from protobuf rpc: getClosestPeers(ClosestPeersRequest) returns (ClosestPeersResponse); - */ - getClosestPeers(request: ClosestPeersRequest, context: T): Promise; - /** - * @generated from protobuf rpc: ping(PingRequest) returns (PingResponse); - */ - ping(request: PingRequest, context: T): Promise; - /** - * @generated from protobuf rpc: routeMessage(RouteMessageWrapper) returns (RouteMessageAck); - */ - routeMessage(request: RouteMessageWrapper, context: T): Promise; -} -/** - * @generated from protobuf service OptionalService - */ -export interface IOptionalService { - /** - * @generated from protobuf rpc: getOptional(OptionalRequest) returns (OptionalResponse); - */ - getOptional(request: OptionalRequest, context: T): Promise; -} diff --git a/packages/proto-rpc/test/proto/TestProtos.ts b/packages/proto-rpc/test/proto/TestProtos.ts deleted file mode 100644 index 94951bdf0d..0000000000 --- a/packages/proto-rpc/test/proto/TestProtos.ts +++ /dev/null @@ -1,317 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies -// @generated from protobuf file "TestProtos.proto" (syntax proto3) -// tslint:disable -import { ServiceType } from "@protobuf-ts/runtime-rpc"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * @generated from protobuf message RouteMessageWrapper - */ -export interface RouteMessageWrapper { - /** - * @generated from protobuf field: PeerDescriptor sourcePeer = 1; - */ - sourcePeer?: PeerDescriptor; - /** - * @generated from protobuf field: string requestId = 2; - */ - requestId: string; - /** - * @generated from protobuf field: PeerDescriptor destinationPeer = 3; - */ - destinationPeer?: PeerDescriptor; - /** - * @generated from protobuf field: PeerDescriptor previousPeer = 4; - */ - previousPeer?: PeerDescriptor; - /** - * @generated from protobuf field: bytes message = 5; - */ - message: Uint8Array; // Expected to be of type Message -} -/** - * @generated from protobuf message RouteMessageAck - */ -export interface RouteMessageAck { - /** - * @generated from protobuf field: PeerDescriptor sourcePeer = 1; - */ - sourcePeer?: PeerDescriptor; - /** - * @generated from protobuf field: string requestId = 2; - */ - requestId: string; - /** - * @generated from protobuf field: PeerDescriptor destinationPeer = 3; - */ - destinationPeer?: PeerDescriptor; - /** - * @generated from protobuf field: string error = 4; - */ - error: string; -} -/** - * @generated from protobuf message PingRequest - */ -export interface PingRequest { - /** - * @generated from protobuf field: string requestId = 1; - */ - requestId: string; -} -/** - * @generated from protobuf message PingResponse - */ -export interface PingResponse { - /** - * @generated from protobuf field: string requestId = 1; - */ - requestId: string; -} -/** - * @generated from protobuf message ClosestPeersRequest - */ -export interface ClosestPeersRequest { - /** - * @generated from protobuf field: PeerDescriptor peerDescriptor = 1; - */ - peerDescriptor?: PeerDescriptor; - /** - * @generated from protobuf field: string requestId = 2; - */ - requestId: string; -} -/** - * @generated from protobuf message ClosestPeersResponse - */ -export interface ClosestPeersResponse { - /** - * @generated from protobuf field: repeated PeerDescriptor peers = 1; - */ - peers: PeerDescriptor[]; - /** - * @generated from protobuf field: string requestId = 2; - */ - requestId: string; -} -/** - * @generated from protobuf message PeerDescriptor - */ -export interface PeerDescriptor { - /** - * @generated from protobuf field: bytes nodeId = 1; - */ - nodeId: Uint8Array; - /** - * @generated from protobuf field: NodeType type = 2; - */ - type: NodeType; - /** - * @generated from protobuf field: ConnectivityMethod udp = 3; - */ - udp?: ConnectivityMethod; - /** - * @generated from protobuf field: ConnectivityMethod tcp = 4; - */ - tcp?: ConnectivityMethod; - /** - * @generated from protobuf field: ConnectivityMethod websocket = 5; - */ - websocket?: ConnectivityMethod; - /** - * @generated from protobuf field: optional bool openInternet = 6; - */ - openInternet?: boolean; -} -/** - * @generated from protobuf message ConnectivityMethod - */ -export interface ConnectivityMethod { - /** - * @generated from protobuf field: uint32 port = 2; - */ - port: number; - /** - * @generated from protobuf field: string ip = 3; - */ - ip: string; -} -/** - * @generated from protobuf message OptionalRequest - */ -export interface OptionalRequest { - /** - * @generated from protobuf field: optional string someOptionalField = 1; - */ - someOptionalField?: string; -} -/** - * @generated from protobuf message OptionalResponse - */ -export interface OptionalResponse { - /** - * @generated from protobuf field: optional string someOptionalField = 1; - */ - someOptionalField?: string; -} -/** - * @generated from protobuf enum NodeType - */ -export enum NodeType { - /** - * @generated from protobuf enum value: NODEJS = 0; - */ - NODEJS = 0, - /** - * @generated from protobuf enum value: BROWSER = 1; - */ - BROWSER = 1 -} -// @generated message type with reflection information, may provide speed optimized methods -class RouteMessageWrapper$Type extends MessageType { - constructor() { - super("RouteMessageWrapper", [ - { no: 1, name: "sourcePeer", kind: "message", T: () => PeerDescriptor }, - { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "destinationPeer", kind: "message", T: () => PeerDescriptor }, - { no: 4, name: "previousPeer", kind: "message", T: () => PeerDescriptor }, - { no: 5, name: "message", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message RouteMessageWrapper - */ -export const RouteMessageWrapper = new RouteMessageWrapper$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class RouteMessageAck$Type extends MessageType { - constructor() { - super("RouteMessageAck", [ - { no: 1, name: "sourcePeer", kind: "message", T: () => PeerDescriptor }, - { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "destinationPeer", kind: "message", T: () => PeerDescriptor }, - { no: 4, name: "error", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message RouteMessageAck - */ -export const RouteMessageAck = new RouteMessageAck$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class PingRequest$Type extends MessageType { - constructor() { - super("PingRequest", [ - { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message PingRequest - */ -export const PingRequest = new PingRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class PingResponse$Type extends MessageType { - constructor() { - super("PingResponse", [ - { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message PingResponse - */ -export const PingResponse = new PingResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ClosestPeersRequest$Type extends MessageType { - constructor() { - super("ClosestPeersRequest", [ - { no: 1, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor }, - { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message ClosestPeersRequest - */ -export const ClosestPeersRequest = new ClosestPeersRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ClosestPeersResponse$Type extends MessageType { - constructor() { - super("ClosestPeersResponse", [ - { no: 1, name: "peers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, - { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message ClosestPeersResponse - */ -export const ClosestPeersResponse = new ClosestPeersResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class PeerDescriptor$Type extends MessageType { - constructor() { - super("PeerDescriptor", [ - { no: 1, name: "nodeId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 2, name: "type", kind: "enum", T: () => ["NodeType", NodeType] }, - { no: 3, name: "udp", kind: "message", T: () => ConnectivityMethod }, - { no: 4, name: "tcp", kind: "message", T: () => ConnectivityMethod }, - { no: 5, name: "websocket", kind: "message", T: () => ConnectivityMethod }, - { no: 6, name: "openInternet", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message PeerDescriptor - */ -export const PeerDescriptor = new PeerDescriptor$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ConnectivityMethod$Type extends MessageType { - constructor() { - super("ConnectivityMethod", [ - { no: 2, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, - { no: 3, name: "ip", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message ConnectivityMethod - */ -export const ConnectivityMethod = new ConnectivityMethod$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class OptionalRequest$Type extends MessageType { - constructor() { - super("OptionalRequest", [ - { no: 1, name: "someOptionalField", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message OptionalRequest - */ -export const OptionalRequest = new OptionalRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class OptionalResponse$Type extends MessageType { - constructor() { - super("OptionalResponse", [ - { no: 1, name: "someOptionalField", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message OptionalResponse - */ -export const OptionalResponse = new OptionalResponse$Type(); -/** - * @generated ServiceType for protobuf service DhtRpcService - */ -export const DhtRpcService = new ServiceType("DhtRpcService", [ - { name: "getClosestPeers", options: {}, I: ClosestPeersRequest, O: ClosestPeersResponse }, - { name: "ping", options: {}, I: PingRequest, O: PingResponse }, - { name: "routeMessage", options: {}, I: RouteMessageWrapper, O: RouteMessageAck } -]); -/** - * @generated ServiceType for protobuf service OptionalService - */ -export const OptionalService = new ServiceType("OptionalService", [ - { name: "getOptional", options: {}, I: OptionalRequest, O: OptionalResponse } -]); diff --git a/packages/proto-rpc/test/proto/WakeUpRpc.client.ts b/packages/proto-rpc/test/proto/WakeUpRpc.client.ts deleted file mode 100644 index 815d4f8ded..0000000000 --- a/packages/proto-rpc/test/proto/WakeUpRpc.client.ts +++ /dev/null @@ -1,37 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies -// @generated from protobuf file "WakeUpRpc.proto" (syntax proto3) -// tslint:disable -import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; -import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; -import { WakeUpRpcService } from "./WakeUpRpc"; -import { stackIntercept } from "@protobuf-ts/runtime-rpc"; -import type { Empty } from "./google/protobuf/empty"; -import type { WakeUpRequest } from "./WakeUpRpc"; -import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; -import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service WakeUpRpcService - */ -export interface IWakeUpRpcServiceClient { - /** - * @generated from protobuf rpc: wakeUp(WakeUpRequest) returns (google.protobuf.Empty); - */ - wakeUp(input: WakeUpRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service WakeUpRpcService - */ -export class WakeUpRpcServiceClient implements IWakeUpRpcServiceClient, ServiceInfo { - typeName = WakeUpRpcService.typeName; - methods = WakeUpRpcService.methods; - options = WakeUpRpcService.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: wakeUp(WakeUpRequest) returns (google.protobuf.Empty); - */ - wakeUp(input: WakeUpRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} diff --git a/packages/proto-rpc/test/proto/WakeUpRpc.server.ts b/packages/proto-rpc/test/proto/WakeUpRpc.server.ts deleted file mode 100644 index b69144ea34..0000000000 --- a/packages/proto-rpc/test/proto/WakeUpRpc.server.ts +++ /dev/null @@ -1,15 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies -// @generated from protobuf file "WakeUpRpc.proto" (syntax proto3) -// tslint:disable -import { Empty } from "./google/protobuf/empty"; -import { WakeUpRequest } from "./WakeUpRpc"; -import { ServerCallContext } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service WakeUpRpcService - */ -export interface IWakeUpRpcService { - /** - * @generated from protobuf rpc: wakeUp(WakeUpRequest) returns (google.protobuf.Empty); - */ - wakeUp(request: WakeUpRequest, context: T): Promise; -} diff --git a/packages/proto-rpc/test/proto/WakeUpRpc.ts b/packages/proto-rpc/test/proto/WakeUpRpc.ts deleted file mode 100644 index e6f4a471df..0000000000 --- a/packages/proto-rpc/test/proto/WakeUpRpc.ts +++ /dev/null @@ -1,33 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies -// @generated from protobuf file "WakeUpRpc.proto" (syntax proto3) -// tslint:disable -import { Empty } from "./google/protobuf/empty"; -import { ServiceType } from "@protobuf-ts/runtime-rpc"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * @generated from protobuf message WakeUpRequest - */ -export interface WakeUpRequest { - /** - * @generated from protobuf field: string reason = 1; - */ - reason: string; -} -// @generated message type with reflection information, may provide speed optimized methods -class WakeUpRequest$Type extends MessageType { - constructor() { - super("WakeUpRequest", [ - { no: 1, name: "reason", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message WakeUpRequest - */ -export const WakeUpRequest = new WakeUpRequest$Type(); -/** - * @generated ServiceType for protobuf service WakeUpRpcService - */ -export const WakeUpRpcService = new ServiceType("WakeUpRpcService", [ - { name: "wakeUp", options: {}, I: WakeUpRequest, O: Empty } -]); diff --git a/packages/proto-rpc/test/proto/google/protobuf/empty.ts b/packages/proto-rpc/test/proto/google/protobuf/empty.ts deleted file mode 100644 index aa12116b9c..0000000000 --- a/packages/proto-rpc/test/proto/google/protobuf/empty.ts +++ /dev/null @@ -1,81 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies -// @generated from protobuf file "google/protobuf/empty.proto" (package "google.protobuf", syntax proto3) -// tslint:disable -// -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * A generic empty message that you can re-use to avoid defining duplicated - * empty messages in your APIs. A typical example is to use it as the request - * or the response type of an API method. For instance: - * - * service Foo { - * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - * } - * - * - * @generated from protobuf message google.protobuf.Empty - */ -export interface Empty { -} -// @generated message type with reflection information, may provide speed optimized methods -class Empty$Type extends MessageType { - constructor() { - super("google.protobuf.Empty", []); - } - create(value?: PartialMessage): Empty { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Empty): Empty { - return target ?? this.create(); - } - internalBinaryWrite(message: Empty, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message google.protobuf.Empty - */ -export const Empty = new Empty$Type(); diff --git a/packages/sdk/.gitignore b/packages/sdk/.gitignore index 1cb86c70dc..b1194d9475 100644 --- a/packages/sdk/.gitignore +++ b/packages/sdk/.gitignore @@ -41,3 +41,6 @@ tests_output test/exports/dist test/exports/package-lock.json docs + +src/generated/packages +src/generated/google \ No newline at end of file diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 2b4fa2897f..a486bedf2a 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -20,7 +20,7 @@ } }, "scripts": { - "prebuild": "node bin/generate-config-validator.js", + "prebuild": "node bin/generate-config-validator.js && ./proto.sh", "postbuild": "bash copy-package.sh && bash fix-esm.sh", "build": "tsc --build ./tsconfig.node.json", "build-browser": "npm run build-browser-development && npm run build-browser-production", diff --git a/packages/sdk/src/generated/google/protobuf/any.ts b/packages/sdk/src/generated/google/protobuf/any.ts deleted file mode 100644 index f9d001e5ae..0000000000 --- a/packages/sdk/src/generated/google/protobuf/any.ts +++ /dev/null @@ -1,319 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "google/protobuf/any.proto" (package "google.protobuf", syntax proto3) -// tslint:disable -// -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { WireType } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { isJsonObject } from "@protobuf-ts/runtime"; -import { typeofJsonValue } from "@protobuf-ts/runtime"; -import type { JsonValue } from "@protobuf-ts/runtime"; -import { jsonWriteOptions } from "@protobuf-ts/runtime"; -import type { JsonReadOptions } from "@protobuf-ts/runtime"; -import type { JsonWriteOptions } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IMessageType } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * `Any` contains an arbitrary serialized protocol buffer message along with a - * URL that describes the type of the serialized message. - * - * Protobuf library provides support to pack/unpack Any values in the form - * of utility functions or additional generated methods of the Any type. - * - * Example 1: Pack and unpack a message in C++. - * - * Foo foo = ...; - * Any any; - * any.PackFrom(foo); - * ... - * if (any.UnpackTo(&foo)) { - * ... - * } - * - * Example 2: Pack and unpack a message in Java. - * - * Foo foo = ...; - * Any any = Any.pack(foo); - * ... - * if (any.is(Foo.class)) { - * foo = any.unpack(Foo.class); - * } - * - * Example 3: Pack and unpack a message in Python. - * - * foo = Foo(...) - * any = Any() - * any.Pack(foo) - * ... - * if any.Is(Foo.DESCRIPTOR): - * any.Unpack(foo) - * ... - * - * Example 4: Pack and unpack a message in Go - * - * foo := &pb.Foo{...} - * any, err := ptypes.MarshalAny(foo) - * ... - * foo := &pb.Foo{} - * if err := ptypes.UnmarshalAny(any, foo); err != nil { - * ... - * } - * - * The pack methods provided by protobuf library will by default use - * 'type.googleapis.com/full.type.name' as the type URL and the unpack - * methods only use the fully qualified type name after the last '/' - * in the type URL, for example "foo.bar.com/x/y.z" will yield type - * name "y.z". - * - * - * JSON - * ==== - * The JSON representation of an `Any` value uses the regular - * representation of the deserialized, embedded message, with an - * additional field `@type` which contains the type URL. Example: - * - * package google.profile; - * message Person { - * string first_name = 1; - * string last_name = 2; - * } - * - * { - * "@type": "type.googleapis.com/google.profile.Person", - * "firstName": , - * "lastName": - * } - * - * If the embedded message type is well-known and has a custom JSON - * representation, that representation will be embedded adding a field - * `value` which holds the custom JSON in addition to the `@type` - * field. Example (for message [google.protobuf.Duration][]): - * - * { - * "@type": "type.googleapis.com/google.protobuf.Duration", - * "value": "1.212s" - * } - * - * - * @generated from protobuf message google.protobuf.Any - */ -export interface Any { - /** - * A URL/resource name that uniquely identifies the type of the serialized - * protocol buffer message. This string must contain at least - * one "/" character. The last segment of the URL's path must represent - * the fully qualified name of the type (as in - * `path/google.protobuf.Duration`). The name should be in a canonical form - * (e.g., leading "." is not accepted). - * - * In practice, teams usually precompile into the binary all types that they - * expect it to use in the context of Any. However, for URLs which use the - * scheme `http`, `https`, or no scheme, one can optionally set up a type - * server that maps type URLs to message definitions as follows: - * - * * If no scheme is provided, `https` is assumed. - * * An HTTP GET on the URL must yield a [google.protobuf.Type][] - * value in binary format, or produce an error. - * * Applications are allowed to cache lookup results based on the - * URL, or have them precompiled into a binary to avoid any - * lookup. Therefore, binary compatibility needs to be preserved - * on changes to types. (Use versioned type names to manage - * breaking changes.) - * - * Note: this functionality is not currently available in the official - * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. - * - * Schemes other than `http`, `https` (or the empty scheme) might be - * used with implementation specific semantics. - * - * - * @generated from protobuf field: string type_url = 1; - */ - typeUrl: string; - /** - * Must be a valid serialized protocol buffer of the above specified type. - * - * @generated from protobuf field: bytes value = 2; - */ - value: Uint8Array; -} -// @generated message type with reflection information, may provide speed optimized methods -class Any$Type extends MessageType { - constructor() { - super("google.protobuf.Any", [ - { no: 1, name: "type_url", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "value", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } - ]); - } - /** - * Pack the message into a new `Any`. - * - * Uses 'type.googleapis.com/full.type.name' as the type URL. - */ - pack(message: T, type: IMessageType): Any { - return { - typeUrl: this.typeNameToUrl(type.typeName), value: type.toBinary(message), - }; - } - /** - * Unpack the message from the `Any`. - */ - unpack(any: Any, type: IMessageType, options?: Partial): T { - if (!this.contains(any, type)) - throw new Error("Cannot unpack google.protobuf.Any with typeUrl '" + any.typeUrl + "' as " + type.typeName + "."); - return type.fromBinary(any.value, options); - } - /** - * Does the given `Any` contain a packed message of the given type? - */ - contains(any: Any, type: IMessageType | string): boolean { - if (!any.typeUrl.length) - return false; - let wants = typeof type == "string" ? type : type.typeName; - let has = this.typeUrlToName(any.typeUrl); - return wants === has; - } - /** - * Convert the message to canonical JSON value. - * - * You have to provide the `typeRegistry` option so that the - * packed message can be converted to JSON. - * - * The `typeRegistry` option is also required to read - * `google.protobuf.Any` from JSON format. - */ - internalJsonWrite(any: Any, options: JsonWriteOptions): JsonValue { - if (any.typeUrl === "") - return {}; - let typeName = this.typeUrlToName(any.typeUrl); - let opt = jsonWriteOptions(options); - let type = opt.typeRegistry?.find(t => t.typeName === typeName); - if (!type) - throw new globalThis.Error("Unable to convert google.protobuf.Any with typeUrl '" + any.typeUrl + "' to JSON. The specified type " + typeName + " is not available in the type registry."); - let value = type.fromBinary(any.value, { readUnknownField: false }); - let json = type.internalJsonWrite(value, opt); - if (typeName.startsWith("google.protobuf.") || !isJsonObject(json)) - json = { value: json }; - json["@type"] = any.typeUrl; - return json; - } - internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Any): Any { - if (!isJsonObject(json)) - throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON " + typeofJsonValue(json) + "."); - if (typeof json["@type"] != "string" || json["@type"] == "") - return this.create(); - let typeName = this.typeUrlToName(json["@type"]); - let type = options?.typeRegistry?.find(t => t.typeName == typeName); - if (!type) - throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON. The specified type " + typeName + " is not available in the type registry."); - let value; - if (typeName.startsWith("google.protobuf.") && json.hasOwnProperty("value")) - value = type.fromJson(json["value"], options); - else { - let copy = Object.assign({}, json); - delete copy["@type"]; - value = type.fromJson(copy, options); - } - if (target === undefined) - target = this.create(); - target.typeUrl = json["@type"]; - target.value = type.toBinary(value); - return target; - } - typeNameToUrl(name: string): string { - if (!name.length) - throw new Error("invalid type name: " + name); - return "type.googleapis.com/" + name; - } - typeUrlToName(url: string): string { - if (!url.length) - throw new Error("invalid type url: " + url); - let slash = url.lastIndexOf("/"); - let name = slash > 0 ? url.substring(slash + 1) : url; - if (!name.length) - throw new Error("invalid type url: " + url); - return name; - } - create(value?: PartialMessage): Any { - const message = globalThis.Object.create((this.messagePrototype!)); - message.typeUrl = ""; - message.value = new Uint8Array(0); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Any): Any { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* string type_url */ 1: - message.typeUrl = reader.string(); - break; - case /* bytes value */ 2: - message.value = reader.bytes(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Any, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* string type_url = 1; */ - if (message.typeUrl !== "") - writer.tag(1, WireType.LengthDelimited).string(message.typeUrl); - /* bytes value = 2; */ - if (message.value.length) - writer.tag(2, WireType.LengthDelimited).bytes(message.value); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message google.protobuf.Any - */ -export const Any = new Any$Type(); diff --git a/packages/sdk/src/generated/google/protobuf/empty.ts b/packages/sdk/src/generated/google/protobuf/empty.ts deleted file mode 100644 index 306ec9ccba..0000000000 --- a/packages/sdk/src/generated/google/protobuf/empty.ts +++ /dev/null @@ -1,82 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "google/protobuf/empty.proto" (package "google.protobuf", syntax proto3) -// tslint:disable -// -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * A generic empty message that you can re-use to avoid defining duplicated - * empty messages in your APIs. A typical example is to use it as the request - * or the response type of an API method. For instance: - * - * service Foo { - * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - * } - * - * The JSON representation for `Empty` is empty JSON object `{}`. - * - * @generated from protobuf message google.protobuf.Empty - */ -export interface Empty { -} -// @generated message type with reflection information, may provide speed optimized methods -class Empty$Type extends MessageType { - constructor() { - super("google.protobuf.Empty", []); - } - create(value?: PartialMessage): Empty { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Empty): Empty { - return target ?? this.create(); - } - internalBinaryWrite(message: Empty, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message google.protobuf.Empty - */ -export const Empty = new Empty$Type(); diff --git a/packages/sdk/src/generated/google/protobuf/timestamp.ts b/packages/sdk/src/generated/google/protobuf/timestamp.ts deleted file mode 100644 index c465566b94..0000000000 --- a/packages/sdk/src/generated/google/protobuf/timestamp.ts +++ /dev/null @@ -1,281 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "google/protobuf/timestamp.proto" (package "google.protobuf", syntax proto3) -// tslint:disable -// -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { WireType } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { typeofJsonValue } from "@protobuf-ts/runtime"; -import type { JsonValue } from "@protobuf-ts/runtime"; -import type { JsonReadOptions } from "@protobuf-ts/runtime"; -import type { JsonWriteOptions } from "@protobuf-ts/runtime"; -import { PbLong } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * A Timestamp represents a point in time independent of any time zone or local - * calendar, encoded as a count of seconds and fractions of seconds at - * nanosecond resolution. The count is relative to an epoch at UTC midnight on - * January 1, 1970, in the proleptic Gregorian calendar which extends the - * Gregorian calendar backwards to year one. - * - * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - * second table is needed for interpretation, using a [24-hour linear - * smear](https://developers.google.com/time/smear). - * - * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - * restricting to that range, we ensure that we can convert to and from [RFC - * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - * - * # Examples - * - * Example 1: Compute Timestamp from POSIX `time()`. - * - * Timestamp timestamp; - * timestamp.set_seconds(time(NULL)); - * timestamp.set_nanos(0); - * - * Example 2: Compute Timestamp from POSIX `gettimeofday()`. - * - * struct timeval tv; - * gettimeofday(&tv, NULL); - * - * Timestamp timestamp; - * timestamp.set_seconds(tv.tv_sec); - * timestamp.set_nanos(tv.tv_usec * 1000); - * - * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - * - * FILETIME ft; - * GetSystemTimeAsFileTime(&ft); - * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - * - * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - * Timestamp timestamp; - * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - * - * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - * - * long millis = System.currentTimeMillis(); - * - * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - * .setNanos((int) ((millis % 1000) * 1000000)).build(); - * - * - * Example 5: Compute Timestamp from current time in Python. - * - * timestamp = Timestamp() - * timestamp.GetCurrentTime() - * - * # JSON Mapping - * - * In JSON format, the Timestamp type is encoded as a string in the - * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the - * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" - * where {year} is always expressed using four digits while {month}, {day}, - * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional - * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), - * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone - * is required. A proto3 JSON serializer should always use UTC (as indicated by - * "Z") when printing the Timestamp type and a proto3 JSON parser should be - * able to accept both UTC and other timezones (as indicated by an offset). - * - * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past - * 01:30 UTC on January 15, 2017. - * - * In JavaScript, one can convert a Date object to this format using the - * standard - * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - * method. In Python, a standard `datetime.datetime` object can be converted - * to this format using - * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with - * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use - * the Joda Time's [`ISODateTimeFormat.dateTime()`]( - * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D - * ) to obtain a formatter capable of generating timestamps in this format. - * - * - * - * @generated from protobuf message google.protobuf.Timestamp - */ -export interface Timestamp { - /** - * Represents seconds of UTC time since Unix epoch - * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - * 9999-12-31T23:59:59Z inclusive. - * - * @generated from protobuf field: int64 seconds = 1; - */ - seconds: number; - /** - * Non-negative fractions of a second at nanosecond resolution. Negative - * second values with fractions must still have non-negative nanos values - * that count forward in time. Must be from 0 to 999,999,999 - * inclusive. - * - * @generated from protobuf field: int32 nanos = 2; - */ - nanos: number; -} -// @generated message type with reflection information, may provide speed optimized methods -class Timestamp$Type extends MessageType { - constructor() { - super("google.protobuf.Timestamp", [ - { no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ }, - { no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ } - ]); - } - /** - * Creates a new `Timestamp` for the current time. - */ - now(): Timestamp { - const msg = this.create(); - const ms = Date.now(); - msg.seconds = PbLong.from(Math.floor(ms / 1000)).toNumber(); - msg.nanos = (ms % 1000) * 1000000; - return msg; - } - /** - * Converts a `Timestamp` to a JavaScript Date. - */ - toDate(message: Timestamp): Date { - return new Date(PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000)); - } - /** - * Converts a JavaScript Date to a `Timestamp`. - */ - fromDate(date: Date): Timestamp { - const msg = this.create(); - const ms = date.getTime(); - msg.seconds = PbLong.from(Math.floor(ms / 1000)).toNumber(); - msg.nanos = (ms % 1000) * 1000000; - return msg; - } - /** - * In JSON format, the `Timestamp` type is encoded as a string - * in the RFC 3339 format. - */ - internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue { - let ms = PbLong.from(message.seconds).toNumber() * 1000; - if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) - throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."); - if (message.nanos < 0) - throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative."); - let z = "Z"; - if (message.nanos > 0) { - let nanosStr = (message.nanos + 1000000000).toString().substring(1); - if (nanosStr.substring(3) === "000000") - z = "." + nanosStr.substring(0, 3) + "Z"; - else if (nanosStr.substring(6) === "000") - z = "." + nanosStr.substring(0, 6) + "Z"; - else - z = "." + nanosStr + "Z"; - } - return new Date(ms).toISOString().replace(".000Z", z); - } - /** - * In JSON format, the `Timestamp` type is encoded as a string - * in the RFC 3339 format. - */ - internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp { - if (typeof json !== "string") - throw new Error("Unable to parse Timestamp from JSON " + typeofJsonValue(json) + "."); - let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/); - if (!matches) - throw new Error("Unable to parse Timestamp from JSON. Invalid format."); - let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z")); - if (Number.isNaN(ms)) - throw new Error("Unable to parse Timestamp from JSON. Invalid value."); - if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) - throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."); - if (!target) - target = this.create(); - target.seconds = PbLong.from(ms / 1000).toNumber(); - target.nanos = 0; - if (matches[7]) - target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000); - return target; - } - create(value?: PartialMessage): Timestamp { - const message = globalThis.Object.create((this.messagePrototype!)); - message.seconds = 0; - message.nanos = 0; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Timestamp): Timestamp { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 seconds */ 1: - message.seconds = reader.int64().toNumber(); - break; - case /* int32 nanos */ 2: - message.nanos = reader.int32(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Timestamp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 seconds = 1; */ - if (message.seconds !== 0) - writer.tag(1, WireType.Varint).int64(message.seconds); - /* int32 nanos = 2; */ - if (message.nanos !== 0) - writer.tag(2, WireType.Varint).int32(message.nanos); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message google.protobuf.Timestamp - */ -export const Timestamp = new Timestamp$Type(); diff --git a/packages/sdk/src/generated/packages/dht/protos/DhtRpc.client.ts b/packages/sdk/src/generated/packages/dht/protos/DhtRpc.client.ts deleted file mode 100644 index dc75017c56..0000000000 --- a/packages/sdk/src/generated/packages/dht/protos/DhtRpc.client.ts +++ /dev/null @@ -1,407 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/dht/protos/DhtRpc.proto" (package "dht", syntax proto3) -// tslint:disable -import { ExternalApiRpc } from "./DhtRpc"; -import type { ExternalStoreDataResponse } from "./DhtRpc"; -import type { ExternalStoreDataRequest } from "./DhtRpc"; -import type { ExternalFetchDataResponse } from "./DhtRpc"; -import type { ExternalFetchDataRequest } from "./DhtRpc"; -import { ConnectionLockRpc } from "./DhtRpc"; -import type { DisconnectNotice } from "./DhtRpc"; -import type { UnlockRequest } from "./DhtRpc"; -import type { LockResponse } from "./DhtRpc"; -import type { LockRequest } from "./DhtRpc"; -import { WebrtcConnectorRpc } from "./DhtRpc"; -import type { IceCandidate } from "./DhtRpc"; -import type { RtcAnswer } from "./DhtRpc"; -import type { RtcOffer } from "./DhtRpc"; -import type { WebrtcConnectionRequest } from "./DhtRpc"; -import { WebsocketClientConnectorRpc } from "./DhtRpc"; -import type { WebsocketConnectionRequest } from "./DhtRpc"; -import { RecursiveOperationSessionRpc } from "./DhtRpc"; -import type { RecursiveOperationResponse } from "./DhtRpc"; -import { StoreRpc } from "./DhtRpc"; -import type { ReplicateDataRequest } from "./DhtRpc"; -import type { StoreDataResponse } from "./DhtRpc"; -import type { StoreDataRequest } from "./DhtRpc"; -import { RecursiveOperationRpc } from "./DhtRpc"; -import { RouterRpc } from "./DhtRpc"; -import type { RouteMessageAck } from "./DhtRpc"; -import type { RouteMessageWrapper } from "./DhtRpc"; -import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; -import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; -import { DhtNodeRpc } from "./DhtRpc"; -import type { Empty } from "../../../google/protobuf/empty"; -import type { LeaveNotice } from "./DhtRpc"; -import type { PingResponse } from "./DhtRpc"; -import type { PingRequest } from "./DhtRpc"; -import type { ClosestRingPeersResponse } from "./DhtRpc"; -import type { ClosestRingPeersRequest } from "./DhtRpc"; -import { stackIntercept } from "@protobuf-ts/runtime-rpc"; -import type { ClosestPeersResponse } from "./DhtRpc"; -import type { ClosestPeersRequest } from "./DhtRpc"; -import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; -import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service dht.DhtNodeRpc - */ -export interface IDhtNodeRpcClient { - /** - * TODO rename to getClosestNeighbors (breaking change) - * - * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse); - */ - getClosestPeers(input: ClosestPeersRequest, options?: RpcOptions): UnaryCall; - /** - * TODO rename to getClosestRingContacts (breaking change) - * - * @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse); - */ - getClosestRingPeers(input: ClosestRingPeersRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse); - */ - ping(input: PingRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty); - */ - leaveNotice(input: LeaveNotice, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.DhtNodeRpc - */ -export class DhtNodeRpcClient implements IDhtNodeRpcClient, ServiceInfo { - typeName = DhtNodeRpc.typeName; - methods = DhtNodeRpc.methods; - options = DhtNodeRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * TODO rename to getClosestNeighbors (breaking change) - * - * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse); - */ - getClosestPeers(input: ClosestPeersRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * TODO rename to getClosestRingContacts (breaking change) - * - * @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse); - */ - getClosestRingPeers(input: ClosestRingPeersRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse); - */ - ping(input: PingRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[2], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty); - */ - leaveNotice(input: LeaveNotice, options?: RpcOptions): UnaryCall { - const method = this.methods[3], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.RouterRpc - */ -export interface IRouterRpcClient { - /** - * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - routeMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - forwardMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.RouterRpc - */ -export class RouterRpcClient implements IRouterRpcClient, ServiceInfo { - typeName = RouterRpc.typeName; - methods = RouterRpc.methods; - options = RouterRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - routeMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - forwardMessage(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.RecursiveOperationRpc - */ -export interface IRecursiveOperationRpcClient { - /** - * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - routeRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.RecursiveOperationRpc - */ -export class RecursiveOperationRpcClient implements IRecursiveOperationRpcClient, ServiceInfo { - typeName = RecursiveOperationRpc.typeName; - methods = RecursiveOperationRpc.methods; - options = RecursiveOperationRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - routeRequest(input: RouteMessageWrapper, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.StoreRpc - */ -export interface IStoreRpcClient { - /** - * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse); - */ - storeData(input: StoreDataRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: replicateData(dht.ReplicateDataRequest) returns (google.protobuf.Empty); - */ - replicateData(input: ReplicateDataRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.StoreRpc - */ -export class StoreRpcClient implements IStoreRpcClient, ServiceInfo { - typeName = StoreRpc.typeName; - methods = StoreRpc.methods; - options = StoreRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse); - */ - storeData(input: StoreDataRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: replicateData(dht.ReplicateDataRequest) returns (google.protobuf.Empty); - */ - replicateData(input: ReplicateDataRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.RecursiveOperationSessionRpc - */ -export interface IRecursiveOperationSessionRpcClient { - /** - * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty); - */ - sendResponse(input: RecursiveOperationResponse, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.RecursiveOperationSessionRpc - */ -export class RecursiveOperationSessionRpcClient implements IRecursiveOperationSessionRpcClient, ServiceInfo { - typeName = RecursiveOperationSessionRpc.typeName; - methods = RecursiveOperationSessionRpc.methods; - options = RecursiveOperationSessionRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty); - */ - sendResponse(input: RecursiveOperationResponse, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.WebsocketClientConnectorRpc - */ -export interface IWebsocketClientConnectorRpcClient { - /** - * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty); - */ - requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.WebsocketClientConnectorRpc - */ -export class WebsocketClientConnectorRpcClient implements IWebsocketClientConnectorRpcClient, ServiceInfo { - typeName = WebsocketClientConnectorRpc.typeName; - methods = WebsocketClientConnectorRpc.methods; - options = WebsocketClientConnectorRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty); - */ - requestConnection(input: WebsocketConnectionRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.WebrtcConnectorRpc - */ -export interface IWebrtcConnectorRpcClient { - /** - * @generated from protobuf rpc: requestConnection(dht.WebrtcConnectionRequest) returns (google.protobuf.Empty); - */ - requestConnection(input: WebrtcConnectionRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty); - */ - rtcOffer(input: RtcOffer, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty); - */ - rtcAnswer(input: RtcAnswer, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty); - */ - iceCandidate(input: IceCandidate, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.WebrtcConnectorRpc - */ -export class WebrtcConnectorRpcClient implements IWebrtcConnectorRpcClient, ServiceInfo { - typeName = WebrtcConnectorRpc.typeName; - methods = WebrtcConnectorRpc.methods; - options = WebrtcConnectorRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: requestConnection(dht.WebrtcConnectionRequest) returns (google.protobuf.Empty); - */ - requestConnection(input: WebrtcConnectionRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty); - */ - rtcOffer(input: RtcOffer, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty); - */ - rtcAnswer(input: RtcAnswer, options?: RpcOptions): UnaryCall { - const method = this.methods[2], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty); - */ - iceCandidate(input: IceCandidate, options?: RpcOptions): UnaryCall { - const method = this.methods[3], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.ConnectionLockRpc - */ -export interface IConnectionLockRpcClient { - /** - * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse); - */ - lockRequest(input: LockRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty); - */ - unlockRequest(input: UnlockRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty); - */ - gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.ConnectionLockRpc - */ -export class ConnectionLockRpcClient implements IConnectionLockRpcClient, ServiceInfo { - typeName = ConnectionLockRpc.typeName; - methods = ConnectionLockRpc.methods; - options = ConnectionLockRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse); - */ - lockRequest(input: LockRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty); - */ - unlockRequest(input: UnlockRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty); - */ - gracefulDisconnect(input: DisconnectNotice, options?: RpcOptions): UnaryCall { - const method = this.methods[2], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service dht.ExternalApiRpc - */ -export interface IExternalApiRpcClient { - /** - * @generated from protobuf rpc: externalFetchData(dht.ExternalFetchDataRequest) returns (dht.ExternalFetchDataResponse); - */ - externalFetchData(input: ExternalFetchDataRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: externalStoreData(dht.ExternalStoreDataRequest) returns (dht.ExternalStoreDataResponse); - */ - externalStoreData(input: ExternalStoreDataRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service dht.ExternalApiRpc - */ -export class ExternalApiRpcClient implements IExternalApiRpcClient, ServiceInfo { - typeName = ExternalApiRpc.typeName; - methods = ExternalApiRpc.methods; - options = ExternalApiRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: externalFetchData(dht.ExternalFetchDataRequest) returns (dht.ExternalFetchDataResponse); - */ - externalFetchData(input: ExternalFetchDataRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: externalStoreData(dht.ExternalStoreDataRequest) returns (dht.ExternalStoreDataResponse); - */ - externalStoreData(input: ExternalStoreDataRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} diff --git a/packages/sdk/src/generated/packages/dht/protos/DhtRpc.server.ts b/packages/sdk/src/generated/packages/dht/protos/DhtRpc.server.ts deleted file mode 100644 index a2e210f8d2..0000000000 --- a/packages/sdk/src/generated/packages/dht/protos/DhtRpc.server.ts +++ /dev/null @@ -1,160 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/dht/protos/DhtRpc.proto" (package "dht", syntax proto3) -// tslint:disable -import { ExternalStoreDataResponse } from "./DhtRpc"; -import { ExternalStoreDataRequest } from "./DhtRpc"; -import { ExternalFetchDataResponse } from "./DhtRpc"; -import { ExternalFetchDataRequest } from "./DhtRpc"; -import { DisconnectNotice } from "./DhtRpc"; -import { UnlockRequest } from "./DhtRpc"; -import { LockResponse } from "./DhtRpc"; -import { LockRequest } from "./DhtRpc"; -import { IceCandidate } from "./DhtRpc"; -import { RtcAnswer } from "./DhtRpc"; -import { RtcOffer } from "./DhtRpc"; -import { WebrtcConnectionRequest } from "./DhtRpc"; -import { WebsocketConnectionRequest } from "./DhtRpc"; -import { RecursiveOperationResponse } from "./DhtRpc"; -import { ReplicateDataRequest } from "./DhtRpc"; -import { StoreDataResponse } from "./DhtRpc"; -import { StoreDataRequest } from "./DhtRpc"; -import { RouteMessageAck } from "./DhtRpc"; -import { RouteMessageWrapper } from "./DhtRpc"; -import { Empty } from "../../../google/protobuf/empty"; -import { LeaveNotice } from "./DhtRpc"; -import { PingResponse } from "./DhtRpc"; -import { PingRequest } from "./DhtRpc"; -import { ClosestRingPeersResponse } from "./DhtRpc"; -import { ClosestRingPeersRequest } from "./DhtRpc"; -import { ClosestPeersResponse } from "./DhtRpc"; -import { ClosestPeersRequest } from "./DhtRpc"; -import { ServerCallContext } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service dht.DhtNodeRpc - */ -export interface IDhtNodeRpc { - /** - * TODO rename to getClosestNeighbors (breaking change) - * - * @generated from protobuf rpc: getClosestPeers(dht.ClosestPeersRequest) returns (dht.ClosestPeersResponse); - */ - getClosestPeers(request: ClosestPeersRequest, context: T): Promise; - /** - * TODO rename to getClosestRingContacts (breaking change) - * - * @generated from protobuf rpc: getClosestRingPeers(dht.ClosestRingPeersRequest) returns (dht.ClosestRingPeersResponse); - */ - getClosestRingPeers(request: ClosestRingPeersRequest, context: T): Promise; - /** - * @generated from protobuf rpc: ping(dht.PingRequest) returns (dht.PingResponse); - */ - ping(request: PingRequest, context: T): Promise; - /** - * @generated from protobuf rpc: leaveNotice(dht.LeaveNotice) returns (google.protobuf.Empty); - */ - leaveNotice(request: LeaveNotice, context: T): Promise; -} -/** - * @generated from protobuf service dht.RouterRpc - */ -export interface IRouterRpc { - /** - * @generated from protobuf rpc: routeMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - routeMessage(request: RouteMessageWrapper, context: T): Promise; - /** - * @generated from protobuf rpc: forwardMessage(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - forwardMessage(request: RouteMessageWrapper, context: T): Promise; -} -/** - * @generated from protobuf service dht.RecursiveOperationRpc - */ -export interface IRecursiveOperationRpc { - /** - * @generated from protobuf rpc: routeRequest(dht.RouteMessageWrapper) returns (dht.RouteMessageAck); - */ - routeRequest(request: RouteMessageWrapper, context: T): Promise; -} -/** - * @generated from protobuf service dht.StoreRpc - */ -export interface IStoreRpc { - /** - * @generated from protobuf rpc: storeData(dht.StoreDataRequest) returns (dht.StoreDataResponse); - */ - storeData(request: StoreDataRequest, context: T): Promise; - /** - * @generated from protobuf rpc: replicateData(dht.ReplicateDataRequest) returns (google.protobuf.Empty); - */ - replicateData(request: ReplicateDataRequest, context: T): Promise; -} -/** - * @generated from protobuf service dht.RecursiveOperationSessionRpc - */ -export interface IRecursiveOperationSessionRpc { - /** - * @generated from protobuf rpc: sendResponse(dht.RecursiveOperationResponse) returns (google.protobuf.Empty); - */ - sendResponse(request: RecursiveOperationResponse, context: T): Promise; -} -/** - * @generated from protobuf service dht.WebsocketClientConnectorRpc - */ -export interface IWebsocketClientConnectorRpc { - /** - * @generated from protobuf rpc: requestConnection(dht.WebsocketConnectionRequest) returns (google.protobuf.Empty); - */ - requestConnection(request: WebsocketConnectionRequest, context: T): Promise; -} -/** - * @generated from protobuf service dht.WebrtcConnectorRpc - */ -export interface IWebrtcConnectorRpc { - /** - * @generated from protobuf rpc: requestConnection(dht.WebrtcConnectionRequest) returns (google.protobuf.Empty); - */ - requestConnection(request: WebrtcConnectionRequest, context: T): Promise; - /** - * @generated from protobuf rpc: rtcOffer(dht.RtcOffer) returns (google.protobuf.Empty); - */ - rtcOffer(request: RtcOffer, context: T): Promise; - /** - * @generated from protobuf rpc: rtcAnswer(dht.RtcAnswer) returns (google.protobuf.Empty); - */ - rtcAnswer(request: RtcAnswer, context: T): Promise; - /** - * @generated from protobuf rpc: iceCandidate(dht.IceCandidate) returns (google.protobuf.Empty); - */ - iceCandidate(request: IceCandidate, context: T): Promise; -} -/** - * @generated from protobuf service dht.ConnectionLockRpc - */ -export interface IConnectionLockRpc { - /** - * @generated from protobuf rpc: lockRequest(dht.LockRequest) returns (dht.LockResponse); - */ - lockRequest(request: LockRequest, context: T): Promise; - /** - * @generated from protobuf rpc: unlockRequest(dht.UnlockRequest) returns (google.protobuf.Empty); - */ - unlockRequest(request: UnlockRequest, context: T): Promise; - /** - * @generated from protobuf rpc: gracefulDisconnect(dht.DisconnectNotice) returns (google.protobuf.Empty); - */ - gracefulDisconnect(request: DisconnectNotice, context: T): Promise; -} -/** - * @generated from protobuf service dht.ExternalApiRpc - */ -export interface IExternalApiRpc { - /** - * @generated from protobuf rpc: externalFetchData(dht.ExternalFetchDataRequest) returns (dht.ExternalFetchDataResponse); - */ - externalFetchData(request: ExternalFetchDataRequest, context: T): Promise; - /** - * @generated from protobuf rpc: externalStoreData(dht.ExternalStoreDataRequest) returns (dht.ExternalStoreDataResponse); - */ - externalStoreData(request: ExternalStoreDataRequest, context: T): Promise; -} diff --git a/packages/sdk/src/generated/packages/dht/protos/DhtRpc.ts b/packages/sdk/src/generated/packages/dht/protos/DhtRpc.ts deleted file mode 100644 index 73ac705f7a..0000000000 --- a/packages/sdk/src/generated/packages/dht/protos/DhtRpc.ts +++ /dev/null @@ -1,1244 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/dht/protos/DhtRpc.proto" (package "dht", syntax proto3) -// tslint:disable -import { Empty } from "../../../google/protobuf/empty"; -import { ServiceType } from "@protobuf-ts/runtime-rpc"; -import { MessageType } from "@protobuf-ts/runtime"; -import { RpcMessage } from "../../proto-rpc/protos/ProtoRpc"; -import { Timestamp } from "../../../google/protobuf/timestamp"; -import { Any } from "../../../google/protobuf/any"; -// Used inside RpcMessage - -/** - * @generated from protobuf message dht.StoreDataRequest - */ -export interface StoreDataRequest { - /** - * @generated from protobuf field: bytes key = 1; - */ - key: Uint8Array; - /** - * @generated from protobuf field: google.protobuf.Any data = 2; - */ - data?: Any; - /** - * @generated from protobuf field: bytes creator = 3; - */ - creator: Uint8Array; - /** - * @generated from protobuf field: google.protobuf.Timestamp createdAt = 4; - */ - createdAt?: Timestamp; - /** - * @generated from protobuf field: uint32 ttl = 5; - */ - ttl: number; -} -/** - * @generated from protobuf message dht.StoreDataResponse - */ -export interface StoreDataResponse { -} -/** - * @generated from protobuf message dht.ExternalStoreDataRequest - */ -export interface ExternalStoreDataRequest { - /** - * @generated from protobuf field: bytes key = 1; - */ - key: Uint8Array; - /** - * @generated from protobuf field: google.protobuf.Any data = 2; - */ - data?: Any; -} -/** - * @generated from protobuf message dht.ExternalStoreDataResponse - */ -export interface ExternalStoreDataResponse { - /** - * @generated from protobuf field: repeated dht.PeerDescriptor storers = 1; - */ - storers: PeerDescriptor[]; -} -/** - * @generated from protobuf message dht.ReplicateDataRequest - */ -export interface ReplicateDataRequest { - /** - * @generated from protobuf field: dht.DataEntry entry = 1; - */ - entry?: DataEntry; -} -/** - * @generated from protobuf message dht.DataEntry - */ -export interface DataEntry { - /** - * @generated from protobuf field: bytes key = 1; - */ - key: Uint8Array; - /** - * @generated from protobuf field: google.protobuf.Any data = 2; - */ - data?: Any; - /** - * @generated from protobuf field: bytes creator = 3; - */ - creator: Uint8Array; - /** - * @generated from protobuf field: google.protobuf.Timestamp createdAt = 4; - */ - createdAt?: Timestamp; - /** - * @generated from protobuf field: google.protobuf.Timestamp storedAt = 5; - */ - storedAt?: Timestamp; - /** - * @generated from protobuf field: uint32 ttl = 6; - */ - ttl: number; // milliseconds - /** - * @generated from protobuf field: bool stale = 7; - */ - stale: boolean; - /** - * @generated from protobuf field: bool deleted = 8; - */ - deleted: boolean; -} -/** - * TODO rename to ClosestNeighborsRequest - * - * @generated from protobuf message dht.ClosestPeersRequest - */ -export interface ClosestPeersRequest { - /** - * @generated from protobuf field: bytes nodeId = 1; - */ - nodeId: Uint8Array; - /** - * @generated from protobuf field: string requestId = 2; - */ - requestId: string; -} -/** - * TODO rename to ClosestNeighborsResponse - * - * @generated from protobuf message dht.ClosestPeersResponse - */ -export interface ClosestPeersResponse { - /** - * @generated from protobuf field: repeated dht.PeerDescriptor peers = 1; - */ - peers: PeerDescriptor[]; - /** - * @generated from protobuf field: string requestId = 2; - */ - requestId: string; -} -/** - * TODO rename to ClosestRingContactsRequest - * - * @generated from protobuf message dht.ClosestRingPeersRequest - */ -export interface ClosestRingPeersRequest { - /** - * @generated from protobuf field: bytes ringId = 1; - */ - ringId: Uint8Array; - /** - * @generated from protobuf field: string requestId = 2; - */ - requestId: string; -} -/** - * TODO rename to ClosestRingContactsResponse - * - * @generated from protobuf message dht.ClosestRingPeersResponse - */ -export interface ClosestRingPeersResponse { - /** - * @generated from protobuf field: repeated dht.PeerDescriptor leftPeers = 1; - */ - leftPeers: PeerDescriptor[]; - /** - * @generated from protobuf field: repeated dht.PeerDescriptor rightPeers = 2; - */ - rightPeers: PeerDescriptor[]; - /** - * @generated from protobuf field: string requestId = 3; - */ - requestId: string; -} -/** - * @generated from protobuf message dht.RecursiveOperationRequest - */ -export interface RecursiveOperationRequest { - /** - * @generated from protobuf field: string sessionId = 1; - */ - sessionId: string; - /** - * @generated from protobuf field: dht.RecursiveOperation operation = 2; - */ - operation: RecursiveOperation; -} -/** - * @generated from protobuf message dht.RecursiveOperationResponse - */ -export interface RecursiveOperationResponse { - /** - * @generated from protobuf field: repeated dht.PeerDescriptor closestConnectedNodes = 1; - */ - closestConnectedNodes: PeerDescriptor[]; - /** - * @generated from protobuf field: repeated dht.DataEntry dataEntries = 2; - */ - dataEntries: DataEntry[]; - /** - * @generated from protobuf field: bool noCloserNodesFound = 3; - */ - noCloserNodesFound: boolean; - /** - * @generated from protobuf field: repeated dht.PeerDescriptor routingPath = 4; - */ - routingPath: PeerDescriptor[]; -} -/** - * @generated from protobuf message dht.PingRequest - */ -export interface PingRequest { - /** - * @generated from protobuf field: string requestId = 1; - */ - requestId: string; -} -/** - * @generated from protobuf message dht.PingResponse - */ -export interface PingResponse { - /** - * @generated from protobuf field: string requestId = 1; - */ - requestId: string; -} -/** - * @generated from protobuf message dht.LeaveNotice - */ -export interface LeaveNotice { -} -/** - * @generated from protobuf message dht.PeerDescriptor - */ -export interface PeerDescriptor { - /** - * @generated from protobuf field: bytes nodeId = 1; - */ - nodeId: Uint8Array; - /** - * @generated from protobuf field: dht.NodeType type = 2; - */ - type: NodeType; - /** - * @generated from protobuf field: dht.ConnectivityMethod udp = 3; - */ - udp?: ConnectivityMethod; - /** - * @generated from protobuf field: dht.ConnectivityMethod tcp = 4; - */ - tcp?: ConnectivityMethod; - /** - * @generated from protobuf field: dht.ConnectivityMethod websocket = 5; - */ - websocket?: ConnectivityMethod; - /** - * @generated from protobuf field: optional uint32 region = 6; - */ - region?: number; - /** - * @generated from protobuf field: optional uint32 ipAddress = 7; - */ - ipAddress?: number; - /** - * @generated from protobuf field: optional bytes publicKey = 8; - */ - publicKey?: Uint8Array; - /** - * signature of fields 2-8 - * - * @generated from protobuf field: optional bytes signature = 9; - */ - signature?: Uint8Array; -} -/** - * @generated from protobuf message dht.ConnectivityMethod - */ -export interface ConnectivityMethod { - /** - * @generated from protobuf field: uint32 port = 1; - */ - port: number; - /** - * @generated from protobuf field: string host = 2; - */ - host: string; - /** - * @generated from protobuf field: bool tls = 3; - */ - tls: boolean; -} -/** - * @generated from protobuf message dht.RouteMessageWrapper - */ -export interface RouteMessageWrapper { - /** - * @generated from protobuf field: string requestId = 1; - */ - requestId: string; - /** - * @generated from protobuf field: dht.PeerDescriptor sourcePeer = 2; - */ - sourcePeer?: PeerDescriptor; - /** - * @generated from protobuf field: bytes target = 3; - */ - target: Uint8Array; - /** - * @generated from protobuf field: dht.Message message = 4; - */ - message?: Message; - /** - * @generated from protobuf field: repeated dht.PeerDescriptor reachableThrough = 5; - */ - reachableThrough: PeerDescriptor[]; - /** - * @generated from protobuf field: repeated dht.PeerDescriptor routingPath = 6; - */ - routingPath: PeerDescriptor[]; - /** - * @generated from protobuf field: repeated string parallelRootNodeIds = 7; - */ - parallelRootNodeIds: string[]; -} -/** - * @generated from protobuf message dht.RouteMessageAck - */ -export interface RouteMessageAck { - /** - * @generated from protobuf field: string requestId = 1; - */ - requestId: string; - /** - * @generated from protobuf field: optional dht.RouteMessageError error = 2; - */ - error?: RouteMessageError; -} -/** - * @generated from protobuf message dht.ConnectivityRequest - */ -export interface ConnectivityRequest { - /** - * @generated from protobuf field: uint32 port = 1; - */ - port: number; - /** - * @generated from protobuf field: bool tls = 2; - */ - tls: boolean; - /** - * @generated from protobuf field: optional string host = 3; - */ - host?: string; - /** - * @generated from protobuf field: bool allowSelfSignedCertificate = 4; - */ - allowSelfSignedCertificate: boolean; -} -/** - * @generated from protobuf message dht.ConnectivityResponse - */ -export interface ConnectivityResponse { - /** - * @generated from protobuf field: string host = 1; - */ - host: string; - /** - * @generated from protobuf field: string natType = 2; - */ - natType: string; - /** - * @generated from protobuf field: dht.ConnectivityMethod websocket = 3; - */ - websocket?: ConnectivityMethod; - /** - * @generated from protobuf field: uint32 ipAddress = 4; - */ - ipAddress: number; - /** - * @generated from protobuf field: string version = 5; - */ - version: string; - /** - * @generated from protobuf field: optional double latitude = 6; - */ - latitude?: number; - /** - * @generated from protobuf field: optional double longitude = 7; - */ - longitude?: number; -} -/** - * @generated from protobuf message dht.HandshakeRequest - */ -export interface HandshakeRequest { - /** - * @generated from protobuf field: dht.PeerDescriptor sourcePeerDescriptor = 1; - */ - sourcePeerDescriptor?: PeerDescriptor; - /** - * @generated from protobuf field: optional dht.PeerDescriptor targetPeerDescriptor = 2; - */ - targetPeerDescriptor?: PeerDescriptor; - /** - * @generated from protobuf field: string version = 3; - */ - version: string; -} -/** - * @generated from protobuf message dht.HandshakeResponse - */ -export interface HandshakeResponse { - /** - * @generated from protobuf field: dht.PeerDescriptor sourcePeerDescriptor = 1; - */ - sourcePeerDescriptor?: PeerDescriptor; - /** - * @generated from protobuf field: optional dht.HandshakeError error = 2; - */ - error?: HandshakeError; - /** - * @generated from protobuf field: string version = 3; - */ - version: string; -} -// Wraps all messages - -/** - * @generated from protobuf message dht.Message - */ -export interface Message { - /** - * @generated from protobuf field: string messageId = 1; - */ - messageId: string; - /** - * @generated from protobuf field: dht.PeerDescriptor sourceDescriptor = 2; - */ - sourceDescriptor?: PeerDescriptor; - /** - * @generated from protobuf field: dht.PeerDescriptor targetDescriptor = 3; - */ - targetDescriptor?: PeerDescriptor; - /** - * @generated from protobuf field: string serviceId = 4; - */ - serviceId: string; // id of the RPC service - /** - * @generated from protobuf oneof: body - */ - body: { - oneofKind: "rpcMessage"; - /** - * @generated from protobuf field: protorpc.RpcMessage rpcMessage = 5; - */ - rpcMessage: RpcMessage; - } | { - oneofKind: "connectivityRequest"; - /** - * @generated from protobuf field: dht.ConnectivityRequest connectivityRequest = 6; - */ - connectivityRequest: ConnectivityRequest; - } | { - oneofKind: "connectivityResponse"; - /** - * @generated from protobuf field: dht.ConnectivityResponse connectivityResponse = 7; - */ - connectivityResponse: ConnectivityResponse; - } | { - oneofKind: "handshakeRequest"; - /** - * @generated from protobuf field: dht.HandshakeRequest handshakeRequest = 8; - */ - handshakeRequest: HandshakeRequest; - } | { - oneofKind: "handshakeResponse"; - /** - * @generated from protobuf field: dht.HandshakeResponse handshakeResponse = 9; - */ - handshakeResponse: HandshakeResponse; - } | { - oneofKind: "recursiveOperationRequest"; - /** - * @generated from protobuf field: dht.RecursiveOperationRequest recursiveOperationRequest = 10; - */ - recursiveOperationRequest: RecursiveOperationRequest; - } | { - oneofKind: undefined; - }; -} -// Connector Messages - -/** - * WebSocket - * - * @generated from protobuf message dht.WebsocketConnectionRequest - */ -export interface WebsocketConnectionRequest { -} -/** - * WebRTC - * - * @generated from protobuf message dht.WebrtcConnectionRequest - */ -export interface WebrtcConnectionRequest { -} -/** - * @generated from protobuf message dht.RtcOffer - */ -export interface RtcOffer { - /** - * @generated from protobuf field: string description = 1; - */ - description: string; - /** - * @generated from protobuf field: string connectionId = 2; - */ - connectionId: string; -} -/** - * @generated from protobuf message dht.RtcAnswer - */ -export interface RtcAnswer { - /** - * @generated from protobuf field: string description = 1; - */ - description: string; - /** - * @generated from protobuf field: string connectionId = 2; - */ - connectionId: string; -} -/** - * @generated from protobuf message dht.IceCandidate - */ -export interface IceCandidate { - /** - * @generated from protobuf field: string candidate = 1; - */ - candidate: string; - /** - * @generated from protobuf field: string mid = 2; - */ - mid: string; - /** - * @generated from protobuf field: string connectionId = 3; - */ - connectionId: string; -} -/** - * @generated from protobuf message dht.LockRequest - */ -export interface LockRequest { - /** - * @generated from protobuf field: string lockId = 1; - */ - lockId: string; -} -/** - * @generated from protobuf message dht.UnlockRequest - */ -export interface UnlockRequest { - /** - * @generated from protobuf field: string lockId = 1; - */ - lockId: string; -} -/** - * @generated from protobuf message dht.LockResponse - */ -export interface LockResponse { - /** - * @generated from protobuf field: bool accepted = 1; - */ - accepted: boolean; -} -/** - * @generated from protobuf message dht.DisconnectNotice - */ -export interface DisconnectNotice { - /** - * @generated from protobuf field: dht.DisconnectMode disconnectMode = 1; - */ - disconnectMode: DisconnectMode; -} -/** - * @generated from protobuf message dht.ExternalFetchDataRequest - */ -export interface ExternalFetchDataRequest { - /** - * @generated from protobuf field: bytes key = 1; - */ - key: Uint8Array; -} -/** - * @generated from protobuf message dht.ExternalFetchDataResponse - */ -export interface ExternalFetchDataResponse { - /** - * @generated from protobuf field: repeated dht.DataEntry entries = 1; - */ - entries: DataEntry[]; -} -/** - * @generated from protobuf enum dht.RecursiveOperation - */ -export enum RecursiveOperation { - /** - * @generated from protobuf enum value: FIND_CLOSEST_NODES = 0; - */ - FIND_CLOSEST_NODES = 0, - /** - * @generated from protobuf enum value: FETCH_DATA = 1; - */ - FETCH_DATA = 1, - /** - * @generated from protobuf enum value: DELETE_DATA = 2; - */ - DELETE_DATA = 2 -} -/** - * @generated from protobuf enum dht.NodeType - */ -export enum NodeType { - /** - * @generated from protobuf enum value: NODEJS = 0; - */ - NODEJS = 0, - /** - * @generated from protobuf enum value: BROWSER = 1; - */ - BROWSER = 1 -} -/** - * @generated from protobuf enum dht.RpcResponseError - */ -export enum RpcResponseError { - /** - * @generated from protobuf enum value: SERVER_TIMOUT = 0; - */ - SERVER_TIMOUT = 0, - /** - * @generated from protobuf enum value: CLIENT_TIMEOUT = 1; - */ - CLIENT_TIMEOUT = 1, - /** - * @generated from protobuf enum value: SERVER_ERROR = 2; - */ - SERVER_ERROR = 2, - /** - * @generated from protobuf enum value: UNKNOWN_RPC_METHOD = 3; - */ - UNKNOWN_RPC_METHOD = 3 -} -/** - * @generated from protobuf enum dht.RouteMessageError - */ -export enum RouteMessageError { - /** - * @generated from protobuf enum value: NO_TARGETS = 0; - */ - NO_TARGETS = 0, - /** - * @generated from protobuf enum value: DUPLICATE = 1; - */ - DUPLICATE = 1, - /** - * TODO: can this be removed? If DhtNode is already stopped the server side requests - * should not be processed - * - * @generated from protobuf enum value: STOPPED = 2; - */ - STOPPED = 2 -} -/** - * @generated from protobuf enum dht.HandshakeError - */ -export enum HandshakeError { - /** - * @generated from protobuf enum value: DUPLICATE_CONNECTION = 0; - */ - DUPLICATE_CONNECTION = 0, - /** - * @generated from protobuf enum value: INVALID_TARGET_PEER_DESCRIPTOR = 1; - */ - INVALID_TARGET_PEER_DESCRIPTOR = 1, - /** - * @generated from protobuf enum value: UNSUPPORTED_VERSION = 2; - */ - UNSUPPORTED_VERSION = 2 -} -/** - * @generated from protobuf enum dht.DisconnectMode - */ -export enum DisconnectMode { - /** - * @generated from protobuf enum value: NORMAL = 0; - */ - NORMAL = 0, - /** - * @generated from protobuf enum value: LEAVING = 1; - */ - LEAVING = 1 -} -// @generated message type with reflection information, may provide speed optimized methods -class StoreDataRequest$Type extends MessageType { - constructor() { - super("dht.StoreDataRequest", [ - { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 2, name: "data", kind: "message", T: () => Any }, - { no: 3, name: "creator", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 4, name: "createdAt", kind: "message", T: () => Timestamp }, - { no: 5, name: "ttl", kind: "scalar", T: 13 /*ScalarType.UINT32*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.StoreDataRequest - */ -export const StoreDataRequest = new StoreDataRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class StoreDataResponse$Type extends MessageType { - constructor() { - super("dht.StoreDataResponse", []); - } -} -/** - * @generated MessageType for protobuf message dht.StoreDataResponse - */ -export const StoreDataResponse = new StoreDataResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ExternalStoreDataRequest$Type extends MessageType { - constructor() { - super("dht.ExternalStoreDataRequest", [ - { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 2, name: "data", kind: "message", T: () => Any } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.ExternalStoreDataRequest - */ -export const ExternalStoreDataRequest = new ExternalStoreDataRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ExternalStoreDataResponse$Type extends MessageType { - constructor() { - super("dht.ExternalStoreDataResponse", [ - { no: 1, name: "storers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.ExternalStoreDataResponse - */ -export const ExternalStoreDataResponse = new ExternalStoreDataResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ReplicateDataRequest$Type extends MessageType { - constructor() { - super("dht.ReplicateDataRequest", [ - { no: 1, name: "entry", kind: "message", T: () => DataEntry } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.ReplicateDataRequest - */ -export const ReplicateDataRequest = new ReplicateDataRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class DataEntry$Type extends MessageType { - constructor() { - super("dht.DataEntry", [ - { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 2, name: "data", kind: "message", T: () => Any }, - { no: 3, name: "creator", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 4, name: "createdAt", kind: "message", T: () => Timestamp }, - { no: 5, name: "storedAt", kind: "message", T: () => Timestamp }, - { no: 6, name: "ttl", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, - { no: 7, name: "stale", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, - { no: 8, name: "deleted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.DataEntry - */ -export const DataEntry = new DataEntry$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ClosestPeersRequest$Type extends MessageType { - constructor() { - super("dht.ClosestPeersRequest", [ - { no: 1, name: "nodeId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.ClosestPeersRequest - */ -export const ClosestPeersRequest = new ClosestPeersRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ClosestPeersResponse$Type extends MessageType { - constructor() { - super("dht.ClosestPeersResponse", [ - { no: 1, name: "peers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, - { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.ClosestPeersResponse - */ -export const ClosestPeersResponse = new ClosestPeersResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ClosestRingPeersRequest$Type extends MessageType { - constructor() { - super("dht.ClosestRingPeersRequest", [ - { no: 1, name: "ringId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.ClosestRingPeersRequest - */ -export const ClosestRingPeersRequest = new ClosestRingPeersRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ClosestRingPeersResponse$Type extends MessageType { - constructor() { - super("dht.ClosestRingPeersResponse", [ - { no: 1, name: "leftPeers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, - { no: 2, name: "rightPeers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, - { no: 3, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.ClosestRingPeersResponse - */ -export const ClosestRingPeersResponse = new ClosestRingPeersResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class RecursiveOperationRequest$Type extends MessageType { - constructor() { - super("dht.RecursiveOperationRequest", [ - { no: 1, name: "sessionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "operation", kind: "enum", T: () => ["dht.RecursiveOperation", RecursiveOperation] } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.RecursiveOperationRequest - */ -export const RecursiveOperationRequest = new RecursiveOperationRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class RecursiveOperationResponse$Type extends MessageType { - constructor() { - super("dht.RecursiveOperationResponse", [ - { no: 1, name: "closestConnectedNodes", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, - { no: 2, name: "dataEntries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => DataEntry }, - { no: 3, name: "noCloserNodesFound", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, - { no: 4, name: "routingPath", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.RecursiveOperationResponse - */ -export const RecursiveOperationResponse = new RecursiveOperationResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class PingRequest$Type extends MessageType { - constructor() { - super("dht.PingRequest", [ - { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.PingRequest - */ -export const PingRequest = new PingRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class PingResponse$Type extends MessageType { - constructor() { - super("dht.PingResponse", [ - { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.PingResponse - */ -export const PingResponse = new PingResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class LeaveNotice$Type extends MessageType { - constructor() { - super("dht.LeaveNotice", []); - } -} -/** - * @generated MessageType for protobuf message dht.LeaveNotice - */ -export const LeaveNotice = new LeaveNotice$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class PeerDescriptor$Type extends MessageType { - constructor() { - super("dht.PeerDescriptor", [ - { no: 1, name: "nodeId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 2, name: "type", kind: "enum", T: () => ["dht.NodeType", NodeType] }, - { no: 3, name: "udp", kind: "message", T: () => ConnectivityMethod }, - { no: 4, name: "tcp", kind: "message", T: () => ConnectivityMethod }, - { no: 5, name: "websocket", kind: "message", T: () => ConnectivityMethod }, - { no: 6, name: "region", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, - { no: 7, name: "ipAddress", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, - { no: 8, name: "publicKey", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ }, - { no: 9, name: "signature", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.PeerDescriptor - */ -export const PeerDescriptor = new PeerDescriptor$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ConnectivityMethod$Type extends MessageType { - constructor() { - super("dht.ConnectivityMethod", [ - { no: 1, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, - { no: 2, name: "host", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "tls", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.ConnectivityMethod - */ -export const ConnectivityMethod = new ConnectivityMethod$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class RouteMessageWrapper$Type extends MessageType { - constructor() { - super("dht.RouteMessageWrapper", [ - { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "sourcePeer", kind: "message", T: () => PeerDescriptor }, - { no: 3, name: "target", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 4, name: "message", kind: "message", T: () => Message }, - { no: 5, name: "reachableThrough", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, - { no: 6, name: "routingPath", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, - { no: 7, name: "parallelRootNodeIds", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.RouteMessageWrapper - */ -export const RouteMessageWrapper = new RouteMessageWrapper$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class RouteMessageAck$Type extends MessageType { - constructor() { - super("dht.RouteMessageAck", [ - { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "error", kind: "enum", opt: true, T: () => ["dht.RouteMessageError", RouteMessageError] } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.RouteMessageAck - */ -export const RouteMessageAck = new RouteMessageAck$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ConnectivityRequest$Type extends MessageType { - constructor() { - super("dht.ConnectivityRequest", [ - { no: 1, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, - { no: 2, name: "tls", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, - { no: 3, name: "host", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 4, name: "allowSelfSignedCertificate", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.ConnectivityRequest - */ -export const ConnectivityRequest = new ConnectivityRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ConnectivityResponse$Type extends MessageType { - constructor() { - super("dht.ConnectivityResponse", [ - { no: 1, name: "host", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "natType", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "websocket", kind: "message", T: () => ConnectivityMethod }, - { no: 4, name: "ipAddress", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }, - { no: 5, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 6, name: "latitude", kind: "scalar", opt: true, T: 1 /*ScalarType.DOUBLE*/ }, - { no: 7, name: "longitude", kind: "scalar", opt: true, T: 1 /*ScalarType.DOUBLE*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.ConnectivityResponse - */ -export const ConnectivityResponse = new ConnectivityResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class HandshakeRequest$Type extends MessageType { - constructor() { - super("dht.HandshakeRequest", [ - { no: 1, name: "sourcePeerDescriptor", kind: "message", T: () => PeerDescriptor }, - { no: 2, name: "targetPeerDescriptor", kind: "message", T: () => PeerDescriptor }, - { no: 3, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.HandshakeRequest - */ -export const HandshakeRequest = new HandshakeRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class HandshakeResponse$Type extends MessageType { - constructor() { - super("dht.HandshakeResponse", [ - { no: 1, name: "sourcePeerDescriptor", kind: "message", T: () => PeerDescriptor }, - { no: 2, name: "error", kind: "enum", opt: true, T: () => ["dht.HandshakeError", HandshakeError] }, - { no: 3, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.HandshakeResponse - */ -export const HandshakeResponse = new HandshakeResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Message$Type extends MessageType { - constructor() { - super("dht.Message", [ - { no: 1, name: "messageId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "sourceDescriptor", kind: "message", T: () => PeerDescriptor }, - { no: 3, name: "targetDescriptor", kind: "message", T: () => PeerDescriptor }, - { no: 4, name: "serviceId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 5, name: "rpcMessage", kind: "message", oneof: "body", T: () => RpcMessage }, - { no: 6, name: "connectivityRequest", kind: "message", oneof: "body", T: () => ConnectivityRequest }, - { no: 7, name: "connectivityResponse", kind: "message", oneof: "body", T: () => ConnectivityResponse }, - { no: 8, name: "handshakeRequest", kind: "message", oneof: "body", T: () => HandshakeRequest }, - { no: 9, name: "handshakeResponse", kind: "message", oneof: "body", T: () => HandshakeResponse }, - { no: 10, name: "recursiveOperationRequest", kind: "message", oneof: "body", T: () => RecursiveOperationRequest } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.Message - */ -export const Message = new Message$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class WebsocketConnectionRequest$Type extends MessageType { - constructor() { - super("dht.WebsocketConnectionRequest", []); - } -} -/** - * @generated MessageType for protobuf message dht.WebsocketConnectionRequest - */ -export const WebsocketConnectionRequest = new WebsocketConnectionRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class WebrtcConnectionRequest$Type extends MessageType { - constructor() { - super("dht.WebrtcConnectionRequest", []); - } -} -/** - * @generated MessageType for protobuf message dht.WebrtcConnectionRequest - */ -export const WebrtcConnectionRequest = new WebrtcConnectionRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class RtcOffer$Type extends MessageType { - constructor() { - super("dht.RtcOffer", [ - { no: 1, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.RtcOffer - */ -export const RtcOffer = new RtcOffer$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class RtcAnswer$Type extends MessageType { - constructor() { - super("dht.RtcAnswer", [ - { no: 1, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.RtcAnswer - */ -export const RtcAnswer = new RtcAnswer$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class IceCandidate$Type extends MessageType { - constructor() { - super("dht.IceCandidate", [ - { no: 1, name: "candidate", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "mid", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.IceCandidate - */ -export const IceCandidate = new IceCandidate$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class LockRequest$Type extends MessageType { - constructor() { - super("dht.LockRequest", [ - { no: 1, name: "lockId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.LockRequest - */ -export const LockRequest = new LockRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class UnlockRequest$Type extends MessageType { - constructor() { - super("dht.UnlockRequest", [ - { no: 1, name: "lockId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.UnlockRequest - */ -export const UnlockRequest = new UnlockRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class LockResponse$Type extends MessageType { - constructor() { - super("dht.LockResponse", [ - { no: 1, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.LockResponse - */ -export const LockResponse = new LockResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class DisconnectNotice$Type extends MessageType { - constructor() { - super("dht.DisconnectNotice", [ - { no: 1, name: "disconnectMode", kind: "enum", T: () => ["dht.DisconnectMode", DisconnectMode] } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.DisconnectNotice - */ -export const DisconnectNotice = new DisconnectNotice$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ExternalFetchDataRequest$Type extends MessageType { - constructor() { - super("dht.ExternalFetchDataRequest", [ - { no: 1, name: "key", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.ExternalFetchDataRequest - */ -export const ExternalFetchDataRequest = new ExternalFetchDataRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ExternalFetchDataResponse$Type extends MessageType { - constructor() { - super("dht.ExternalFetchDataResponse", [ - { no: 1, name: "entries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => DataEntry } - ]); - } -} -/** - * @generated MessageType for protobuf message dht.ExternalFetchDataResponse - */ -export const ExternalFetchDataResponse = new ExternalFetchDataResponse$Type(); -/** - * @generated ServiceType for protobuf service dht.DhtNodeRpc - */ -export const DhtNodeRpc = new ServiceType("dht.DhtNodeRpc", [ - { name: "getClosestPeers", options: {}, I: ClosestPeersRequest, O: ClosestPeersResponse }, - { name: "getClosestRingPeers", options: {}, I: ClosestRingPeersRequest, O: ClosestRingPeersResponse }, - { name: "ping", options: {}, I: PingRequest, O: PingResponse }, - { name: "leaveNotice", options: {}, I: LeaveNotice, O: Empty } -]); -/** - * @generated ServiceType for protobuf service dht.RouterRpc - */ -export const RouterRpc = new ServiceType("dht.RouterRpc", [ - { name: "routeMessage", options: {}, I: RouteMessageWrapper, O: RouteMessageAck }, - { name: "forwardMessage", options: {}, I: RouteMessageWrapper, O: RouteMessageAck } -]); -/** - * @generated ServiceType for protobuf service dht.RecursiveOperationRpc - */ -export const RecursiveOperationRpc = new ServiceType("dht.RecursiveOperationRpc", [ - { name: "routeRequest", options: {}, I: RouteMessageWrapper, O: RouteMessageAck } -]); -/** - * @generated ServiceType for protobuf service dht.StoreRpc - */ -export const StoreRpc = new ServiceType("dht.StoreRpc", [ - { name: "storeData", options: {}, I: StoreDataRequest, O: StoreDataResponse }, - { name: "replicateData", options: {}, I: ReplicateDataRequest, O: Empty } -]); -/** - * @generated ServiceType for protobuf service dht.RecursiveOperationSessionRpc - */ -export const RecursiveOperationSessionRpc = new ServiceType("dht.RecursiveOperationSessionRpc", [ - { name: "sendResponse", options: {}, I: RecursiveOperationResponse, O: Empty } -]); -/** - * @generated ServiceType for protobuf service dht.WebsocketClientConnectorRpc - */ -export const WebsocketClientConnectorRpc = new ServiceType("dht.WebsocketClientConnectorRpc", [ - { name: "requestConnection", options: {}, I: WebsocketConnectionRequest, O: Empty } -]); -/** - * @generated ServiceType for protobuf service dht.WebrtcConnectorRpc - */ -export const WebrtcConnectorRpc = new ServiceType("dht.WebrtcConnectorRpc", [ - { name: "requestConnection", options: {}, I: WebrtcConnectionRequest, O: Empty }, - { name: "rtcOffer", options: {}, I: RtcOffer, O: Empty }, - { name: "rtcAnswer", options: {}, I: RtcAnswer, O: Empty }, - { name: "iceCandidate", options: {}, I: IceCandidate, O: Empty } -]); -/** - * @generated ServiceType for protobuf service dht.ConnectionLockRpc - */ -export const ConnectionLockRpc = new ServiceType("dht.ConnectionLockRpc", [ - { name: "lockRequest", options: {}, I: LockRequest, O: LockResponse }, - { name: "unlockRequest", options: {}, I: UnlockRequest, O: Empty }, - { name: "gracefulDisconnect", options: {}, I: DisconnectNotice, O: Empty } -]); -/** - * @generated ServiceType for protobuf service dht.ExternalApiRpc - */ -export const ExternalApiRpc = new ServiceType("dht.ExternalApiRpc", [ - { name: "externalFetchData", options: {}, I: ExternalFetchDataRequest, O: ExternalFetchDataResponse }, - { name: "externalStoreData", options: {}, I: ExternalStoreDataRequest, O: ExternalStoreDataResponse } -]); diff --git a/packages/sdk/src/generated/packages/proto-rpc/protos/ProtoRpc.ts b/packages/sdk/src/generated/packages/proto-rpc/protos/ProtoRpc.ts deleted file mode 100644 index 7cfcf25ce6..0000000000 --- a/packages/sdk/src/generated/packages/proto-rpc/protos/ProtoRpc.ts +++ /dev/null @@ -1,108 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/proto-rpc/protos/ProtoRpc.proto" (package "protorpc", syntax proto3) -// tslint:disable -import { MessageType } from "@protobuf-ts/runtime"; -import { Empty } from "../../../google/protobuf/empty"; -import { Any } from "../../../google/protobuf/any"; -/** - * @generated from protobuf message protorpc.RpcMessage - */ -export interface RpcMessage { - /** - * @generated from protobuf field: map header = 1; - */ - header: { - [key: string]: string; - }; - /** - * @generated from protobuf field: google.protobuf.Any body = 2; - */ - body?: Any; - /** - * @generated from protobuf field: string requestId = 3; - */ - requestId: string; - /** - * @generated from protobuf field: optional protorpc.RpcErrorType errorType = 4; - */ - errorType?: RpcErrorType; - /** - * @generated from protobuf field: optional string errorClassName = 5; - */ - errorClassName?: string; - /** - * @generated from protobuf field: optional string errorCode = 6; - */ - errorCode?: string; - /** - * @generated from protobuf field: optional string errorMessage = 7; - */ - errorMessage?: string; -} -// Dummy message to force the generation of the typescript class "google.prototype.Empty" -// We need this generated class in RpcCommunicator - -/** - * @generated from protobuf message protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq - */ -export interface Mnfo2uhnf92hvqi2nviouq2hv9puhq { - /** - * @generated from protobuf field: google.protobuf.Empty empty = 1; - */ - empty?: Empty; -} -/** - * @generated from protobuf enum protorpc.RpcErrorType - */ -export enum RpcErrorType { - /** - * @generated from protobuf enum value: SERVER_TIMEOUT = 0; - */ - SERVER_TIMEOUT = 0, - /** - * @generated from protobuf enum value: CLIENT_TIMEOUT = 1; - */ - CLIENT_TIMEOUT = 1, - /** - * @generated from protobuf enum value: UNKNOWN_RPC_METHOD = 2; - */ - UNKNOWN_RPC_METHOD = 2, - /** - * @generated from protobuf enum value: CLIENT_ERROR = 3; - */ - CLIENT_ERROR = 3, - /** - * @generated from protobuf enum value: SERVER_ERROR = 4; - */ - SERVER_ERROR = 4 -} -// @generated message type with reflection information, may provide speed optimized methods -class RpcMessage$Type extends MessageType { - constructor() { - super("protorpc.RpcMessage", [ - { no: 1, name: "header", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } }, - { no: 2, name: "body", kind: "message", T: () => Any }, - { no: 3, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 4, name: "errorType", kind: "enum", opt: true, T: () => ["protorpc.RpcErrorType", RpcErrorType] }, - { no: 5, name: "errorClassName", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 6, name: "errorCode", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 7, name: "errorMessage", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message protorpc.RpcMessage - */ -export const RpcMessage = new RpcMessage$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Mnfo2uhnf92hvqi2nviouq2hv9puhq$Type extends MessageType { - constructor() { - super("protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq", [ - { no: 1, name: "empty", kind: "message", T: () => Empty } - ]); - } -} -/** - * @generated MessageType for protobuf message protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq - */ -export const Mnfo2uhnf92hvqi2nviouq2hv9puhq = new Mnfo2uhnf92hvqi2nviouq2hv9puhq$Type(); diff --git a/packages/sdk/src/generated/packages/sdk/protos/SdkRpc.client.ts b/packages/sdk/src/generated/packages/sdk/protos/SdkRpc.client.ts deleted file mode 100644 index 0da6c6b371..0000000000 --- a/packages/sdk/src/generated/packages/sdk/protos/SdkRpc.client.ts +++ /dev/null @@ -1,37 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/sdk/protos/SdkRpc.proto" (syntax proto3) -// tslint:disable -import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; -import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; -import { OperatorDiscovery } from "./SdkRpc"; -import { stackIntercept } from "@protobuf-ts/runtime-rpc"; -import type { OperatorDiscoveryResponse } from "./SdkRpc"; -import type { OperatorDiscoveryRequest } from "./SdkRpc"; -import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; -import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service OperatorDiscovery - */ -export interface IOperatorDiscoveryClient { - /** - * @generated from protobuf rpc: discoverOperators(OperatorDiscoveryRequest) returns (OperatorDiscoveryResponse); - */ - discoverOperators(input: OperatorDiscoveryRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service OperatorDiscovery - */ -export class OperatorDiscoveryClient implements IOperatorDiscoveryClient, ServiceInfo { - typeName = OperatorDiscovery.typeName; - methods = OperatorDiscovery.methods; - options = OperatorDiscovery.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: discoverOperators(OperatorDiscoveryRequest) returns (OperatorDiscoveryResponse); - */ - discoverOperators(input: OperatorDiscoveryRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} diff --git a/packages/sdk/src/generated/packages/sdk/protos/SdkRpc.server.ts b/packages/sdk/src/generated/packages/sdk/protos/SdkRpc.server.ts deleted file mode 100644 index b1a9a83a66..0000000000 --- a/packages/sdk/src/generated/packages/sdk/protos/SdkRpc.server.ts +++ /dev/null @@ -1,15 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/sdk/protos/SdkRpc.proto" (syntax proto3) -// tslint:disable -import { OperatorDiscoveryResponse } from "./SdkRpc"; -import { OperatorDiscoveryRequest } from "./SdkRpc"; -import { ServerCallContext } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service OperatorDiscovery - */ -export interface IOperatorDiscovery { - /** - * @generated from protobuf rpc: discoverOperators(OperatorDiscoveryRequest) returns (OperatorDiscoveryResponse); - */ - discoverOperators(request: OperatorDiscoveryRequest, context: T): Promise; -} diff --git a/packages/sdk/src/generated/packages/sdk/protos/SdkRpc.ts b/packages/sdk/src/generated/packages/sdk/protos/SdkRpc.ts deleted file mode 100644 index c1924147ff..0000000000 --- a/packages/sdk/src/generated/packages/sdk/protos/SdkRpc.ts +++ /dev/null @@ -1,54 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/sdk/protos/SdkRpc.proto" (syntax proto3) -// tslint:disable -import { ServiceType } from "@protobuf-ts/runtime-rpc"; -import { MessageType } from "@protobuf-ts/runtime"; -import { PeerDescriptor } from "../../dht/protos/DhtRpc"; -/** - * @generated from protobuf message OperatorDiscoveryRequest - */ -export interface OperatorDiscoveryRequest { - /** - * @generated from protobuf field: string streamPartId = 1; - */ - streamPartId: string; -} -/** - * @generated from protobuf message OperatorDiscoveryResponse - */ -export interface OperatorDiscoveryResponse { - /** - * @generated from protobuf field: repeated dht.PeerDescriptor operators = 1; - */ - operators: PeerDescriptor[]; -} -// @generated message type with reflection information, may provide speed optimized methods -class OperatorDiscoveryRequest$Type extends MessageType { - constructor() { - super("OperatorDiscoveryRequest", [ - { no: 1, name: "streamPartId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message OperatorDiscoveryRequest - */ -export const OperatorDiscoveryRequest = new OperatorDiscoveryRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class OperatorDiscoveryResponse$Type extends MessageType { - constructor() { - super("OperatorDiscoveryResponse", [ - { no: 1, name: "operators", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor } - ]); - } -} -/** - * @generated MessageType for protobuf message OperatorDiscoveryResponse - */ -export const OperatorDiscoveryResponse = new OperatorDiscoveryResponse$Type(); -/** - * @generated ServiceType for protobuf service OperatorDiscovery - */ -export const OperatorDiscovery = new ServiceType("OperatorDiscovery", [ - { name: "discoverOperators", options: {}, I: OperatorDiscoveryRequest, O: OperatorDiscoveryResponse } -]); diff --git a/packages/trackerless-network/.gitignore b/packages/trackerless-network/.gitignore index d86f46a454..0a960528c8 100644 --- a/packages/trackerless-network/.gitignore +++ b/packages/trackerless-network/.gitignore @@ -1,5 +1,6 @@ node_modules/ dist/ +generated/ # IntelliJ IDEA .idea/workspace.xml diff --git a/packages/trackerless-network/generated/google/protobuf/any.ts b/packages/trackerless-network/generated/google/protobuf/any.ts deleted file mode 100644 index e4b27234d8..0000000000 --- a/packages/trackerless-network/generated/google/protobuf/any.ts +++ /dev/null @@ -1,326 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "google/protobuf/any.proto" (package "google.protobuf", syntax proto3) -// tslint:disable -// -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { WireType } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { isJsonObject } from "@protobuf-ts/runtime"; -import { typeofJsonValue } from "@protobuf-ts/runtime"; -import type { JsonValue } from "@protobuf-ts/runtime"; -import { jsonWriteOptions } from "@protobuf-ts/runtime"; -import type { JsonReadOptions } from "@protobuf-ts/runtime"; -import type { JsonWriteOptions } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IMessageType } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * `Any` contains an arbitrary serialized protocol buffer message along with a - * URL that describes the type of the serialized message. - * - * Protobuf library provides support to pack/unpack Any values in the form - * of utility functions or additional generated methods of the Any type. - * - * Example 1: Pack and unpack a message in C++. - * - * Foo foo = ...; - * Any any; - * any.PackFrom(foo); - * ... - * if (any.UnpackTo(&foo)) { - * ... - * } - * - * Example 2: Pack and unpack a message in Java. - * - * Foo foo = ...; - * Any any = Any.pack(foo); - * ... - * if (any.is(Foo.class)) { - * foo = any.unpack(Foo.class); - * } - * // or ... - * if (any.isSameTypeAs(Foo.getDefaultInstance())) { - * foo = any.unpack(Foo.getDefaultInstance()); - * } - * - * Example 3: Pack and unpack a message in Python. - * - * foo = Foo(...) - * any = Any() - * any.Pack(foo) - * ... - * if any.Is(Foo.DESCRIPTOR): - * any.Unpack(foo) - * ... - * - * Example 4: Pack and unpack a message in Go - * - * foo := &pb.Foo{...} - * any, err := anypb.New(foo) - * if err != nil { - * ... - * } - * ... - * foo := &pb.Foo{} - * if err := any.UnmarshalTo(foo); err != nil { - * ... - * } - * - * The pack methods provided by protobuf library will by default use - * 'type.googleapis.com/full.type.name' as the type URL and the unpack - * methods only use the fully qualified type name after the last '/' - * in the type URL, for example "foo.bar.com/x/y.z" will yield type - * name "y.z". - * - * JSON - * ==== - * The JSON representation of an `Any` value uses the regular - * representation of the deserialized, embedded message, with an - * additional field `@type` which contains the type URL. Example: - * - * package google.profile; - * message Person { - * string first_name = 1; - * string last_name = 2; - * } - * - * { - * "@type": "type.googleapis.com/google.profile.Person", - * "firstName": , - * "lastName": - * } - * - * If the embedded message type is well-known and has a custom JSON - * representation, that representation will be embedded adding a field - * `value` which holds the custom JSON in addition to the `@type` - * field. Example (for message [google.protobuf.Duration][]): - * - * { - * "@type": "type.googleapis.com/google.protobuf.Duration", - * "value": "1.212s" - * } - * - * - * @generated from protobuf message google.protobuf.Any - */ -export interface Any { - /** - * A URL/resource name that uniquely identifies the type of the serialized - * protocol buffer message. This string must contain at least - * one "/" character. The last segment of the URL's path must represent - * the fully qualified name of the type (as in - * `path/google.protobuf.Duration`). The name should be in a canonical form - * (e.g., leading "." is not accepted). - * - * In practice, teams usually precompile into the binary all types that they - * expect it to use in the context of Any. However, for URLs which use the - * scheme `http`, `https`, or no scheme, one can optionally set up a type - * server that maps type URLs to message definitions as follows: - * - * * If no scheme is provided, `https` is assumed. - * * An HTTP GET on the URL must yield a [google.protobuf.Type][] - * value in binary format, or produce an error. - * * Applications are allowed to cache lookup results based on the - * URL, or have them precompiled into a binary to avoid any - * lookup. Therefore, binary compatibility needs to be preserved - * on changes to types. (Use versioned type names to manage - * breaking changes.) - * - * Note: this functionality is not currently available in the official - * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. As of May 2023, there are no widely used type server - * implementations and no plans to implement one. - * - * Schemes other than `http`, `https` (or the empty scheme) might be - * used with implementation specific semantics. - * - * - * @generated from protobuf field: string type_url = 1; - */ - typeUrl: string; - /** - * Must be a valid serialized protocol buffer of the above specified type. - * - * @generated from protobuf field: bytes value = 2; - */ - value: Uint8Array; -} -// @generated message type with reflection information, may provide speed optimized methods -class Any$Type extends MessageType { - constructor() { - super("google.protobuf.Any", [ - { no: 1, name: "type_url", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "value", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } - ]); - } - /** - * Pack the message into a new `Any`. - * - * Uses 'type.googleapis.com/full.type.name' as the type URL. - */ - pack(message: T, type: IMessageType): Any { - return { - typeUrl: this.typeNameToUrl(type.typeName), value: type.toBinary(message), - }; - } - /** - * Unpack the message from the `Any`. - */ - unpack(any: Any, type: IMessageType, options?: Partial): T { - if (!this.contains(any, type)) - throw new Error("Cannot unpack google.protobuf.Any with typeUrl '" + any.typeUrl + "' as " + type.typeName + "."); - return type.fromBinary(any.value, options); - } - /** - * Does the given `Any` contain a packed message of the given type? - */ - contains(any: Any, type: IMessageType | string): boolean { - if (!any.typeUrl.length) - return false; - let wants = typeof type == "string" ? type : type.typeName; - let has = this.typeUrlToName(any.typeUrl); - return wants === has; - } - /** - * Convert the message to canonical JSON value. - * - * You have to provide the `typeRegistry` option so that the - * packed message can be converted to JSON. - * - * The `typeRegistry` option is also required to read - * `google.protobuf.Any` from JSON format. - */ - internalJsonWrite(any: Any, options: JsonWriteOptions): JsonValue { - if (any.typeUrl === "") - return {}; - let typeName = this.typeUrlToName(any.typeUrl); - let opt = jsonWriteOptions(options); - let type = opt.typeRegistry?.find(t => t.typeName === typeName); - if (!type) - throw new globalThis.Error("Unable to convert google.protobuf.Any with typeUrl '" + any.typeUrl + "' to JSON. The specified type " + typeName + " is not available in the type registry."); - let value = type.fromBinary(any.value, { readUnknownField: false }); - let json = type.internalJsonWrite(value, opt); - if (typeName.startsWith("google.protobuf.") || !isJsonObject(json)) - json = { value: json }; - json["@type"] = any.typeUrl; - return json; - } - internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Any): Any { - if (!isJsonObject(json)) - throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON " + typeofJsonValue(json) + "."); - if (typeof json["@type"] != "string" || json["@type"] == "") - return this.create(); - let typeName = this.typeUrlToName(json["@type"]); - let type = options?.typeRegistry?.find(t => t.typeName == typeName); - if (!type) - throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON. The specified type " + typeName + " is not available in the type registry."); - let value; - if (typeName.startsWith("google.protobuf.") && json.hasOwnProperty("value")) - value = type.fromJson(json["value"], options); - else { - let copy = Object.assign({}, json); - delete copy["@type"]; - value = type.fromJson(copy, options); - } - if (target === undefined) - target = this.create(); - target.typeUrl = json["@type"]; - target.value = type.toBinary(value); - return target; - } - typeNameToUrl(name: string): string { - if (!name.length) - throw new Error("invalid type name: " + name); - return "type.googleapis.com/" + name; - } - typeUrlToName(url: string): string { - if (!url.length) - throw new Error("invalid type url: " + url); - let slash = url.lastIndexOf("/"); - let name = slash > 0 ? url.substring(slash + 1) : url; - if (!name.length) - throw new Error("invalid type url: " + url); - return name; - } - create(value?: PartialMessage): Any { - const message = globalThis.Object.create((this.messagePrototype!)); - message.typeUrl = ""; - message.value = new Uint8Array(0); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Any): Any { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* string type_url */ 1: - message.typeUrl = reader.string(); - break; - case /* bytes value */ 2: - message.value = reader.bytes(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Any, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* string type_url = 1; */ - if (message.typeUrl !== "") - writer.tag(1, WireType.LengthDelimited).string(message.typeUrl); - /* bytes value = 2; */ - if (message.value.length) - writer.tag(2, WireType.LengthDelimited).bytes(message.value); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message google.protobuf.Any - */ -export const Any = new Any$Type(); diff --git a/packages/trackerless-network/generated/google/protobuf/empty.ts b/packages/trackerless-network/generated/google/protobuf/empty.ts deleted file mode 100644 index 76f8eb3fa7..0000000000 --- a/packages/trackerless-network/generated/google/protobuf/empty.ts +++ /dev/null @@ -1,81 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "google/protobuf/empty.proto" (package "google.protobuf", syntax proto3) -// tslint:disable -// -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * A generic empty message that you can re-use to avoid defining duplicated - * empty messages in your APIs. A typical example is to use it as the request - * or the response type of an API method. For instance: - * - * service Foo { - * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - * } - * - * - * @generated from protobuf message google.protobuf.Empty - */ -export interface Empty { -} -// @generated message type with reflection information, may provide speed optimized methods -class Empty$Type extends MessageType { - constructor() { - super("google.protobuf.Empty", []); - } - create(value?: PartialMessage): Empty { - const message = globalThis.Object.create((this.messagePrototype!)); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Empty): Empty { - return target ?? this.create(); - } - internalBinaryWrite(message: Empty, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message google.protobuf.Empty - */ -export const Empty = new Empty$Type(); diff --git a/packages/trackerless-network/generated/google/protobuf/timestamp.ts b/packages/trackerless-network/generated/google/protobuf/timestamp.ts deleted file mode 100644 index 3faca940c6..0000000000 --- a/packages/trackerless-network/generated/google/protobuf/timestamp.ts +++ /dev/null @@ -1,287 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "google/protobuf/timestamp.proto" (package "google.protobuf", syntax proto3) -// tslint:disable -// -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { WireType } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { typeofJsonValue } from "@protobuf-ts/runtime"; -import type { JsonValue } from "@protobuf-ts/runtime"; -import type { JsonReadOptions } from "@protobuf-ts/runtime"; -import type { JsonWriteOptions } from "@protobuf-ts/runtime"; -import { PbLong } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -/** - * A Timestamp represents a point in time independent of any time zone or local - * calendar, encoded as a count of seconds and fractions of seconds at - * nanosecond resolution. The count is relative to an epoch at UTC midnight on - * January 1, 1970, in the proleptic Gregorian calendar which extends the - * Gregorian calendar backwards to year one. - * - * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - * second table is needed for interpretation, using a [24-hour linear - * smear](https://developers.google.com/time/smear). - * - * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - * restricting to that range, we ensure that we can convert to and from [RFC - * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - * - * # Examples - * - * Example 1: Compute Timestamp from POSIX `time()`. - * - * Timestamp timestamp; - * timestamp.set_seconds(time(NULL)); - * timestamp.set_nanos(0); - * - * Example 2: Compute Timestamp from POSIX `gettimeofday()`. - * - * struct timeval tv; - * gettimeofday(&tv, NULL); - * - * Timestamp timestamp; - * timestamp.set_seconds(tv.tv_sec); - * timestamp.set_nanos(tv.tv_usec * 1000); - * - * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - * - * FILETIME ft; - * GetSystemTimeAsFileTime(&ft); - * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - * - * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - * Timestamp timestamp; - * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - * - * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - * - * long millis = System.currentTimeMillis(); - * - * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - * .setNanos((int) ((millis % 1000) * 1000000)).build(); - * - * Example 5: Compute Timestamp from Java `Instant.now()`. - * - * Instant now = Instant.now(); - * - * Timestamp timestamp = - * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - * .setNanos(now.getNano()).build(); - * - * Example 6: Compute Timestamp from current time in Python. - * - * timestamp = Timestamp() - * timestamp.GetCurrentTime() - * - * # JSON Mapping - * - * In JSON format, the Timestamp type is encoded as a string in the - * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the - * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" - * where {year} is always expressed using four digits while {month}, {day}, - * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional - * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), - * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone - * is required. A proto3 JSON serializer should always use UTC (as indicated by - * "Z") when printing the Timestamp type and a proto3 JSON parser should be - * able to accept both UTC and other timezones (as indicated by an offset). - * - * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past - * 01:30 UTC on January 15, 2017. - * - * In JavaScript, one can convert a Date object to this format using the - * standard - * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - * method. In Python, a standard `datetime.datetime` object can be converted - * to this format using - * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with - * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use - * the Joda Time's [`ISODateTimeFormat.dateTime()`]( - * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() - * ) to obtain a formatter capable of generating timestamps in this format. - * - * - * @generated from protobuf message google.protobuf.Timestamp - */ -export interface Timestamp { - /** - * Represents seconds of UTC time since Unix epoch - * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - * 9999-12-31T23:59:59Z inclusive. - * - * @generated from protobuf field: int64 seconds = 1; - */ - seconds: number; - /** - * Non-negative fractions of a second at nanosecond resolution. Negative - * second values with fractions must still have non-negative nanos values - * that count forward in time. Must be from 0 to 999,999,999 - * inclusive. - * - * @generated from protobuf field: int32 nanos = 2; - */ - nanos: number; -} -// @generated message type with reflection information, may provide speed optimized methods -class Timestamp$Type extends MessageType { - constructor() { - super("google.protobuf.Timestamp", [ - { no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ }, - { no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ } - ]); - } - /** - * Creates a new `Timestamp` for the current time. - */ - now(): Timestamp { - const msg = this.create(); - const ms = Date.now(); - msg.seconds = PbLong.from(Math.floor(ms / 1000)).toNumber(); - msg.nanos = (ms % 1000) * 1000000; - return msg; - } - /** - * Converts a `Timestamp` to a JavaScript Date. - */ - toDate(message: Timestamp): Date { - return new Date(PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000)); - } - /** - * Converts a JavaScript Date to a `Timestamp`. - */ - fromDate(date: Date): Timestamp { - const msg = this.create(); - const ms = date.getTime(); - msg.seconds = PbLong.from(Math.floor(ms / 1000)).toNumber(); - msg.nanos = (ms % 1000) * 1000000; - return msg; - } - /** - * In JSON format, the `Timestamp` type is encoded as a string - * in the RFC 3339 format. - */ - internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue { - let ms = PbLong.from(message.seconds).toNumber() * 1000; - if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) - throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."); - if (message.nanos < 0) - throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative."); - let z = "Z"; - if (message.nanos > 0) { - let nanosStr = (message.nanos + 1000000000).toString().substring(1); - if (nanosStr.substring(3) === "000000") - z = "." + nanosStr.substring(0, 3) + "Z"; - else if (nanosStr.substring(6) === "000") - z = "." + nanosStr.substring(0, 6) + "Z"; - else - z = "." + nanosStr + "Z"; - } - return new Date(ms).toISOString().replace(".000Z", z); - } - /** - * In JSON format, the `Timestamp` type is encoded as a string - * in the RFC 3339 format. - */ - internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp { - if (typeof json !== "string") - throw new Error("Unable to parse Timestamp from JSON " + typeofJsonValue(json) + "."); - let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/); - if (!matches) - throw new Error("Unable to parse Timestamp from JSON. Invalid format."); - let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z")); - if (Number.isNaN(ms)) - throw new Error("Unable to parse Timestamp from JSON. Invalid value."); - if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) - throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."); - if (!target) - target = this.create(); - target.seconds = PbLong.from(ms / 1000).toNumber(); - target.nanos = 0; - if (matches[7]) - target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000); - return target; - } - create(value?: PartialMessage): Timestamp { - const message = globalThis.Object.create((this.messagePrototype!)); - message.seconds = 0; - message.nanos = 0; - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Timestamp): Timestamp { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* int64 seconds */ 1: - message.seconds = reader.int64().toNumber(); - break; - case /* int32 nanos */ 2: - message.nanos = reader.int32(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: Timestamp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* int64 seconds = 1; */ - if (message.seconds !== 0) - writer.tag(1, WireType.Varint).int64(message.seconds); - /* int32 nanos = 2; */ - if (message.nanos !== 0) - writer.tag(2, WireType.Varint).int32(message.nanos); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message google.protobuf.Timestamp - */ -export const Timestamp = new Timestamp$Type(); diff --git a/packages/trackerless-network/generated/packages/proto-rpc/protos/ProtoRpc.ts b/packages/trackerless-network/generated/packages/proto-rpc/protos/ProtoRpc.ts deleted file mode 100644 index 7cfcf25ce6..0000000000 --- a/packages/trackerless-network/generated/packages/proto-rpc/protos/ProtoRpc.ts +++ /dev/null @@ -1,108 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/proto-rpc/protos/ProtoRpc.proto" (package "protorpc", syntax proto3) -// tslint:disable -import { MessageType } from "@protobuf-ts/runtime"; -import { Empty } from "../../../google/protobuf/empty"; -import { Any } from "../../../google/protobuf/any"; -/** - * @generated from protobuf message protorpc.RpcMessage - */ -export interface RpcMessage { - /** - * @generated from protobuf field: map header = 1; - */ - header: { - [key: string]: string; - }; - /** - * @generated from protobuf field: google.protobuf.Any body = 2; - */ - body?: Any; - /** - * @generated from protobuf field: string requestId = 3; - */ - requestId: string; - /** - * @generated from protobuf field: optional protorpc.RpcErrorType errorType = 4; - */ - errorType?: RpcErrorType; - /** - * @generated from protobuf field: optional string errorClassName = 5; - */ - errorClassName?: string; - /** - * @generated from protobuf field: optional string errorCode = 6; - */ - errorCode?: string; - /** - * @generated from protobuf field: optional string errorMessage = 7; - */ - errorMessage?: string; -} -// Dummy message to force the generation of the typescript class "google.prototype.Empty" -// We need this generated class in RpcCommunicator - -/** - * @generated from protobuf message protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq - */ -export interface Mnfo2uhnf92hvqi2nviouq2hv9puhq { - /** - * @generated from protobuf field: google.protobuf.Empty empty = 1; - */ - empty?: Empty; -} -/** - * @generated from protobuf enum protorpc.RpcErrorType - */ -export enum RpcErrorType { - /** - * @generated from protobuf enum value: SERVER_TIMEOUT = 0; - */ - SERVER_TIMEOUT = 0, - /** - * @generated from protobuf enum value: CLIENT_TIMEOUT = 1; - */ - CLIENT_TIMEOUT = 1, - /** - * @generated from protobuf enum value: UNKNOWN_RPC_METHOD = 2; - */ - UNKNOWN_RPC_METHOD = 2, - /** - * @generated from protobuf enum value: CLIENT_ERROR = 3; - */ - CLIENT_ERROR = 3, - /** - * @generated from protobuf enum value: SERVER_ERROR = 4; - */ - SERVER_ERROR = 4 -} -// @generated message type with reflection information, may provide speed optimized methods -class RpcMessage$Type extends MessageType { - constructor() { - super("protorpc.RpcMessage", [ - { no: 1, name: "header", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } }, - { no: 2, name: "body", kind: "message", T: () => Any }, - { no: 3, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 4, name: "errorType", kind: "enum", opt: true, T: () => ["protorpc.RpcErrorType", RpcErrorType] }, - { no: 5, name: "errorClassName", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 6, name: "errorCode", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 7, name: "errorMessage", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message protorpc.RpcMessage - */ -export const RpcMessage = new RpcMessage$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class Mnfo2uhnf92hvqi2nviouq2hv9puhq$Type extends MessageType { - constructor() { - super("protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq", [ - { no: 1, name: "empty", kind: "message", T: () => Empty } - ]); - } -} -/** - * @generated MessageType for protobuf message protorpc.Mnfo2uhnf92hvqi2nviouq2hv9puhq - */ -export const Mnfo2uhnf92hvqi2nviouq2hv9puhq = new Mnfo2uhnf92hvqi2nviouq2hv9puhq$Type(); diff --git a/packages/trackerless-network/generated/packages/trackerless-network/protos/NetworkRpc.client.ts b/packages/trackerless-network/generated/packages/trackerless-network/protos/NetworkRpc.client.ts deleted file mode 100644 index 6c276ec1a4..0000000000 --- a/packages/trackerless-network/generated/packages/trackerless-network/protos/NetworkRpc.client.ts +++ /dev/null @@ -1,218 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/trackerless-network/protos/NetworkRpc.proto" (syntax proto3) -// tslint:disable -import { NodeInfoRpc } from "./NetworkRpc"; -import type { NodeInfoResponse } from "./NetworkRpc"; -import type { NodeInfoRequest } from "./NetworkRpc"; -import { TemporaryConnectionRpc } from "./NetworkRpc"; -import type { CloseTemporaryConnection } from "./NetworkRpc"; -import type { TemporaryConnectionResponse } from "./NetworkRpc"; -import type { TemporaryConnectionRequest } from "./NetworkRpc"; -import { NeighborUpdateRpc } from "./NetworkRpc"; -import type { NeighborUpdate } from "./NetworkRpc"; -import { HandshakeRpc } from "./NetworkRpc"; -import type { InterleaveResponse } from "./NetworkRpc"; -import type { InterleaveRequest } from "./NetworkRpc"; -import type { StreamPartHandshakeResponse } from "./NetworkRpc"; -import type { StreamPartHandshakeRequest } from "./NetworkRpc"; -import { ProxyConnectionRpc } from "./NetworkRpc"; -import type { ProxyConnectionResponse } from "./NetworkRpc"; -import type { ProxyConnectionRequest } from "./NetworkRpc"; -import type { RpcTransport } from "@protobuf-ts/runtime-rpc"; -import type { ServiceInfo } from "@protobuf-ts/runtime-rpc"; -import { ContentDeliveryRpc } from "./NetworkRpc"; -import type { LeaveStreamPartNotice } from "./NetworkRpc"; -import { stackIntercept } from "@protobuf-ts/runtime-rpc"; -import type { Empty } from "../../../google/protobuf/empty"; -import type { StreamMessage } from "./NetworkRpc"; -import type { UnaryCall } from "@protobuf-ts/runtime-rpc"; -import type { RpcOptions } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service ContentDeliveryRpc - */ -export interface IContentDeliveryRpcClient { - /** - * @generated from protobuf rpc: sendStreamMessage(StreamMessage) returns (google.protobuf.Empty); - */ - sendStreamMessage(input: StreamMessage, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: leaveStreamPartNotice(LeaveStreamPartNotice) returns (google.protobuf.Empty); - */ - leaveStreamPartNotice(input: LeaveStreamPartNotice, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service ContentDeliveryRpc - */ -export class ContentDeliveryRpcClient implements IContentDeliveryRpcClient, ServiceInfo { - typeName = ContentDeliveryRpc.typeName; - methods = ContentDeliveryRpc.methods; - options = ContentDeliveryRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: sendStreamMessage(StreamMessage) returns (google.protobuf.Empty); - */ - sendStreamMessage(input: StreamMessage, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: leaveStreamPartNotice(LeaveStreamPartNotice) returns (google.protobuf.Empty); - */ - leaveStreamPartNotice(input: LeaveStreamPartNotice, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service ProxyConnectionRpc - */ -export interface IProxyConnectionRpcClient { - /** - * @generated from protobuf rpc: requestConnection(ProxyConnectionRequest) returns (ProxyConnectionResponse); - */ - requestConnection(input: ProxyConnectionRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service ProxyConnectionRpc - */ -export class ProxyConnectionRpcClient implements IProxyConnectionRpcClient, ServiceInfo { - typeName = ProxyConnectionRpc.typeName; - methods = ProxyConnectionRpc.methods; - options = ProxyConnectionRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: requestConnection(ProxyConnectionRequest) returns (ProxyConnectionResponse); - */ - requestConnection(input: ProxyConnectionRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service HandshakeRpc - */ -export interface IHandshakeRpcClient { - /** - * @generated from protobuf rpc: handshake(StreamPartHandshakeRequest) returns (StreamPartHandshakeResponse); - */ - handshake(input: StreamPartHandshakeRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: interleaveRequest(InterleaveRequest) returns (InterleaveResponse); - */ - interleaveRequest(input: InterleaveRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service HandshakeRpc - */ -export class HandshakeRpcClient implements IHandshakeRpcClient, ServiceInfo { - typeName = HandshakeRpc.typeName; - methods = HandshakeRpc.methods; - options = HandshakeRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: handshake(StreamPartHandshakeRequest) returns (StreamPartHandshakeResponse); - */ - handshake(input: StreamPartHandshakeRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: interleaveRequest(InterleaveRequest) returns (InterleaveResponse); - */ - interleaveRequest(input: InterleaveRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service NeighborUpdateRpc - */ -export interface INeighborUpdateRpcClient { - /** - * @generated from protobuf rpc: neighborUpdate(NeighborUpdate) returns (NeighborUpdate); - */ - neighborUpdate(input: NeighborUpdate, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service NeighborUpdateRpc - */ -export class NeighborUpdateRpcClient implements INeighborUpdateRpcClient, ServiceInfo { - typeName = NeighborUpdateRpc.typeName; - methods = NeighborUpdateRpc.methods; - options = NeighborUpdateRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: neighborUpdate(NeighborUpdate) returns (NeighborUpdate); - */ - neighborUpdate(input: NeighborUpdate, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service TemporaryConnectionRpc - */ -export interface ITemporaryConnectionRpcClient { - /** - * @generated from protobuf rpc: openConnection(TemporaryConnectionRequest) returns (TemporaryConnectionResponse); - */ - openConnection(input: TemporaryConnectionRequest, options?: RpcOptions): UnaryCall; - /** - * @generated from protobuf rpc: closeConnection(CloseTemporaryConnection) returns (google.protobuf.Empty); - */ - closeConnection(input: CloseTemporaryConnection, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service TemporaryConnectionRpc - */ -export class TemporaryConnectionRpcClient implements ITemporaryConnectionRpcClient, ServiceInfo { - typeName = TemporaryConnectionRpc.typeName; - methods = TemporaryConnectionRpc.methods; - options = TemporaryConnectionRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: openConnection(TemporaryConnectionRequest) returns (TemporaryConnectionResponse); - */ - openConnection(input: TemporaryConnectionRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } - /** - * @generated from protobuf rpc: closeConnection(CloseTemporaryConnection) returns (google.protobuf.Empty); - */ - closeConnection(input: CloseTemporaryConnection, options?: RpcOptions): UnaryCall { - const method = this.methods[1], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} -/** - * @generated from protobuf service NodeInfoRpc - */ -export interface INodeInfoRpcClient { - /** - * @generated from protobuf rpc: getInfo(NodeInfoRequest) returns (NodeInfoResponse); - */ - getInfo(input: NodeInfoRequest, options?: RpcOptions): UnaryCall; -} -/** - * @generated from protobuf service NodeInfoRpc - */ -export class NodeInfoRpcClient implements INodeInfoRpcClient, ServiceInfo { - typeName = NodeInfoRpc.typeName; - methods = NodeInfoRpc.methods; - options = NodeInfoRpc.options; - constructor(private readonly _transport: RpcTransport) { - } - /** - * @generated from protobuf rpc: getInfo(NodeInfoRequest) returns (NodeInfoResponse); - */ - getInfo(input: NodeInfoRequest, options?: RpcOptions): UnaryCall { - const method = this.methods[0], opt = this._transport.mergeOptions(options); - return stackIntercept("unary", this._transport, method, opt, input); - } -} diff --git a/packages/trackerless-network/generated/packages/trackerless-network/protos/NetworkRpc.server.ts b/packages/trackerless-network/generated/packages/trackerless-network/protos/NetworkRpc.server.ts deleted file mode 100644 index 9af14969f7..0000000000 --- a/packages/trackerless-network/generated/packages/trackerless-network/protos/NetworkRpc.server.ts +++ /dev/null @@ -1,85 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/trackerless-network/protos/NetworkRpc.proto" (syntax proto3) -// tslint:disable -import { NodeInfoResponse } from "./NetworkRpc"; -import { NodeInfoRequest } from "./NetworkRpc"; -import { CloseTemporaryConnection } from "./NetworkRpc"; -import { TemporaryConnectionResponse } from "./NetworkRpc"; -import { TemporaryConnectionRequest } from "./NetworkRpc"; -import { NeighborUpdate } from "./NetworkRpc"; -import { InterleaveResponse } from "./NetworkRpc"; -import { InterleaveRequest } from "./NetworkRpc"; -import { StreamPartHandshakeResponse } from "./NetworkRpc"; -import { StreamPartHandshakeRequest } from "./NetworkRpc"; -import { ProxyConnectionResponse } from "./NetworkRpc"; -import { ProxyConnectionRequest } from "./NetworkRpc"; -import { LeaveStreamPartNotice } from "./NetworkRpc"; -import { Empty } from "../../../google/protobuf/empty"; -import { StreamMessage } from "./NetworkRpc"; -import { ServerCallContext } from "@protobuf-ts/runtime-rpc"; -/** - * @generated from protobuf service ContentDeliveryRpc - */ -export interface IContentDeliveryRpc { - /** - * @generated from protobuf rpc: sendStreamMessage(StreamMessage) returns (google.protobuf.Empty); - */ - sendStreamMessage(request: StreamMessage, context: T): Promise; - /** - * @generated from protobuf rpc: leaveStreamPartNotice(LeaveStreamPartNotice) returns (google.protobuf.Empty); - */ - leaveStreamPartNotice(request: LeaveStreamPartNotice, context: T): Promise; -} -/** - * @generated from protobuf service ProxyConnectionRpc - */ -export interface IProxyConnectionRpc { - /** - * @generated from protobuf rpc: requestConnection(ProxyConnectionRequest) returns (ProxyConnectionResponse); - */ - requestConnection(request: ProxyConnectionRequest, context: T): Promise; -} -/** - * @generated from protobuf service HandshakeRpc - */ -export interface IHandshakeRpc { - /** - * @generated from protobuf rpc: handshake(StreamPartHandshakeRequest) returns (StreamPartHandshakeResponse); - */ - handshake(request: StreamPartHandshakeRequest, context: T): Promise; - /** - * @generated from protobuf rpc: interleaveRequest(InterleaveRequest) returns (InterleaveResponse); - */ - interleaveRequest(request: InterleaveRequest, context: T): Promise; -} -/** - * @generated from protobuf service NeighborUpdateRpc - */ -export interface INeighborUpdateRpc { - /** - * @generated from protobuf rpc: neighborUpdate(NeighborUpdate) returns (NeighborUpdate); - */ - neighborUpdate(request: NeighborUpdate, context: T): Promise; -} -/** - * @generated from protobuf service TemporaryConnectionRpc - */ -export interface ITemporaryConnectionRpc { - /** - * @generated from protobuf rpc: openConnection(TemporaryConnectionRequest) returns (TemporaryConnectionResponse); - */ - openConnection(request: TemporaryConnectionRequest, context: T): Promise; - /** - * @generated from protobuf rpc: closeConnection(CloseTemporaryConnection) returns (google.protobuf.Empty); - */ - closeConnection(request: CloseTemporaryConnection, context: T): Promise; -} -/** - * @generated from protobuf service NodeInfoRpc - */ -export interface INodeInfoRpc { - /** - * @generated from protobuf rpc: getInfo(NodeInfoRequest) returns (NodeInfoResponse); - */ - getInfo(request: NodeInfoRequest, context: T): Promise; -} diff --git a/packages/trackerless-network/generated/packages/trackerless-network/protos/NetworkRpc.ts b/packages/trackerless-network/generated/packages/trackerless-network/protos/NetworkRpc.ts deleted file mode 100644 index 769341508e..0000000000 --- a/packages/trackerless-network/generated/packages/trackerless-network/protos/NetworkRpc.ts +++ /dev/null @@ -1,783 +0,0 @@ -// @generated by protobuf-ts 2.9.4 with parameter server_generic,generate_dependencies,long_type_number -// @generated from protobuf file "packages/trackerless-network/protos/NetworkRpc.proto" (syntax proto3) -// tslint:disable -import { Empty } from "../../../google/protobuf/empty"; -import { ServiceType } from "@protobuf-ts/runtime-rpc"; -import { MessageType } from "@protobuf-ts/runtime"; -import { PeerDescriptor } from "../../dht/protos/DhtRpc"; -/** - * @generated from protobuf message MessageID - */ -export interface MessageID { - /** - * @generated from protobuf field: string streamId = 1; - */ - streamId: string; - /** - * @generated from protobuf field: int32 streamPartition = 2; - */ - streamPartition: number; - /** - * @generated from protobuf field: int64 timestamp = 3; - */ - timestamp: number; - /** - * @generated from protobuf field: int32 sequenceNumber = 4; - */ - sequenceNumber: number; - /** - * @generated from protobuf field: bytes publisherId = 5; - */ - publisherId: Uint8Array; - /** - * @generated from protobuf field: string messageChainId = 6; - */ - messageChainId: string; -} -/** - * @generated from protobuf message MessageRef - */ -export interface MessageRef { - /** - * @generated from protobuf field: int64 timestamp = 1; - */ - timestamp: number; - /** - * @generated from protobuf field: int32 sequenceNumber = 2; - */ - sequenceNumber: number; -} -/** - * @generated from protobuf message StreamMessage - */ -export interface StreamMessage { - /** - * this is a required field but in generated NetworkRpc.ts it is incorrectly annotated as optional (NET-1082) - * - * @generated from protobuf field: MessageID messageId = 1; - */ - messageId?: MessageID; - /** - * @generated from protobuf field: optional MessageRef previousMessageRef = 2; - */ - previousMessageRef?: MessageRef; - /** - * @generated from protobuf field: bytes signature = 3; - */ - signature: Uint8Array; - /** - * @generated from protobuf field: SignatureType signatureType = 4; - */ - signatureType: SignatureType; - /** - * @generated from protobuf oneof: body - */ - body: { - oneofKind: "contentMessage"; - /** - * @generated from protobuf field: ContentMessage contentMessage = 5; - */ - contentMessage: ContentMessage; - } | { - oneofKind: "groupKeyRequest"; - /** - * @generated from protobuf field: GroupKeyRequest groupKeyRequest = 6; - */ - groupKeyRequest: GroupKeyRequest; - } | { - oneofKind: "groupKeyResponse"; - /** - * @generated from protobuf field: GroupKeyResponse groupKeyResponse = 7; - */ - groupKeyResponse: GroupKeyResponse; - } | { - oneofKind: undefined; - }; -} -/** - * @generated from protobuf message ContentMessage - */ -export interface ContentMessage { - /** - * @generated from protobuf field: bytes content = 1; - */ - content: Uint8Array; - /** - * @generated from protobuf field: ContentType contentType = 2; - */ - contentType: ContentType; - /** - * @generated from protobuf field: EncryptionType encryptionType = 3; - */ - encryptionType: EncryptionType; - /** - * @generated from protobuf field: optional string groupKeyId = 4; - */ - groupKeyId?: string; - /** - * @generated from protobuf field: optional GroupKey newGroupKey = 5; - */ - newGroupKey?: GroupKey; -} -/** - * @generated from protobuf message GroupKeyRequest - */ -export interface GroupKeyRequest { - /** - * @generated from protobuf field: string requestId = 1; - */ - requestId: string; - /** - * @generated from protobuf field: bytes recipientId = 2; - */ - recipientId: Uint8Array; - /** - * @generated from protobuf field: bytes rsaPublicKey = 3; - */ - rsaPublicKey: Uint8Array; - /** - * @generated from protobuf field: repeated string groupKeyIds = 4; - */ - groupKeyIds: string[]; -} -/** - * @generated from protobuf message GroupKeyResponse - */ -export interface GroupKeyResponse { - /** - * @generated from protobuf field: string requestId = 1; - */ - requestId: string; - /** - * @generated from protobuf field: bytes recipientId = 2; - */ - recipientId: Uint8Array; - /** - * @generated from protobuf field: repeated GroupKey groupKeys = 3; - */ - groupKeys: GroupKey[]; -} -/** - * @generated from protobuf message GroupKey - */ -export interface GroupKey { - /** - * @generated from protobuf field: string id = 1; - */ - id: string; - /** - * @generated from protobuf field: bytes data = 2; - */ - data: Uint8Array; -} -/** - * @generated from protobuf message StreamPartHandshakeRequest - */ -export interface StreamPartHandshakeRequest { - /** - * @generated from protobuf field: string streamPartId = 1; - */ - streamPartId: string; - /** - * @generated from protobuf field: string requestId = 2; - */ - requestId: string; - /** - * @generated from protobuf field: optional bytes concurrentHandshakeNodeId = 3; - */ - concurrentHandshakeNodeId?: Uint8Array; - /** - * @generated from protobuf field: repeated bytes neighborNodeIds = 4; - */ - neighborNodeIds: Uint8Array[]; - /** - * @generated from protobuf field: optional bytes interleaveNodeId = 5; - */ - interleaveNodeId?: Uint8Array; -} -/** - * @generated from protobuf message StreamPartHandshakeResponse - */ -export interface StreamPartHandshakeResponse { - /** - * @generated from protobuf field: bool accepted = 1; - */ - accepted: boolean; - /** - * @generated from protobuf field: string requestId = 2; - */ - requestId: string; - /** - * @generated from protobuf field: optional dht.PeerDescriptor interleaveTargetDescriptor = 3; - */ - interleaveTargetDescriptor?: PeerDescriptor; -} -/** - * @generated from protobuf message InterleaveRequest - */ -export interface InterleaveRequest { - /** - * this is a required field but in generated NetworkRpc.ts it is incorrectly annotated as optional (NET-1082) - * - * @generated from protobuf field: dht.PeerDescriptor interleaveTargetDescriptor = 1; - */ - interleaveTargetDescriptor?: PeerDescriptor; -} -/** - * @generated from protobuf message InterleaveResponse - */ -export interface InterleaveResponse { - /** - * @generated from protobuf field: bool accepted = 1; - */ - accepted: boolean; -} -/** - * @generated from protobuf message LeaveStreamPartNotice - */ -export interface LeaveStreamPartNotice { - /** - * @generated from protobuf field: string streamPartId = 1; - */ - streamPartId: string; - /** - * @generated from protobuf field: bool isEntryPoint = 2; - */ - isEntryPoint: boolean; -} -/** - * @generated from protobuf message NeighborUpdate - */ -export interface NeighborUpdate { - /** - * @generated from protobuf field: string streamPartId = 1; - */ - streamPartId: string; - /** - * @generated from protobuf field: bool removeMe = 2; - */ - removeMe: boolean; - /** - * @generated from protobuf field: repeated dht.PeerDescriptor neighborDescriptors = 3; - */ - neighborDescriptors: PeerDescriptor[]; -} -/** - * @generated from protobuf message ProxyConnectionRequest - */ -export interface ProxyConnectionRequest { - /** - * @generated from protobuf field: ProxyDirection direction = 1; - */ - direction: ProxyDirection; - /** - * @generated from protobuf field: bytes userId = 2; - */ - userId: Uint8Array; -} -/** - * @generated from protobuf message ProxyConnectionResponse - */ -export interface ProxyConnectionResponse { - /** - * @generated from protobuf field: bool accepted = 1; - */ - accepted: boolean; -} -/** - * @generated from protobuf message TemporaryConnectionRequest - */ -export interface TemporaryConnectionRequest { -} -/** - * @generated from protobuf message TemporaryConnectionResponse - */ -export interface TemporaryConnectionResponse { - /** - * @generated from protobuf field: bool accepted = 1; - */ - accepted: boolean; -} -/** - * @generated from protobuf message CloseTemporaryConnection - */ -export interface CloseTemporaryConnection { -} -/** - * @generated from protobuf message StreamPartitionInfo - */ -export interface StreamPartitionInfo { - /** - * @generated from protobuf field: string id = 1; - */ - id: string; - /** - * @generated from protobuf field: repeated dht.PeerDescriptor controlLayerNeighbors = 2; - */ - controlLayerNeighbors: PeerDescriptor[]; - /** - * @generated from protobuf field: repeated dht.PeerDescriptor deprecatedContentDeliveryLayerNeighbors = 3; - */ - deprecatedContentDeliveryLayerNeighbors: PeerDescriptor[]; - /** - * @generated from protobuf field: repeated ContentDeliveryLayerNeighborInfo contentDeliveryLayerNeighbors = 4; - */ - contentDeliveryLayerNeighbors: ContentDeliveryLayerNeighborInfo[]; -} -/** - * @generated from protobuf message ContentDeliveryLayerNeighborInfo - */ -export interface ContentDeliveryLayerNeighborInfo { - /** - * @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 1; - */ - peerDescriptor?: PeerDescriptor; - /** - * @generated from protobuf field: optional int32 rtt = 2; - */ - rtt?: number; -} -/** - * @generated from protobuf message ControlLayerInfo - */ -export interface ControlLayerInfo { - /** - * @generated from protobuf field: repeated dht.PeerDescriptor neighbors = 1; - */ - neighbors: PeerDescriptor[]; - /** - * @generated from protobuf field: repeated dht.PeerDescriptor connections = 2; - */ - connections: PeerDescriptor[]; -} -/** - * @generated from protobuf message NodeInfoRequest - */ -export interface NodeInfoRequest { -} -/** - * @generated from protobuf message NodeInfoResponse - */ -export interface NodeInfoResponse { - /** - * @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 1; - */ - peerDescriptor?: PeerDescriptor; - /** - * @generated from protobuf field: repeated StreamPartitionInfo streamPartitions = 2; - */ - streamPartitions: StreamPartitionInfo[]; - /** - * @generated from protobuf field: ControlLayerInfo controlLayer = 3; - */ - controlLayer?: ControlLayerInfo; - /** - * @generated from protobuf field: string version = 4; - */ - version: string; -} -/** - * @generated from protobuf enum ContentType - */ -export enum ContentType { - /** - * @generated from protobuf enum value: JSON = 0; - */ - JSON = 0, - /** - * @generated from protobuf enum value: BINARY = 1; - */ - BINARY = 1 -} -/** - * @generated from protobuf enum EncryptionType - */ -export enum EncryptionType { - /** - * @generated from protobuf enum value: NONE = 0; - */ - NONE = 0, - /** - * @generated from protobuf enum value: AES = 1; - */ - AES = 1 -} -/** - * @generated from protobuf enum SignatureType - */ -export enum SignatureType { - /** - * @generated from protobuf enum value: LEGACY_SECP256K1 = 0; - */ - LEGACY_SECP256K1 = 0, - /** - * @generated from protobuf enum value: SECP256K1 = 1; - */ - SECP256K1 = 1, - /** - * @generated from protobuf enum value: ERC_1271 = 2; - */ - ERC_1271 = 2 -} -/** - * @generated from protobuf enum ProxyDirection - */ -export enum ProxyDirection { - /** - * @generated from protobuf enum value: PUBLISH = 0; - */ - PUBLISH = 0, - /** - * @generated from protobuf enum value: SUBSCRIBE = 1; - */ - SUBSCRIBE = 1 -} -// @generated message type with reflection information, may provide speed optimized methods -class MessageID$Type extends MessageType { - constructor() { - super("MessageID", [ - { no: 1, name: "streamId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "streamPartition", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, - { no: 3, name: "timestamp", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ }, - { no: 4, name: "sequenceNumber", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, - { no: 5, name: "publisherId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 6, name: "messageChainId", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message MessageID - */ -export const MessageID = new MessageID$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class MessageRef$Type extends MessageType { - constructor() { - super("MessageRef", [ - { no: 1, name: "timestamp", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ }, - { no: 2, name: "sequenceNumber", kind: "scalar", T: 5 /*ScalarType.INT32*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message MessageRef - */ -export const MessageRef = new MessageRef$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class StreamMessage$Type extends MessageType { - constructor() { - super("StreamMessage", [ - { no: 1, name: "messageId", kind: "message", T: () => MessageID }, - { no: 2, name: "previousMessageRef", kind: "message", T: () => MessageRef }, - { no: 3, name: "signature", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 4, name: "signatureType", kind: "enum", T: () => ["SignatureType", SignatureType] }, - { no: 5, name: "contentMessage", kind: "message", oneof: "body", T: () => ContentMessage }, - { no: 6, name: "groupKeyRequest", kind: "message", oneof: "body", T: () => GroupKeyRequest }, - { no: 7, name: "groupKeyResponse", kind: "message", oneof: "body", T: () => GroupKeyResponse } - ]); - } -} -/** - * @generated MessageType for protobuf message StreamMessage - */ -export const StreamMessage = new StreamMessage$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ContentMessage$Type extends MessageType { - constructor() { - super("ContentMessage", [ - { no: 1, name: "content", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 2, name: "contentType", kind: "enum", T: () => ["ContentType", ContentType] }, - { no: 3, name: "encryptionType", kind: "enum", T: () => ["EncryptionType", EncryptionType] }, - { no: 4, name: "groupKeyId", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, - { no: 5, name: "newGroupKey", kind: "message", T: () => GroupKey } - ]); - } -} -/** - * @generated MessageType for protobuf message ContentMessage - */ -export const ContentMessage = new ContentMessage$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class GroupKeyRequest$Type extends MessageType { - constructor() { - super("GroupKeyRequest", [ - { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "recipientId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 3, name: "rsaPublicKey", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 4, name: "groupKeyIds", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message GroupKeyRequest - */ -export const GroupKeyRequest = new GroupKeyRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class GroupKeyResponse$Type extends MessageType { - constructor() { - super("GroupKeyResponse", [ - { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "recipientId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }, - { no: 3, name: "groupKeys", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => GroupKey } - ]); - } -} -/** - * @generated MessageType for protobuf message GroupKeyResponse - */ -export const GroupKeyResponse = new GroupKeyResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class GroupKey$Type extends MessageType { - constructor() { - super("GroupKey", [ - { no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "data", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message GroupKey - */ -export const GroupKey = new GroupKey$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class StreamPartHandshakeRequest$Type extends MessageType { - constructor() { - super("StreamPartHandshakeRequest", [ - { no: 1, name: "streamPartId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "concurrentHandshakeNodeId", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ }, - { no: 4, name: "neighborNodeIds", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ }, - { no: 5, name: "interleaveNodeId", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message StreamPartHandshakeRequest - */ -export const StreamPartHandshakeRequest = new StreamPartHandshakeRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class StreamPartHandshakeResponse$Type extends MessageType { - constructor() { - super("StreamPartHandshakeResponse", [ - { no: 1, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, - { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "interleaveTargetDescriptor", kind: "message", T: () => PeerDescriptor } - ]); - } -} -/** - * @generated MessageType for protobuf message StreamPartHandshakeResponse - */ -export const StreamPartHandshakeResponse = new StreamPartHandshakeResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class InterleaveRequest$Type extends MessageType { - constructor() { - super("InterleaveRequest", [ - { no: 1, name: "interleaveTargetDescriptor", kind: "message", T: () => PeerDescriptor } - ]); - } -} -/** - * @generated MessageType for protobuf message InterleaveRequest - */ -export const InterleaveRequest = new InterleaveRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class InterleaveResponse$Type extends MessageType { - constructor() { - super("InterleaveResponse", [ - { no: 1, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message InterleaveResponse - */ -export const InterleaveResponse = new InterleaveResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class LeaveStreamPartNotice$Type extends MessageType { - constructor() { - super("LeaveStreamPartNotice", [ - { no: 1, name: "streamPartId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "isEntryPoint", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message LeaveStreamPartNotice - */ -export const LeaveStreamPartNotice = new LeaveStreamPartNotice$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class NeighborUpdate$Type extends MessageType { - constructor() { - super("NeighborUpdate", [ - { no: 1, name: "streamPartId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "removeMe", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, - { no: 3, name: "neighborDescriptors", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor } - ]); - } -} -/** - * @generated MessageType for protobuf message NeighborUpdate - */ -export const NeighborUpdate = new NeighborUpdate$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ProxyConnectionRequest$Type extends MessageType { - constructor() { - super("ProxyConnectionRequest", [ - { no: 1, name: "direction", kind: "enum", T: () => ["ProxyDirection", ProxyDirection] }, - { no: 2, name: "userId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message ProxyConnectionRequest - */ -export const ProxyConnectionRequest = new ProxyConnectionRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ProxyConnectionResponse$Type extends MessageType { - constructor() { - super("ProxyConnectionResponse", [ - { no: 1, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message ProxyConnectionResponse - */ -export const ProxyConnectionResponse = new ProxyConnectionResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class TemporaryConnectionRequest$Type extends MessageType { - constructor() { - super("TemporaryConnectionRequest", []); - } -} -/** - * @generated MessageType for protobuf message TemporaryConnectionRequest - */ -export const TemporaryConnectionRequest = new TemporaryConnectionRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class TemporaryConnectionResponse$Type extends MessageType { - constructor() { - super("TemporaryConnectionResponse", [ - { no: 1, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message TemporaryConnectionResponse - */ -export const TemporaryConnectionResponse = new TemporaryConnectionResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class CloseTemporaryConnection$Type extends MessageType { - constructor() { - super("CloseTemporaryConnection", []); - } -} -/** - * @generated MessageType for protobuf message CloseTemporaryConnection - */ -export const CloseTemporaryConnection = new CloseTemporaryConnection$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class StreamPartitionInfo$Type extends MessageType { - constructor() { - super("StreamPartitionInfo", [ - { no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "controlLayerNeighbors", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, - { no: 3, name: "deprecatedContentDeliveryLayerNeighbors", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, - { no: 4, name: "contentDeliveryLayerNeighbors", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => ContentDeliveryLayerNeighborInfo } - ]); - } -} -/** - * @generated MessageType for protobuf message StreamPartitionInfo - */ -export const StreamPartitionInfo = new StreamPartitionInfo$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ContentDeliveryLayerNeighborInfo$Type extends MessageType { - constructor() { - super("ContentDeliveryLayerNeighborInfo", [ - { no: 1, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor }, - { no: 2, name: "rtt", kind: "scalar", opt: true, T: 5 /*ScalarType.INT32*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message ContentDeliveryLayerNeighborInfo - */ -export const ContentDeliveryLayerNeighborInfo = new ContentDeliveryLayerNeighborInfo$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ControlLayerInfo$Type extends MessageType { - constructor() { - super("ControlLayerInfo", [ - { no: 1, name: "neighbors", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }, - { no: 2, name: "connections", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor } - ]); - } -} -/** - * @generated MessageType for protobuf message ControlLayerInfo - */ -export const ControlLayerInfo = new ControlLayerInfo$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class NodeInfoRequest$Type extends MessageType { - constructor() { - super("NodeInfoRequest", []); - } -} -/** - * @generated MessageType for protobuf message NodeInfoRequest - */ -export const NodeInfoRequest = new NodeInfoRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class NodeInfoResponse$Type extends MessageType { - constructor() { - super("NodeInfoResponse", [ - { no: 1, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor }, - { no: 2, name: "streamPartitions", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => StreamPartitionInfo }, - { no: 3, name: "controlLayer", kind: "message", T: () => ControlLayerInfo }, - { no: 4, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } -} -/** - * @generated MessageType for protobuf message NodeInfoResponse - */ -export const NodeInfoResponse = new NodeInfoResponse$Type(); -/** - * @generated ServiceType for protobuf service ContentDeliveryRpc - */ -export const ContentDeliveryRpc = new ServiceType("ContentDeliveryRpc", [ - { name: "sendStreamMessage", options: {}, I: StreamMessage, O: Empty }, - { name: "leaveStreamPartNotice", options: {}, I: LeaveStreamPartNotice, O: Empty } -]); -/** - * @generated ServiceType for protobuf service ProxyConnectionRpc - */ -export const ProxyConnectionRpc = new ServiceType("ProxyConnectionRpc", [ - { name: "requestConnection", options: {}, I: ProxyConnectionRequest, O: ProxyConnectionResponse } -]); -/** - * @generated ServiceType for protobuf service HandshakeRpc - */ -export const HandshakeRpc = new ServiceType("HandshakeRpc", [ - { name: "handshake", options: {}, I: StreamPartHandshakeRequest, O: StreamPartHandshakeResponse }, - { name: "interleaveRequest", options: {}, I: InterleaveRequest, O: InterleaveResponse } -]); -/** - * @generated ServiceType for protobuf service NeighborUpdateRpc - */ -export const NeighborUpdateRpc = new ServiceType("NeighborUpdateRpc", [ - { name: "neighborUpdate", options: {}, I: NeighborUpdate, O: NeighborUpdate } -]); -/** - * @generated ServiceType for protobuf service TemporaryConnectionRpc - */ -export const TemporaryConnectionRpc = new ServiceType("TemporaryConnectionRpc", [ - { name: "openConnection", options: {}, I: TemporaryConnectionRequest, O: TemporaryConnectionResponse }, - { name: "closeConnection", options: {}, I: CloseTemporaryConnection, O: Empty } -]); -/** - * @generated ServiceType for protobuf service NodeInfoRpc - */ -export const NodeInfoRpc = new ServiceType("NodeInfoRpc", [ - { name: "getInfo", options: {}, I: NodeInfoRequest, O: NodeInfoResponse } -]); diff --git a/packages/trackerless-network/package.json b/packages/trackerless-network/package.json index 724006d5b1..e6354fcf4d 100644 --- a/packages/trackerless-network/package.json +++ b/packages/trackerless-network/package.json @@ -14,7 +14,7 @@ "scripts": { "build": "tsc -b tsconfig.node.json", "build-browser": "webpack --mode=development --progress", - "generate-protoc-code": "./proto.sh", + "prebuild": "./proto.sh", "check": "tsc -p ./tsconfig.jest.json", "clean": "jest --clearCache || true; rm -rf dist *.tsbuildinfo node_modules/.cache || true", "coverage": "jest --coverage",