From a946fabb7e893149514b7cd5dabca493365ac117 Mon Sep 17 00:00:00 2001 From: Vadim Date: Thu, 5 Mar 2026 21:10:56 +0300 Subject: [PATCH] wip --- package.json | 3 +- src/generated/google/protobuf/descriptor.ts | 7272 +++++++++++++++++++ src/generated/google/protobuf/duration.ts | 200 + src/generated/google/protobuf/empty.ts | 86 + src/generated/google/protobuf/timestamp.ts | 230 + src/generated/message.ts | 3306 +++++++++ src/generated/validate/validate.ts | 6069 ++++++++++++++++ 7 files changed, 17164 insertions(+), 2 deletions(-) create mode 100644 src/generated/google/protobuf/descriptor.ts create mode 100644 src/generated/google/protobuf/duration.ts create mode 100644 src/generated/google/protobuf/empty.ts create mode 100644 src/generated/google/protobuf/timestamp.ts create mode 100644 src/generated/message.ts create mode 100644 src/generated/validate/validate.ts diff --git a/package.json b/package.json index 0214335..9f4d79f 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,7 @@ "private": true, "scripts": { "dev": "bun --watch ./src/index.ts", - "proto": "protoc --plugin=node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=esModuleInterop=true --ts_proto_out=./src/grpc/types -I ./proto/ ./proto/*.proto", - "test": "protoc --plugin=node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=esModuleInterop=true --ts_proto_out=./src/grpc/types -I ./proto/ ./proto/*.proto" + "proto": "protoc --plugin=node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=esModuleInterop=true --ts_proto_opt=outputServices=grpc-js --ts_proto_opt=env=node --ts_proto_out=./src/generated -I ./proto/ ./proto/*.proto" }, "devDependencies": { "@types/bcrypt": "^6.0.0", diff --git a/src/generated/google/protobuf/descriptor.ts b/src/generated/google/protobuf/descriptor.ts new file mode 100644 index 0000000..b7d36c1 --- /dev/null +++ b/src/generated/google/protobuf/descriptor.ts @@ -0,0 +1,7272 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.4 +// protoc v6.33.4 +// source: google/protobuf/descriptor.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** EDITION_UNSTABLE - A placeholder edition for developing and testing unscheduled features. */ + EDITION_UNSTABLE = 9999, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relied on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 9999: + case "EDITION_UNSTABLE": + return Edition.EDITION_UNSTABLE; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_UNSTABLE: + return "EDITION_UNSTABLE"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * Describes the 'visibility' of a symbol with respect to the proto import + * system. Symbols can only be imported when the visibility rules do not prevent + * it (ex: local symbols cannot be imported). Visibility modifiers can only set + * on `message` and `enum` as they are the only types available to be referenced + * from other files. + */ +export enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2, + UNRECOGNIZED = -1, +} + +export function symbolVisibilityFromJSON(object: any): SymbolVisibility { + switch (object) { + case 0: + case "VISIBILITY_UNSET": + return SymbolVisibility.VISIBILITY_UNSET; + case 1: + case "VISIBILITY_LOCAL": + return SymbolVisibility.VISIBILITY_LOCAL; + case 2: + case "VISIBILITY_EXPORT": + return SymbolVisibility.VISIBILITY_EXPORT; + case -1: + case "UNRECOGNIZED": + default: + return SymbolVisibility.UNRECOGNIZED; + } +} + +export function symbolVisibilityToJSON(object: SymbolVisibility): string { + switch (object) { + case SymbolVisibility.VISIBILITY_UNSET: + return "VISIBILITY_UNSET"; + case SymbolVisibility.VISIBILITY_LOCAL: + return "VISIBILITY_LOCAL"; + case SymbolVisibility.VISIBILITY_EXPORT: + return "VISIBILITY_EXPORT"; + case SymbolVisibility.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSet { + file: FileDescriptorProto[]; +} + +/** Describes a complete .proto file. */ +export interface FileDescriptorProto { + /** file name, relative to root of source tree */ + name?: + | string + | undefined; + /** e.g. "foo", "foo.bar", etc. */ + package?: + | string + | undefined; + /** Names of files imported by this file. */ + dependency: string[]; + /** Indexes of the public imported files in the dependency list above. */ + publicDependency: number[]; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + */ + weakDependency: number[]; + /** + * Names of files imported by this file purely for the purpose of providing + * option extensions. These are excluded from the dependency list above. + */ + optionDependency: string[]; + /** All top-level definitions in this file. */ + messageType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + service: ServiceDescriptorProto[]; + extension: FieldDescriptorProto[]; + options?: + | FileOptions + | undefined; + /** + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + */ + sourceCodeInfo?: + | SourceCodeInfo + | undefined; + /** + * The syntax of the proto file. + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + syntax?: + | string + | undefined; + /** + * The edition of the proto file. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + edition?: Edition | undefined; +} + +/** Describes a message type. */ +export interface DescriptorProto { + name?: string | undefined; + field: FieldDescriptorProto[]; + extension: FieldDescriptorProto[]; + nestedType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + extensionRange: DescriptorProto_ExtensionRange[]; + oneofDecl: OneofDescriptorProto[]; + options?: MessageOptions | undefined; + reservedRange: DescriptorProto_ReservedRange[]; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + */ + reservedName: string[]; + /** Support for `export` and `local` keywords on enums. */ + visibility?: SymbolVisibility | undefined; +} + +export interface DescriptorProto_ExtensionRange { + /** Inclusive. */ + start?: + | number + | undefined; + /** Exclusive. */ + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; +} + +/** + * Range of reserved tag numbers. Reserved tag numbers may not be used by + * fields or extension ranges in the same message. Reserved ranges may + * not overlap. + */ +export interface DescriptorProto_ReservedRange { + /** Inclusive. */ + start?: + | number + | undefined; + /** Exclusive. */ + end?: number | undefined; +} + +export interface ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; +} + +/** Describes a field within a message. */ +export interface FieldDescriptorProto { + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; + /** + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + */ + type?: + | FieldDescriptorProto_Type + | undefined; + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + */ + typeName?: + | string + | undefined; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + */ + extendee?: + | string + | undefined; + /** + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + */ + defaultValue?: + | string + | undefined; + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + */ + oneofIndex?: + | number + | undefined; + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + */ + jsonName?: string | undefined; + options?: + | FieldOptions + | undefined; + /** + * If true, this is a proto3 "optional". When a proto3 field is optional, it + * tracks presence regardless of field type. + * + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. + * + * For message fields, proto3_optional doesn't create any semantic change, + * since non-repeated message fields always track presence. However it still + * indicates the semantic detail of whether the user wrote "optional" or not. + * This can be useful for round-tripping the .proto file. For consistency we + * give message fields a synthetic oneof also, even though it is not required + * to track presence. This is especially important because the parser can't + * tell if a field is a message or an enum, so it must always create a + * synthetic oneof. + * + * Proto2 optional fields do not set this flag, because they already indicate + * optional with `LABEL_OPTIONAL`. + */ + proto3Optional?: boolean | undefined; +} + +export enum FieldDescriptorProto_Type { + /** + * TYPE_DOUBLE - 0 is reserved for errors. + * Order is weird for historical reasons. + */ + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + /** + * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + */ + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + /** + * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + */ + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported after google.protobuf. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. + */ + TYPE_GROUP = 10, + /** TYPE_MESSAGE - Length-delimited aggregate. */ + TYPE_MESSAGE = 11, + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = 17, + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = 18, + UNRECOGNIZED = -1, +} + +export function fieldDescriptorProto_TypeFromJSON(object: any): FieldDescriptorProto_Type { + switch (object) { + case 1: + case "TYPE_DOUBLE": + return FieldDescriptorProto_Type.TYPE_DOUBLE; + case 2: + case "TYPE_FLOAT": + return FieldDescriptorProto_Type.TYPE_FLOAT; + case 3: + case "TYPE_INT64": + return FieldDescriptorProto_Type.TYPE_INT64; + case 4: + case "TYPE_UINT64": + return FieldDescriptorProto_Type.TYPE_UINT64; + case 5: + case "TYPE_INT32": + return FieldDescriptorProto_Type.TYPE_INT32; + case 6: + case "TYPE_FIXED64": + return FieldDescriptorProto_Type.TYPE_FIXED64; + case 7: + case "TYPE_FIXED32": + return FieldDescriptorProto_Type.TYPE_FIXED32; + case 8: + case "TYPE_BOOL": + return FieldDescriptorProto_Type.TYPE_BOOL; + case 9: + case "TYPE_STRING": + return FieldDescriptorProto_Type.TYPE_STRING; + case 10: + case "TYPE_GROUP": + return FieldDescriptorProto_Type.TYPE_GROUP; + case 11: + case "TYPE_MESSAGE": + return FieldDescriptorProto_Type.TYPE_MESSAGE; + case 12: + case "TYPE_BYTES": + return FieldDescriptorProto_Type.TYPE_BYTES; + case 13: + case "TYPE_UINT32": + return FieldDescriptorProto_Type.TYPE_UINT32; + case 14: + case "TYPE_ENUM": + return FieldDescriptorProto_Type.TYPE_ENUM; + case 15: + case "TYPE_SFIXED32": + return FieldDescriptorProto_Type.TYPE_SFIXED32; + case 16: + case "TYPE_SFIXED64": + return FieldDescriptorProto_Type.TYPE_SFIXED64; + case 17: + case "TYPE_SINT32": + return FieldDescriptorProto_Type.TYPE_SINT32; + case 18: + case "TYPE_SINT64": + return FieldDescriptorProto_Type.TYPE_SINT64; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Type.UNRECOGNIZED; + } +} + +export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Type): string { + switch (object) { + case FieldDescriptorProto_Type.TYPE_DOUBLE: + return "TYPE_DOUBLE"; + case FieldDescriptorProto_Type.TYPE_FLOAT: + return "TYPE_FLOAT"; + case FieldDescriptorProto_Type.TYPE_INT64: + return "TYPE_INT64"; + case FieldDescriptorProto_Type.TYPE_UINT64: + return "TYPE_UINT64"; + case FieldDescriptorProto_Type.TYPE_INT32: + return "TYPE_INT32"; + case FieldDescriptorProto_Type.TYPE_FIXED64: + return "TYPE_FIXED64"; + case FieldDescriptorProto_Type.TYPE_FIXED32: + return "TYPE_FIXED32"; + case FieldDescriptorProto_Type.TYPE_BOOL: + return "TYPE_BOOL"; + case FieldDescriptorProto_Type.TYPE_STRING: + return "TYPE_STRING"; + case FieldDescriptorProto_Type.TYPE_GROUP: + return "TYPE_GROUP"; + case FieldDescriptorProto_Type.TYPE_MESSAGE: + return "TYPE_MESSAGE"; + case FieldDescriptorProto_Type.TYPE_BYTES: + return "TYPE_BYTES"; + case FieldDescriptorProto_Type.TYPE_UINT32: + return "TYPE_UINT32"; + case FieldDescriptorProto_Type.TYPE_ENUM: + return "TYPE_ENUM"; + case FieldDescriptorProto_Type.TYPE_SFIXED32: + return "TYPE_SFIXED32"; + case FieldDescriptorProto_Type.TYPE_SFIXED64: + return "TYPE_SFIXED64"; + case FieldDescriptorProto_Type.TYPE_SINT32: + return "TYPE_SINT32"; + case FieldDescriptorProto_Type.TYPE_SINT64: + return "TYPE_SINT64"; + case FieldDescriptorProto_Type.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FieldDescriptorProto_Label { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = 1, + LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, + UNRECOGNIZED = -1, +} + +export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label { + switch (object) { + case 1: + case "LABEL_OPTIONAL": + return FieldDescriptorProto_Label.LABEL_OPTIONAL; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProto_Label.LABEL_REPEATED; + case 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Label.UNRECOGNIZED; + } +} + +export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_Label): string { + switch (object) { + case FieldDescriptorProto_Label.LABEL_OPTIONAL: + return "LABEL_OPTIONAL"; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return "LABEL_REPEATED"; + case FieldDescriptorProto_Label.LABEL_REQUIRED: + return "LABEL_REQUIRED"; + case FieldDescriptorProto_Label.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name?: string | undefined; + options?: OneofOptions | undefined; +} + +/** Describes an enum type. */ +export interface EnumDescriptorProto { + name?: string | undefined; + value: EnumValueDescriptorProto[]; + options?: + | EnumOptions + | undefined; + /** + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + */ + reservedRange: EnumDescriptorProto_EnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reservedName: string[]; + /** Support for `export` and `local` keywords on enums. */ + visibility?: SymbolVisibility | undefined; +} + +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. + */ +export interface EnumDescriptorProto_EnumReservedRange { + /** Inclusive. */ + start?: + | number + | undefined; + /** Inclusive. */ + end?: number | undefined; +} + +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; +} + +/** Describes a service. */ +export interface ServiceDescriptorProto { + name?: string | undefined; + method: MethodDescriptorProto[]; + options?: ServiceOptions | undefined; +} + +/** Describes a method of a service. */ +export interface MethodDescriptorProto { + name?: + | string + | undefined; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + */ + inputType?: string | undefined; + outputType?: string | undefined; + options?: + | MethodOptions + | undefined; + /** Identifies if client streams multiple client messages */ + clientStreaming?: + | boolean + | undefined; + /** Identifies if server streams multiple server messages */ + serverStreaming?: boolean | undefined; +} + +export interface FileOptions { + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + */ + javaPackage?: + | string + | undefined; + /** + * Controls the name of the wrapper Java class generated for the .proto file. + * That class will always contain the .proto file's getDescriptor() method as + * well as any top-level extensions defined in the .proto file. + * If java_multiple_files is disabled, then all the other classes from the + * .proto file will be nested inside the single wrapper outer class. + */ + javaOuterClassname?: + | string + | undefined; + /** + * If enabled, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the wrapper class + * named by java_outer_classname. However, the wrapper class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + */ + javaMultipleFiles?: + | boolean + | undefined; + /** + * This option does nothing. + * + * @deprecated + */ + javaGenerateEqualsAndHash?: + | boolean + | undefined; + /** + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. + */ + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + */ + goPackage?: + | string + | undefined; + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + */ + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; + /** + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + */ + deprecated?: + | boolean + | undefined; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + ccEnableArenas?: + | boolean + | undefined; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objcClassPrefix?: + | string + | undefined; + /** Namespace for generated classes; defaults to the package. */ + csharpNamespace?: + | string + | undefined; + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + */ + swiftPrefix?: + | string + | undefined; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + phpClassPrefix?: + | string + | undefined; + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + */ + phpNamespace?: + | string + | undefined; + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + */ + phpMetadataNamespace?: + | string + | undefined; + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + */ + rubyPackage?: + | string + | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpretedOption: UninterpretedOption[]; +} + +/** Generated classes can be optimized for speed or code size. */ +export enum FileOptions_OptimizeMode { + /** SPEED - Generate complete code for parsing, serialization, */ + SPEED = 1, + /** CODE_SIZE - etc. */ + CODE_SIZE = 2, + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + LITE_RUNTIME = 3, + UNRECOGNIZED = -1, +} + +export function fileOptions_OptimizeModeFromJSON(object: any): FileOptions_OptimizeMode { + switch (object) { + case 1: + case "SPEED": + return FileOptions_OptimizeMode.SPEED; + case 2: + case "CODE_SIZE": + return FileOptions_OptimizeMode.CODE_SIZE; + case 3: + case "LITE_RUNTIME": + return FileOptions_OptimizeMode.LITE_RUNTIME; + case -1: + case "UNRECOGNIZED": + default: + return FileOptions_OptimizeMode.UNRECOGNIZED; + } +} + +export function fileOptions_OptimizeModeToJSON(object: FileOptions_OptimizeMode): string { + switch (object) { + case FileOptions_OptimizeMode.SPEED: + return "SPEED"; + case FileOptions_OptimizeMode.CODE_SIZE: + return "CODE_SIZE"; + case FileOptions_OptimizeMode.LITE_RUNTIME: + return "LITE_RUNTIME"; + case FileOptions_OptimizeMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface MessageOptions { + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + */ + messageSetWireFormat?: + | boolean + | undefined; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + */ + noStandardDescriptorAccessor?: + | boolean + | undefined; + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + */ + deprecated?: + | boolean + | undefined; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + */ + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface FieldOptions { + /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. + */ + ctype?: + | FieldOptions_CType + | undefined; + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. + */ + packed?: + | boolean + | undefined; + /** + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + */ + jstype?: + | FieldOptions_JSType + | undefined; + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. + */ + unverifiedLazy?: + | boolean + | undefined; + /** + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + */ + deprecated?: + | boolean + | undefined; + /** + * DEPRECATED. DO NOT USE! + * For Google-internal migration only. Do not use. + * + * @deprecated + */ + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ + CORD = 1, + STRING_PIECE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_CTypeFromJSON(object: any): FieldOptions_CType { + switch (object) { + case 0: + case "STRING": + return FieldOptions_CType.STRING; + case 1: + case "CORD": + return FieldOptions_CType.CORD; + case 2: + case "STRING_PIECE": + return FieldOptions_CType.STRING_PIECE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_CType.UNRECOGNIZED; + } +} + +export function fieldOptions_CTypeToJSON(object: FieldOptions_CType): string { + switch (object) { + case FieldOptions_CType.STRING: + return "STRING"; + case FieldOptions_CType.CORD: + return "CORD"; + case FieldOptions_CType.STRING_PIECE: + return "STRING_PIECE"; + case FieldOptions_CType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FieldOptions_JSType { + /** JS_NORMAL - Use the default type. */ + JS_NORMAL = 0, + /** JS_STRING - Use JavaScript strings. */ + JS_STRING = 1, + /** JS_NUMBER - Use JavaScript numbers. */ + JS_NUMBER = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_JSTypeFromJSON(object: any): FieldOptions_JSType { + switch (object) { + case 0: + case "JS_NORMAL": + return FieldOptions_JSType.JS_NORMAL; + case 1: + case "JS_STRING": + return FieldOptions_JSType.JS_STRING; + case 2: + case "JS_NUMBER": + return FieldOptions_JSType.JS_NUMBER; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_JSType.UNRECOGNIZED; + } +} + +export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { + switch (object) { + case FieldOptions_JSType.JS_NORMAL: + return "JS_NORMAL"; + case FieldOptions_JSType.JS_STRING: + return "JS_STRING"; + case FieldOptions_JSType.JS_NUMBER: + return "JS_NUMBER"; + case FieldOptions_JSType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** If set to RETENTION_SOURCE, the option will be omitted from the binary. */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + +export interface OneofOptions { + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface EnumOptions { + /** + * Set this option to true to allow mapping different tag names to the same + * value. + */ + allowAlias?: + | boolean + | undefined; + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + */ + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface EnumValueOptions { + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + */ + deprecated?: + | boolean + | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface ServiceOptions { + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + */ + deprecated?: + | boolean + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface MethodOptions { + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + */ + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +/** + * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + * or neither? HTTP based RPC implementation may choose GET verb for safe + * methods, and PUT verb for idempotent methods instead of the default POST. + */ +export enum MethodOptions_IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + /** NO_SIDE_EFFECTS - implies idempotent */ + NO_SIDE_EFFECTS = 1, + /** IDEMPOTENT - idempotent, but may have side effects */ + IDEMPOTENT = 2, + UNRECOGNIZED = -1, +} + +export function methodOptions_IdempotencyLevelFromJSON(object: any): MethodOptions_IdempotencyLevel { + switch (object) { + case 0: + case "IDEMPOTENCY_UNKNOWN": + return MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN; + case 1: + case "NO_SIDE_EFFECTS": + return MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS; + case 2: + case "IDEMPOTENT": + return MethodOptions_IdempotencyLevel.IDEMPOTENT; + case -1: + case "UNRECOGNIZED": + default: + return MethodOptions_IdempotencyLevel.UNRECOGNIZED; + } +} + +export function methodOptions_IdempotencyLevelToJSON(object: MethodOptions_IdempotencyLevel): string { + switch (object) { + case MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN: + return "IDEMPOTENCY_UNKNOWN"; + case MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS: + return "NO_SIDE_EFFECTS"; + case MethodOptions_IdempotencyLevel.IDEMPOTENT: + return "IDEMPOTENT"; + case MethodOptions_IdempotencyLevel.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOption { + name: UninterpretedOption_NamePart[]; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + */ + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Buffer | undefined; + aggregateValue?: string | undefined; +} + +/** + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". + */ +export interface UninterpretedOption_NamePart { + namePart: string; + isExtension: boolean; +} + +/** + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. + */ +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; + enforceNamingStyle?: FeatureSet_EnforceNamingStyle | undefined; + defaultSymbolVisibility?: FeatureSet_VisibilityFeature_DefaultSymbolVisibility | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FeatureSet_EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2, + UNRECOGNIZED = -1, +} + +export function featureSet_EnforceNamingStyleFromJSON(object: any): FeatureSet_EnforceNamingStyle { + switch (object) { + case 0: + case "ENFORCE_NAMING_STYLE_UNKNOWN": + return FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN; + case 1: + case "STYLE2024": + return FeatureSet_EnforceNamingStyle.STYLE2024; + case 2: + case "STYLE_LEGACY": + return FeatureSet_EnforceNamingStyle.STYLE_LEGACY; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnforceNamingStyle.UNRECOGNIZED; + } +} + +export function featureSet_EnforceNamingStyleToJSON(object: FeatureSet_EnforceNamingStyle): string { + switch (object) { + case FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN: + return "ENFORCE_NAMING_STYLE_UNKNOWN"; + case FeatureSet_EnforceNamingStyle.STYLE2024: + return "STYLE2024"; + case FeatureSet_EnforceNamingStyle.STYLE_LEGACY: + return "STYLE_LEGACY"; + case FeatureSet_EnforceNamingStyle.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface FeatureSet_VisibilityFeature { +} + +export enum FeatureSet_VisibilityFeature_DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + /** EXPORT_ALL - Default pre-EDITION_2024, all UNSET visibility are export. */ + EXPORT_ALL = 1, + /** EXPORT_TOP_LEVEL - All top-level symbols default to export, nested default to local. */ + EXPORT_TOP_LEVEL = 2, + /** LOCAL_ALL - All symbols default to local. */ + LOCAL_ALL = 3, + /** + * STRICT - All symbols local by default. Nested types cannot be exported. + * With special case caveat for message { enum {} reserved 1 to max; } + * This is the recommended setting for new protos. + */ + STRICT = 4, + UNRECOGNIZED = -1, +} + +export function featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON( + object: any, +): FeatureSet_VisibilityFeature_DefaultSymbolVisibility { + switch (object) { + case 0: + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN; + case 1: + case "EXPORT_ALL": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_ALL; + case 2: + case "EXPORT_TOP_LEVEL": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_TOP_LEVEL; + case 3: + case "LOCAL_ALL": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.LOCAL_ALL; + case 4: + case "STRICT": + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.STRICT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.UNRECOGNIZED; + } +} + +export function featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON( + object: FeatureSet_VisibilityFeature_DefaultSymbolVisibility, +): string { + switch (object) { + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN: + return "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_ALL: + return "EXPORT_ALL"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_TOP_LEVEL: + return "EXPORT_TOP_LEVEL"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.LOCAL_ALL: + return "LOCAL_ALL"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.STRICT: + return "STRICT"; + case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfo { + /** + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + */ + location: SourceCodeInfo_Location[]; +} + +export interface SourceCodeInfo_Location { + /** + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + */ + path: number[]; + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + */ + span: number[]; + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * + * Examples: + * + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * + * // Comment attached to moo. + * // + * // Another line attached to moo. + * optional double moo = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to moo or corge because there are blank lines separating it from + * // both. + * + * // Detached comment for corge paragraph 2. + * + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. * / + * /* Block comment attached to + * * grault. * / + * optional int32 grault = 6; + * + * // ignored detached comments. + */ + leadingComments?: string | undefined; + trailingComments?: string | undefined; + leadingDetachedComments: string[]; +} + +/** + * Describes the relationship between generated code and its original source + * file. A GeneratedCodeInfo message is associated with only one generated + * source file, but may contain references to different source .proto files. + */ +export interface GeneratedCodeInfo { + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + */ + annotation: GeneratedCodeInfo_Annotation[]; +} + +export interface GeneratedCodeInfo_Annotation { + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + */ + path: number[]; + /** Identifies the filesystem path to the original source .proto. */ + sourceFile?: + | string + | undefined; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin?: + | number + | undefined; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified object. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +function createBaseFileDescriptorSet(): FileDescriptorSet { + return { file: [] }; +} + +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.file) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.file.push(FileDescriptorProto.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FileDescriptorSet { + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; + }, + + toJSON(message: FileDescriptorSet): unknown { + const obj: any = {}; + if (message.file?.length) { + obj.file = message.file.map((e) => FileDescriptorProto.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FileDescriptorSet { + return FileDescriptorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FileDescriptorSet { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map((e) => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFileDescriptorProto(): FileDescriptorProto { + return { + name: "", + package: "", + dependency: [], + publicDependency: [], + weakDependency: [], + optionDependency: [], + messageType: [], + enumType: [], + service: [], + extension: [], + options: undefined, + sourceCodeInfo: undefined, + syntax: "", + edition: 0, + }; +} + +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.package !== undefined && message.package !== "") { + writer.uint32(18).string(message.package); + } + for (const v of message.dependency) { + writer.uint32(26).string(v!); + } + for (const v of message.publicDependency) { + writer.uint32(80).int32(v!); + } + for (const v of message.weakDependency) { + writer.uint32(88).int32(v!); + } + for (const v of message.optionDependency) { + writer.uint32(122).string(v!); + } + for (const v of message.messageType) { + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.service) { + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.options !== undefined) { + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); + } + if (message.sourceCodeInfo !== undefined) { + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); + } + if (message.syntax !== undefined && message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.package = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.dependency.push(reader.string()); + continue; + } + case 10: { + if (tag === 80) { + message.publicDependency.push(reader.int32()); + + continue; + } + + if (tag === 82) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.publicDependency.push(reader.int32()); + } + + continue; + } + + break; + } + case 11: { + if (tag === 88) { + message.weakDependency.push(reader.int32()); + + continue; + } + + if (tag === 90) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.weakDependency.push(reader.int32()); + } + + continue; + } + + break; + } + case 15: { + if (tag !== 122) { + break; + } + + message.optionDependency.push(reader.string()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.messageType.push(DescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.service.push(ServiceDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.options = FileOptions.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.sourceCodeInfo = SourceCodeInfo.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.syntax = reader.string(); + continue; + } + case 14: { + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FileDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) + : [], + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.public_dependency) + ? object.public_dependency.map((e: any) => globalThis.Number(e)) + : [], + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.weak_dependency) + ? object.weak_dependency.map((e: any) => globalThis.Number(e)) + : [], + optionDependency: globalThis.Array.isArray(object?.optionDependency) + ? object.optionDependency.map((e: any) => globalThis.String(e)) + : globalThis.Array.isArray(object?.option_dependency) + ? object.option_dependency.map((e: any) => globalThis.String(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) + ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) + : globalThis.Array.isArray(object?.message_type) + ? object.message_type.map((e: any) => DescriptorProto.fromJSON(e)) + : [], + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : globalThis.Array.isArray(object?.enum_type) + ? object.enum_type.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) + ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, + sourceCodeInfo: isSet(object.sourceCodeInfo) + ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) + : isSet(object.source_code_info) + ? SourceCodeInfo.fromJSON(object.source_code_info) + : undefined, + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + }; + }, + + toJSON(message: FileDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.package !== undefined && message.package !== "") { + obj.package = message.package; + } + if (message.dependency?.length) { + obj.dependency = message.dependency; + } + if (message.publicDependency?.length) { + obj.publicDependency = message.publicDependency.map((e) => Math.round(e)); + } + if (message.weakDependency?.length) { + obj.weakDependency = message.weakDependency.map((e) => Math.round(e)); + } + if (message.optionDependency?.length) { + obj.optionDependency = message.optionDependency; + } + if (message.messageType?.length) { + obj.messageType = message.messageType.map((e) => DescriptorProto.toJSON(e)); + } + if (message.enumType?.length) { + obj.enumType = message.enumType.map((e) => EnumDescriptorProto.toJSON(e)); + } + if (message.service?.length) { + obj.service = message.service.map((e) => ServiceDescriptorProto.toJSON(e)); + } + if (message.extension?.length) { + obj.extension = message.extension.map((e) => FieldDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = FileOptions.toJSON(message.options); + } + if (message.sourceCodeInfo !== undefined) { + obj.sourceCodeInfo = SourceCodeInfo.toJSON(message.sourceCodeInfo); + } + if (message.syntax !== undefined && message.syntax !== "") { + obj.syntax = message.syntax; + } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + return obj; + }, + + create, I>>(base?: I): FileDescriptorProto { + return FileDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FileDescriptorProto { + const message = createBaseFileDescriptorProto(); + message.name = object.name ?? ""; + message.package = object.package ?? ""; + message.dependency = object.dependency?.map((e) => e) || []; + message.publicDependency = object.publicDependency?.map((e) => e) || []; + message.weakDependency = object.weakDependency?.map((e) => e) || []; + message.optionDependency = object.optionDependency?.map((e) => e) || []; + message.messageType = object.messageType?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; + message.service = object.service?.map((e) => ServiceDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? FileOptions.fromPartial(object.options) + : undefined; + message.sourceCodeInfo = (object.sourceCodeInfo !== undefined && object.sourceCodeInfo !== null) + ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) + : undefined; + message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; + return message; + }, +}; + +function createBaseDescriptorProto(): DescriptorProto { + return { + name: "", + field: [], + extension: [], + nestedType: [], + enumType: [], + extensionRange: [], + oneofDecl: [], + options: undefined, + reservedRange: [], + reservedName: [], + visibility: 0, + }; +} + +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.field) { + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.nestedType) { + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.extensionRange) { + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.oneofDecl) { + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.options !== undefined) { + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); + } + for (const v of message.reservedRange) { + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); + } + for (const v of message.reservedName) { + writer.uint32(82).string(v!); + } + if (message.visibility !== undefined && message.visibility !== 0) { + writer.uint32(88).int32(message.visibility); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.field.push(FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.nestedType.push(DescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.extensionRange.push(DescriptorProto_ExtensionRange.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.oneofDecl.push(OneofDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.options = MessageOptions.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.reservedRange.push(DescriptorProto_ReservedRange.decode(reader, reader.uint32())); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.reservedName.push(reader.string()); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + + message.visibility = reader.int32() as any; + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) + ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + nestedType: globalThis.Array.isArray(object?.nestedType) + ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) + : globalThis.Array.isArray(object?.nested_type) + ? object.nested_type.map((e: any) => DescriptorProto.fromJSON(e)) + : [], + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : globalThis.Array.isArray(object?.enum_type) + ? object.enum_type.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) + ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) + : globalThis.Array.isArray(object?.extension_range) + ? object.extension_range.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) + : [], + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) + ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) + : globalThis.Array.isArray(object?.oneof_decl) + ? object.oneof_decl.map((e: any) => OneofDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, + reservedRange: globalThis.Array.isArray(object?.reservedRange) + ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) + : globalThis.Array.isArray(object?.reserved_range) + ? object.reserved_range.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) + : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : globalThis.Array.isArray(object?.reserved_name) + ? object.reserved_name.map((e: any) => globalThis.String(e)) + : [], + visibility: isSet(object.visibility) ? symbolVisibilityFromJSON(object.visibility) : 0, + }; + }, + + toJSON(message: DescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.field?.length) { + obj.field = message.field.map((e) => FieldDescriptorProto.toJSON(e)); + } + if (message.extension?.length) { + obj.extension = message.extension.map((e) => FieldDescriptorProto.toJSON(e)); + } + if (message.nestedType?.length) { + obj.nestedType = message.nestedType.map((e) => DescriptorProto.toJSON(e)); + } + if (message.enumType?.length) { + obj.enumType = message.enumType.map((e) => EnumDescriptorProto.toJSON(e)); + } + if (message.extensionRange?.length) { + obj.extensionRange = message.extensionRange.map((e) => DescriptorProto_ExtensionRange.toJSON(e)); + } + if (message.oneofDecl?.length) { + obj.oneofDecl = message.oneofDecl.map((e) => OneofDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = MessageOptions.toJSON(message.options); + } + if (message.reservedRange?.length) { + obj.reservedRange = message.reservedRange.map((e) => DescriptorProto_ReservedRange.toJSON(e)); + } + if (message.reservedName?.length) { + obj.reservedName = message.reservedName; + } + if (message.visibility !== undefined && message.visibility !== 0) { + obj.visibility = symbolVisibilityToJSON(message.visibility); + } + return obj; + }, + + create, I>>(base?: I): DescriptorProto { + return DescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DescriptorProto { + const message = createBaseDescriptorProto(); + message.name = object.name ?? ""; + message.field = object.field?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.nestedType = object.nestedType?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; + message.extensionRange = object.extensionRange?.map((e) => DescriptorProto_ExtensionRange.fromPartial(e)) || []; + message.oneofDecl = object.oneofDecl?.map((e) => OneofDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? MessageOptions.fromPartial(object.options) + : undefined; + message.reservedRange = object.reservedRange?.map((e) => DescriptorProto_ReservedRange.fromPartial(e)) || []; + message.reservedName = object.reservedName?.map((e) => e) || []; + message.visibility = object.visibility ?? 0; + return message; + }, +}; + +function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { + return { start: 0, end: 0, options: undefined }; +} + +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + if (message.options !== undefined) { + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ExtensionRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.start = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.end = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.options = ExtensionRangeOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DescriptorProto_ExtensionRange { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: DescriptorProto_ExtensionRange): unknown { + const obj: any = {}; + if (message.start !== undefined && message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + if (message.options !== undefined) { + obj.options = ExtensionRangeOptions.toJSON(message.options); + } + return obj; + }, + + create, I>>(base?: I): DescriptorProto_ExtensionRange { + return DescriptorProto_ExtensionRange.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): DescriptorProto_ExtensionRange { + const message = createBaseDescriptorProto_ExtensionRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + message.options = (object.options !== undefined && object.options !== null) + ? ExtensionRangeOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { + return { start: 0, end: 0 }; +} + +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.start = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.end = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DescriptorProto_ReservedRange { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; + }, + + toJSON(message: DescriptorProto_ReservedRange): unknown { + const obj: any = {}; + if (message.start !== undefined && message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + return obj; + }, + + create, I>>(base?: I): DescriptorProto_ReservedRange { + return DescriptorProto_ReservedRange.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): DescriptorProto_ReservedRange { + const message = createBaseDescriptorProto_ReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +function createBaseExtensionRangeOptions(): ExtensionRangeOptions { + return { uninterpretedOption: [], declaration: [], features: undefined, verification: 1 }; +} + +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + } + case 50: { + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions { + return { + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + declaration: globalThis.Array.isArray(object?.declaration) + ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) + ? extensionRangeOptions_VerificationStateFromJSON(object.verification) + : 1, + }; + }, + + toJSON(message: ExtensionRangeOptions): unknown { + const obj: any = {}; + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); + } + return obj; + }, + + create, I>>(base?: I): ExtensionRangeOptions { + return ExtensionRangeOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtensionRangeOptions { + const message = createBaseExtensionRangeOptions(); + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? 1; + return message; + }, +}; + +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; +} + +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); + } + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); + } + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions_Declaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + fullName: isSet(object.fullName) + ? globalThis.String(object.fullName) + : isSet(object.full_name) + ? globalThis.String(object.full_name) + : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptions_Declaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + obj.fullName = message.fullName; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>( + base?: I, + ): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); + } + if (message.options !== undefined) { + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); + } + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { + writer.uint32(136).bool(message.proto3Optional); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.number = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.label = reader.int32() as any; + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.type = reader.int32() as any; + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.typeName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.extendee = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.defaultValue = reader.string(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.oneofIndex = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.jsonName = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.options = FieldOptions.decode(reader, reader.uint32()); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + + message.proto3Optional = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, + typeName: isSet(object.typeName) + ? globalThis.String(object.typeName) + : isSet(object.type_name) + ? globalThis.String(object.type_name) + : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) + ? globalThis.String(object.defaultValue) + : isSet(object.default_value) + ? globalThis.String(object.default_value) + : "", + oneofIndex: isSet(object.oneofIndex) + ? globalThis.Number(object.oneofIndex) + : isSet(object.oneof_index) + ? globalThis.Number(object.oneof_index) + : 0, + jsonName: isSet(object.jsonName) + ? globalThis.String(object.jsonName) + : isSet(object.json_name) + ? globalThis.String(object.json_name) + : "", + options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, + proto3Optional: isSet(object.proto3Optional) + ? globalThis.Boolean(object.proto3Optional) + : isSet(object.proto3_optional) + ? globalThis.Boolean(object.proto3_optional) + : false, + }; + }, + + toJSON(message: FieldDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.label !== undefined && message.label !== 1) { + obj.label = fieldDescriptorProto_LabelToJSON(message.label); + } + if (message.type !== undefined && message.type !== 1) { + obj.type = fieldDescriptorProto_TypeToJSON(message.type); + } + if (message.typeName !== undefined && message.typeName !== "") { + obj.typeName = message.typeName; + } + if (message.extendee !== undefined && message.extendee !== "") { + obj.extendee = message.extendee; + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + obj.defaultValue = message.defaultValue; + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + obj.oneofIndex = Math.round(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + obj.jsonName = message.jsonName; + } + if (message.options !== undefined) { + obj.options = FieldOptions.toJSON(message.options); + } + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { + obj.proto3Optional = message.proto3Optional; + } + return obj; + }, + + create, I>>(base?: I): FieldDescriptorProto { + return FieldDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldDescriptorProto { + const message = createBaseFieldDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.label = object.label ?? 1; + message.type = object.type ?? 1; + message.typeName = object.typeName ?? ""; + message.extendee = object.extendee ?? ""; + message.defaultValue = object.defaultValue ?? ""; + message.oneofIndex = object.oneofIndex ?? 0; + message.jsonName = object.jsonName ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? FieldOptions.fromPartial(object.options) + : undefined; + message.proto3Optional = object.proto3Optional ?? false; + return message; + }, +}; + +function createBaseOneofDescriptorProto(): OneofDescriptorProto { + return { name: "", options: undefined }; +} + +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.options !== undefined) { + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.options = OneofOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: OneofDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.options !== undefined) { + obj.options = OneofOptions.toJSON(message.options); + } + return obj; + }, + + create, I>>(base?: I): OneofDescriptorProto { + return OneofDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofDescriptorProto { + const message = createBaseOneofDescriptorProto(); + message.name = object.name ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? OneofOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseEnumDescriptorProto(): EnumDescriptorProto { + return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [], visibility: 0 }; +} + +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.value) { + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.options !== undefined) { + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + for (const v of message.reservedRange) { + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.reservedName) { + writer.uint32(42).string(v!); + } + if (message.visibility !== undefined && message.visibility !== 0) { + writer.uint32(48).int32(message.visibility); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value.push(EnumValueDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.options = EnumOptions.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reservedRange.push(EnumDescriptorProto_EnumReservedRange.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.reservedName.push(reader.string()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.visibility = reader.int32() as any; + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, + reservedRange: globalThis.Array.isArray(object?.reservedRange) + ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) + : globalThis.Array.isArray(object?.reserved_range) + ? object.reserved_range.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) + : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : globalThis.Array.isArray(object?.reserved_name) + ? object.reserved_name.map((e: any) => globalThis.String(e)) + : [], + visibility: isSet(object.visibility) ? symbolVisibilityFromJSON(object.visibility) : 0, + }; + }, + + toJSON(message: EnumDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.value?.length) { + obj.value = message.value.map((e) => EnumValueDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = EnumOptions.toJSON(message.options); + } + if (message.reservedRange?.length) { + obj.reservedRange = message.reservedRange.map((e) => EnumDescriptorProto_EnumReservedRange.toJSON(e)); + } + if (message.reservedName?.length) { + obj.reservedName = message.reservedName; + } + if (message.visibility !== undefined && message.visibility !== 0) { + obj.visibility = symbolVisibilityToJSON(message.visibility); + } + return obj; + }, + + create, I>>(base?: I): EnumDescriptorProto { + return EnumDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EnumDescriptorProto { + const message = createBaseEnumDescriptorProto(); + message.name = object.name ?? ""; + message.value = object.value?.map((e) => EnumValueDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? EnumOptions.fromPartial(object.options) + : undefined; + message.reservedRange = object.reservedRange?.map((e) => EnumDescriptorProto_EnumReservedRange.fromPartial(e)) || + []; + message.reservedName = object.reservedName?.map((e) => e) || []; + message.visibility = object.visibility ?? 0; + return message; + }, +}; + +function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { + return { start: 0, end: 0 }; +} + +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.start = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.end = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; + }, + + toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + const obj: any = {}; + if (message.start !== undefined && message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + return obj; + }, + + create, I>>( + base?: I, + ): EnumDescriptorProto_EnumReservedRange { + return EnumDescriptorProto_EnumReservedRange.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): EnumDescriptorProto_EnumReservedRange { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { + return { name: "", number: 0, options: undefined }; +} + +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.options !== undefined) { + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.number = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.options = EnumValueOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumValueDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: EnumValueDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.options !== undefined) { + obj.options = EnumValueOptions.toJSON(message.options); + } + return obj; + }, + + create, I>>(base?: I): EnumValueDescriptorProto { + return EnumValueDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EnumValueDescriptorProto { + const message = createBaseEnumValueDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.options = (object.options !== undefined && object.options !== null) + ? EnumValueOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseServiceDescriptorProto(): ServiceDescriptorProto { + return { name: "", method: [], options: undefined }; +} + +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.method) { + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.options !== undefined) { + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.method.push(MethodDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.options = ServiceOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.Array.isArray(object?.method) + ? object.method.map((e: any) => MethodDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? ServiceOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: ServiceDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.method?.length) { + obj.method = message.method.map((e) => MethodDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = ServiceOptions.toJSON(message.options); + } + return obj; + }, + + create, I>>(base?: I): ServiceDescriptorProto { + return ServiceDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceDescriptorProto { + const message = createBaseServiceDescriptorProto(); + message.name = object.name ?? ""; + message.method = object.method?.map((e) => MethodDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? ServiceOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseMethodDescriptorProto(): MethodDescriptorProto { + return { + name: "", + inputType: "", + outputType: "", + options: undefined, + clientStreaming: false, + serverStreaming: false, + }; +} + +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.inputType !== undefined && message.inputType !== "") { + writer.uint32(18).string(message.inputType); + } + if (message.outputType !== undefined && message.outputType !== "") { + writer.uint32(26).string(message.outputType); + } + if (message.options !== undefined) { + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); + } + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { + writer.uint32(40).bool(message.clientStreaming); + } + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { + writer.uint32(48).bool(message.serverStreaming); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.inputType = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.outputType = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.options = MethodOptions.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.clientStreaming = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.serverStreaming = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MethodDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) + ? globalThis.String(object.inputType) + : isSet(object.input_type) + ? globalThis.String(object.input_type) + : "", + outputType: isSet(object.outputType) + ? globalThis.String(object.outputType) + : isSet(object.output_type) + ? globalThis.String(object.output_type) + : "", + options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, + clientStreaming: isSet(object.clientStreaming) + ? globalThis.Boolean(object.clientStreaming) + : isSet(object.client_streaming) + ? globalThis.Boolean(object.client_streaming) + : false, + serverStreaming: isSet(object.serverStreaming) + ? globalThis.Boolean(object.serverStreaming) + : isSet(object.server_streaming) + ? globalThis.Boolean(object.server_streaming) + : false, + }; + }, + + toJSON(message: MethodDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.inputType !== undefined && message.inputType !== "") { + obj.inputType = message.inputType; + } + if (message.outputType !== undefined && message.outputType !== "") { + obj.outputType = message.outputType; + } + if (message.options !== undefined) { + obj.options = MethodOptions.toJSON(message.options); + } + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { + obj.clientStreaming = message.clientStreaming; + } + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { + obj.serverStreaming = message.serverStreaming; + } + return obj; + }, + + create, I>>(base?: I): MethodDescriptorProto { + return MethodDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MethodDescriptorProto { + const message = createBaseMethodDescriptorProto(); + message.name = object.name ?? ""; + message.inputType = object.inputType ?? ""; + message.outputType = object.outputType ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? MethodOptions.fromPartial(object.options) + : undefined; + message.clientStreaming = object.clientStreaming ?? false; + message.serverStreaming = object.serverStreaming ?? false; + return message; + }, +}; + +function createBaseFileOptions(): FileOptions { + return { + javaPackage: "", + javaOuterClassname: "", + javaMultipleFiles: false, + javaGenerateEqualsAndHash: false, + javaStringCheckUtf8: false, + optimizeFor: 1, + goPackage: "", + ccGenericServices: false, + javaGenericServices: false, + pyGenericServices: false, + deprecated: false, + ccEnableArenas: true, + objcClassPrefix: "", + csharpNamespace: "", + swiftPrefix: "", + phpClassPrefix: "", + phpNamespace: "", + phpMetadataNamespace: "", + rubyPackage: "", + features: undefined, + uninterpretedOption: [], + }; +} + +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { + writer.uint32(10).string(message.javaPackage); + } + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { + writer.uint32(66).string(message.javaOuterClassname); + } + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { + writer.uint32(80).bool(message.javaMultipleFiles); + } + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { + writer.uint32(160).bool(message.javaGenerateEqualsAndHash); + } + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { + writer.uint32(216).bool(message.javaStringCheckUtf8); + } + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { + writer.uint32(72).int32(message.optimizeFor); + } + if (message.goPackage !== undefined && message.goPackage !== "") { + writer.uint32(90).string(message.goPackage); + } + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { + writer.uint32(128).bool(message.ccGenericServices); + } + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { + writer.uint32(136).bool(message.javaGenericServices); + } + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { + writer.uint32(144).bool(message.pyGenericServices); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(184).bool(message.deprecated); + } + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { + writer.uint32(248).bool(message.ccEnableArenas); + } + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { + writer.uint32(290).string(message.objcClassPrefix); + } + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { + writer.uint32(298).string(message.csharpNamespace); + } + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { + writer.uint32(314).string(message.swiftPrefix); + } + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { + writer.uint32(322).string(message.phpClassPrefix); + } + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { + writer.uint32(330).string(message.phpNamespace); + } + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { + writer.uint32(354).string(message.phpMetadataNamespace); + } + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { + writer.uint32(362).string(message.rubyPackage); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.javaPackage = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.javaOuterClassname = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + + message.javaMultipleFiles = reader.bool(); + continue; + } + case 20: { + if (tag !== 160) { + break; + } + + message.javaGenerateEqualsAndHash = reader.bool(); + continue; + } + case 27: { + if (tag !== 216) { + break; + } + + message.javaStringCheckUtf8 = reader.bool(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.optimizeFor = reader.int32() as any; + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.goPackage = reader.string(); + continue; + } + case 16: { + if (tag !== 128) { + break; + } + + message.ccGenericServices = reader.bool(); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + + message.javaGenericServices = reader.bool(); + continue; + } + case 18: { + if (tag !== 144) { + break; + } + + message.pyGenericServices = reader.bool(); + continue; + } + case 23: { + if (tag !== 184) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 31: { + if (tag !== 248) { + break; + } + + message.ccEnableArenas = reader.bool(); + continue; + } + case 36: { + if (tag !== 290) { + break; + } + + message.objcClassPrefix = reader.string(); + continue; + } + case 37: { + if (tag !== 298) { + break; + } + + message.csharpNamespace = reader.string(); + continue; + } + case 39: { + if (tag !== 314) { + break; + } + + message.swiftPrefix = reader.string(); + continue; + } + case 40: { + if (tag !== 322) { + break; + } + + message.phpClassPrefix = reader.string(); + continue; + } + case 41: { + if (tag !== 330) { + break; + } + + message.phpNamespace = reader.string(); + continue; + } + case 44: { + if (tag !== 354) { + break; + } + + message.phpMetadataNamespace = reader.string(); + continue; + } + case 45: { + if (tag !== 362) { + break; + } + + message.rubyPackage = reader.string(); + continue; + } + case 50: { + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FileOptions { + return { + javaPackage: isSet(object.javaPackage) + ? globalThis.String(object.javaPackage) + : isSet(object.java_package) + ? globalThis.String(object.java_package) + : "", + javaOuterClassname: isSet(object.javaOuterClassname) + ? globalThis.String(object.javaOuterClassname) + : isSet(object.java_outer_classname) + ? globalThis.String(object.java_outer_classname) + : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) + ? globalThis.Boolean(object.javaMultipleFiles) + : isSet(object.java_multiple_files) + ? globalThis.Boolean(object.java_multiple_files) + : false, + javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) + : isSet(object.java_generate_equals_and_hash) + ? globalThis.Boolean(object.java_generate_equals_and_hash) + : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) + ? globalThis.Boolean(object.javaStringCheckUtf8) + : isSet(object.java_string_check_utf8) + ? globalThis.Boolean(object.java_string_check_utf8) + : false, + optimizeFor: isSet(object.optimizeFor) + ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) + : isSet(object.optimize_for) + ? fileOptions_OptimizeModeFromJSON(object.optimize_for) + : 1, + goPackage: isSet(object.goPackage) + ? globalThis.String(object.goPackage) + : isSet(object.go_package) + ? globalThis.String(object.go_package) + : "", + ccGenericServices: isSet(object.ccGenericServices) + ? globalThis.Boolean(object.ccGenericServices) + : isSet(object.cc_generic_services) + ? globalThis.Boolean(object.cc_generic_services) + : false, + javaGenericServices: isSet(object.javaGenericServices) + ? globalThis.Boolean(object.javaGenericServices) + : isSet(object.java_generic_services) + ? globalThis.Boolean(object.java_generic_services) + : false, + pyGenericServices: isSet(object.pyGenericServices) + ? globalThis.Boolean(object.pyGenericServices) + : isSet(object.py_generic_services) + ? globalThis.Boolean(object.py_generic_services) + : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) + ? globalThis.Boolean(object.ccEnableArenas) + : isSet(object.cc_enable_arenas) + ? globalThis.Boolean(object.cc_enable_arenas) + : true, + objcClassPrefix: isSet(object.objcClassPrefix) + ? globalThis.String(object.objcClassPrefix) + : isSet(object.objc_class_prefix) + ? globalThis.String(object.objc_class_prefix) + : "", + csharpNamespace: isSet(object.csharpNamespace) + ? globalThis.String(object.csharpNamespace) + : isSet(object.csharp_namespace) + ? globalThis.String(object.csharp_namespace) + : "", + swiftPrefix: isSet(object.swiftPrefix) + ? globalThis.String(object.swiftPrefix) + : isSet(object.swift_prefix) + ? globalThis.String(object.swift_prefix) + : "", + phpClassPrefix: isSet(object.phpClassPrefix) + ? globalThis.String(object.phpClassPrefix) + : isSet(object.php_class_prefix) + ? globalThis.String(object.php_class_prefix) + : "", + phpNamespace: isSet(object.phpNamespace) + ? globalThis.String(object.phpNamespace) + : isSet(object.php_namespace) + ? globalThis.String(object.php_namespace) + : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) + ? globalThis.String(object.phpMetadataNamespace) + : isSet(object.php_metadata_namespace) + ? globalThis.String(object.php_metadata_namespace) + : "", + rubyPackage: isSet(object.rubyPackage) + ? globalThis.String(object.rubyPackage) + : isSet(object.ruby_package) + ? globalThis.String(object.ruby_package) + : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FileOptions): unknown { + const obj: any = {}; + if (message.javaPackage !== undefined && message.javaPackage !== "") { + obj.javaPackage = message.javaPackage; + } + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { + obj.javaOuterClassname = message.javaOuterClassname; + } + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { + obj.javaMultipleFiles = message.javaMultipleFiles; + } + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { + obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + } + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { + obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; + } + if (message.optimizeFor !== undefined && message.optimizeFor !== 1) { + obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor); + } + if (message.goPackage !== undefined && message.goPackage !== "") { + obj.goPackage = message.goPackage; + } + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { + obj.ccGenericServices = message.ccGenericServices; + } + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { + obj.javaGenericServices = message.javaGenericServices; + } + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { + obj.pyGenericServices = message.pyGenericServices; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { + obj.ccEnableArenas = message.ccEnableArenas; + } + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { + obj.objcClassPrefix = message.objcClassPrefix; + } + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { + obj.csharpNamespace = message.csharpNamespace; + } + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { + obj.swiftPrefix = message.swiftPrefix; + } + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { + obj.phpClassPrefix = message.phpClassPrefix; + } + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { + obj.phpNamespace = message.phpNamespace; + } + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { + obj.phpMetadataNamespace = message.phpMetadataNamespace; + } + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { + obj.rubyPackage = message.rubyPackage; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FileOptions { + return FileOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FileOptions { + const message = createBaseFileOptions(); + message.javaPackage = object.javaPackage ?? ""; + message.javaOuterClassname = object.javaOuterClassname ?? ""; + message.javaMultipleFiles = object.javaMultipleFiles ?? false; + message.javaGenerateEqualsAndHash = object.javaGenerateEqualsAndHash ?? false; + message.javaStringCheckUtf8 = object.javaStringCheckUtf8 ?? false; + message.optimizeFor = object.optimizeFor ?? 1; + message.goPackage = object.goPackage ?? ""; + message.ccGenericServices = object.ccGenericServices ?? false; + message.javaGenericServices = object.javaGenericServices ?? false; + message.pyGenericServices = object.pyGenericServices ?? false; + message.deprecated = object.deprecated ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; + message.objcClassPrefix = object.objcClassPrefix ?? ""; + message.csharpNamespace = object.csharpNamespace ?? ""; + message.swiftPrefix = object.swiftPrefix ?? ""; + message.phpClassPrefix = object.phpClassPrefix ?? ""; + message.phpNamespace = object.phpNamespace ?? ""; + message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; + message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMessageOptions(): MessageOptions { + return { + messageSetWireFormat: false, + noStandardDescriptorAccessor: false, + deprecated: false, + mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { + writer.uint32(8).bool(message.messageSetWireFormat); + } + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { + writer.uint32(16).bool(message.noStandardDescriptorAccessor); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if (message.mapEntry !== undefined && message.mapEntry !== false) { + writer.uint32(56).bool(message.mapEntry); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessageOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.messageSetWireFormat = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.noStandardDescriptorAccessor = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.mapEntry = reader.bool(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MessageOptions { + return { + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : isSet(object.message_set_wire_format) + ? globalThis.Boolean(object.message_set_wire_format) + : false, + noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) + : isSet(object.no_standard_descriptor_accessor) + ? globalThis.Boolean(object.no_standard_descriptor_accessor) + : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) + ? globalThis.Boolean(object.mapEntry) + : isSet(object.map_entry) + ? globalThis.Boolean(object.map_entry) + : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : isSet(object.deprecated_legacy_json_field_conflicts) + ? globalThis.Boolean(object.deprecated_legacy_json_field_conflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MessageOptions): unknown { + const obj: any = {}; + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { + obj.messageSetWireFormat = message.messageSetWireFormat; + } + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { + obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.mapEntry !== undefined && message.mapEntry !== false) { + obj.mapEntry = message.mapEntry; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MessageOptions { + return MessageOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MessageOptions { + const message = createBaseMessageOptions(); + message.messageSetWireFormat = object.messageSetWireFormat ?? false; + message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; + message.deprecated = object.deprecated ?? false; + message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFieldOptions(): FieldOptions { + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; +} + +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { + writer.uint32(8).int32(message.ctype); + } + if (message.packed !== undefined && message.packed !== false) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== undefined && message.jstype !== 0) { + writer.uint32(48).int32(message.jstype); + } + if (message.lazy !== undefined && message.lazy !== false) { + writer.uint32(40).bool(message.lazy); + } + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if (message.weak !== undefined && message.weak !== false) { + writer.uint32(80).bool(message.weak); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + for (const v of message.targets) { + writer.uint32(152).int32(v!); + } + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.ctype = reader.int32() as any; + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.packed = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.jstype = reader.int32() as any; + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.lazy = reader.bool(); + continue; + } + case 15: { + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + + message.weak = reader.bool(); + continue; + } + case 16: { + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + } + case 19: { + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + } + case 20: { + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldOptions { + return { + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, + packed: isSet(object.packed) ? globalThis.Boolean(object.packed) : false, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) + ? globalThis.Boolean(object.unverifiedLazy) + : isSet(object.unverified_lazy) + ? globalThis.Boolean(object.unverified_lazy) + : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) + ? globalThis.Boolean(object.debugRedact) + : isSet(object.debug_redact) + ? globalThis.Boolean(object.debug_redact) + : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) + ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) + : [], + editionDefaults: globalThis.Array.isArray(object?.editionDefaults) + ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : globalThis.Array.isArray(object?.edition_defaults) + ? object.edition_defaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : isSet(object.feature_support) + ? FieldOptions_FeatureSupport.fromJSON(object.feature_support) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FieldOptions): unknown { + const obj: any = {}; + if (message.ctype !== undefined && message.ctype !== 0) { + obj.ctype = fieldOptions_CTypeToJSON(message.ctype); + } + if (message.packed !== undefined && message.packed !== false) { + obj.packed = message.packed; + } + if (message.jstype !== undefined && message.jstype !== 0) { + obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); + } + if (message.lazy !== undefined && message.lazy !== false) { + obj.lazy = message.lazy; + } + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + obj.unverifiedLazy = message.unverifiedLazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.weak !== undefined && message.weak !== false) { + obj.weak = message.weak; + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); + } + if (message.editionDefaults?.length) { + obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions { + return FieldOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions { + const message = createBaseFieldOptions(); + message.ctype = object.ctype ?? 0; + message.packed = object.packed ?? false; + message.jstype = object.jstype ?? 0; + message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; + message.deprecated = object.deprecated ?? false; + message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: 0, value: "" }; +} + +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_EditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldOptions_EditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: FieldOptions_EditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { editionIntroduced: 0, editionDeprecated: 0, deprecationWarning: "", editionRemoved: 0 }; +} + +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + writer.uint32(8).int32(message.editionIntroduced); + } + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + writer.uint32(16).int32(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + writer.uint32(32).int32(message.editionRemoved); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_FeatureSupport(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.editionIntroduced = reader.int32() as any; + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.editionDeprecated = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.deprecationWarning = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.editionRemoved = reader.int32() as any; + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldOptions_FeatureSupport { + return { + editionIntroduced: isSet(object.editionIntroduced) + ? editionFromJSON(object.editionIntroduced) + : isSet(object.edition_introduced) + ? editionFromJSON(object.edition_introduced) + : 0, + editionDeprecated: isSet(object.editionDeprecated) + ? editionFromJSON(object.editionDeprecated) + : isSet(object.edition_deprecated) + ? editionFromJSON(object.edition_deprecated) + : 0, + deprecationWarning: isSet(object.deprecationWarning) + ? globalThis.String(object.deprecationWarning) + : isSet(object.deprecation_warning) + ? globalThis.String(object.deprecation_warning) + : "", + editionRemoved: isSet(object.editionRemoved) + ? editionFromJSON(object.editionRemoved) + : isSet(object.edition_removed) + ? editionFromJSON(object.edition_removed) + : 0, + }; + }, + + toJSON(message: FieldOptions_FeatureSupport): unknown { + const obj: any = {}; + if (message.editionIntroduced !== undefined && message.editionIntroduced !== 0) { + obj.editionIntroduced = editionToJSON(message.editionIntroduced); + } + if (message.editionDeprecated !== undefined && message.editionDeprecated !== 0) { + obj.editionDeprecated = editionToJSON(message.editionDeprecated); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + obj.deprecationWarning = message.deprecationWarning; + } + if (message.editionRemoved !== undefined && message.editionRemoved !== 0) { + obj.editionRemoved = editionToJSON(message.editionRemoved); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 0; + message.editionDeprecated = object.editionDeprecated ?? 0; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 0; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) + ? globalThis.Boolean(object.allowAlias) + : isSet(object.allow_alias) + ? globalThis.Boolean(object.allow_alias) + : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) + : isSet(object.deprecated_legacy_json_field_conflicts) + ? globalThis.Boolean(object.deprecated_legacy_json_field_conflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allowAlias !== undefined && message.allowAlias !== false) { + obj.allowAlias = message.allowAlias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EnumOptions { + return EnumOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EnumOptions { + const message = createBaseEnumOptions(); + message.allowAlias = object.allowAlias ?? false; + message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumValueOptions(): EnumValueOptions { + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; +} + +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(8).bool(message.deprecated); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumValueOptions { + return { + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debugRedact: isSet(object.debugRedact) + ? globalThis.Boolean(object.debugRedact) + : isSet(object.debug_redact) + ? globalThis.Boolean(object.debug_redact) + : false, + featureSupport: isSet(object.featureSupport) + ? FieldOptions_FeatureSupport.fromJSON(object.featureSupport) + : isSet(object.feature_support) + ? FieldOptions_FeatureSupport.fromJSON(object.feature_support) + : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumValueOptions): unknown { + const obj: any = {}; + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + obj.debugRedact = message.debugRedact; + } + if (message.featureSupport !== undefined) { + obj.featureSupport = FieldOptions_FeatureSupport.toJSON(message.featureSupport); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EnumValueOptions { + return EnumValueOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EnumValueOptions { + const message = createBaseEnumValueOptions(); + message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseServiceOptions(): ServiceOptions { + return { features: undefined, deprecated: false, uninterpretedOption: [] }; +} + +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(264).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 34: { + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 33: { + if (tag !== 264) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ServiceOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ServiceOptions { + return ServiceOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceOptions { + const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMethodOptions(): MethodOptions { + return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; +} + +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(264).bool(message.deprecated); + } + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { + writer.uint32(272).int32(message.idempotencyLevel); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: { + if (tag !== 264) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 34: { + if (tag !== 272) { + break; + } + + message.idempotencyLevel = reader.int32() as any; + continue; + } + case 35: { + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MethodOptions { + return { + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + idempotencyLevel: isSet(object.idempotencyLevel) + ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) + : isSet(object.idempotency_level) + ? methodOptions_IdempotencyLevelFromJSON(object.idempotency_level) + : 0, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MethodOptions): unknown { + const obj: any = {}; + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.idempotencyLevel !== undefined && message.idempotencyLevel !== 0) { + obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpretedOption?.length) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MethodOptions { + return MethodOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MethodOptions { + const message = createBaseMethodOptions(); + message.deprecated = object.deprecated ?? false; + message.idempotencyLevel = object.idempotencyLevel ?? 0; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUninterpretedOption(): UninterpretedOption { + return { + name: [], + identifierValue: "", + positiveIntValue: 0, + negativeIntValue: 0, + doubleValue: 0, + stringValue: Buffer.alloc(0), + aggregateValue: "", + }; +} + +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.name) { + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.identifierValue !== undefined && message.identifierValue !== "") { + writer.uint32(26).string(message.identifierValue); + } + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { + writer.uint32(32).uint64(message.positiveIntValue); + } + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { + writer.uint32(40).int64(message.negativeIntValue); + } + if (message.doubleValue !== undefined && message.doubleValue !== 0) { + writer.uint32(49).double(message.doubleValue); + } + if (message.stringValue !== undefined && message.stringValue.length !== 0) { + writer.uint32(58).bytes(message.stringValue); + } + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { + writer.uint32(66).string(message.aggregateValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + + message.name.push(UninterpretedOption_NamePart.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.identifierValue = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.positiveIntValue = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.negativeIntValue = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 49) { + break; + } + + message.doubleValue = reader.double(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.stringValue = Buffer.from(reader.bytes()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.aggregateValue = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UninterpretedOption { + return { + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) + ? globalThis.String(object.identifierValue) + : isSet(object.identifier_value) + ? globalThis.String(object.identifier_value) + : "", + positiveIntValue: isSet(object.positiveIntValue) + ? globalThis.Number(object.positiveIntValue) + : isSet(object.positive_int_value) + ? globalThis.Number(object.positive_int_value) + : 0, + negativeIntValue: isSet(object.negativeIntValue) + ? globalThis.Number(object.negativeIntValue) + : isSet(object.negative_int_value) + ? globalThis.Number(object.negative_int_value) + : 0, + doubleValue: isSet(object.doubleValue) + ? globalThis.Number(object.doubleValue) + : isSet(object.double_value) + ? globalThis.Number(object.double_value) + : 0, + stringValue: isSet(object.stringValue) + ? Buffer.from(bytesFromBase64(object.stringValue)) + : isSet(object.string_value) + ? Buffer.from(bytesFromBase64(object.string_value)) + : Buffer.alloc(0), + aggregateValue: isSet(object.aggregateValue) + ? globalThis.String(object.aggregateValue) + : isSet(object.aggregate_value) + ? globalThis.String(object.aggregate_value) + : "", + }; + }, + + toJSON(message: UninterpretedOption): unknown { + const obj: any = {}; + if (message.name?.length) { + obj.name = message.name.map((e) => UninterpretedOption_NamePart.toJSON(e)); + } + if (message.identifierValue !== undefined && message.identifierValue !== "") { + obj.identifierValue = message.identifierValue; + } + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { + obj.positiveIntValue = Math.round(message.positiveIntValue); + } + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { + obj.negativeIntValue = Math.round(message.negativeIntValue); + } + if (message.doubleValue !== undefined && message.doubleValue !== 0) { + obj.doubleValue = message.doubleValue; + } + if (message.stringValue !== undefined && message.stringValue.length !== 0) { + obj.stringValue = base64FromBytes(message.stringValue); + } + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { + obj.aggregateValue = message.aggregateValue; + } + return obj; + }, + + create, I>>(base?: I): UninterpretedOption { + return UninterpretedOption.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UninterpretedOption { + const message = createBaseUninterpretedOption(); + message.name = object.name?.map((e) => UninterpretedOption_NamePart.fromPartial(e)) || []; + message.identifierValue = object.identifierValue ?? ""; + message.positiveIntValue = object.positiveIntValue ?? 0; + message.negativeIntValue = object.negativeIntValue ?? 0; + message.doubleValue = object.doubleValue ?? 0; + message.stringValue = object.stringValue ?? Buffer.alloc(0); + message.aggregateValue = object.aggregateValue ?? ""; + return message; + }, +}; + +function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { + return { namePart: "", isExtension: false }; +} + +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.namePart !== "") { + writer.uint32(10).string(message.namePart); + } + if (message.isExtension !== false) { + writer.uint32(16).bool(message.isExtension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption_NamePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.namePart = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.isExtension = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UninterpretedOption_NamePart { + return { + namePart: isSet(object.namePart) + ? globalThis.String(object.namePart) + : isSet(object.name_part) + ? globalThis.String(object.name_part) + : "", + isExtension: isSet(object.isExtension) + ? globalThis.Boolean(object.isExtension) + : isSet(object.is_extension) + ? globalThis.Boolean(object.is_extension) + : false, + }; + }, + + toJSON(message: UninterpretedOption_NamePart): unknown { + const obj: any = {}; + if (message.namePart !== "") { + obj.namePart = message.namePart; + } + if (message.isExtension !== false) { + obj.isExtension = message.isExtension; + } + return obj; + }, + + create, I>>(base?: I): UninterpretedOption_NamePart { + return UninterpretedOption_NamePart.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UninterpretedOption_NamePart { + const message = createBaseUninterpretedOption_NamePart(); + message.namePart = object.namePart ?? ""; + message.isExtension = object.isExtension ?? false; + return message; + }, +}; + +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 0, + enumType: 0, + repeatedFieldEncoding: 0, + utf8Validation: 0, + messageEncoding: 0, + jsonFormat: 0, + enforceNamingStyle: 0, + defaultSymbolVisibility: 0, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + writer.uint32(48).int32(message.jsonFormat); + } + if (message.enforceNamingStyle !== undefined && message.enforceNamingStyle !== 0) { + writer.uint32(56).int32(message.enforceNamingStyle); + } + if (message.defaultSymbolVisibility !== undefined && message.defaultSymbolVisibility !== 0) { + writer.uint32(64).int32(message.defaultSymbolVisibility); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.fieldPresence = reader.int32() as any; + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.enumType = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = reader.int32() as any; + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.utf8Validation = reader.int32() as any; + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.messageEncoding = reader.int32() as any; + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.jsonFormat = reader.int32() as any; + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.enforceNamingStyle = reader.int32() as any; + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.defaultSymbolVisibility = reader.int32() as any; + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + fieldPresence: isSet(object.fieldPresence) + ? featureSet_FieldPresenceFromJSON(object.fieldPresence) + : isSet(object.field_presence) + ? featureSet_FieldPresenceFromJSON(object.field_presence) + : 0, + enumType: isSet(object.enumType) + ? featureSet_EnumTypeFromJSON(object.enumType) + : isSet(object.enum_type) + ? featureSet_EnumTypeFromJSON(object.enum_type) + : 0, + repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) + : isSet(object.repeated_field_encoding) + ? featureSet_RepeatedFieldEncodingFromJSON(object.repeated_field_encoding) + : 0, + utf8Validation: isSet(object.utf8Validation) + ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) + : isSet(object.utf8_validation) + ? featureSet_Utf8ValidationFromJSON(object.utf8_validation) + : 0, + messageEncoding: isSet(object.messageEncoding) + ? featureSet_MessageEncodingFromJSON(object.messageEncoding) + : isSet(object.message_encoding) + ? featureSet_MessageEncodingFromJSON(object.message_encoding) + : 0, + jsonFormat: isSet(object.jsonFormat) + ? featureSet_JsonFormatFromJSON(object.jsonFormat) + : isSet(object.json_format) + ? featureSet_JsonFormatFromJSON(object.json_format) + : 0, + enforceNamingStyle: isSet(object.enforceNamingStyle) + ? featureSet_EnforceNamingStyleFromJSON(object.enforceNamingStyle) + : isSet(object.enforce_naming_style) + ? featureSet_EnforceNamingStyleFromJSON(object.enforce_naming_style) + : 0, + defaultSymbolVisibility: isSet(object.defaultSymbolVisibility) + ? featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON(object.defaultSymbolVisibility) + : isSet(object.default_symbol_visibility) + ? featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON(object.default_symbol_visibility) + : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.fieldPresence !== undefined && message.fieldPresence !== 0) { + obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); + } + if (message.enumType !== undefined && message.enumType !== 0) { + obj.enumType = featureSet_EnumTypeToJSON(message.enumType); + } + if (message.repeatedFieldEncoding !== undefined && message.repeatedFieldEncoding !== 0) { + obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== undefined && message.utf8Validation !== 0) { + obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); + } + if (message.messageEncoding !== undefined && message.messageEncoding !== 0) { + obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== 0) { + obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); + } + if (message.enforceNamingStyle !== undefined && message.enforceNamingStyle !== 0) { + obj.enforceNamingStyle = featureSet_EnforceNamingStyleToJSON(message.enforceNamingStyle); + } + if (message.defaultSymbolVisibility !== undefined && message.defaultSymbolVisibility !== 0) { + obj.defaultSymbolVisibility = featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON( + message.defaultSymbolVisibility, + ); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 0; + message.enumType = object.enumType ?? 0; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 0; + message.jsonFormat = object.jsonFormat ?? 0; + message.enforceNamingStyle = object.enforceNamingStyle ?? 0; + message.defaultSymbolVisibility = object.defaultSymbolVisibility ?? 0; + return message; + }, +}; + +function createBaseFeatureSet_VisibilityFeature(): FeatureSet_VisibilityFeature { + return {}; +} + +export const FeatureSet_VisibilityFeature: MessageFns = { + encode(_: FeatureSet_VisibilityFeature, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet_VisibilityFeature { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet_VisibilityFeature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): FeatureSet_VisibilityFeature { + return {}; + }, + + toJSON(_: FeatureSet_VisibilityFeature): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): FeatureSet_VisibilityFeature { + return FeatureSet_VisibilityFeature.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): FeatureSet_VisibilityFeature { + const message = createBaseFeatureSet_VisibilityFeature(); + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.minimumEdition = reader.int32() as any; + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.maximumEdition = reader.int32() as any; + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) + ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) + : [], + minimumEdition: isSet(object.minimumEdition) + ? editionFromJSON(object.minimumEdition) + : isSet(object.minimum_edition) + ? editionFromJSON(object.minimum_edition) + : 0, + maximumEdition: isSet(object.maximumEdition) + ? editionFromJSON(object.maximumEdition) + : isSet(object.maximum_edition) + ? editionFromJSON(object.maximum_edition) + : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== 0) { + obj.minimumEdition = editionToJSON(message.minimumEdition); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== 0) { + obj.maximumEdition = editionToJSON(message.maximumEdition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 0; + message.maximumEdition = object.maximumEdition ?? 0; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: 0, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridableFeatures: isSet(object.overridableFeatures) + ? FeatureSet.fromJSON(object.overridableFeatures) + : isSet(object.overridable_features) + ? FeatureSet.fromJSON(object.overridable_features) + : undefined, + fixedFeatures: isSet(object.fixedFeatures) + ? FeatureSet.fromJSON(object.fixedFeatures) + : isSet(object.fixed_features) + ? FeatureSet.fromJSON(object.fixed_features) + : undefined, + }; + }, + + toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridableFeatures !== undefined) { + obj.overridableFeatures = FeatureSet.toJSON(message.overridableFeatures); + } + if (message.fixedFeatures !== undefined) { + obj.fixedFeatures = FeatureSet.toJSON(message.fixedFeatures); + } + return obj; + }, + + create, I>>( + base?: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + +function createBaseSourceCodeInfo(): SourceCodeInfo { + return { location: [] }; +} + +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.location) { + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.location.push(SourceCodeInfo_Location.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SourceCodeInfo { + return { + location: globalThis.Array.isArray(object?.location) + ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SourceCodeInfo): unknown { + const obj: any = {}; + if (message.location?.length) { + obj.location = message.location.map((e) => SourceCodeInfo_Location.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SourceCodeInfo { + return SourceCodeInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SourceCodeInfo { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map((e) => SourceCodeInfo_Location.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { + return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; +} + +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.join(); + writer.uint32(18).fork(); + for (const v of message.span) { + writer.int32(v); + } + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { + writer.uint32(26).string(message.leadingComments); + } + if (message.trailingComments !== undefined && message.trailingComments !== "") { + writer.uint32(34).string(message.trailingComments); + } + for (const v of message.leadingDetachedComments) { + writer.uint32(50).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo_Location(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.path.push(reader.int32()); + + continue; + } + + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + + continue; + } + + break; + } + case 2: { + if (tag === 16) { + message.span.push(reader.int32()); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.span.push(reader.int32()); + } + + continue; + } + + break; + } + case 3: { + if (tag !== 26) { + break; + } + + message.leadingComments = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.trailingComments = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.leadingDetachedComments.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SourceCodeInfo_Location { + return { + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) + ? globalThis.String(object.leadingComments) + : isSet(object.leading_comments) + ? globalThis.String(object.leading_comments) + : "", + trailingComments: isSet(object.trailingComments) + ? globalThis.String(object.trailingComments) + : isSet(object.trailing_comments) + ? globalThis.String(object.trailing_comments) + : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) + : globalThis.Array.isArray(object?.leading_detached_comments) + ? object.leading_detached_comments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: SourceCodeInfo_Location): unknown { + const obj: any = {}; + if (message.path?.length) { + obj.path = message.path.map((e) => Math.round(e)); + } + if (message.span?.length) { + obj.span = message.span.map((e) => Math.round(e)); + } + if (message.leadingComments !== undefined && message.leadingComments !== "") { + obj.leadingComments = message.leadingComments; + } + if (message.trailingComments !== undefined && message.trailingComments !== "") { + obj.trailingComments = message.trailingComments; + } + if (message.leadingDetachedComments?.length) { + obj.leadingDetachedComments = message.leadingDetachedComments; + } + return obj; + }, + + create, I>>(base?: I): SourceCodeInfo_Location { + return SourceCodeInfo_Location.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SourceCodeInfo_Location { + const message = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map((e) => e) || []; + message.span = object.span?.map((e) => e) || []; + message.leadingComments = object.leadingComments ?? ""; + message.trailingComments = object.trailingComments ?? ""; + message.leadingDetachedComments = object.leadingDetachedComments?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { + return { annotation: [] }; +} + +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.annotation) { + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.annotation.push(GeneratedCodeInfo_Annotation.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneratedCodeInfo { + return { + annotation: globalThis.Array.isArray(object?.annotation) + ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneratedCodeInfo): unknown { + const obj: any = {}; + if (message.annotation?.length) { + obj.annotation = message.annotation.map((e) => GeneratedCodeInfo_Annotation.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneratedCodeInfo { + return GeneratedCodeInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneratedCodeInfo { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map((e) => GeneratedCodeInfo_Annotation.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: 0 }; +} + +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { + writer.uint32(18).string(message.sourceFile); + } + if (message.begin !== undefined && message.begin !== 0) { + writer.uint32(24).int32(message.begin); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(32).int32(message.end); + } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo_Annotation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.path.push(reader.int32()); + + continue; + } + + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + + continue; + } + + break; + } + case 2: { + if (tag !== 18) { + break; + } + + message.sourceFile = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.begin = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.end = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneratedCodeInfo_Annotation { + return { + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) + ? globalThis.String(object.sourceFile) + : isSet(object.source_file) + ? globalThis.String(object.source_file) + : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, + }; + }, + + toJSON(message: GeneratedCodeInfo_Annotation): unknown { + const obj: any = {}; + if (message.path?.length) { + obj.path = message.path.map((e) => Math.round(e)); + } + if (message.sourceFile !== undefined && message.sourceFile !== "") { + obj.sourceFile = message.sourceFile; + } + if (message.begin !== undefined && message.begin !== 0) { + obj.begin = Math.round(message.begin); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic); + } + return obj; + }, + + create, I>>(base?: I): GeneratedCodeInfo_Annotation { + return GeneratedCodeInfo_Annotation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneratedCodeInfo_Annotation { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map((e) => e) || []; + message.sourceFile = object.sourceFile ?? ""; + message.begin = object.begin ?? 0; + message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); +} + +function base64FromBytes(arr: Uint8Array): string { + return globalThis.Buffer.from(arr).toString("base64"); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/generated/google/protobuf/duration.ts b/src/generated/google/protobuf/duration.ts new file mode 100644 index 0000000..ddefefb --- /dev/null +++ b/src/generated/google/protobuf/duration.ts @@ -0,0 +1,200 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.4 +// protoc v6.33.4 +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(message.seconds); + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } + return obj; + }, + + create, I>>(base?: I): Duration { + return Duration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Duration { + const message = createBaseDuration(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/generated/google/protobuf/empty.ts b/src/generated/google/protobuf/empty.ts new file mode 100644 index 0000000..4b9b7da --- /dev/null +++ b/src/generated/google/protobuf/empty.ts @@ -0,0 +1,86 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.4 +// protoc v6.33.4 +// source: google/protobuf/empty.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * 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); + * } + */ +export interface Empty { +} + +function createBaseEmpty(): Empty { + return {}; +} + +export const Empty: MessageFns = { + encode(_: Empty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Empty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEmpty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Empty { + return {}; + }, + + toJSON(_: Empty): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Empty { + return Empty.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Empty { + const message = createBaseEmpty(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/generated/google/protobuf/timestamp.ts b/src/generated/google/protobuf/timestamp.ts new file mode 100644 index 0000000..09d7fac --- /dev/null +++ b/src/generated/google/protobuf/timestamp.ts @@ -0,0 +1,230 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.4 +// protoc v6.33.4 +// source: google/protobuf/timestamp.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * 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. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must + * be between -315576000000 and 315576000000 inclusive (which corresponds to + * 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). + */ + seconds: number; + /** + * Non-negative fractions of a second at nanosecond resolution. This field is + * the nanosecond portion of the duration, not an alternative to seconds. + * Negative second values with fractions must still have non-negative nanos + * values that count forward in time. Must be between 0 and 999,999,999 + * inclusive. + */ + nanos: number; +} + +function createBaseTimestamp(): Timestamp { + return { seconds: 0, nanos: 0 }; +} + +export const Timestamp: MessageFns = { + encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Timestamp { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Timestamp): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(message.seconds); + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } + return obj; + }, + + create, I>>(base?: I): Timestamp { + return Timestamp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Timestamp { + const message = createBaseTimestamp(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/generated/message.ts b/src/generated/message.ts new file mode 100644 index 0000000..9912082 --- /dev/null +++ b/src/generated/message.ts @@ -0,0 +1,3306 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.4 +// protoc v6.33.4 +// source: message.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { + type CallOptions, + type ChannelCredentials, + Client, + type ClientOptions, + type ClientUnaryCall, + type handleUnaryCall, + makeGenericClientConstructor, + type Metadata, + type ServiceError, + type UntypedServiceImplementation, +} from "@grpc/grpc-js"; +import { Empty } from "./google/protobuf/empty"; + +export const protobufPackage = "message"; + +/** User */ +export interface CreateUserRequest { + email: string; + name?: string | undefined; +} + +export interface CreateUserResponse { + data: User | undefined; +} + +export interface UpdateUserRequest { + id: number; + /** todo */ + token?: string | undefined; + description?: string | undefined; +} + +export interface UpdateUserResponse { + data: User | undefined; +} + +export interface GetUserByTokenRequest { + /** todo */ + token: string; +} + +export interface GetUserByEmailRequest { + email: string; +} + +export interface GetUserRequest { + id: number; +} + +export interface GetUserResponse { + data: User | undefined; +} + +export interface ListUserRequest { + page: number; + userIds: number[]; +} + +export interface ListUserResponse { + data: User[]; +} + +export interface User { + id: number; + token?: string | undefined; + email: string; + description?: string | undefined; + name?: string | undefined; +} + +export interface UserForChatResponse { + id: number; + token?: string | undefined; + email: string; + description?: string | undefined; + isAdmin?: boolean | undefined; + name?: string | undefined; +} + +/** Chat */ +export interface CreateChatRequest { + name?: string | undefined; + users: UserForChat[]; +} + +export interface UserForChat { + userId: number; + isAdmin?: boolean | undefined; +} + +export interface CreateChatResponse { + data: Chat | undefined; +} + +export interface UpdateChatRequest { + id: string; + users: UserForChat[]; +} + +export interface UpdateChatResponse { + data: Chat | undefined; +} + +export interface GetChatRequest { + id: string; +} + +export interface GetChatResponse { + data: Chat | undefined; +} + +export interface ListChatRequest { + page: number; + userId: number; +} + +export interface ListChatResponse { + data: Chat[]; +} + +export interface Chat { + id: string; + typeId: number; + name?: string | undefined; + users: UserForChatResponse[]; + message: Message | undefined; +} + +/** Message */ +export interface CreateMessageRequest { + chatId: string; + userId: number; + message?: string | undefined; + image?: string | undefined; + video?: string | undefined; + file?: string | undefined; +} + +export interface CreateMessageResponse { + data: Message | undefined; +} + +export interface UpdateMessageRequest { + id: number; + chatId: string; + message?: string | undefined; + image?: string | undefined; + video?: string | undefined; + file?: string | undefined; +} + +export interface UpdateMessageResponse { + data: Message | undefined; +} + +export interface GetMessageRequest { + id: number; +} + +export interface GetMessageResponse { + data: Message | undefined; +} + +export interface ListMessageRequest { + page: number; + chatId: string; + userId: number; +} + +export interface ListMessageResponse { + data: Message[]; +} + +export interface Message { + id: number; + userId: number; + message?: string | undefined; + image?: string | undefined; + video?: string | undefined; + file?: string | undefined; + createdAt: string; + updatedAt: string; +} + +/** Version */ +export interface GetVersionResponse { + data: Version | undefined; +} + +export interface Version { + id: number; + version: string; +} + +function createBaseCreateUserRequest(): CreateUserRequest { + return { email: "", name: undefined }; +} + +export const CreateUserRequest: MessageFns = { + encode(message: CreateUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.email !== "") { + writer.uint32(10).string(message.email); + } + if (message.name !== undefined) { + writer.uint32(18).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateUserRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateUserRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.email = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateUserRequest { + return { + email: isSet(object.email) ? globalThis.String(object.email) : "", + name: isSet(object.name) ? globalThis.String(object.name) : undefined, + }; + }, + + toJSON(message: CreateUserRequest): unknown { + const obj: any = {}; + if (message.email !== "") { + obj.email = message.email; + } + if (message.name !== undefined) { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): CreateUserRequest { + return CreateUserRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CreateUserRequest { + const message = createBaseCreateUserRequest(); + message.email = object.email ?? ""; + message.name = object.name ?? undefined; + return message; + }, +}; + +function createBaseCreateUserResponse(): CreateUserResponse { + return { data: undefined }; +} + +export const CreateUserResponse: MessageFns = { + encode(message: CreateUserResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== undefined) { + User.encode(message.data, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateUserResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateUserResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data = User.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateUserResponse { + return { data: isSet(object.data) ? User.fromJSON(object.data) : undefined }; + }, + + toJSON(message: CreateUserResponse): unknown { + const obj: any = {}; + if (message.data !== undefined) { + obj.data = User.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): CreateUserResponse { + return CreateUserResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CreateUserResponse { + const message = createBaseCreateUserResponse(); + message.data = (object.data !== undefined && object.data !== null) ? User.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseUpdateUserRequest(): UpdateUserRequest { + return { id: 0, token: undefined, description: undefined }; +} + +export const UpdateUserRequest: MessageFns = { + encode(message: UpdateUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.token !== undefined) { + writer.uint32(18).string(message.token); + } + if (message.description !== undefined) { + writer.uint32(26).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateUserRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.token = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.description = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateUserRequest { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + token: isSet(object.token) ? globalThis.String(object.token) : undefined, + description: isSet(object.description) ? globalThis.String(object.description) : undefined, + }; + }, + + toJSON(message: UpdateUserRequest): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.token !== undefined) { + obj.token = message.token; + } + if (message.description !== undefined) { + obj.description = message.description; + } + return obj; + }, + + create, I>>(base?: I): UpdateUserRequest { + return UpdateUserRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UpdateUserRequest { + const message = createBaseUpdateUserRequest(); + message.id = object.id ?? 0; + message.token = object.token ?? undefined; + message.description = object.description ?? undefined; + return message; + }, +}; + +function createBaseUpdateUserResponse(): UpdateUserResponse { + return { data: undefined }; +} + +export const UpdateUserResponse: MessageFns = { + encode(message: UpdateUserResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== undefined) { + User.encode(message.data, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateUserResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data = User.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateUserResponse { + return { data: isSet(object.data) ? User.fromJSON(object.data) : undefined }; + }, + + toJSON(message: UpdateUserResponse): unknown { + const obj: any = {}; + if (message.data !== undefined) { + obj.data = User.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): UpdateUserResponse { + return UpdateUserResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UpdateUserResponse { + const message = createBaseUpdateUserResponse(); + message.data = (object.data !== undefined && object.data !== null) ? User.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseGetUserByTokenRequest(): GetUserByTokenRequest { + return { token: "" }; +} + +export const GetUserByTokenRequest: MessageFns = { + encode(message: GetUserByTokenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.token !== "") { + writer.uint32(10).string(message.token); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetUserByTokenRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserByTokenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.token = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetUserByTokenRequest { + return { token: isSet(object.token) ? globalThis.String(object.token) : "" }; + }, + + toJSON(message: GetUserByTokenRequest): unknown { + const obj: any = {}; + if (message.token !== "") { + obj.token = message.token; + } + return obj; + }, + + create, I>>(base?: I): GetUserByTokenRequest { + return GetUserByTokenRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetUserByTokenRequest { + const message = createBaseGetUserByTokenRequest(); + message.token = object.token ?? ""; + return message; + }, +}; + +function createBaseGetUserByEmailRequest(): GetUserByEmailRequest { + return { email: "" }; +} + +export const GetUserByEmailRequest: MessageFns = { + encode(message: GetUserByEmailRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.email !== "") { + writer.uint32(10).string(message.email); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetUserByEmailRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserByEmailRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.email = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetUserByEmailRequest { + return { email: isSet(object.email) ? globalThis.String(object.email) : "" }; + }, + + toJSON(message: GetUserByEmailRequest): unknown { + const obj: any = {}; + if (message.email !== "") { + obj.email = message.email; + } + return obj; + }, + + create, I>>(base?: I): GetUserByEmailRequest { + return GetUserByEmailRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetUserByEmailRequest { + const message = createBaseGetUserByEmailRequest(); + message.email = object.email ?? ""; + return message; + }, +}; + +function createBaseGetUserRequest(): GetUserRequest { + return { id: 0 }; +} + +export const GetUserRequest: MessageFns = { + encode(message: GetUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetUserRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetUserRequest { + return { id: isSet(object.id) ? globalThis.Number(object.id) : 0 }; + }, + + toJSON(message: GetUserRequest): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + return obj; + }, + + create, I>>(base?: I): GetUserRequest { + return GetUserRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetUserRequest { + const message = createBaseGetUserRequest(); + message.id = object.id ?? 0; + return message; + }, +}; + +function createBaseGetUserResponse(): GetUserResponse { + return { data: undefined }; +} + +export const GetUserResponse: MessageFns = { + encode(message: GetUserResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== undefined) { + User.encode(message.data, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetUserResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data = User.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetUserResponse { + return { data: isSet(object.data) ? User.fromJSON(object.data) : undefined }; + }, + + toJSON(message: GetUserResponse): unknown { + const obj: any = {}; + if (message.data !== undefined) { + obj.data = User.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): GetUserResponse { + return GetUserResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetUserResponse { + const message = createBaseGetUserResponse(); + message.data = (object.data !== undefined && object.data !== null) ? User.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseListUserRequest(): ListUserRequest { + return { page: 0, userIds: [] }; +} + +export const ListUserRequest: MessageFns = { + encode(message: ListUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.page !== 0) { + writer.uint32(8).int32(message.page); + } + writer.uint32(18).fork(); + for (const v of message.userIds) { + writer.int32(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListUserRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListUserRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.page = reader.int32(); + continue; + } + case 2: { + if (tag === 16) { + message.userIds.push(reader.int32()); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.userIds.push(reader.int32()); + } + + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListUserRequest { + return { + page: isSet(object.page) ? globalThis.Number(object.page) : 0, + userIds: globalThis.Array.isArray(object?.userIds) + ? object.userIds.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.user_ids) + ? object.user_ids.map((e: any) => globalThis.Number(e)) + : [], + }; + }, + + toJSON(message: ListUserRequest): unknown { + const obj: any = {}; + if (message.page !== 0) { + obj.page = Math.round(message.page); + } + if (message.userIds?.length) { + obj.userIds = message.userIds.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): ListUserRequest { + return ListUserRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListUserRequest { + const message = createBaseListUserRequest(); + message.page = object.page ?? 0; + message.userIds = object.userIds?.map((e) => e) || []; + return message; + }, +}; + +function createBaseListUserResponse(): ListUserResponse { + return { data: [] }; +} + +export const ListUserResponse: MessageFns = { + encode(message: ListUserResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.data) { + User.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListUserResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListUserResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data.push(User.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListUserResponse { + return { data: globalThis.Array.isArray(object?.data) ? object.data.map((e: any) => User.fromJSON(e)) : [] }; + }, + + toJSON(message: ListUserResponse): unknown { + const obj: any = {}; + if (message.data?.length) { + obj.data = message.data.map((e) => User.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListUserResponse { + return ListUserResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListUserResponse { + const message = createBaseListUserResponse(); + message.data = object.data?.map((e) => User.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUser(): User { + return { id: 0, token: undefined, email: "", description: undefined, name: undefined }; +} + +export const User: MessageFns = { + encode(message: User, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.token !== undefined) { + writer.uint32(18).string(message.token); + } + if (message.email !== "") { + writer.uint32(26).string(message.email); + } + if (message.description !== undefined) { + writer.uint32(34).string(message.description); + } + if (message.name !== undefined) { + writer.uint32(42).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): User { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUser(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.token = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.email = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.description = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): User { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + token: isSet(object.token) ? globalThis.String(object.token) : undefined, + email: isSet(object.email) ? globalThis.String(object.email) : "", + description: isSet(object.description) ? globalThis.String(object.description) : undefined, + name: isSet(object.name) ? globalThis.String(object.name) : undefined, + }; + }, + + toJSON(message: User): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.token !== undefined) { + obj.token = message.token; + } + if (message.email !== "") { + obj.email = message.email; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.name !== undefined) { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): User { + return User.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): User { + const message = createBaseUser(); + message.id = object.id ?? 0; + message.token = object.token ?? undefined; + message.email = object.email ?? ""; + message.description = object.description ?? undefined; + message.name = object.name ?? undefined; + return message; + }, +}; + +function createBaseUserForChatResponse(): UserForChatResponse { + return { id: 0, token: undefined, email: "", description: undefined, isAdmin: undefined, name: undefined }; +} + +export const UserForChatResponse: MessageFns = { + encode(message: UserForChatResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.token !== undefined) { + writer.uint32(18).string(message.token); + } + if (message.email !== "") { + writer.uint32(26).string(message.email); + } + if (message.description !== undefined) { + writer.uint32(34).string(message.description); + } + if (message.isAdmin !== undefined) { + writer.uint32(40).bool(message.isAdmin); + } + if (message.name !== undefined) { + writer.uint32(50).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserForChatResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserForChatResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.token = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.email = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.description = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.isAdmin = reader.bool(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UserForChatResponse { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + token: isSet(object.token) ? globalThis.String(object.token) : undefined, + email: isSet(object.email) ? globalThis.String(object.email) : "", + description: isSet(object.description) ? globalThis.String(object.description) : undefined, + isAdmin: isSet(object.isAdmin) + ? globalThis.Boolean(object.isAdmin) + : isSet(object.is_admin) + ? globalThis.Boolean(object.is_admin) + : undefined, + name: isSet(object.name) ? globalThis.String(object.name) : undefined, + }; + }, + + toJSON(message: UserForChatResponse): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.token !== undefined) { + obj.token = message.token; + } + if (message.email !== "") { + obj.email = message.email; + } + if (message.description !== undefined) { + obj.description = message.description; + } + if (message.isAdmin !== undefined) { + obj.isAdmin = message.isAdmin; + } + if (message.name !== undefined) { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): UserForChatResponse { + return UserForChatResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UserForChatResponse { + const message = createBaseUserForChatResponse(); + message.id = object.id ?? 0; + message.token = object.token ?? undefined; + message.email = object.email ?? ""; + message.description = object.description ?? undefined; + message.isAdmin = object.isAdmin ?? undefined; + message.name = object.name ?? undefined; + return message; + }, +}; + +function createBaseCreateChatRequest(): CreateChatRequest { + return { name: undefined, users: [] }; +} + +export const CreateChatRequest: MessageFns = { + encode(message: CreateChatRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined) { + writer.uint32(10).string(message.name); + } + for (const v of message.users) { + UserForChat.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateChatRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateChatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.users.push(UserForChat.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateChatRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : undefined, + users: globalThis.Array.isArray(object?.users) ? object.users.map((e: any) => UserForChat.fromJSON(e)) : [], + }; + }, + + toJSON(message: CreateChatRequest): unknown { + const obj: any = {}; + if (message.name !== undefined) { + obj.name = message.name; + } + if (message.users?.length) { + obj.users = message.users.map((e) => UserForChat.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CreateChatRequest { + return CreateChatRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CreateChatRequest { + const message = createBaseCreateChatRequest(); + message.name = object.name ?? undefined; + message.users = object.users?.map((e) => UserForChat.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUserForChat(): UserForChat { + return { userId: 0, isAdmin: undefined }; +} + +export const UserForChat: MessageFns = { + encode(message: UserForChat, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.userId !== 0) { + writer.uint32(8).int32(message.userId); + } + if (message.isAdmin !== undefined) { + writer.uint32(16).bool(message.isAdmin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserForChat { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserForChat(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.userId = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.isAdmin = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UserForChat { + return { + userId: isSet(object.userId) + ? globalThis.Number(object.userId) + : isSet(object.user_id) + ? globalThis.Number(object.user_id) + : 0, + isAdmin: isSet(object.isAdmin) + ? globalThis.Boolean(object.isAdmin) + : isSet(object.is_admin) + ? globalThis.Boolean(object.is_admin) + : undefined, + }; + }, + + toJSON(message: UserForChat): unknown { + const obj: any = {}; + if (message.userId !== 0) { + obj.userId = Math.round(message.userId); + } + if (message.isAdmin !== undefined) { + obj.isAdmin = message.isAdmin; + } + return obj; + }, + + create, I>>(base?: I): UserForChat { + return UserForChat.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UserForChat { + const message = createBaseUserForChat(); + message.userId = object.userId ?? 0; + message.isAdmin = object.isAdmin ?? undefined; + return message; + }, +}; + +function createBaseCreateChatResponse(): CreateChatResponse { + return { data: undefined }; +} + +export const CreateChatResponse: MessageFns = { + encode(message: CreateChatResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== undefined) { + Chat.encode(message.data, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateChatResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateChatResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data = Chat.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateChatResponse { + return { data: isSet(object.data) ? Chat.fromJSON(object.data) : undefined }; + }, + + toJSON(message: CreateChatResponse): unknown { + const obj: any = {}; + if (message.data !== undefined) { + obj.data = Chat.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): CreateChatResponse { + return CreateChatResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CreateChatResponse { + const message = createBaseCreateChatResponse(); + message.data = (object.data !== undefined && object.data !== null) ? Chat.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseUpdateChatRequest(): UpdateChatRequest { + return { id: "", users: [] }; +} + +export const UpdateChatRequest: MessageFns = { + encode(message: UpdateChatRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + for (const v of message.users) { + UserForChat.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateChatRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateChatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.users.push(UserForChat.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateChatRequest { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + users: globalThis.Array.isArray(object?.users) ? object.users.map((e: any) => UserForChat.fromJSON(e)) : [], + }; + }, + + toJSON(message: UpdateChatRequest): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.users?.length) { + obj.users = message.users.map((e) => UserForChat.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): UpdateChatRequest { + return UpdateChatRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UpdateChatRequest { + const message = createBaseUpdateChatRequest(); + message.id = object.id ?? ""; + message.users = object.users?.map((e) => UserForChat.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUpdateChatResponse(): UpdateChatResponse { + return { data: undefined }; +} + +export const UpdateChatResponse: MessageFns = { + encode(message: UpdateChatResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== undefined) { + Chat.encode(message.data, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateChatResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateChatResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data = Chat.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateChatResponse { + return { data: isSet(object.data) ? Chat.fromJSON(object.data) : undefined }; + }, + + toJSON(message: UpdateChatResponse): unknown { + const obj: any = {}; + if (message.data !== undefined) { + obj.data = Chat.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): UpdateChatResponse { + return UpdateChatResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UpdateChatResponse { + const message = createBaseUpdateChatResponse(); + message.data = (object.data !== undefined && object.data !== null) ? Chat.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseGetChatRequest(): GetChatRequest { + return { id: "" }; +} + +export const GetChatRequest: MessageFns = { + encode(message: GetChatRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChatRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetChatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetChatRequest { + return { id: isSet(object.id) ? globalThis.String(object.id) : "" }; + }, + + toJSON(message: GetChatRequest): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): GetChatRequest { + return GetChatRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetChatRequest { + const message = createBaseGetChatRequest(); + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseGetChatResponse(): GetChatResponse { + return { data: undefined }; +} + +export const GetChatResponse: MessageFns = { + encode(message: GetChatResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== undefined) { + Chat.encode(message.data, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChatResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetChatResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data = Chat.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetChatResponse { + return { data: isSet(object.data) ? Chat.fromJSON(object.data) : undefined }; + }, + + toJSON(message: GetChatResponse): unknown { + const obj: any = {}; + if (message.data !== undefined) { + obj.data = Chat.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): GetChatResponse { + return GetChatResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetChatResponse { + const message = createBaseGetChatResponse(); + message.data = (object.data !== undefined && object.data !== null) ? Chat.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseListChatRequest(): ListChatRequest { + return { page: 0, userId: 0 }; +} + +export const ListChatRequest: MessageFns = { + encode(message: ListChatRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.page !== 0) { + writer.uint32(8).int32(message.page); + } + if (message.userId !== 0) { + writer.uint32(16).int32(message.userId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListChatRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListChatRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.page = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.userId = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListChatRequest { + return { + page: isSet(object.page) ? globalThis.Number(object.page) : 0, + userId: isSet(object.userId) + ? globalThis.Number(object.userId) + : isSet(object.user_id) + ? globalThis.Number(object.user_id) + : 0, + }; + }, + + toJSON(message: ListChatRequest): unknown { + const obj: any = {}; + if (message.page !== 0) { + obj.page = Math.round(message.page); + } + if (message.userId !== 0) { + obj.userId = Math.round(message.userId); + } + return obj; + }, + + create, I>>(base?: I): ListChatRequest { + return ListChatRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListChatRequest { + const message = createBaseListChatRequest(); + message.page = object.page ?? 0; + message.userId = object.userId ?? 0; + return message; + }, +}; + +function createBaseListChatResponse(): ListChatResponse { + return { data: [] }; +} + +export const ListChatResponse: MessageFns = { + encode(message: ListChatResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.data) { + Chat.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListChatResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListChatResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data.push(Chat.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListChatResponse { + return { data: globalThis.Array.isArray(object?.data) ? object.data.map((e: any) => Chat.fromJSON(e)) : [] }; + }, + + toJSON(message: ListChatResponse): unknown { + const obj: any = {}; + if (message.data?.length) { + obj.data = message.data.map((e) => Chat.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListChatResponse { + return ListChatResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListChatResponse { + const message = createBaseListChatResponse(); + message.data = object.data?.map((e) => Chat.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseChat(): Chat { + return { id: "", typeId: 0, name: undefined, users: [], message: undefined }; +} + +export const Chat: MessageFns = { + encode(message: Chat, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.typeId !== 0) { + writer.uint32(16).int32(message.typeId); + } + if (message.name !== undefined) { + writer.uint32(26).string(message.name); + } + for (const v of message.users) { + UserForChatResponse.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.message !== undefined) { + Message.encode(message.message, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Chat { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChat(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.typeId = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.name = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.users.push(UserForChatResponse.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = Message.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Chat { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + typeId: isSet(object.typeId) + ? globalThis.Number(object.typeId) + : isSet(object.type_id) + ? globalThis.Number(object.type_id) + : 0, + name: isSet(object.name) ? globalThis.String(object.name) : undefined, + users: globalThis.Array.isArray(object?.users) + ? object.users.map((e: any) => UserForChatResponse.fromJSON(e)) + : [], + message: isSet(object.message) ? Message.fromJSON(object.message) : undefined, + }; + }, + + toJSON(message: Chat): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.typeId !== 0) { + obj.typeId = Math.round(message.typeId); + } + if (message.name !== undefined) { + obj.name = message.name; + } + if (message.users?.length) { + obj.users = message.users.map((e) => UserForChatResponse.toJSON(e)); + } + if (message.message !== undefined) { + obj.message = Message.toJSON(message.message); + } + return obj; + }, + + create, I>>(base?: I): Chat { + return Chat.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Chat { + const message = createBaseChat(); + message.id = object.id ?? ""; + message.typeId = object.typeId ?? 0; + message.name = object.name ?? undefined; + message.users = object.users?.map((e) => UserForChatResponse.fromPartial(e)) || []; + message.message = (object.message !== undefined && object.message !== null) + ? Message.fromPartial(object.message) + : undefined; + return message; + }, +}; + +function createBaseCreateMessageRequest(): CreateMessageRequest { + return { chatId: "", userId: 0, message: undefined, image: undefined, video: undefined, file: undefined }; +} + +export const CreateMessageRequest: MessageFns = { + encode(message: CreateMessageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chatId !== "") { + writer.uint32(18).string(message.chatId); + } + if (message.userId !== 0) { + writer.uint32(24).int32(message.userId); + } + if (message.message !== undefined) { + writer.uint32(34).string(message.message); + } + if (message.image !== undefined) { + writer.uint32(42).string(message.image); + } + if (message.video !== undefined) { + writer.uint32(50).string(message.video); + } + if (message.file !== undefined) { + writer.uint32(58).string(message.file); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateMessageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateMessageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + + message.chatId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.userId = reader.int32(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.message = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.image = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.video = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.file = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateMessageRequest { + return { + chatId: isSet(object.chatId) + ? globalThis.String(object.chatId) + : isSet(object.chat_id) + ? globalThis.String(object.chat_id) + : "", + userId: isSet(object.userId) + ? globalThis.Number(object.userId) + : isSet(object.user_id) + ? globalThis.Number(object.user_id) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : undefined, + image: isSet(object.image) ? globalThis.String(object.image) : undefined, + video: isSet(object.video) ? globalThis.String(object.video) : undefined, + file: isSet(object.file) ? globalThis.String(object.file) : undefined, + }; + }, + + toJSON(message: CreateMessageRequest): unknown { + const obj: any = {}; + if (message.chatId !== "") { + obj.chatId = message.chatId; + } + if (message.userId !== 0) { + obj.userId = Math.round(message.userId); + } + if (message.message !== undefined) { + obj.message = message.message; + } + if (message.image !== undefined) { + obj.image = message.image; + } + if (message.video !== undefined) { + obj.video = message.video; + } + if (message.file !== undefined) { + obj.file = message.file; + } + return obj; + }, + + create, I>>(base?: I): CreateMessageRequest { + return CreateMessageRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CreateMessageRequest { + const message = createBaseCreateMessageRequest(); + message.chatId = object.chatId ?? ""; + message.userId = object.userId ?? 0; + message.message = object.message ?? undefined; + message.image = object.image ?? undefined; + message.video = object.video ?? undefined; + message.file = object.file ?? undefined; + return message; + }, +}; + +function createBaseCreateMessageResponse(): CreateMessageResponse { + return { data: undefined }; +} + +export const CreateMessageResponse: MessageFns = { + encode(message: CreateMessageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== undefined) { + Message.encode(message.data, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateMessageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateMessageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data = Message.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateMessageResponse { + return { data: isSet(object.data) ? Message.fromJSON(object.data) : undefined }; + }, + + toJSON(message: CreateMessageResponse): unknown { + const obj: any = {}; + if (message.data !== undefined) { + obj.data = Message.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): CreateMessageResponse { + return CreateMessageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CreateMessageResponse { + const message = createBaseCreateMessageResponse(); + message.data = (object.data !== undefined && object.data !== null) ? Message.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseUpdateMessageRequest(): UpdateMessageRequest { + return { id: 0, chatId: "", message: undefined, image: undefined, video: undefined, file: undefined }; +} + +export const UpdateMessageRequest: MessageFns = { + encode(message: UpdateMessageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.chatId !== "") { + writer.uint32(18).string(message.chatId); + } + if (message.message !== undefined) { + writer.uint32(26).string(message.message); + } + if (message.image !== undefined) { + writer.uint32(34).string(message.image); + } + if (message.video !== undefined) { + writer.uint32(42).string(message.video); + } + if (message.file !== undefined) { + writer.uint32(50).string(message.file); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateMessageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateMessageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.chatId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.image = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.video = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.file = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateMessageRequest { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + chatId: isSet(object.chatId) + ? globalThis.String(object.chatId) + : isSet(object.chat_id) + ? globalThis.String(object.chat_id) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : undefined, + image: isSet(object.image) ? globalThis.String(object.image) : undefined, + video: isSet(object.video) ? globalThis.String(object.video) : undefined, + file: isSet(object.file) ? globalThis.String(object.file) : undefined, + }; + }, + + toJSON(message: UpdateMessageRequest): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.chatId !== "") { + obj.chatId = message.chatId; + } + if (message.message !== undefined) { + obj.message = message.message; + } + if (message.image !== undefined) { + obj.image = message.image; + } + if (message.video !== undefined) { + obj.video = message.video; + } + if (message.file !== undefined) { + obj.file = message.file; + } + return obj; + }, + + create, I>>(base?: I): UpdateMessageRequest { + return UpdateMessageRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UpdateMessageRequest { + const message = createBaseUpdateMessageRequest(); + message.id = object.id ?? 0; + message.chatId = object.chatId ?? ""; + message.message = object.message ?? undefined; + message.image = object.image ?? undefined; + message.video = object.video ?? undefined; + message.file = object.file ?? undefined; + return message; + }, +}; + +function createBaseUpdateMessageResponse(): UpdateMessageResponse { + return { data: undefined }; +} + +export const UpdateMessageResponse: MessageFns = { + encode(message: UpdateMessageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== undefined) { + Message.encode(message.data, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateMessageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateMessageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data = Message.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateMessageResponse { + return { data: isSet(object.data) ? Message.fromJSON(object.data) : undefined }; + }, + + toJSON(message: UpdateMessageResponse): unknown { + const obj: any = {}; + if (message.data !== undefined) { + obj.data = Message.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): UpdateMessageResponse { + return UpdateMessageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UpdateMessageResponse { + const message = createBaseUpdateMessageResponse(); + message.data = (object.data !== undefined && object.data !== null) ? Message.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseGetMessageRequest(): GetMessageRequest { + return { id: 0 }; +} + +export const GetMessageRequest: MessageFns = { + encode(message: GetMessageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetMessageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetMessageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetMessageRequest { + return { id: isSet(object.id) ? globalThis.Number(object.id) : 0 }; + }, + + toJSON(message: GetMessageRequest): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + return obj; + }, + + create, I>>(base?: I): GetMessageRequest { + return GetMessageRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetMessageRequest { + const message = createBaseGetMessageRequest(); + message.id = object.id ?? 0; + return message; + }, +}; + +function createBaseGetMessageResponse(): GetMessageResponse { + return { data: undefined }; +} + +export const GetMessageResponse: MessageFns = { + encode(message: GetMessageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== undefined) { + Message.encode(message.data, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetMessageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetMessageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data = Message.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetMessageResponse { + return { data: isSet(object.data) ? Message.fromJSON(object.data) : undefined }; + }, + + toJSON(message: GetMessageResponse): unknown { + const obj: any = {}; + if (message.data !== undefined) { + obj.data = Message.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): GetMessageResponse { + return GetMessageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetMessageResponse { + const message = createBaseGetMessageResponse(); + message.data = (object.data !== undefined && object.data !== null) ? Message.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseListMessageRequest(): ListMessageRequest { + return { page: 0, chatId: "", userId: 0 }; +} + +export const ListMessageRequest: MessageFns = { + encode(message: ListMessageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.page !== 0) { + writer.uint32(8).int32(message.page); + } + if (message.chatId !== "") { + writer.uint32(18).string(message.chatId); + } + if (message.userId !== 0) { + writer.uint32(24).int32(message.userId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListMessageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListMessageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.page = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.chatId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.userId = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListMessageRequest { + return { + page: isSet(object.page) ? globalThis.Number(object.page) : 0, + chatId: isSet(object.chatId) + ? globalThis.String(object.chatId) + : isSet(object.chat_id) + ? globalThis.String(object.chat_id) + : "", + userId: isSet(object.userId) + ? globalThis.Number(object.userId) + : isSet(object.user_id) + ? globalThis.Number(object.user_id) + : 0, + }; + }, + + toJSON(message: ListMessageRequest): unknown { + const obj: any = {}; + if (message.page !== 0) { + obj.page = Math.round(message.page); + } + if (message.chatId !== "") { + obj.chatId = message.chatId; + } + if (message.userId !== 0) { + obj.userId = Math.round(message.userId); + } + return obj; + }, + + create, I>>(base?: I): ListMessageRequest { + return ListMessageRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListMessageRequest { + const message = createBaseListMessageRequest(); + message.page = object.page ?? 0; + message.chatId = object.chatId ?? ""; + message.userId = object.userId ?? 0; + return message; + }, +}; + +function createBaseListMessageResponse(): ListMessageResponse { + return { data: [] }; +} + +export const ListMessageResponse: MessageFns = { + encode(message: ListMessageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.data) { + Message.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListMessageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListMessageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data.push(Message.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListMessageResponse { + return { data: globalThis.Array.isArray(object?.data) ? object.data.map((e: any) => Message.fromJSON(e)) : [] }; + }, + + toJSON(message: ListMessageResponse): unknown { + const obj: any = {}; + if (message.data?.length) { + obj.data = message.data.map((e) => Message.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListMessageResponse { + return ListMessageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListMessageResponse { + const message = createBaseListMessageResponse(); + message.data = object.data?.map((e) => Message.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMessage(): Message { + return { + id: 0, + userId: 0, + message: undefined, + image: undefined, + video: undefined, + file: undefined, + createdAt: "", + updatedAt: "", + }; +} + +export const Message: MessageFns = { + encode(message: Message, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.userId !== 0) { + writer.uint32(16).int32(message.userId); + } + if (message.message !== undefined) { + writer.uint32(26).string(message.message); + } + if (message.image !== undefined) { + writer.uint32(34).string(message.image); + } + if (message.video !== undefined) { + writer.uint32(42).string(message.video); + } + if (message.file !== undefined) { + writer.uint32(50).string(message.file); + } + if (message.createdAt !== "") { + writer.uint32(58).string(message.createdAt); + } + if (message.updatedAt !== "") { + writer.uint32(66).string(message.updatedAt); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Message { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.userId = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.image = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.video = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.file = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.createdAt = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.updatedAt = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Message { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + userId: isSet(object.userId) + ? globalThis.Number(object.userId) + : isSet(object.user_id) + ? globalThis.Number(object.user_id) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : undefined, + image: isSet(object.image) ? globalThis.String(object.image) : undefined, + video: isSet(object.video) ? globalThis.String(object.video) : undefined, + file: isSet(object.file) ? globalThis.String(object.file) : undefined, + createdAt: isSet(object.createdAt) + ? globalThis.String(object.createdAt) + : isSet(object.created_at) + ? globalThis.String(object.created_at) + : "", + updatedAt: isSet(object.updatedAt) + ? globalThis.String(object.updatedAt) + : isSet(object.updated_at) + ? globalThis.String(object.updated_at) + : "", + }; + }, + + toJSON(message: Message): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.userId !== 0) { + obj.userId = Math.round(message.userId); + } + if (message.message !== undefined) { + obj.message = message.message; + } + if (message.image !== undefined) { + obj.image = message.image; + } + if (message.video !== undefined) { + obj.video = message.video; + } + if (message.file !== undefined) { + obj.file = message.file; + } + if (message.createdAt !== "") { + obj.createdAt = message.createdAt; + } + if (message.updatedAt !== "") { + obj.updatedAt = message.updatedAt; + } + return obj; + }, + + create, I>>(base?: I): Message { + return Message.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Message { + const message = createBaseMessage(); + message.id = object.id ?? 0; + message.userId = object.userId ?? 0; + message.message = object.message ?? undefined; + message.image = object.image ?? undefined; + message.video = object.video ?? undefined; + message.file = object.file ?? undefined; + message.createdAt = object.createdAt ?? ""; + message.updatedAt = object.updatedAt ?? ""; + return message; + }, +}; + +function createBaseGetVersionResponse(): GetVersionResponse { + return { data: undefined }; +} + +export const GetVersionResponse: MessageFns = { + encode(message: GetVersionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== undefined) { + Version.encode(message.data, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetVersionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetVersionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data = Version.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetVersionResponse { + return { data: isSet(object.data) ? Version.fromJSON(object.data) : undefined }; + }, + + toJSON(message: GetVersionResponse): unknown { + const obj: any = {}; + if (message.data !== undefined) { + obj.data = Version.toJSON(message.data); + } + return obj; + }, + + create, I>>(base?: I): GetVersionResponse { + return GetVersionResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetVersionResponse { + const message = createBaseGetVersionResponse(); + message.data = (object.data !== undefined && object.data !== null) ? Version.fromPartial(object.data) : undefined; + return message; + }, +}; + +function createBaseVersion(): Version { + return { id: 0, version: "" }; +} + +export const Version: MessageFns = { + encode(message: Version, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Version { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Version { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + version: isSet(object.version) ? globalThis.String(object.version) : "", + }; + }, + + toJSON(message: Version): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.version !== "") { + obj.version = message.version; + } + return obj; + }, + + create, I>>(base?: I): Version { + return Version.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Version { + const message = createBaseVersion(); + message.id = object.id ?? 0; + message.version = object.version ?? ""; + return message; + }, +}; + +export type MessageServiceService = typeof MessageServiceService; +export const MessageServiceService = { + createUser: { + path: "/message.MessageService/CreateUser", + requestStream: false, + responseStream: false, + requestSerialize: (value: CreateUserRequest): Buffer => Buffer.from(CreateUserRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): CreateUserRequest => CreateUserRequest.decode(value), + responseSerialize: (value: CreateUserResponse): Buffer => Buffer.from(CreateUserResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): CreateUserResponse => CreateUserResponse.decode(value), + }, + updateUser: { + path: "/message.MessageService/UpdateUser", + requestStream: false, + responseStream: false, + requestSerialize: (value: UpdateUserRequest): Buffer => Buffer.from(UpdateUserRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): UpdateUserRequest => UpdateUserRequest.decode(value), + responseSerialize: (value: UpdateUserResponse): Buffer => Buffer.from(UpdateUserResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): UpdateUserResponse => UpdateUserResponse.decode(value), + }, + getUserByToken: { + path: "/message.MessageService/GetUserByToken", + requestStream: false, + responseStream: false, + requestSerialize: (value: GetUserByTokenRequest): Buffer => + Buffer.from(GetUserByTokenRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetUserByTokenRequest => GetUserByTokenRequest.decode(value), + responseSerialize: (value: GetUserResponse): Buffer => Buffer.from(GetUserResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetUserResponse => GetUserResponse.decode(value), + }, + getUserByEmail: { + path: "/message.MessageService/GetUserByEmail", + requestStream: false, + responseStream: false, + requestSerialize: (value: GetUserByEmailRequest): Buffer => + Buffer.from(GetUserByEmailRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetUserByEmailRequest => GetUserByEmailRequest.decode(value), + responseSerialize: (value: GetUserResponse): Buffer => Buffer.from(GetUserResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetUserResponse => GetUserResponse.decode(value), + }, + listUser: { + path: "/message.MessageService/ListUser", + requestStream: false, + responseStream: false, + requestSerialize: (value: ListUserRequest): Buffer => Buffer.from(ListUserRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ListUserRequest => ListUserRequest.decode(value), + responseSerialize: (value: ListUserResponse): Buffer => Buffer.from(ListUserResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ListUserResponse => ListUserResponse.decode(value), + }, + getUser: { + path: "/message.MessageService/GetUser", + requestStream: false, + responseStream: false, + requestSerialize: (value: GetUserRequest): Buffer => Buffer.from(GetUserRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetUserRequest => GetUserRequest.decode(value), + responseSerialize: (value: GetUserResponse): Buffer => Buffer.from(GetUserResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetUserResponse => GetUserResponse.decode(value), + }, + createChat: { + path: "/message.MessageService/CreateChat", + requestStream: false, + responseStream: false, + requestSerialize: (value: CreateChatRequest): Buffer => Buffer.from(CreateChatRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): CreateChatRequest => CreateChatRequest.decode(value), + responseSerialize: (value: CreateChatResponse): Buffer => Buffer.from(CreateChatResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): CreateChatResponse => CreateChatResponse.decode(value), + }, + updateChat: { + path: "/message.MessageService/UpdateChat", + requestStream: false, + responseStream: false, + requestSerialize: (value: UpdateChatRequest): Buffer => Buffer.from(UpdateChatRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): UpdateChatRequest => UpdateChatRequest.decode(value), + responseSerialize: (value: UpdateChatResponse): Buffer => Buffer.from(UpdateChatResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): UpdateChatResponse => UpdateChatResponse.decode(value), + }, + getChat: { + path: "/message.MessageService/GetChat", + requestStream: false, + responseStream: false, + requestSerialize: (value: GetChatRequest): Buffer => Buffer.from(GetChatRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetChatRequest => GetChatRequest.decode(value), + responseSerialize: (value: GetChatResponse): Buffer => Buffer.from(GetChatResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetChatResponse => GetChatResponse.decode(value), + }, + listChat: { + path: "/message.MessageService/ListChat", + requestStream: false, + responseStream: false, + requestSerialize: (value: ListChatRequest): Buffer => Buffer.from(ListChatRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ListChatRequest => ListChatRequest.decode(value), + responseSerialize: (value: ListChatResponse): Buffer => Buffer.from(ListChatResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ListChatResponse => ListChatResponse.decode(value), + }, + createMessage: { + path: "/message.MessageService/CreateMessage", + requestStream: false, + responseStream: false, + requestSerialize: (value: CreateMessageRequest): Buffer => Buffer.from(CreateMessageRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): CreateMessageRequest => CreateMessageRequest.decode(value), + responseSerialize: (value: CreateMessageResponse): Buffer => + Buffer.from(CreateMessageResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): CreateMessageResponse => CreateMessageResponse.decode(value), + }, + updateMessage: { + path: "/message.MessageService/UpdateMessage", + requestStream: false, + responseStream: false, + requestSerialize: (value: UpdateMessageRequest): Buffer => Buffer.from(UpdateMessageRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): UpdateMessageRequest => UpdateMessageRequest.decode(value), + responseSerialize: (value: UpdateMessageResponse): Buffer => + Buffer.from(UpdateMessageResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): UpdateMessageResponse => UpdateMessageResponse.decode(value), + }, + getMessage: { + path: "/message.MessageService/GetMessage", + requestStream: false, + responseStream: false, + requestSerialize: (value: GetMessageRequest): Buffer => Buffer.from(GetMessageRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetMessageRequest => GetMessageRequest.decode(value), + responseSerialize: (value: GetMessageResponse): Buffer => Buffer.from(GetMessageResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetMessageResponse => GetMessageResponse.decode(value), + }, + listMessage: { + path: "/message.MessageService/ListMessage", + requestStream: false, + responseStream: false, + requestSerialize: (value: ListMessageRequest): Buffer => Buffer.from(ListMessageRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ListMessageRequest => ListMessageRequest.decode(value), + responseSerialize: (value: ListMessageResponse): Buffer => Buffer.from(ListMessageResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ListMessageResponse => ListMessageResponse.decode(value), + }, + getVersion: { + path: "/message.MessageService/GetVersion", + requestStream: false, + responseStream: false, + requestSerialize: (value: Empty): Buffer => Buffer.from(Empty.encode(value).finish()), + requestDeserialize: (value: Buffer): Empty => Empty.decode(value), + responseSerialize: (value: GetVersionResponse): Buffer => Buffer.from(GetVersionResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetVersionResponse => GetVersionResponse.decode(value), + }, +} as const; + +export interface MessageServiceServer extends UntypedServiceImplementation { + createUser: handleUnaryCall; + updateUser: handleUnaryCall; + getUserByToken: handleUnaryCall; + getUserByEmail: handleUnaryCall; + listUser: handleUnaryCall; + getUser: handleUnaryCall; + createChat: handleUnaryCall; + updateChat: handleUnaryCall; + getChat: handleUnaryCall; + listChat: handleUnaryCall; + createMessage: handleUnaryCall; + updateMessage: handleUnaryCall; + getMessage: handleUnaryCall; + listMessage: handleUnaryCall; + getVersion: handleUnaryCall; +} + +export interface MessageServiceClient extends Client { + createUser( + request: CreateUserRequest, + callback: (error: ServiceError | null, response: CreateUserResponse) => void, + ): ClientUnaryCall; + createUser( + request: CreateUserRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: CreateUserResponse) => void, + ): ClientUnaryCall; + createUser( + request: CreateUserRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: CreateUserResponse) => void, + ): ClientUnaryCall; + updateUser( + request: UpdateUserRequest, + callback: (error: ServiceError | null, response: UpdateUserResponse) => void, + ): ClientUnaryCall; + updateUser( + request: UpdateUserRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: UpdateUserResponse) => void, + ): ClientUnaryCall; + updateUser( + request: UpdateUserRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: UpdateUserResponse) => void, + ): ClientUnaryCall; + getUserByToken( + request: GetUserByTokenRequest, + callback: (error: ServiceError | null, response: GetUserResponse) => void, + ): ClientUnaryCall; + getUserByToken( + request: GetUserByTokenRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetUserResponse) => void, + ): ClientUnaryCall; + getUserByToken( + request: GetUserByTokenRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetUserResponse) => void, + ): ClientUnaryCall; + getUserByEmail( + request: GetUserByEmailRequest, + callback: (error: ServiceError | null, response: GetUserResponse) => void, + ): ClientUnaryCall; + getUserByEmail( + request: GetUserByEmailRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetUserResponse) => void, + ): ClientUnaryCall; + getUserByEmail( + request: GetUserByEmailRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetUserResponse) => void, + ): ClientUnaryCall; + listUser( + request: ListUserRequest, + callback: (error: ServiceError | null, response: ListUserResponse) => void, + ): ClientUnaryCall; + listUser( + request: ListUserRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ListUserResponse) => void, + ): ClientUnaryCall; + listUser( + request: ListUserRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ListUserResponse) => void, + ): ClientUnaryCall; + getUser( + request: GetUserRequest, + callback: (error: ServiceError | null, response: GetUserResponse) => void, + ): ClientUnaryCall; + getUser( + request: GetUserRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetUserResponse) => void, + ): ClientUnaryCall; + getUser( + request: GetUserRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetUserResponse) => void, + ): ClientUnaryCall; + createChat( + request: CreateChatRequest, + callback: (error: ServiceError | null, response: CreateChatResponse) => void, + ): ClientUnaryCall; + createChat( + request: CreateChatRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: CreateChatResponse) => void, + ): ClientUnaryCall; + createChat( + request: CreateChatRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: CreateChatResponse) => void, + ): ClientUnaryCall; + updateChat( + request: UpdateChatRequest, + callback: (error: ServiceError | null, response: UpdateChatResponse) => void, + ): ClientUnaryCall; + updateChat( + request: UpdateChatRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: UpdateChatResponse) => void, + ): ClientUnaryCall; + updateChat( + request: UpdateChatRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: UpdateChatResponse) => void, + ): ClientUnaryCall; + getChat( + request: GetChatRequest, + callback: (error: ServiceError | null, response: GetChatResponse) => void, + ): ClientUnaryCall; + getChat( + request: GetChatRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetChatResponse) => void, + ): ClientUnaryCall; + getChat( + request: GetChatRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetChatResponse) => void, + ): ClientUnaryCall; + listChat( + request: ListChatRequest, + callback: (error: ServiceError | null, response: ListChatResponse) => void, + ): ClientUnaryCall; + listChat( + request: ListChatRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ListChatResponse) => void, + ): ClientUnaryCall; + listChat( + request: ListChatRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ListChatResponse) => void, + ): ClientUnaryCall; + createMessage( + request: CreateMessageRequest, + callback: (error: ServiceError | null, response: CreateMessageResponse) => void, + ): ClientUnaryCall; + createMessage( + request: CreateMessageRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: CreateMessageResponse) => void, + ): ClientUnaryCall; + createMessage( + request: CreateMessageRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: CreateMessageResponse) => void, + ): ClientUnaryCall; + updateMessage( + request: UpdateMessageRequest, + callback: (error: ServiceError | null, response: UpdateMessageResponse) => void, + ): ClientUnaryCall; + updateMessage( + request: UpdateMessageRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: UpdateMessageResponse) => void, + ): ClientUnaryCall; + updateMessage( + request: UpdateMessageRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: UpdateMessageResponse) => void, + ): ClientUnaryCall; + getMessage( + request: GetMessageRequest, + callback: (error: ServiceError | null, response: GetMessageResponse) => void, + ): ClientUnaryCall; + getMessage( + request: GetMessageRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetMessageResponse) => void, + ): ClientUnaryCall; + getMessage( + request: GetMessageRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetMessageResponse) => void, + ): ClientUnaryCall; + listMessage( + request: ListMessageRequest, + callback: (error: ServiceError | null, response: ListMessageResponse) => void, + ): ClientUnaryCall; + listMessage( + request: ListMessageRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ListMessageResponse) => void, + ): ClientUnaryCall; + listMessage( + request: ListMessageRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ListMessageResponse) => void, + ): ClientUnaryCall; + getVersion( + request: Empty, + callback: (error: ServiceError | null, response: GetVersionResponse) => void, + ): ClientUnaryCall; + getVersion( + request: Empty, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetVersionResponse) => void, + ): ClientUnaryCall; + getVersion( + request: Empty, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetVersionResponse) => void, + ): ClientUnaryCall; +} + +export const MessageServiceClient = makeGenericClientConstructor( + MessageServiceService, + "message.MessageService", +) as unknown as { + new (address: string, credentials: ChannelCredentials, options?: Partial): MessageServiceClient; + service: typeof MessageServiceService; + serviceName: string; +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/generated/validate/validate.ts b/src/generated/validate/validate.ts new file mode 100644 index 0000000..3ec5682 --- /dev/null +++ b/src/generated/validate/validate.ts @@ -0,0 +1,6069 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.4 +// protoc v6.33.4 +// source: validate/validate.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../google/protobuf/duration"; +import { Timestamp } from "../google/protobuf/timestamp"; + +export const protobufPackage = "validate"; + +/** WellKnownRegex contain some well-known patterns. */ +export enum KnownRegex { + UNKNOWN = 0, + /** HTTP_HEADER_NAME - HTTP header name as defined by RFC 7230. */ + HTTP_HEADER_NAME = 1, + /** HTTP_HEADER_VALUE - HTTP header value as defined by RFC 7230. */ + HTTP_HEADER_VALUE = 2, + UNRECOGNIZED = -1, +} + +export function knownRegexFromJSON(object: any): KnownRegex { + switch (object) { + case 0: + case "UNKNOWN": + return KnownRegex.UNKNOWN; + case 1: + case "HTTP_HEADER_NAME": + return KnownRegex.HTTP_HEADER_NAME; + case 2: + case "HTTP_HEADER_VALUE": + return KnownRegex.HTTP_HEADER_VALUE; + case -1: + case "UNRECOGNIZED": + default: + return KnownRegex.UNRECOGNIZED; + } +} + +export function knownRegexToJSON(object: KnownRegex): string { + switch (object) { + case KnownRegex.UNKNOWN: + return "UNKNOWN"; + case KnownRegex.HTTP_HEADER_NAME: + return "HTTP_HEADER_NAME"; + case KnownRegex.HTTP_HEADER_VALUE: + return "HTTP_HEADER_VALUE"; + case KnownRegex.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * FieldRules encapsulates the rules for each type of field. Depending on the + * field, the correct set should be used to ensure proper validations. + */ +export interface FieldRules { + message?: + | MessageRules + | undefined; + /** Scalar Field Types */ + float?: FloatRules | undefined; + double?: DoubleRules | undefined; + int32?: Int32Rules | undefined; + int64?: Int64Rules | undefined; + uint32?: UInt32Rules | undefined; + uint64?: UInt64Rules | undefined; + sint32?: SInt32Rules | undefined; + sint64?: SInt64Rules | undefined; + fixed32?: Fixed32Rules | undefined; + fixed64?: Fixed64Rules | undefined; + sfixed32?: SFixed32Rules | undefined; + sfixed64?: SFixed64Rules | undefined; + bool?: BoolRules | undefined; + string?: StringRules | undefined; + bytes?: + | BytesRules + | undefined; + /** Complex Field Types */ + enum?: EnumRules | undefined; + repeated?: RepeatedRules | undefined; + map?: + | MapRules + | undefined; + /** Well-Known Field Types */ + any?: AnyRules | undefined; + duration?: DurationRules | undefined; + timestamp?: TimestampRules | undefined; +} + +/** FloatRules describes the constraints applied to `float` values */ +export interface FloatRules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | number + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | number + | undefined; + /** + * Lte specifies that this field must be less than or equal to the + * specified value, inclusive + */ + lte?: + | number + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive. If the value of Gt is larger than a specified Lt or Lte, the + * range is reversed. + */ + gt?: + | number + | undefined; + /** + * Gte specifies that this field must be greater than or equal to the + * specified value, inclusive. If the value of Gte is larger than a + * specified Lt or Lte, the range is reversed. + */ + gte?: + | number + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: number[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: number[]; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** DoubleRules describes the constraints applied to `double` values */ +export interface DoubleRules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | number + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | number + | undefined; + /** + * Lte specifies that this field must be less than or equal to the + * specified value, inclusive + */ + lte?: + | number + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive. If the value of Gt is larger than a specified Lt or Lte, the + * range is reversed. + */ + gt?: + | number + | undefined; + /** + * Gte specifies that this field must be greater than or equal to the + * specified value, inclusive. If the value of Gte is larger than a + * specified Lt or Lte, the range is reversed. + */ + gte?: + | number + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: number[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: number[]; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** Int32Rules describes the constraints applied to `int32` values */ +export interface Int32Rules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | number + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | number + | undefined; + /** + * Lte specifies that this field must be less than or equal to the + * specified value, inclusive + */ + lte?: + | number + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive. If the value of Gt is larger than a specified Lt or Lte, the + * range is reversed. + */ + gt?: + | number + | undefined; + /** + * Gte specifies that this field must be greater than or equal to the + * specified value, inclusive. If the value of Gte is larger than a + * specified Lt or Lte, the range is reversed. + */ + gte?: + | number + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: number[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: number[]; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** Int64Rules describes the constraints applied to `int64` values */ +export interface Int64Rules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | number + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | number + | undefined; + /** + * Lte specifies that this field must be less than or equal to the + * specified value, inclusive + */ + lte?: + | number + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive. If the value of Gt is larger than a specified Lt or Lte, the + * range is reversed. + */ + gt?: + | number + | undefined; + /** + * Gte specifies that this field must be greater than or equal to the + * specified value, inclusive. If the value of Gte is larger than a + * specified Lt or Lte, the range is reversed. + */ + gte?: + | number + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: number[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: number[]; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** UInt32Rules describes the constraints applied to `uint32` values */ +export interface UInt32Rules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | number + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | number + | undefined; + /** + * Lte specifies that this field must be less than or equal to the + * specified value, inclusive + */ + lte?: + | number + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive. If the value of Gt is larger than a specified Lt or Lte, the + * range is reversed. + */ + gt?: + | number + | undefined; + /** + * Gte specifies that this field must be greater than or equal to the + * specified value, inclusive. If the value of Gte is larger than a + * specified Lt or Lte, the range is reversed. + */ + gte?: + | number + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: number[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: number[]; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** UInt64Rules describes the constraints applied to `uint64` values */ +export interface UInt64Rules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | number + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | number + | undefined; + /** + * Lte specifies that this field must be less than or equal to the + * specified value, inclusive + */ + lte?: + | number + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive. If the value of Gt is larger than a specified Lt or Lte, the + * range is reversed. + */ + gt?: + | number + | undefined; + /** + * Gte specifies that this field must be greater than or equal to the + * specified value, inclusive. If the value of Gte is larger than a + * specified Lt or Lte, the range is reversed. + */ + gte?: + | number + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: number[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: number[]; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** SInt32Rules describes the constraints applied to `sint32` values */ +export interface SInt32Rules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | number + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | number + | undefined; + /** + * Lte specifies that this field must be less than or equal to the + * specified value, inclusive + */ + lte?: + | number + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive. If the value of Gt is larger than a specified Lt or Lte, the + * range is reversed. + */ + gt?: + | number + | undefined; + /** + * Gte specifies that this field must be greater than or equal to the + * specified value, inclusive. If the value of Gte is larger than a + * specified Lt or Lte, the range is reversed. + */ + gte?: + | number + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: number[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: number[]; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** SInt64Rules describes the constraints applied to `sint64` values */ +export interface SInt64Rules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | number + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | number + | undefined; + /** + * Lte specifies that this field must be less than or equal to the + * specified value, inclusive + */ + lte?: + | number + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive. If the value of Gt is larger than a specified Lt or Lte, the + * range is reversed. + */ + gt?: + | number + | undefined; + /** + * Gte specifies that this field must be greater than or equal to the + * specified value, inclusive. If the value of Gte is larger than a + * specified Lt or Lte, the range is reversed. + */ + gte?: + | number + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: number[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: number[]; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** Fixed32Rules describes the constraints applied to `fixed32` values */ +export interface Fixed32Rules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | number + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | number + | undefined; + /** + * Lte specifies that this field must be less than or equal to the + * specified value, inclusive + */ + lte?: + | number + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive. If the value of Gt is larger than a specified Lt or Lte, the + * range is reversed. + */ + gt?: + | number + | undefined; + /** + * Gte specifies that this field must be greater than or equal to the + * specified value, inclusive. If the value of Gte is larger than a + * specified Lt or Lte, the range is reversed. + */ + gte?: + | number + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: number[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: number[]; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** Fixed64Rules describes the constraints applied to `fixed64` values */ +export interface Fixed64Rules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | number + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | number + | undefined; + /** + * Lte specifies that this field must be less than or equal to the + * specified value, inclusive + */ + lte?: + | number + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive. If the value of Gt is larger than a specified Lt or Lte, the + * range is reversed. + */ + gt?: + | number + | undefined; + /** + * Gte specifies that this field must be greater than or equal to the + * specified value, inclusive. If the value of Gte is larger than a + * specified Lt or Lte, the range is reversed. + */ + gte?: + | number + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: number[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: number[]; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** SFixed32Rules describes the constraints applied to `sfixed32` values */ +export interface SFixed32Rules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | number + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | number + | undefined; + /** + * Lte specifies that this field must be less than or equal to the + * specified value, inclusive + */ + lte?: + | number + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive. If the value of Gt is larger than a specified Lt or Lte, the + * range is reversed. + */ + gt?: + | number + | undefined; + /** + * Gte specifies that this field must be greater than or equal to the + * specified value, inclusive. If the value of Gte is larger than a + * specified Lt or Lte, the range is reversed. + */ + gte?: + | number + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: number[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: number[]; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** SFixed64Rules describes the constraints applied to `sfixed64` values */ +export interface SFixed64Rules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | number + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | number + | undefined; + /** + * Lte specifies that this field must be less than or equal to the + * specified value, inclusive + */ + lte?: + | number + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive. If the value of Gt is larger than a specified Lt or Lte, the + * range is reversed. + */ + gt?: + | number + | undefined; + /** + * Gte specifies that this field must be greater than or equal to the + * specified value, inclusive. If the value of Gte is larger than a + * specified Lt or Lte, the range is reversed. + */ + gte?: + | number + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: number[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: number[]; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** BoolRules describes the constraints applied to `bool` values */ +export interface BoolRules { + /** Const specifies that this field must be exactly the specified value */ + const?: boolean | undefined; +} + +/** StringRules describe the constraints applied to `string` values */ +export interface StringRules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | string + | undefined; + /** + * Len specifies that this field must be the specified number of + * characters (Unicode code points). Note that the number of + * characters may differ from the number of bytes in the string. + */ + len?: + | number + | undefined; + /** + * MinLen specifies that this field must be the specified number of + * characters (Unicode code points) at a minimum. Note that the number of + * characters may differ from the number of bytes in the string. + */ + minLen?: + | number + | undefined; + /** + * MaxLen specifies that this field must be the specified number of + * characters (Unicode code points) at a maximum. Note that the number of + * characters may differ from the number of bytes in the string. + */ + maxLen?: + | number + | undefined; + /** LenBytes specifies that this field must be the specified number of bytes */ + lenBytes?: + | number + | undefined; + /** + * MinBytes specifies that this field must be the specified number of bytes + * at a minimum + */ + minBytes?: + | number + | undefined; + /** + * MaxBytes specifies that this field must be the specified number of bytes + * at a maximum + */ + maxBytes?: + | number + | undefined; + /** + * Pattern specifies that this field must match against the specified + * regular expression (RE2 syntax). The included expression should elide + * any delimiters. + */ + pattern?: + | string + | undefined; + /** + * Prefix specifies that this field must have the specified substring at + * the beginning of the string. + */ + prefix?: + | string + | undefined; + /** + * Suffix specifies that this field must have the specified substring at + * the end of the string. + */ + suffix?: + | string + | undefined; + /** + * Contains specifies that this field must have the specified substring + * anywhere in the string. + */ + contains?: + | string + | undefined; + /** + * NotContains specifies that this field cannot have the specified substring + * anywhere in the string. + */ + notContains?: + | string + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: string[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: string[]; + /** + * Email specifies that the field must be a valid email address as + * defined by RFC 5322 + */ + email?: + | boolean + | undefined; + /** + * Hostname specifies that the field must be a valid hostname as + * defined by RFC 1034. This constraint does not support + * internationalized domain names (IDNs). + */ + hostname?: + | boolean + | undefined; + /** + * Ip specifies that the field must be a valid IP (v4 or v6) address. + * Valid IPv6 addresses should not include surrounding square brackets. + */ + ip?: + | boolean + | undefined; + /** Ipv4 specifies that the field must be a valid IPv4 address. */ + ipv4?: + | boolean + | undefined; + /** + * Ipv6 specifies that the field must be a valid IPv6 address. Valid + * IPv6 addresses should not include surrounding square brackets. + */ + ipv6?: + | boolean + | undefined; + /** + * Uri specifies that the field must be a valid, absolute URI as defined + * by RFC 3986 + */ + uri?: + | boolean + | undefined; + /** + * UriRef specifies that the field must be a valid URI as defined by RFC + * 3986 and may be relative or absolute. + */ + uriRef?: + | boolean + | undefined; + /** + * Address specifies that the field must be either a valid hostname as + * defined by RFC 1034 (which does not support internationalized domain + * names or IDNs), or it can be a valid IP (v4 or v6). + */ + address?: + | boolean + | undefined; + /** + * Uuid specifies that the field must be a valid UUID as defined by + * RFC 4122 + */ + uuid?: + | boolean + | undefined; + /** WellKnownRegex specifies a common well known pattern defined as a regex. */ + wellKnownRegex?: + | KnownRegex + | undefined; + /** + * This applies to regexes HTTP_HEADER_NAME and HTTP_HEADER_VALUE to enable + * strict header validation. + * By default, this is true, and HTTP header validations are RFC-compliant. + * Setting to false will enable a looser validations that only disallows + * \r\n\0 characters, which can be used to bypass header matching rules. + */ + strict?: + | boolean + | undefined; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** BytesRules describe the constraints applied to `bytes` values */ +export interface BytesRules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | Buffer + | undefined; + /** Len specifies that this field must be the specified number of bytes */ + len?: + | number + | undefined; + /** + * MinLen specifies that this field must be the specified number of bytes + * at a minimum + */ + minLen?: + | number + | undefined; + /** + * MaxLen specifies that this field must be the specified number of bytes + * at a maximum + */ + maxLen?: + | number + | undefined; + /** + * Pattern specifies that this field must match against the specified + * regular expression (RE2 syntax). The included expression should elide + * any delimiters. + */ + pattern?: + | string + | undefined; + /** + * Prefix specifies that this field must have the specified bytes at the + * beginning of the string. + */ + prefix?: + | Buffer + | undefined; + /** + * Suffix specifies that this field must have the specified bytes at the + * end of the string. + */ + suffix?: + | Buffer + | undefined; + /** + * Contains specifies that this field must have the specified bytes + * anywhere in the string. + */ + contains?: + | Buffer + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: Buffer[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: Buffer[]; + /** + * Ip specifies that the field must be a valid IP (v4 or v6) address in + * byte format + */ + ip?: + | boolean + | undefined; + /** + * Ipv4 specifies that the field must be a valid IPv4 address in byte + * format + */ + ipv4?: + | boolean + | undefined; + /** + * Ipv6 specifies that the field must be a valid IPv6 address in byte + * format + */ + ipv6?: + | boolean + | undefined; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** EnumRules describe the constraints applied to enum values */ +export interface EnumRules { + /** Const specifies that this field must be exactly the specified value */ + const?: + | number + | undefined; + /** + * DefinedOnly specifies that this field must be only one of the defined + * values for this enum, failing on any undefined value. + */ + definedOnly?: + | boolean + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: number[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: number[]; +} + +/** + * MessageRules describe the constraints applied to embedded message values. + * For message-type fields, validation is performed recursively. + */ +export interface MessageRules { + /** + * Skip specifies that the validation rules of this field should not be + * evaluated + */ + skip?: + | boolean + | undefined; + /** Required specifies that this field must be set */ + required?: boolean | undefined; +} + +/** RepeatedRules describe the constraints applied to `repeated` values */ +export interface RepeatedRules { + /** + * MinItems specifies that this field must have the specified number of + * items at a minimum + */ + minItems?: + | number + | undefined; + /** + * MaxItems specifies that this field must have the specified number of + * items at a maximum + */ + maxItems?: + | number + | undefined; + /** + * Unique specifies that all elements in this field must be unique. This + * constraint is only applicable to scalar and enum types (messages are not + * supported). + */ + unique?: + | boolean + | undefined; + /** + * Items specifies the constraints to be applied to each item in the field. + * Repeated message fields will still execute validation against each item + * unless skip is specified here. + */ + items?: + | FieldRules + | undefined; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** MapRules describe the constraints applied to `map` values */ +export interface MapRules { + /** + * MinPairs specifies that this field must have the specified number of + * KVs at a minimum + */ + minPairs?: + | number + | undefined; + /** + * MaxPairs specifies that this field must have the specified number of + * KVs at a maximum + */ + maxPairs?: + | number + | undefined; + /** + * NoSparse specifies values in this field cannot be unset. This only + * applies to map's with message value types. + */ + noSparse?: + | boolean + | undefined; + /** Keys specifies the constraints to be applied to each key in the field. */ + keys?: + | FieldRules + | undefined; + /** + * Values specifies the constraints to be applied to the value of each key + * in the field. Message values will still have their validations evaluated + * unless skip is specified here. + */ + values?: + | FieldRules + | undefined; + /** + * IgnoreEmpty specifies that the validation rules of this field should be + * evaluated only if the field is not empty + */ + ignoreEmpty?: boolean | undefined; +} + +/** + * AnyRules describe constraints applied exclusively to the + * `google.protobuf.Any` well-known type + */ +export interface AnyRules { + /** Required specifies that this field must be set */ + required?: + | boolean + | undefined; + /** + * In specifies that this field's `type_url` must be equal to one of the + * specified values. + */ + in: string[]; + /** + * NotIn specifies that this field's `type_url` must not be equal to any of + * the specified values. + */ + notIn: string[]; +} + +/** + * DurationRules describe the constraints applied exclusively to the + * `google.protobuf.Duration` well-known type + */ +export interface DurationRules { + /** Required specifies that this field must be set */ + required?: + | boolean + | undefined; + /** Const specifies that this field must be exactly the specified value */ + const?: + | Duration + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | Duration + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * inclusive + */ + lte?: + | Duration + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive + */ + gt?: + | Duration + | undefined; + /** + * Gte specifies that this field must be greater than the specified value, + * inclusive + */ + gte?: + | Duration + | undefined; + /** + * In specifies that this field must be equal to one of the specified + * values + */ + in: Duration[]; + /** + * NotIn specifies that this field cannot be equal to one of the specified + * values + */ + notIn: Duration[]; +} + +/** + * TimestampRules describe the constraints applied exclusively to the + * `google.protobuf.Timestamp` well-known type + */ +export interface TimestampRules { + /** Required specifies that this field must be set */ + required?: + | boolean + | undefined; + /** Const specifies that this field must be exactly the specified value */ + const?: + | Date + | undefined; + /** + * Lt specifies that this field must be less than the specified value, + * exclusive + */ + lt?: + | Date + | undefined; + /** + * Lte specifies that this field must be less than the specified value, + * inclusive + */ + lte?: + | Date + | undefined; + /** + * Gt specifies that this field must be greater than the specified value, + * exclusive + */ + gt?: + | Date + | undefined; + /** + * Gte specifies that this field must be greater than the specified value, + * inclusive + */ + gte?: + | Date + | undefined; + /** + * LtNow specifies that this must be less than the current time. LtNow + * can only be used with the Within rule. + */ + ltNow?: + | boolean + | undefined; + /** + * GtNow specifies that this must be greater than the current time. GtNow + * can only be used with the Within rule. + */ + gtNow?: + | boolean + | undefined; + /** + * Within specifies that this field must be within this duration of the + * current time. This constraint can be used alone or with the LtNow and + * GtNow rules. + */ + within?: Duration | undefined; +} + +function createBaseFieldRules(): FieldRules { + return { + message: undefined, + float: undefined, + double: undefined, + int32: undefined, + int64: undefined, + uint32: undefined, + uint64: undefined, + sint32: undefined, + sint64: undefined, + fixed32: undefined, + fixed64: undefined, + sfixed32: undefined, + sfixed64: undefined, + bool: undefined, + string: undefined, + bytes: undefined, + enum: undefined, + repeated: undefined, + map: undefined, + any: undefined, + duration: undefined, + timestamp: undefined, + }; +} + +export const FieldRules: MessageFns = { + encode(message: FieldRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== undefined) { + MessageRules.encode(message.message, writer.uint32(138).fork()).join(); + } + if (message.float !== undefined) { + FloatRules.encode(message.float, writer.uint32(10).fork()).join(); + } + if (message.double !== undefined) { + DoubleRules.encode(message.double, writer.uint32(18).fork()).join(); + } + if (message.int32 !== undefined) { + Int32Rules.encode(message.int32, writer.uint32(26).fork()).join(); + } + if (message.int64 !== undefined) { + Int64Rules.encode(message.int64, writer.uint32(34).fork()).join(); + } + if (message.uint32 !== undefined) { + UInt32Rules.encode(message.uint32, writer.uint32(42).fork()).join(); + } + if (message.uint64 !== undefined) { + UInt64Rules.encode(message.uint64, writer.uint32(50).fork()).join(); + } + if (message.sint32 !== undefined) { + SInt32Rules.encode(message.sint32, writer.uint32(58).fork()).join(); + } + if (message.sint64 !== undefined) { + SInt64Rules.encode(message.sint64, writer.uint32(66).fork()).join(); + } + if (message.fixed32 !== undefined) { + Fixed32Rules.encode(message.fixed32, writer.uint32(74).fork()).join(); + } + if (message.fixed64 !== undefined) { + Fixed64Rules.encode(message.fixed64, writer.uint32(82).fork()).join(); + } + if (message.sfixed32 !== undefined) { + SFixed32Rules.encode(message.sfixed32, writer.uint32(90).fork()).join(); + } + if (message.sfixed64 !== undefined) { + SFixed64Rules.encode(message.sfixed64, writer.uint32(98).fork()).join(); + } + if (message.bool !== undefined) { + BoolRules.encode(message.bool, writer.uint32(106).fork()).join(); + } + if (message.string !== undefined) { + StringRules.encode(message.string, writer.uint32(114).fork()).join(); + } + if (message.bytes !== undefined) { + BytesRules.encode(message.bytes, writer.uint32(122).fork()).join(); + } + if (message.enum !== undefined) { + EnumRules.encode(message.enum, writer.uint32(130).fork()).join(); + } + if (message.repeated !== undefined) { + RepeatedRules.encode(message.repeated, writer.uint32(146).fork()).join(); + } + if (message.map !== undefined) { + MapRules.encode(message.map, writer.uint32(154).fork()).join(); + } + if (message.any !== undefined) { + AnyRules.encode(message.any, writer.uint32(162).fork()).join(); + } + if (message.duration !== undefined) { + DurationRules.encode(message.duration, writer.uint32(170).fork()).join(); + } + if (message.timestamp !== undefined) { + TimestampRules.encode(message.timestamp, writer.uint32(178).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 17: { + if (tag !== 138) { + break; + } + + message.message = MessageRules.decode(reader, reader.uint32()); + continue; + } + case 1: { + if (tag !== 10) { + break; + } + + message.float = FloatRules.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.double = DoubleRules.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.int32 = Int32Rules.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.int64 = Int64Rules.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.uint32 = UInt32Rules.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.uint64 = UInt64Rules.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.sint32 = SInt32Rules.decode(reader, reader.uint32()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.sint64 = SInt64Rules.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.fixed32 = Fixed32Rules.decode(reader, reader.uint32()); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.fixed64 = Fixed64Rules.decode(reader, reader.uint32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.sfixed32 = SFixed32Rules.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.sfixed64 = SFixed64Rules.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.bool = BoolRules.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.string = StringRules.decode(reader, reader.uint32()); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.bytes = BytesRules.decode(reader, reader.uint32()); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + + message.enum = EnumRules.decode(reader, reader.uint32()); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + + message.repeated = RepeatedRules.decode(reader, reader.uint32()); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + + message.map = MapRules.decode(reader, reader.uint32()); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + + message.any = AnyRules.decode(reader, reader.uint32()); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + + message.duration = DurationRules.decode(reader, reader.uint32()); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + + message.timestamp = TimestampRules.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldRules { + return { + message: isSet(object.message) ? MessageRules.fromJSON(object.message) : undefined, + float: isSet(object.float) ? FloatRules.fromJSON(object.float) : undefined, + double: isSet(object.double) ? DoubleRules.fromJSON(object.double) : undefined, + int32: isSet(object.int32) ? Int32Rules.fromJSON(object.int32) : undefined, + int64: isSet(object.int64) ? Int64Rules.fromJSON(object.int64) : undefined, + uint32: isSet(object.uint32) ? UInt32Rules.fromJSON(object.uint32) : undefined, + uint64: isSet(object.uint64) ? UInt64Rules.fromJSON(object.uint64) : undefined, + sint32: isSet(object.sint32) ? SInt32Rules.fromJSON(object.sint32) : undefined, + sint64: isSet(object.sint64) ? SInt64Rules.fromJSON(object.sint64) : undefined, + fixed32: isSet(object.fixed32) ? Fixed32Rules.fromJSON(object.fixed32) : undefined, + fixed64: isSet(object.fixed64) ? Fixed64Rules.fromJSON(object.fixed64) : undefined, + sfixed32: isSet(object.sfixed32) ? SFixed32Rules.fromJSON(object.sfixed32) : undefined, + sfixed64: isSet(object.sfixed64) ? SFixed64Rules.fromJSON(object.sfixed64) : undefined, + bool: isSet(object.bool) ? BoolRules.fromJSON(object.bool) : undefined, + string: isSet(object.string) ? StringRules.fromJSON(object.string) : undefined, + bytes: isSet(object.bytes) ? BytesRules.fromJSON(object.bytes) : undefined, + enum: isSet(object.enum) ? EnumRules.fromJSON(object.enum) : undefined, + repeated: isSet(object.repeated) ? RepeatedRules.fromJSON(object.repeated) : undefined, + map: isSet(object.map) ? MapRules.fromJSON(object.map) : undefined, + any: isSet(object.any) ? AnyRules.fromJSON(object.any) : undefined, + duration: isSet(object.duration) ? DurationRules.fromJSON(object.duration) : undefined, + timestamp: isSet(object.timestamp) ? TimestampRules.fromJSON(object.timestamp) : undefined, + }; + }, + + toJSON(message: FieldRules): unknown { + const obj: any = {}; + if (message.message !== undefined) { + obj.message = MessageRules.toJSON(message.message); + } + if (message.float !== undefined) { + obj.float = FloatRules.toJSON(message.float); + } + if (message.double !== undefined) { + obj.double = DoubleRules.toJSON(message.double); + } + if (message.int32 !== undefined) { + obj.int32 = Int32Rules.toJSON(message.int32); + } + if (message.int64 !== undefined) { + obj.int64 = Int64Rules.toJSON(message.int64); + } + if (message.uint32 !== undefined) { + obj.uint32 = UInt32Rules.toJSON(message.uint32); + } + if (message.uint64 !== undefined) { + obj.uint64 = UInt64Rules.toJSON(message.uint64); + } + if (message.sint32 !== undefined) { + obj.sint32 = SInt32Rules.toJSON(message.sint32); + } + if (message.sint64 !== undefined) { + obj.sint64 = SInt64Rules.toJSON(message.sint64); + } + if (message.fixed32 !== undefined) { + obj.fixed32 = Fixed32Rules.toJSON(message.fixed32); + } + if (message.fixed64 !== undefined) { + obj.fixed64 = Fixed64Rules.toJSON(message.fixed64); + } + if (message.sfixed32 !== undefined) { + obj.sfixed32 = SFixed32Rules.toJSON(message.sfixed32); + } + if (message.sfixed64 !== undefined) { + obj.sfixed64 = SFixed64Rules.toJSON(message.sfixed64); + } + if (message.bool !== undefined) { + obj.bool = BoolRules.toJSON(message.bool); + } + if (message.string !== undefined) { + obj.string = StringRules.toJSON(message.string); + } + if (message.bytes !== undefined) { + obj.bytes = BytesRules.toJSON(message.bytes); + } + if (message.enum !== undefined) { + obj.enum = EnumRules.toJSON(message.enum); + } + if (message.repeated !== undefined) { + obj.repeated = RepeatedRules.toJSON(message.repeated); + } + if (message.map !== undefined) { + obj.map = MapRules.toJSON(message.map); + } + if (message.any !== undefined) { + obj.any = AnyRules.toJSON(message.any); + } + if (message.duration !== undefined) { + obj.duration = DurationRules.toJSON(message.duration); + } + if (message.timestamp !== undefined) { + obj.timestamp = TimestampRules.toJSON(message.timestamp); + } + return obj; + }, + + create, I>>(base?: I): FieldRules { + return FieldRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldRules { + const message = createBaseFieldRules(); + message.message = (object.message !== undefined && object.message !== null) + ? MessageRules.fromPartial(object.message) + : undefined; + message.float = (object.float !== undefined && object.float !== null) + ? FloatRules.fromPartial(object.float) + : undefined; + message.double = (object.double !== undefined && object.double !== null) + ? DoubleRules.fromPartial(object.double) + : undefined; + message.int32 = (object.int32 !== undefined && object.int32 !== null) + ? Int32Rules.fromPartial(object.int32) + : undefined; + message.int64 = (object.int64 !== undefined && object.int64 !== null) + ? Int64Rules.fromPartial(object.int64) + : undefined; + message.uint32 = (object.uint32 !== undefined && object.uint32 !== null) + ? UInt32Rules.fromPartial(object.uint32) + : undefined; + message.uint64 = (object.uint64 !== undefined && object.uint64 !== null) + ? UInt64Rules.fromPartial(object.uint64) + : undefined; + message.sint32 = (object.sint32 !== undefined && object.sint32 !== null) + ? SInt32Rules.fromPartial(object.sint32) + : undefined; + message.sint64 = (object.sint64 !== undefined && object.sint64 !== null) + ? SInt64Rules.fromPartial(object.sint64) + : undefined; + message.fixed32 = (object.fixed32 !== undefined && object.fixed32 !== null) + ? Fixed32Rules.fromPartial(object.fixed32) + : undefined; + message.fixed64 = (object.fixed64 !== undefined && object.fixed64 !== null) + ? Fixed64Rules.fromPartial(object.fixed64) + : undefined; + message.sfixed32 = (object.sfixed32 !== undefined && object.sfixed32 !== null) + ? SFixed32Rules.fromPartial(object.sfixed32) + : undefined; + message.sfixed64 = (object.sfixed64 !== undefined && object.sfixed64 !== null) + ? SFixed64Rules.fromPartial(object.sfixed64) + : undefined; + message.bool = (object.bool !== undefined && object.bool !== null) ? BoolRules.fromPartial(object.bool) : undefined; + message.string = (object.string !== undefined && object.string !== null) + ? StringRules.fromPartial(object.string) + : undefined; + message.bytes = (object.bytes !== undefined && object.bytes !== null) + ? BytesRules.fromPartial(object.bytes) + : undefined; + message.enum = (object.enum !== undefined && object.enum !== null) ? EnumRules.fromPartial(object.enum) : undefined; + message.repeated = (object.repeated !== undefined && object.repeated !== null) + ? RepeatedRules.fromPartial(object.repeated) + : undefined; + message.map = (object.map !== undefined && object.map !== null) ? MapRules.fromPartial(object.map) : undefined; + message.any = (object.any !== undefined && object.any !== null) ? AnyRules.fromPartial(object.any) : undefined; + message.duration = (object.duration !== undefined && object.duration !== null) + ? DurationRules.fromPartial(object.duration) + : undefined; + message.timestamp = (object.timestamp !== undefined && object.timestamp !== null) + ? TimestampRules.fromPartial(object.timestamp) + : undefined; + return message; + }, +}; + +function createBaseFloatRules(): FloatRules { + return { const: 0, lt: 0, lte: 0, gt: 0, gte: 0, in: [], notIn: [], ignoreEmpty: false }; +} + +export const FloatRules: MessageFns = { + encode(message: FloatRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== 0) { + writer.uint32(13).float(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + writer.uint32(21).float(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + writer.uint32(29).float(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + writer.uint32(37).float(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + writer.uint32(45).float(message.gte); + } + for (const v of message.in) { + writer.uint32(53).float(v!); + } + for (const v of message.notIn) { + writer.uint32(61).float(v!); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(64).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FloatRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFloatRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } + + message.const = reader.float(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + + message.lt = reader.float(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } + + message.lte = reader.float(); + continue; + } + case 4: { + if (tag !== 37) { + break; + } + + message.gt = reader.float(); + continue; + } + case 5: { + if (tag !== 45) { + break; + } + + message.gte = reader.float(); + continue; + } + case 6: { + if (tag === 53) { + message.in.push(reader.float()); + + continue; + } + + if (tag === 50) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.in.push(reader.float()); + } + + continue; + } + + break; + } + case 7: { + if (tag === 61) { + message.notIn.push(reader.float()); + + continue; + } + + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.notIn.push(reader.float()); + } + + continue; + } + + break; + } + case 8: { + if (tag !== 64) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FloatRules { + return { + const: isSet(object.const) ? globalThis.Number(object.const) : 0, + lt: isSet(object.lt) ? globalThis.Number(object.lt) : 0, + lte: isSet(object.lte) ? globalThis.Number(object.lte) : 0, + gt: isSet(object.gt) ? globalThis.Number(object.gt) : 0, + gte: isSet(object.gte) ? globalThis.Number(object.gte) : 0, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.Number(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.Number(e)) + : [], + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: FloatRules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== 0) { + obj.const = message.const; + } + if (message.lt !== undefined && message.lt !== 0) { + obj.lt = message.lt; + } + if (message.lte !== undefined && message.lte !== 0) { + obj.lte = message.lte; + } + if (message.gt !== undefined && message.gt !== 0) { + obj.gt = message.gt; + } + if (message.gte !== undefined && message.gte !== 0) { + obj.gte = message.gte; + } + if (message.in?.length) { + obj.in = message.in; + } + if (message.notIn?.length) { + obj.notIn = message.notIn; + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): FloatRules { + return FloatRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FloatRules { + const message = createBaseFloatRules(); + message.const = object.const ?? 0; + message.lt = object.lt ?? 0; + message.lte = object.lte ?? 0; + message.gt = object.gt ?? 0; + message.gte = object.gte ?? 0; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseDoubleRules(): DoubleRules { + return { const: 0, lt: 0, lte: 0, gt: 0, gte: 0, in: [], notIn: [], ignoreEmpty: false }; +} + +export const DoubleRules: MessageFns = { + encode(message: DoubleRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== 0) { + writer.uint32(9).double(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + writer.uint32(17).double(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + writer.uint32(25).double(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + writer.uint32(33).double(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + writer.uint32(41).double(message.gte); + } + for (const v of message.in) { + writer.uint32(49).double(v!); + } + for (const v of message.notIn) { + writer.uint32(57).double(v!); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(64).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DoubleRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDoubleRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 9) { + break; + } + + message.const = reader.double(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + + message.lt = reader.double(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + + message.lte = reader.double(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + + message.gt = reader.double(); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + + message.gte = reader.double(); + continue; + } + case 6: { + if (tag === 49) { + message.in.push(reader.double()); + + continue; + } + + if (tag === 50) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.in.push(reader.double()); + } + + continue; + } + + break; + } + case 7: { + if (tag === 57) { + message.notIn.push(reader.double()); + + continue; + } + + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.notIn.push(reader.double()); + } + + continue; + } + + break; + } + case 8: { + if (tag !== 64) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DoubleRules { + return { + const: isSet(object.const) ? globalThis.Number(object.const) : 0, + lt: isSet(object.lt) ? globalThis.Number(object.lt) : 0, + lte: isSet(object.lte) ? globalThis.Number(object.lte) : 0, + gt: isSet(object.gt) ? globalThis.Number(object.gt) : 0, + gte: isSet(object.gte) ? globalThis.Number(object.gte) : 0, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.Number(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.Number(e)) + : [], + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: DoubleRules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== 0) { + obj.const = message.const; + } + if (message.lt !== undefined && message.lt !== 0) { + obj.lt = message.lt; + } + if (message.lte !== undefined && message.lte !== 0) { + obj.lte = message.lte; + } + if (message.gt !== undefined && message.gt !== 0) { + obj.gt = message.gt; + } + if (message.gte !== undefined && message.gte !== 0) { + obj.gte = message.gte; + } + if (message.in?.length) { + obj.in = message.in; + } + if (message.notIn?.length) { + obj.notIn = message.notIn; + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): DoubleRules { + return DoubleRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DoubleRules { + const message = createBaseDoubleRules(); + message.const = object.const ?? 0; + message.lt = object.lt ?? 0; + message.lte = object.lte ?? 0; + message.gt = object.gt ?? 0; + message.gte = object.gte ?? 0; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseInt32Rules(): Int32Rules { + return { const: 0, lt: 0, lte: 0, gt: 0, gte: 0, in: [], notIn: [], ignoreEmpty: false }; +} + +export const Int32Rules: MessageFns = { + encode(message: Int32Rules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== 0) { + writer.uint32(8).int32(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + writer.uint32(16).int32(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + writer.uint32(24).int32(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + writer.uint32(32).int32(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + writer.uint32(40).int32(message.gte); + } + for (const v of message.in) { + writer.uint32(48).int32(v!); + } + for (const v of message.notIn) { + writer.uint32(56).int32(v!); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(64).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Int32Rules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInt32Rules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.const = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.lt = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.lte = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.gt = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.gte = reader.int32(); + continue; + } + case 6: { + if (tag === 48) { + message.in.push(reader.int32()); + + continue; + } + + if (tag === 50) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.in.push(reader.int32()); + } + + continue; + } + + break; + } + case 7: { + if (tag === 56) { + message.notIn.push(reader.int32()); + + continue; + } + + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.notIn.push(reader.int32()); + } + + continue; + } + + break; + } + case 8: { + if (tag !== 64) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Int32Rules { + return { + const: isSet(object.const) ? globalThis.Number(object.const) : 0, + lt: isSet(object.lt) ? globalThis.Number(object.lt) : 0, + lte: isSet(object.lte) ? globalThis.Number(object.lte) : 0, + gt: isSet(object.gt) ? globalThis.Number(object.gt) : 0, + gte: isSet(object.gte) ? globalThis.Number(object.gte) : 0, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.Number(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.Number(e)) + : [], + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: Int32Rules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== 0) { + obj.const = Math.round(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + obj.lt = Math.round(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + obj.lte = Math.round(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + obj.gt = Math.round(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + obj.gte = Math.round(message.gte); + } + if (message.in?.length) { + obj.in = message.in.map((e) => Math.round(e)); + } + if (message.notIn?.length) { + obj.notIn = message.notIn.map((e) => Math.round(e)); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): Int32Rules { + return Int32Rules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Int32Rules { + const message = createBaseInt32Rules(); + message.const = object.const ?? 0; + message.lt = object.lt ?? 0; + message.lte = object.lte ?? 0; + message.gt = object.gt ?? 0; + message.gte = object.gte ?? 0; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseInt64Rules(): Int64Rules { + return { const: 0, lt: 0, lte: 0, gt: 0, gte: 0, in: [], notIn: [], ignoreEmpty: false }; +} + +export const Int64Rules: MessageFns = { + encode(message: Int64Rules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== 0) { + writer.uint32(8).int64(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + writer.uint32(16).int64(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + writer.uint32(24).int64(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + writer.uint32(32).int64(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + writer.uint32(40).int64(message.gte); + } + for (const v of message.in) { + writer.uint32(48).int64(v!); + } + for (const v of message.notIn) { + writer.uint32(56).int64(v!); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(64).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Int64Rules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInt64Rules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.const = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.lt = longToNumber(reader.int64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.lte = longToNumber(reader.int64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.gt = longToNumber(reader.int64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.gte = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag === 48) { + message.in.push(longToNumber(reader.int64())); + + continue; + } + + if (tag === 50) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.in.push(longToNumber(reader.int64())); + } + + continue; + } + + break; + } + case 7: { + if (tag === 56) { + message.notIn.push(longToNumber(reader.int64())); + + continue; + } + + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.notIn.push(longToNumber(reader.int64())); + } + + continue; + } + + break; + } + case 8: { + if (tag !== 64) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Int64Rules { + return { + const: isSet(object.const) ? globalThis.Number(object.const) : 0, + lt: isSet(object.lt) ? globalThis.Number(object.lt) : 0, + lte: isSet(object.lte) ? globalThis.Number(object.lte) : 0, + gt: isSet(object.gt) ? globalThis.Number(object.gt) : 0, + gte: isSet(object.gte) ? globalThis.Number(object.gte) : 0, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.Number(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.Number(e)) + : [], + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: Int64Rules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== 0) { + obj.const = Math.round(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + obj.lt = Math.round(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + obj.lte = Math.round(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + obj.gt = Math.round(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + obj.gte = Math.round(message.gte); + } + if (message.in?.length) { + obj.in = message.in.map((e) => Math.round(e)); + } + if (message.notIn?.length) { + obj.notIn = message.notIn.map((e) => Math.round(e)); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): Int64Rules { + return Int64Rules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Int64Rules { + const message = createBaseInt64Rules(); + message.const = object.const ?? 0; + message.lt = object.lt ?? 0; + message.lte = object.lte ?? 0; + message.gt = object.gt ?? 0; + message.gte = object.gte ?? 0; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseUInt32Rules(): UInt32Rules { + return { const: 0, lt: 0, lte: 0, gt: 0, gte: 0, in: [], notIn: [], ignoreEmpty: false }; +} + +export const UInt32Rules: MessageFns = { + encode(message: UInt32Rules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== 0) { + writer.uint32(8).uint32(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + writer.uint32(16).uint32(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + writer.uint32(24).uint32(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + writer.uint32(32).uint32(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + writer.uint32(40).uint32(message.gte); + } + for (const v of message.in) { + writer.uint32(48).uint32(v!); + } + for (const v of message.notIn) { + writer.uint32(56).uint32(v!); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(64).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UInt32Rules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUInt32Rules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.const = reader.uint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.lt = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.lte = reader.uint32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.gt = reader.uint32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.gte = reader.uint32(); + continue; + } + case 6: { + if (tag === 48) { + message.in.push(reader.uint32()); + + continue; + } + + if (tag === 50) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.in.push(reader.uint32()); + } + + continue; + } + + break; + } + case 7: { + if (tag === 56) { + message.notIn.push(reader.uint32()); + + continue; + } + + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.notIn.push(reader.uint32()); + } + + continue; + } + + break; + } + case 8: { + if (tag !== 64) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UInt32Rules { + return { + const: isSet(object.const) ? globalThis.Number(object.const) : 0, + lt: isSet(object.lt) ? globalThis.Number(object.lt) : 0, + lte: isSet(object.lte) ? globalThis.Number(object.lte) : 0, + gt: isSet(object.gt) ? globalThis.Number(object.gt) : 0, + gte: isSet(object.gte) ? globalThis.Number(object.gte) : 0, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.Number(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.Number(e)) + : [], + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: UInt32Rules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== 0) { + obj.const = Math.round(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + obj.lt = Math.round(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + obj.lte = Math.round(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + obj.gt = Math.round(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + obj.gte = Math.round(message.gte); + } + if (message.in?.length) { + obj.in = message.in.map((e) => Math.round(e)); + } + if (message.notIn?.length) { + obj.notIn = message.notIn.map((e) => Math.round(e)); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): UInt32Rules { + return UInt32Rules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UInt32Rules { + const message = createBaseUInt32Rules(); + message.const = object.const ?? 0; + message.lt = object.lt ?? 0; + message.lte = object.lte ?? 0; + message.gt = object.gt ?? 0; + message.gte = object.gte ?? 0; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseUInt64Rules(): UInt64Rules { + return { const: 0, lt: 0, lte: 0, gt: 0, gte: 0, in: [], notIn: [], ignoreEmpty: false }; +} + +export const UInt64Rules: MessageFns = { + encode(message: UInt64Rules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== 0) { + writer.uint32(8).uint64(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + writer.uint32(16).uint64(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + writer.uint32(24).uint64(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + writer.uint32(32).uint64(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + writer.uint32(40).uint64(message.gte); + } + for (const v of message.in) { + writer.uint32(48).uint64(v!); + } + for (const v of message.notIn) { + writer.uint32(56).uint64(v!); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(64).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UInt64Rules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUInt64Rules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.const = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.lt = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.lte = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.gt = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.gte = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag === 48) { + message.in.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 50) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.in.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + case 7: { + if (tag === 56) { + message.notIn.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.notIn.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + case 8: { + if (tag !== 64) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UInt64Rules { + return { + const: isSet(object.const) ? globalThis.Number(object.const) : 0, + lt: isSet(object.lt) ? globalThis.Number(object.lt) : 0, + lte: isSet(object.lte) ? globalThis.Number(object.lte) : 0, + gt: isSet(object.gt) ? globalThis.Number(object.gt) : 0, + gte: isSet(object.gte) ? globalThis.Number(object.gte) : 0, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.Number(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.Number(e)) + : [], + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: UInt64Rules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== 0) { + obj.const = Math.round(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + obj.lt = Math.round(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + obj.lte = Math.round(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + obj.gt = Math.round(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + obj.gte = Math.round(message.gte); + } + if (message.in?.length) { + obj.in = message.in.map((e) => Math.round(e)); + } + if (message.notIn?.length) { + obj.notIn = message.notIn.map((e) => Math.round(e)); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): UInt64Rules { + return UInt64Rules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UInt64Rules { + const message = createBaseUInt64Rules(); + message.const = object.const ?? 0; + message.lt = object.lt ?? 0; + message.lte = object.lte ?? 0; + message.gt = object.gt ?? 0; + message.gte = object.gte ?? 0; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseSInt32Rules(): SInt32Rules { + return { const: 0, lt: 0, lte: 0, gt: 0, gte: 0, in: [], notIn: [], ignoreEmpty: false }; +} + +export const SInt32Rules: MessageFns = { + encode(message: SInt32Rules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== 0) { + writer.uint32(8).sint32(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + writer.uint32(16).sint32(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + writer.uint32(24).sint32(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + writer.uint32(32).sint32(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + writer.uint32(40).sint32(message.gte); + } + for (const v of message.in) { + writer.uint32(48).sint32(v!); + } + for (const v of message.notIn) { + writer.uint32(56).sint32(v!); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(64).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SInt32Rules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSInt32Rules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.const = reader.sint32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.lt = reader.sint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.lte = reader.sint32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.gt = reader.sint32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.gte = reader.sint32(); + continue; + } + case 6: { + if (tag === 48) { + message.in.push(reader.sint32()); + + continue; + } + + if (tag === 50) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.in.push(reader.sint32()); + } + + continue; + } + + break; + } + case 7: { + if (tag === 56) { + message.notIn.push(reader.sint32()); + + continue; + } + + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.notIn.push(reader.sint32()); + } + + continue; + } + + break; + } + case 8: { + if (tag !== 64) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SInt32Rules { + return { + const: isSet(object.const) ? globalThis.Number(object.const) : 0, + lt: isSet(object.lt) ? globalThis.Number(object.lt) : 0, + lte: isSet(object.lte) ? globalThis.Number(object.lte) : 0, + gt: isSet(object.gt) ? globalThis.Number(object.gt) : 0, + gte: isSet(object.gte) ? globalThis.Number(object.gte) : 0, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.Number(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.Number(e)) + : [], + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: SInt32Rules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== 0) { + obj.const = Math.round(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + obj.lt = Math.round(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + obj.lte = Math.round(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + obj.gt = Math.round(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + obj.gte = Math.round(message.gte); + } + if (message.in?.length) { + obj.in = message.in.map((e) => Math.round(e)); + } + if (message.notIn?.length) { + obj.notIn = message.notIn.map((e) => Math.round(e)); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): SInt32Rules { + return SInt32Rules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SInt32Rules { + const message = createBaseSInt32Rules(); + message.const = object.const ?? 0; + message.lt = object.lt ?? 0; + message.lte = object.lte ?? 0; + message.gt = object.gt ?? 0; + message.gte = object.gte ?? 0; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseSInt64Rules(): SInt64Rules { + return { const: 0, lt: 0, lte: 0, gt: 0, gte: 0, in: [], notIn: [], ignoreEmpty: false }; +} + +export const SInt64Rules: MessageFns = { + encode(message: SInt64Rules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== 0) { + writer.uint32(8).sint64(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + writer.uint32(16).sint64(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + writer.uint32(24).sint64(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + writer.uint32(32).sint64(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + writer.uint32(40).sint64(message.gte); + } + for (const v of message.in) { + writer.uint32(48).sint64(v!); + } + for (const v of message.notIn) { + writer.uint32(56).sint64(v!); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(64).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SInt64Rules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSInt64Rules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.const = longToNumber(reader.sint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.lt = longToNumber(reader.sint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.lte = longToNumber(reader.sint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.gt = longToNumber(reader.sint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.gte = longToNumber(reader.sint64()); + continue; + } + case 6: { + if (tag === 48) { + message.in.push(longToNumber(reader.sint64())); + + continue; + } + + if (tag === 50) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.in.push(longToNumber(reader.sint64())); + } + + continue; + } + + break; + } + case 7: { + if (tag === 56) { + message.notIn.push(longToNumber(reader.sint64())); + + continue; + } + + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.notIn.push(longToNumber(reader.sint64())); + } + + continue; + } + + break; + } + case 8: { + if (tag !== 64) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SInt64Rules { + return { + const: isSet(object.const) ? globalThis.Number(object.const) : 0, + lt: isSet(object.lt) ? globalThis.Number(object.lt) : 0, + lte: isSet(object.lte) ? globalThis.Number(object.lte) : 0, + gt: isSet(object.gt) ? globalThis.Number(object.gt) : 0, + gte: isSet(object.gte) ? globalThis.Number(object.gte) : 0, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.Number(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.Number(e)) + : [], + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: SInt64Rules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== 0) { + obj.const = Math.round(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + obj.lt = Math.round(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + obj.lte = Math.round(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + obj.gt = Math.round(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + obj.gte = Math.round(message.gte); + } + if (message.in?.length) { + obj.in = message.in.map((e) => Math.round(e)); + } + if (message.notIn?.length) { + obj.notIn = message.notIn.map((e) => Math.round(e)); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): SInt64Rules { + return SInt64Rules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SInt64Rules { + const message = createBaseSInt64Rules(); + message.const = object.const ?? 0; + message.lt = object.lt ?? 0; + message.lte = object.lte ?? 0; + message.gt = object.gt ?? 0; + message.gte = object.gte ?? 0; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseFixed32Rules(): Fixed32Rules { + return { const: 0, lt: 0, lte: 0, gt: 0, gte: 0, in: [], notIn: [], ignoreEmpty: false }; +} + +export const Fixed32Rules: MessageFns = { + encode(message: Fixed32Rules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== 0) { + writer.uint32(13).fixed32(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + writer.uint32(21).fixed32(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + writer.uint32(29).fixed32(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + writer.uint32(37).fixed32(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + writer.uint32(45).fixed32(message.gte); + } + for (const v of message.in) { + writer.uint32(53).fixed32(v!); + } + for (const v of message.notIn) { + writer.uint32(61).fixed32(v!); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(64).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Fixed32Rules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFixed32Rules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } + + message.const = reader.fixed32(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + + message.lt = reader.fixed32(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } + + message.lte = reader.fixed32(); + continue; + } + case 4: { + if (tag !== 37) { + break; + } + + message.gt = reader.fixed32(); + continue; + } + case 5: { + if (tag !== 45) { + break; + } + + message.gte = reader.fixed32(); + continue; + } + case 6: { + if (tag === 53) { + message.in.push(reader.fixed32()); + + continue; + } + + if (tag === 50) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.in.push(reader.fixed32()); + } + + continue; + } + + break; + } + case 7: { + if (tag === 61) { + message.notIn.push(reader.fixed32()); + + continue; + } + + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.notIn.push(reader.fixed32()); + } + + continue; + } + + break; + } + case 8: { + if (tag !== 64) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Fixed32Rules { + return { + const: isSet(object.const) ? globalThis.Number(object.const) : 0, + lt: isSet(object.lt) ? globalThis.Number(object.lt) : 0, + lte: isSet(object.lte) ? globalThis.Number(object.lte) : 0, + gt: isSet(object.gt) ? globalThis.Number(object.gt) : 0, + gte: isSet(object.gte) ? globalThis.Number(object.gte) : 0, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.Number(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.Number(e)) + : [], + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: Fixed32Rules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== 0) { + obj.const = Math.round(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + obj.lt = Math.round(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + obj.lte = Math.round(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + obj.gt = Math.round(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + obj.gte = Math.round(message.gte); + } + if (message.in?.length) { + obj.in = message.in.map((e) => Math.round(e)); + } + if (message.notIn?.length) { + obj.notIn = message.notIn.map((e) => Math.round(e)); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): Fixed32Rules { + return Fixed32Rules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Fixed32Rules { + const message = createBaseFixed32Rules(); + message.const = object.const ?? 0; + message.lt = object.lt ?? 0; + message.lte = object.lte ?? 0; + message.gt = object.gt ?? 0; + message.gte = object.gte ?? 0; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseFixed64Rules(): Fixed64Rules { + return { const: 0, lt: 0, lte: 0, gt: 0, gte: 0, in: [], notIn: [], ignoreEmpty: false }; +} + +export const Fixed64Rules: MessageFns = { + encode(message: Fixed64Rules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== 0) { + writer.uint32(9).fixed64(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + writer.uint32(17).fixed64(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + writer.uint32(25).fixed64(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + writer.uint32(33).fixed64(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + writer.uint32(41).fixed64(message.gte); + } + for (const v of message.in) { + writer.uint32(49).fixed64(v!); + } + for (const v of message.notIn) { + writer.uint32(57).fixed64(v!); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(64).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Fixed64Rules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFixed64Rules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 9) { + break; + } + + message.const = longToNumber(reader.fixed64()); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + + message.lt = longToNumber(reader.fixed64()); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + + message.lte = longToNumber(reader.fixed64()); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + + message.gt = longToNumber(reader.fixed64()); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + + message.gte = longToNumber(reader.fixed64()); + continue; + } + case 6: { + if (tag === 49) { + message.in.push(longToNumber(reader.fixed64())); + + continue; + } + + if (tag === 50) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.in.push(longToNumber(reader.fixed64())); + } + + continue; + } + + break; + } + case 7: { + if (tag === 57) { + message.notIn.push(longToNumber(reader.fixed64())); + + continue; + } + + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.notIn.push(longToNumber(reader.fixed64())); + } + + continue; + } + + break; + } + case 8: { + if (tag !== 64) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Fixed64Rules { + return { + const: isSet(object.const) ? globalThis.Number(object.const) : 0, + lt: isSet(object.lt) ? globalThis.Number(object.lt) : 0, + lte: isSet(object.lte) ? globalThis.Number(object.lte) : 0, + gt: isSet(object.gt) ? globalThis.Number(object.gt) : 0, + gte: isSet(object.gte) ? globalThis.Number(object.gte) : 0, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.Number(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.Number(e)) + : [], + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: Fixed64Rules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== 0) { + obj.const = Math.round(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + obj.lt = Math.round(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + obj.lte = Math.round(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + obj.gt = Math.round(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + obj.gte = Math.round(message.gte); + } + if (message.in?.length) { + obj.in = message.in.map((e) => Math.round(e)); + } + if (message.notIn?.length) { + obj.notIn = message.notIn.map((e) => Math.round(e)); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): Fixed64Rules { + return Fixed64Rules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Fixed64Rules { + const message = createBaseFixed64Rules(); + message.const = object.const ?? 0; + message.lt = object.lt ?? 0; + message.lte = object.lte ?? 0; + message.gt = object.gt ?? 0; + message.gte = object.gte ?? 0; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseSFixed32Rules(): SFixed32Rules { + return { const: 0, lt: 0, lte: 0, gt: 0, gte: 0, in: [], notIn: [], ignoreEmpty: false }; +} + +export const SFixed32Rules: MessageFns = { + encode(message: SFixed32Rules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== 0) { + writer.uint32(13).sfixed32(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + writer.uint32(21).sfixed32(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + writer.uint32(29).sfixed32(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + writer.uint32(37).sfixed32(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + writer.uint32(45).sfixed32(message.gte); + } + for (const v of message.in) { + writer.uint32(53).sfixed32(v!); + } + for (const v of message.notIn) { + writer.uint32(61).sfixed32(v!); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(64).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SFixed32Rules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSFixed32Rules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 13) { + break; + } + + message.const = reader.sfixed32(); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + + message.lt = reader.sfixed32(); + continue; + } + case 3: { + if (tag !== 29) { + break; + } + + message.lte = reader.sfixed32(); + continue; + } + case 4: { + if (tag !== 37) { + break; + } + + message.gt = reader.sfixed32(); + continue; + } + case 5: { + if (tag !== 45) { + break; + } + + message.gte = reader.sfixed32(); + continue; + } + case 6: { + if (tag === 53) { + message.in.push(reader.sfixed32()); + + continue; + } + + if (tag === 50) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.in.push(reader.sfixed32()); + } + + continue; + } + + break; + } + case 7: { + if (tag === 61) { + message.notIn.push(reader.sfixed32()); + + continue; + } + + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.notIn.push(reader.sfixed32()); + } + + continue; + } + + break; + } + case 8: { + if (tag !== 64) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SFixed32Rules { + return { + const: isSet(object.const) ? globalThis.Number(object.const) : 0, + lt: isSet(object.lt) ? globalThis.Number(object.lt) : 0, + lte: isSet(object.lte) ? globalThis.Number(object.lte) : 0, + gt: isSet(object.gt) ? globalThis.Number(object.gt) : 0, + gte: isSet(object.gte) ? globalThis.Number(object.gte) : 0, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.Number(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.Number(e)) + : [], + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: SFixed32Rules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== 0) { + obj.const = Math.round(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + obj.lt = Math.round(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + obj.lte = Math.round(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + obj.gt = Math.round(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + obj.gte = Math.round(message.gte); + } + if (message.in?.length) { + obj.in = message.in.map((e) => Math.round(e)); + } + if (message.notIn?.length) { + obj.notIn = message.notIn.map((e) => Math.round(e)); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): SFixed32Rules { + return SFixed32Rules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SFixed32Rules { + const message = createBaseSFixed32Rules(); + message.const = object.const ?? 0; + message.lt = object.lt ?? 0; + message.lte = object.lte ?? 0; + message.gt = object.gt ?? 0; + message.gte = object.gte ?? 0; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseSFixed64Rules(): SFixed64Rules { + return { const: 0, lt: 0, lte: 0, gt: 0, gte: 0, in: [], notIn: [], ignoreEmpty: false }; +} + +export const SFixed64Rules: MessageFns = { + encode(message: SFixed64Rules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== 0) { + writer.uint32(9).sfixed64(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + writer.uint32(17).sfixed64(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + writer.uint32(25).sfixed64(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + writer.uint32(33).sfixed64(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + writer.uint32(41).sfixed64(message.gte); + } + for (const v of message.in) { + writer.uint32(49).sfixed64(v!); + } + for (const v of message.notIn) { + writer.uint32(57).sfixed64(v!); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(64).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SFixed64Rules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSFixed64Rules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 9) { + break; + } + + message.const = longToNumber(reader.sfixed64()); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + + message.lt = longToNumber(reader.sfixed64()); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + + message.lte = longToNumber(reader.sfixed64()); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + + message.gt = longToNumber(reader.sfixed64()); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + + message.gte = longToNumber(reader.sfixed64()); + continue; + } + case 6: { + if (tag === 49) { + message.in.push(longToNumber(reader.sfixed64())); + + continue; + } + + if (tag === 50) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.in.push(longToNumber(reader.sfixed64())); + } + + continue; + } + + break; + } + case 7: { + if (tag === 57) { + message.notIn.push(longToNumber(reader.sfixed64())); + + continue; + } + + if (tag === 58) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.notIn.push(longToNumber(reader.sfixed64())); + } + + continue; + } + + break; + } + case 8: { + if (tag !== 64) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SFixed64Rules { + return { + const: isSet(object.const) ? globalThis.Number(object.const) : 0, + lt: isSet(object.lt) ? globalThis.Number(object.lt) : 0, + lte: isSet(object.lte) ? globalThis.Number(object.lte) : 0, + gt: isSet(object.gt) ? globalThis.Number(object.gt) : 0, + gte: isSet(object.gte) ? globalThis.Number(object.gte) : 0, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.Number(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.Number(e)) + : [], + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: SFixed64Rules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== 0) { + obj.const = Math.round(message.const); + } + if (message.lt !== undefined && message.lt !== 0) { + obj.lt = Math.round(message.lt); + } + if (message.lte !== undefined && message.lte !== 0) { + obj.lte = Math.round(message.lte); + } + if (message.gt !== undefined && message.gt !== 0) { + obj.gt = Math.round(message.gt); + } + if (message.gte !== undefined && message.gte !== 0) { + obj.gte = Math.round(message.gte); + } + if (message.in?.length) { + obj.in = message.in.map((e) => Math.round(e)); + } + if (message.notIn?.length) { + obj.notIn = message.notIn.map((e) => Math.round(e)); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): SFixed64Rules { + return SFixed64Rules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SFixed64Rules { + const message = createBaseSFixed64Rules(); + message.const = object.const ?? 0; + message.lt = object.lt ?? 0; + message.lte = object.lte ?? 0; + message.gt = object.gt ?? 0; + message.gte = object.gte ?? 0; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseBoolRules(): BoolRules { + return { const: false }; +} + +export const BoolRules: MessageFns = { + encode(message: BoolRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== false) { + writer.uint32(8).bool(message.const); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BoolRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBoolRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.const = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BoolRules { + return { const: isSet(object.const) ? globalThis.Boolean(object.const) : false }; + }, + + toJSON(message: BoolRules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== false) { + obj.const = message.const; + } + return obj; + }, + + create, I>>(base?: I): BoolRules { + return BoolRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BoolRules { + const message = createBaseBoolRules(); + message.const = object.const ?? false; + return message; + }, +}; + +function createBaseStringRules(): StringRules { + return { + const: "", + len: 0, + minLen: 0, + maxLen: 0, + lenBytes: 0, + minBytes: 0, + maxBytes: 0, + pattern: "", + prefix: "", + suffix: "", + contains: "", + notContains: "", + in: [], + notIn: [], + email: undefined, + hostname: undefined, + ip: undefined, + ipv4: undefined, + ipv6: undefined, + uri: undefined, + uriRef: undefined, + address: undefined, + uuid: undefined, + wellKnownRegex: undefined, + strict: true, + ignoreEmpty: false, + }; +} + +export const StringRules: MessageFns = { + encode(message: StringRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== "") { + writer.uint32(10).string(message.const); + } + if (message.len !== undefined && message.len !== 0) { + writer.uint32(152).uint64(message.len); + } + if (message.minLen !== undefined && message.minLen !== 0) { + writer.uint32(16).uint64(message.minLen); + } + if (message.maxLen !== undefined && message.maxLen !== 0) { + writer.uint32(24).uint64(message.maxLen); + } + if (message.lenBytes !== undefined && message.lenBytes !== 0) { + writer.uint32(160).uint64(message.lenBytes); + } + if (message.minBytes !== undefined && message.minBytes !== 0) { + writer.uint32(32).uint64(message.minBytes); + } + if (message.maxBytes !== undefined && message.maxBytes !== 0) { + writer.uint32(40).uint64(message.maxBytes); + } + if (message.pattern !== undefined && message.pattern !== "") { + writer.uint32(50).string(message.pattern); + } + if (message.prefix !== undefined && message.prefix !== "") { + writer.uint32(58).string(message.prefix); + } + if (message.suffix !== undefined && message.suffix !== "") { + writer.uint32(66).string(message.suffix); + } + if (message.contains !== undefined && message.contains !== "") { + writer.uint32(74).string(message.contains); + } + if (message.notContains !== undefined && message.notContains !== "") { + writer.uint32(186).string(message.notContains); + } + for (const v of message.in) { + writer.uint32(82).string(v!); + } + for (const v of message.notIn) { + writer.uint32(90).string(v!); + } + if (message.email !== undefined) { + writer.uint32(96).bool(message.email); + } + if (message.hostname !== undefined) { + writer.uint32(104).bool(message.hostname); + } + if (message.ip !== undefined) { + writer.uint32(112).bool(message.ip); + } + if (message.ipv4 !== undefined) { + writer.uint32(120).bool(message.ipv4); + } + if (message.ipv6 !== undefined) { + writer.uint32(128).bool(message.ipv6); + } + if (message.uri !== undefined) { + writer.uint32(136).bool(message.uri); + } + if (message.uriRef !== undefined) { + writer.uint32(144).bool(message.uriRef); + } + if (message.address !== undefined) { + writer.uint32(168).bool(message.address); + } + if (message.uuid !== undefined) { + writer.uint32(176).bool(message.uuid); + } + if (message.wellKnownRegex !== undefined) { + writer.uint32(192).int32(message.wellKnownRegex); + } + if (message.strict !== undefined && message.strict !== true) { + writer.uint32(200).bool(message.strict); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(208).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StringRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStringRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.const = reader.string(); + continue; + } + case 19: { + if (tag !== 152) { + break; + } + + message.len = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.minLen = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxLen = longToNumber(reader.uint64()); + continue; + } + case 20: { + if (tag !== 160) { + break; + } + + message.lenBytes = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.minBytes = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.maxBytes = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.pattern = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.prefix = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.suffix = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.contains = reader.string(); + continue; + } + case 23: { + if (tag !== 186) { + break; + } + + message.notContains = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.in.push(reader.string()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.notIn.push(reader.string()); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + + message.email = reader.bool(); + continue; + } + case 13: { + if (tag !== 104) { + break; + } + + message.hostname = reader.bool(); + continue; + } + case 14: { + if (tag !== 112) { + break; + } + + message.ip = reader.bool(); + continue; + } + case 15: { + if (tag !== 120) { + break; + } + + message.ipv4 = reader.bool(); + continue; + } + case 16: { + if (tag !== 128) { + break; + } + + message.ipv6 = reader.bool(); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + + message.uri = reader.bool(); + continue; + } + case 18: { + if (tag !== 144) { + break; + } + + message.uriRef = reader.bool(); + continue; + } + case 21: { + if (tag !== 168) { + break; + } + + message.address = reader.bool(); + continue; + } + case 22: { + if (tag !== 176) { + break; + } + + message.uuid = reader.bool(); + continue; + } + case 24: { + if (tag !== 192) { + break; + } + + message.wellKnownRegex = reader.int32() as any; + continue; + } + case 25: { + if (tag !== 200) { + break; + } + + message.strict = reader.bool(); + continue; + } + case 26: { + if (tag !== 208) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StringRules { + return { + const: isSet(object.const) ? globalThis.String(object.const) : "", + len: isSet(object.len) ? globalThis.Number(object.len) : 0, + minLen: isSet(object.minLen) + ? globalThis.Number(object.minLen) + : isSet(object.min_len) + ? globalThis.Number(object.min_len) + : 0, + maxLen: isSet(object.maxLen) + ? globalThis.Number(object.maxLen) + : isSet(object.max_len) + ? globalThis.Number(object.max_len) + : 0, + lenBytes: isSet(object.lenBytes) + ? globalThis.Number(object.lenBytes) + : isSet(object.len_bytes) + ? globalThis.Number(object.len_bytes) + : 0, + minBytes: isSet(object.minBytes) + ? globalThis.Number(object.minBytes) + : isSet(object.min_bytes) + ? globalThis.Number(object.min_bytes) + : 0, + maxBytes: isSet(object.maxBytes) + ? globalThis.Number(object.maxBytes) + : isSet(object.max_bytes) + ? globalThis.Number(object.max_bytes) + : 0, + pattern: isSet(object.pattern) ? globalThis.String(object.pattern) : "", + prefix: isSet(object.prefix) ? globalThis.String(object.prefix) : "", + suffix: isSet(object.suffix) ? globalThis.String(object.suffix) : "", + contains: isSet(object.contains) ? globalThis.String(object.contains) : "", + notContains: isSet(object.notContains) + ? globalThis.String(object.notContains) + : isSet(object.not_contains) + ? globalThis.String(object.not_contains) + : "", + in: globalThis.Array.isArray(object?.in) + ? object.in.map((e: any) => globalThis.String(e)) + : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.String(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.String(e)) + : [], + email: isSet(object.email) ? globalThis.Boolean(object.email) : undefined, + hostname: isSet(object.hostname) ? globalThis.Boolean(object.hostname) : undefined, + ip: isSet(object.ip) ? globalThis.Boolean(object.ip) : undefined, + ipv4: isSet(object.ipv4) ? globalThis.Boolean(object.ipv4) : undefined, + ipv6: isSet(object.ipv6) ? globalThis.Boolean(object.ipv6) : undefined, + uri: isSet(object.uri) ? globalThis.Boolean(object.uri) : undefined, + uriRef: isSet(object.uriRef) + ? globalThis.Boolean(object.uriRef) + : isSet(object.uri_ref) + ? globalThis.Boolean(object.uri_ref) + : undefined, + address: isSet(object.address) ? globalThis.Boolean(object.address) : undefined, + uuid: isSet(object.uuid) ? globalThis.Boolean(object.uuid) : undefined, + wellKnownRegex: isSet(object.wellKnownRegex) + ? knownRegexFromJSON(object.wellKnownRegex) + : isSet(object.well_known_regex) + ? knownRegexFromJSON(object.well_known_regex) + : undefined, + strict: isSet(object.strict) ? globalThis.Boolean(object.strict) : true, + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: StringRules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== "") { + obj.const = message.const; + } + if (message.len !== undefined && message.len !== 0) { + obj.len = Math.round(message.len); + } + if (message.minLen !== undefined && message.minLen !== 0) { + obj.minLen = Math.round(message.minLen); + } + if (message.maxLen !== undefined && message.maxLen !== 0) { + obj.maxLen = Math.round(message.maxLen); + } + if (message.lenBytes !== undefined && message.lenBytes !== 0) { + obj.lenBytes = Math.round(message.lenBytes); + } + if (message.minBytes !== undefined && message.minBytes !== 0) { + obj.minBytes = Math.round(message.minBytes); + } + if (message.maxBytes !== undefined && message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.pattern !== undefined && message.pattern !== "") { + obj.pattern = message.pattern; + } + if (message.prefix !== undefined && message.prefix !== "") { + obj.prefix = message.prefix; + } + if (message.suffix !== undefined && message.suffix !== "") { + obj.suffix = message.suffix; + } + if (message.contains !== undefined && message.contains !== "") { + obj.contains = message.contains; + } + if (message.notContains !== undefined && message.notContains !== "") { + obj.notContains = message.notContains; + } + if (message.in?.length) { + obj.in = message.in; + } + if (message.notIn?.length) { + obj.notIn = message.notIn; + } + if (message.email !== undefined) { + obj.email = message.email; + } + if (message.hostname !== undefined) { + obj.hostname = message.hostname; + } + if (message.ip !== undefined) { + obj.ip = message.ip; + } + if (message.ipv4 !== undefined) { + obj.ipv4 = message.ipv4; + } + if (message.ipv6 !== undefined) { + obj.ipv6 = message.ipv6; + } + if (message.uri !== undefined) { + obj.uri = message.uri; + } + if (message.uriRef !== undefined) { + obj.uriRef = message.uriRef; + } + if (message.address !== undefined) { + obj.address = message.address; + } + if (message.uuid !== undefined) { + obj.uuid = message.uuid; + } + if (message.wellKnownRegex !== undefined) { + obj.wellKnownRegex = knownRegexToJSON(message.wellKnownRegex); + } + if (message.strict !== undefined && message.strict !== true) { + obj.strict = message.strict; + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): StringRules { + return StringRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StringRules { + const message = createBaseStringRules(); + message.const = object.const ?? ""; + message.len = object.len ?? 0; + message.minLen = object.minLen ?? 0; + message.maxLen = object.maxLen ?? 0; + message.lenBytes = object.lenBytes ?? 0; + message.minBytes = object.minBytes ?? 0; + message.maxBytes = object.maxBytes ?? 0; + message.pattern = object.pattern ?? ""; + message.prefix = object.prefix ?? ""; + message.suffix = object.suffix ?? ""; + message.contains = object.contains ?? ""; + message.notContains = object.notContains ?? ""; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.email = object.email ?? undefined; + message.hostname = object.hostname ?? undefined; + message.ip = object.ip ?? undefined; + message.ipv4 = object.ipv4 ?? undefined; + message.ipv6 = object.ipv6 ?? undefined; + message.uri = object.uri ?? undefined; + message.uriRef = object.uriRef ?? undefined; + message.address = object.address ?? undefined; + message.uuid = object.uuid ?? undefined; + message.wellKnownRegex = object.wellKnownRegex ?? undefined; + message.strict = object.strict ?? true; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseBytesRules(): BytesRules { + return { + const: Buffer.alloc(0), + len: 0, + minLen: 0, + maxLen: 0, + pattern: "", + prefix: Buffer.alloc(0), + suffix: Buffer.alloc(0), + contains: Buffer.alloc(0), + in: [], + notIn: [], + ip: undefined, + ipv4: undefined, + ipv6: undefined, + ignoreEmpty: false, + }; +} + +export const BytesRules: MessageFns = { + encode(message: BytesRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const.length !== 0) { + writer.uint32(10).bytes(message.const); + } + if (message.len !== undefined && message.len !== 0) { + writer.uint32(104).uint64(message.len); + } + if (message.minLen !== undefined && message.minLen !== 0) { + writer.uint32(16).uint64(message.minLen); + } + if (message.maxLen !== undefined && message.maxLen !== 0) { + writer.uint32(24).uint64(message.maxLen); + } + if (message.pattern !== undefined && message.pattern !== "") { + writer.uint32(34).string(message.pattern); + } + if (message.prefix !== undefined && message.prefix.length !== 0) { + writer.uint32(42).bytes(message.prefix); + } + if (message.suffix !== undefined && message.suffix.length !== 0) { + writer.uint32(50).bytes(message.suffix); + } + if (message.contains !== undefined && message.contains.length !== 0) { + writer.uint32(58).bytes(message.contains); + } + for (const v of message.in) { + writer.uint32(66).bytes(v!); + } + for (const v of message.notIn) { + writer.uint32(74).bytes(v!); + } + if (message.ip !== undefined) { + writer.uint32(80).bool(message.ip); + } + if (message.ipv4 !== undefined) { + writer.uint32(88).bool(message.ipv4); + } + if (message.ipv6 !== undefined) { + writer.uint32(96).bool(message.ipv6); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(112).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BytesRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBytesRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.const = Buffer.from(reader.bytes()); + continue; + } + case 13: { + if (tag !== 104) { + break; + } + + message.len = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.minLen = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxLen = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.pattern = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.prefix = Buffer.from(reader.bytes()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.suffix = Buffer.from(reader.bytes()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.contains = Buffer.from(reader.bytes()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.in.push(Buffer.from(reader.bytes())); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.notIn.push(Buffer.from(reader.bytes())); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + + message.ip = reader.bool(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + + message.ipv4 = reader.bool(); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + + message.ipv6 = reader.bool(); + continue; + } + case 14: { + if (tag !== 112) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BytesRules { + return { + const: isSet(object.const) ? Buffer.from(bytesFromBase64(object.const)) : Buffer.alloc(0), + len: isSet(object.len) ? globalThis.Number(object.len) : 0, + minLen: isSet(object.minLen) + ? globalThis.Number(object.minLen) + : isSet(object.min_len) + ? globalThis.Number(object.min_len) + : 0, + maxLen: isSet(object.maxLen) + ? globalThis.Number(object.maxLen) + : isSet(object.max_len) + ? globalThis.Number(object.max_len) + : 0, + pattern: isSet(object.pattern) ? globalThis.String(object.pattern) : "", + prefix: isSet(object.prefix) ? Buffer.from(bytesFromBase64(object.prefix)) : Buffer.alloc(0), + suffix: isSet(object.suffix) ? Buffer.from(bytesFromBase64(object.suffix)) : Buffer.alloc(0), + contains: isSet(object.contains) ? Buffer.from(bytesFromBase64(object.contains)) : Buffer.alloc(0), + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => Buffer.from(bytesFromBase64(e))) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => Buffer.from(bytesFromBase64(e))) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => Buffer.from(bytesFromBase64(e))) + : [], + ip: isSet(object.ip) ? globalThis.Boolean(object.ip) : undefined, + ipv4: isSet(object.ipv4) ? globalThis.Boolean(object.ipv4) : undefined, + ipv6: isSet(object.ipv6) ? globalThis.Boolean(object.ipv6) : undefined, + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: BytesRules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const.length !== 0) { + obj.const = base64FromBytes(message.const); + } + if (message.len !== undefined && message.len !== 0) { + obj.len = Math.round(message.len); + } + if (message.minLen !== undefined && message.minLen !== 0) { + obj.minLen = Math.round(message.minLen); + } + if (message.maxLen !== undefined && message.maxLen !== 0) { + obj.maxLen = Math.round(message.maxLen); + } + if (message.pattern !== undefined && message.pattern !== "") { + obj.pattern = message.pattern; + } + if (message.prefix !== undefined && message.prefix.length !== 0) { + obj.prefix = base64FromBytes(message.prefix); + } + if (message.suffix !== undefined && message.suffix.length !== 0) { + obj.suffix = base64FromBytes(message.suffix); + } + if (message.contains !== undefined && message.contains.length !== 0) { + obj.contains = base64FromBytes(message.contains); + } + if (message.in?.length) { + obj.in = message.in.map((e) => base64FromBytes(e)); + } + if (message.notIn?.length) { + obj.notIn = message.notIn.map((e) => base64FromBytes(e)); + } + if (message.ip !== undefined) { + obj.ip = message.ip; + } + if (message.ipv4 !== undefined) { + obj.ipv4 = message.ipv4; + } + if (message.ipv6 !== undefined) { + obj.ipv6 = message.ipv6; + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): BytesRules { + return BytesRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BytesRules { + const message = createBaseBytesRules(); + message.const = object.const ?? Buffer.alloc(0); + message.len = object.len ?? 0; + message.minLen = object.minLen ?? 0; + message.maxLen = object.maxLen ?? 0; + message.pattern = object.pattern ?? ""; + message.prefix = object.prefix ?? Buffer.alloc(0); + message.suffix = object.suffix ?? Buffer.alloc(0); + message.contains = object.contains ?? Buffer.alloc(0); + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + message.ip = object.ip ?? undefined; + message.ipv4 = object.ipv4 ?? undefined; + message.ipv6 = object.ipv6 ?? undefined; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseEnumRules(): EnumRules { + return { const: 0, definedOnly: false, in: [], notIn: [] }; +} + +export const EnumRules: MessageFns = { + encode(message: EnumRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.const !== undefined && message.const !== 0) { + writer.uint32(8).int32(message.const); + } + if (message.definedOnly !== undefined && message.definedOnly !== false) { + writer.uint32(16).bool(message.definedOnly); + } + for (const v of message.in) { + writer.uint32(24).int32(v!); + } + for (const v of message.notIn) { + writer.uint32(32).int32(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.const = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.definedOnly = reader.bool(); + continue; + } + case 3: { + if (tag === 24) { + message.in.push(reader.int32()); + + continue; + } + + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.in.push(reader.int32()); + } + + continue; + } + + break; + } + case 4: { + if (tag === 32) { + message.notIn.push(reader.int32()); + + continue; + } + + if (tag === 34) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.notIn.push(reader.int32()); + } + + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumRules { + return { + const: isSet(object.const) ? globalThis.Number(object.const) : 0, + definedOnly: isSet(object.definedOnly) + ? globalThis.Boolean(object.definedOnly) + : isSet(object.defined_only) + ? globalThis.Boolean(object.defined_only) + : false, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.Number(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.Number(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.Number(e)) + : [], + }; + }, + + toJSON(message: EnumRules): unknown { + const obj: any = {}; + if (message.const !== undefined && message.const !== 0) { + obj.const = Math.round(message.const); + } + if (message.definedOnly !== undefined && message.definedOnly !== false) { + obj.definedOnly = message.definedOnly; + } + if (message.in?.length) { + obj.in = message.in.map((e) => Math.round(e)); + } + if (message.notIn?.length) { + obj.notIn = message.notIn.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): EnumRules { + return EnumRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EnumRules { + const message = createBaseEnumRules(); + message.const = object.const ?? 0; + message.definedOnly = object.definedOnly ?? false; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMessageRules(): MessageRules { + return { skip: false, required: false }; +} + +export const MessageRules: MessageFns = { + encode(message: MessageRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.skip !== undefined && message.skip !== false) { + writer.uint32(8).bool(message.skip); + } + if (message.required !== undefined && message.required !== false) { + writer.uint32(16).bool(message.required); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MessageRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessageRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.skip = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.required = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MessageRules { + return { + skip: isSet(object.skip) ? globalThis.Boolean(object.skip) : false, + required: isSet(object.required) ? globalThis.Boolean(object.required) : false, + }; + }, + + toJSON(message: MessageRules): unknown { + const obj: any = {}; + if (message.skip !== undefined && message.skip !== false) { + obj.skip = message.skip; + } + if (message.required !== undefined && message.required !== false) { + obj.required = message.required; + } + return obj; + }, + + create, I>>(base?: I): MessageRules { + return MessageRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MessageRules { + const message = createBaseMessageRules(); + message.skip = object.skip ?? false; + message.required = object.required ?? false; + return message; + }, +}; + +function createBaseRepeatedRules(): RepeatedRules { + return { minItems: 0, maxItems: 0, unique: false, items: undefined, ignoreEmpty: false }; +} + +export const RepeatedRules: MessageFns = { + encode(message: RepeatedRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minItems !== undefined && message.minItems !== 0) { + writer.uint32(8).uint64(message.minItems); + } + if (message.maxItems !== undefined && message.maxItems !== 0) { + writer.uint32(16).uint64(message.maxItems); + } + if (message.unique !== undefined && message.unique !== false) { + writer.uint32(24).bool(message.unique); + } + if (message.items !== undefined) { + FieldRules.encode(message.items, writer.uint32(34).fork()).join(); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(40).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RepeatedRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRepeatedRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.minItems = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxItems = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.unique = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.items = FieldRules.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RepeatedRules { + return { + minItems: isSet(object.minItems) + ? globalThis.Number(object.minItems) + : isSet(object.min_items) + ? globalThis.Number(object.min_items) + : 0, + maxItems: isSet(object.maxItems) + ? globalThis.Number(object.maxItems) + : isSet(object.max_items) + ? globalThis.Number(object.max_items) + : 0, + unique: isSet(object.unique) ? globalThis.Boolean(object.unique) : false, + items: isSet(object.items) ? FieldRules.fromJSON(object.items) : undefined, + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: RepeatedRules): unknown { + const obj: any = {}; + if (message.minItems !== undefined && message.minItems !== 0) { + obj.minItems = Math.round(message.minItems); + } + if (message.maxItems !== undefined && message.maxItems !== 0) { + obj.maxItems = Math.round(message.maxItems); + } + if (message.unique !== undefined && message.unique !== false) { + obj.unique = message.unique; + } + if (message.items !== undefined) { + obj.items = FieldRules.toJSON(message.items); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): RepeatedRules { + return RepeatedRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RepeatedRules { + const message = createBaseRepeatedRules(); + message.minItems = object.minItems ?? 0; + message.maxItems = object.maxItems ?? 0; + message.unique = object.unique ?? false; + message.items = (object.items !== undefined && object.items !== null) + ? FieldRules.fromPartial(object.items) + : undefined; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseMapRules(): MapRules { + return { minPairs: 0, maxPairs: 0, noSparse: false, keys: undefined, values: undefined, ignoreEmpty: false }; +} + +export const MapRules: MessageFns = { + encode(message: MapRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minPairs !== undefined && message.minPairs !== 0) { + writer.uint32(8).uint64(message.minPairs); + } + if (message.maxPairs !== undefined && message.maxPairs !== 0) { + writer.uint32(16).uint64(message.maxPairs); + } + if (message.noSparse !== undefined && message.noSparse !== false) { + writer.uint32(24).bool(message.noSparse); + } + if (message.keys !== undefined) { + FieldRules.encode(message.keys, writer.uint32(34).fork()).join(); + } + if (message.values !== undefined) { + FieldRules.encode(message.values, writer.uint32(42).fork()).join(); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + writer.uint32(48).bool(message.ignoreEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MapRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMapRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.minPairs = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxPairs = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.noSparse = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.keys = FieldRules.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.values = FieldRules.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.ignoreEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MapRules { + return { + minPairs: isSet(object.minPairs) + ? globalThis.Number(object.minPairs) + : isSet(object.min_pairs) + ? globalThis.Number(object.min_pairs) + : 0, + maxPairs: isSet(object.maxPairs) + ? globalThis.Number(object.maxPairs) + : isSet(object.max_pairs) + ? globalThis.Number(object.max_pairs) + : 0, + noSparse: isSet(object.noSparse) + ? globalThis.Boolean(object.noSparse) + : isSet(object.no_sparse) + ? globalThis.Boolean(object.no_sparse) + : false, + keys: isSet(object.keys) ? FieldRules.fromJSON(object.keys) : undefined, + values: isSet(object.values) ? FieldRules.fromJSON(object.values) : undefined, + ignoreEmpty: isSet(object.ignoreEmpty) + ? globalThis.Boolean(object.ignoreEmpty) + : isSet(object.ignore_empty) + ? globalThis.Boolean(object.ignore_empty) + : false, + }; + }, + + toJSON(message: MapRules): unknown { + const obj: any = {}; + if (message.minPairs !== undefined && message.minPairs !== 0) { + obj.minPairs = Math.round(message.minPairs); + } + if (message.maxPairs !== undefined && message.maxPairs !== 0) { + obj.maxPairs = Math.round(message.maxPairs); + } + if (message.noSparse !== undefined && message.noSparse !== false) { + obj.noSparse = message.noSparse; + } + if (message.keys !== undefined) { + obj.keys = FieldRules.toJSON(message.keys); + } + if (message.values !== undefined) { + obj.values = FieldRules.toJSON(message.values); + } + if (message.ignoreEmpty !== undefined && message.ignoreEmpty !== false) { + obj.ignoreEmpty = message.ignoreEmpty; + } + return obj; + }, + + create, I>>(base?: I): MapRules { + return MapRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MapRules { + const message = createBaseMapRules(); + message.minPairs = object.minPairs ?? 0; + message.maxPairs = object.maxPairs ?? 0; + message.noSparse = object.noSparse ?? false; + message.keys = (object.keys !== undefined && object.keys !== null) + ? FieldRules.fromPartial(object.keys) + : undefined; + message.values = (object.values !== undefined && object.values !== null) + ? FieldRules.fromPartial(object.values) + : undefined; + message.ignoreEmpty = object.ignoreEmpty ?? false; + return message; + }, +}; + +function createBaseAnyRules(): AnyRules { + return { required: false, in: [], notIn: [] }; +} + +export const AnyRules: MessageFns = { + encode(message: AnyRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.required !== undefined && message.required !== false) { + writer.uint32(8).bool(message.required); + } + for (const v of message.in) { + writer.uint32(18).string(v!); + } + for (const v of message.notIn) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AnyRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAnyRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.required = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.in.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.notIn.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AnyRules { + return { + required: isSet(object.required) ? globalThis.Boolean(object.required) : false, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => globalThis.String(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => globalThis.String(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: AnyRules): unknown { + const obj: any = {}; + if (message.required !== undefined && message.required !== false) { + obj.required = message.required; + } + if (message.in?.length) { + obj.in = message.in; + } + if (message.notIn?.length) { + obj.notIn = message.notIn; + } + return obj; + }, + + create, I>>(base?: I): AnyRules { + return AnyRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AnyRules { + const message = createBaseAnyRules(); + message.required = object.required ?? false; + message.in = object.in?.map((e) => e) || []; + message.notIn = object.notIn?.map((e) => e) || []; + return message; + }, +}; + +function createBaseDurationRules(): DurationRules { + return { + required: false, + const: undefined, + lt: undefined, + lte: undefined, + gt: undefined, + gte: undefined, + in: [], + notIn: [], + }; +} + +export const DurationRules: MessageFns = { + encode(message: DurationRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.required !== undefined && message.required !== false) { + writer.uint32(8).bool(message.required); + } + if (message.const !== undefined) { + Duration.encode(message.const, writer.uint32(18).fork()).join(); + } + if (message.lt !== undefined) { + Duration.encode(message.lt, writer.uint32(26).fork()).join(); + } + if (message.lte !== undefined) { + Duration.encode(message.lte, writer.uint32(34).fork()).join(); + } + if (message.gt !== undefined) { + Duration.encode(message.gt, writer.uint32(42).fork()).join(); + } + if (message.gte !== undefined) { + Duration.encode(message.gte, writer.uint32(50).fork()).join(); + } + for (const v of message.in) { + Duration.encode(v!, writer.uint32(58).fork()).join(); + } + for (const v of message.notIn) { + Duration.encode(v!, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DurationRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDurationRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.required = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.const = Duration.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lt = Duration.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lte = Duration.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.gt = Duration.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.gte = Duration.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.in.push(Duration.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.notIn.push(Duration.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DurationRules { + return { + required: isSet(object.required) ? globalThis.Boolean(object.required) : false, + const: isSet(object.const) ? Duration.fromJSON(object.const) : undefined, + lt: isSet(object.lt) ? Duration.fromJSON(object.lt) : undefined, + lte: isSet(object.lte) ? Duration.fromJSON(object.lte) : undefined, + gt: isSet(object.gt) ? Duration.fromJSON(object.gt) : undefined, + gte: isSet(object.gte) ? Duration.fromJSON(object.gte) : undefined, + in: globalThis.Array.isArray(object?.in) ? object.in.map((e: any) => Duration.fromJSON(e)) : [], + notIn: globalThis.Array.isArray(object?.notIn) + ? object.notIn.map((e: any) => Duration.fromJSON(e)) + : globalThis.Array.isArray(object?.not_in) + ? object.not_in.map((e: any) => Duration.fromJSON(e)) + : [], + }; + }, + + toJSON(message: DurationRules): unknown { + const obj: any = {}; + if (message.required !== undefined && message.required !== false) { + obj.required = message.required; + } + if (message.const !== undefined) { + obj.const = Duration.toJSON(message.const); + } + if (message.lt !== undefined) { + obj.lt = Duration.toJSON(message.lt); + } + if (message.lte !== undefined) { + obj.lte = Duration.toJSON(message.lte); + } + if (message.gt !== undefined) { + obj.gt = Duration.toJSON(message.gt); + } + if (message.gte !== undefined) { + obj.gte = Duration.toJSON(message.gte); + } + if (message.in?.length) { + obj.in = message.in.map((e) => Duration.toJSON(e)); + } + if (message.notIn?.length) { + obj.notIn = message.notIn.map((e) => Duration.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DurationRules { + return DurationRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DurationRules { + const message = createBaseDurationRules(); + message.required = object.required ?? false; + message.const = (object.const !== undefined && object.const !== null) + ? Duration.fromPartial(object.const) + : undefined; + message.lt = (object.lt !== undefined && object.lt !== null) ? Duration.fromPartial(object.lt) : undefined; + message.lte = (object.lte !== undefined && object.lte !== null) ? Duration.fromPartial(object.lte) : undefined; + message.gt = (object.gt !== undefined && object.gt !== null) ? Duration.fromPartial(object.gt) : undefined; + message.gte = (object.gte !== undefined && object.gte !== null) ? Duration.fromPartial(object.gte) : undefined; + message.in = object.in?.map((e) => Duration.fromPartial(e)) || []; + message.notIn = object.notIn?.map((e) => Duration.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseTimestampRules(): TimestampRules { + return { + required: false, + const: undefined, + lt: undefined, + lte: undefined, + gt: undefined, + gte: undefined, + ltNow: false, + gtNow: false, + within: undefined, + }; +} + +export const TimestampRules: MessageFns = { + encode(message: TimestampRules, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.required !== undefined && message.required !== false) { + writer.uint32(8).bool(message.required); + } + if (message.const !== undefined) { + Timestamp.encode(toTimestamp(message.const), writer.uint32(18).fork()).join(); + } + if (message.lt !== undefined) { + Timestamp.encode(toTimestamp(message.lt), writer.uint32(26).fork()).join(); + } + if (message.lte !== undefined) { + Timestamp.encode(toTimestamp(message.lte), writer.uint32(34).fork()).join(); + } + if (message.gt !== undefined) { + Timestamp.encode(toTimestamp(message.gt), writer.uint32(42).fork()).join(); + } + if (message.gte !== undefined) { + Timestamp.encode(toTimestamp(message.gte), writer.uint32(50).fork()).join(); + } + if (message.ltNow !== undefined && message.ltNow !== false) { + writer.uint32(56).bool(message.ltNow); + } + if (message.gtNow !== undefined && message.gtNow !== false) { + writer.uint32(64).bool(message.gtNow); + } + if (message.within !== undefined) { + Duration.encode(message.within, writer.uint32(74).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TimestampRules { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestampRules(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.required = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.const = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.lt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lte = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.gt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.gte = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.ltNow = reader.bool(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.gtNow = reader.bool(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.within = Duration.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TimestampRules { + return { + required: isSet(object.required) ? globalThis.Boolean(object.required) : false, + const: isSet(object.const) ? fromJsonTimestamp(object.const) : undefined, + lt: isSet(object.lt) ? fromJsonTimestamp(object.lt) : undefined, + lte: isSet(object.lte) ? fromJsonTimestamp(object.lte) : undefined, + gt: isSet(object.gt) ? fromJsonTimestamp(object.gt) : undefined, + gte: isSet(object.gte) ? fromJsonTimestamp(object.gte) : undefined, + ltNow: isSet(object.ltNow) + ? globalThis.Boolean(object.ltNow) + : isSet(object.lt_now) + ? globalThis.Boolean(object.lt_now) + : false, + gtNow: isSet(object.gtNow) + ? globalThis.Boolean(object.gtNow) + : isSet(object.gt_now) + ? globalThis.Boolean(object.gt_now) + : false, + within: isSet(object.within) ? Duration.fromJSON(object.within) : undefined, + }; + }, + + toJSON(message: TimestampRules): unknown { + const obj: any = {}; + if (message.required !== undefined && message.required !== false) { + obj.required = message.required; + } + if (message.const !== undefined) { + obj.const = message.const.toISOString(); + } + if (message.lt !== undefined) { + obj.lt = message.lt.toISOString(); + } + if (message.lte !== undefined) { + obj.lte = message.lte.toISOString(); + } + if (message.gt !== undefined) { + obj.gt = message.gt.toISOString(); + } + if (message.gte !== undefined) { + obj.gte = message.gte.toISOString(); + } + if (message.ltNow !== undefined && message.ltNow !== false) { + obj.ltNow = message.ltNow; + } + if (message.gtNow !== undefined && message.gtNow !== false) { + obj.gtNow = message.gtNow; + } + if (message.within !== undefined) { + obj.within = Duration.toJSON(message.within); + } + return obj; + }, + + create, I>>(base?: I): TimestampRules { + return TimestampRules.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TimestampRules { + const message = createBaseTimestampRules(); + message.required = object.required ?? false; + message.const = object.const ?? undefined; + message.lt = object.lt ?? undefined; + message.lte = object.lte ?? undefined; + message.gt = object.gt ?? undefined; + message.gte = object.gte ?? undefined; + message.ltNow = object.ltNow ?? false; + message.gtNow = object.gtNow ?? false; + message.within = (object.within !== undefined && object.within !== null) + ? Duration.fromPartial(object.within) + : undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); +} + +function base64FromBytes(arr: Uint8Array): string { + return globalThis.Buffer.from(arr).toString("base64"); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +}