import type { ByteSource, PartialDeep } from "protoscript"; import * as protoscript from "protoscript"; /** * The syntax in which a protocol buffer element is defined. */ export type Syntax = "SYNTAX_PROTO2" | "SYNTAX_PROTO3" | "SYNTAX_EDITIONS"; /** * A protocol buffer message type. */ export interface Type { /** * The fully qualified message name. */ name: string; /** * The list of fields. */ fields: Field[]; /** * The list of types appearing in `oneof` definitions in this type. */ oneofs: string[]; /** * The protocol buffer options. */ options: Option[]; /** * The source context. */ sourceContext: protoscript.SourceContext; /** * The source syntax. */ syntax: Syntax; /** * The source edition string, only valid when syntax is SYNTAX_EDITIONS. */ edition: string; } /** * A single field of a message type. */ export interface Field { /** * The field type. */ kind: Field.Kind; /** * The field cardinality. */ cardinality: Field.Cardinality; /** * The field number. */ number: number; /** * The field name. */ name: string; /** * The field type URL, without the scheme, for message or enumeration * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. */ typeUrl: string; /** * The index of the field type in `Type.oneofs`, for message or enumeration * types. The first type has index 1; zero means the type is not in the list. */ oneofIndex: number; /** * Whether to use alternative packed wire representation. */ packed: boolean; /** * The protocol buffer options. */ options: Option[]; /** * The field JSON name. */ jsonName: string; /** * The string value of the default value of this field. Proto2 syntax only. */ defaultValue: string; } export declare namespace Field { /** * Basic field types. */ type Kind = "TYPE_UNKNOWN" | "TYPE_DOUBLE" | "TYPE_FLOAT" | "TYPE_INT64" | "TYPE_UINT64" | "TYPE_INT32" | "TYPE_FIXED64" | "TYPE_FIXED32" | "TYPE_BOOL" | "TYPE_STRING" | "TYPE_GROUP" | "TYPE_MESSAGE" | "TYPE_BYTES" | "TYPE_UINT32" | "TYPE_ENUM" | "TYPE_SFIXED32" | "TYPE_SFIXED64" | "TYPE_SINT32" | "TYPE_SINT64"; /** * Whether a field is optional, required, or repeated. */ type Cardinality = "CARDINALITY_UNKNOWN" | "CARDINALITY_OPTIONAL" | "CARDINALITY_REQUIRED" | "CARDINALITY_REPEATED"; } /** * Enum type definition. */ export interface Enum { /** * Enum type name. */ name: string; /** * Enum value definitions. */ enumvalue: EnumValue[]; /** * Protocol buffer options. */ options: Option[]; /** * The source context. */ sourceContext: protoscript.SourceContext; /** * The source syntax. */ syntax: Syntax; /** * The source edition string, only valid when syntax is SYNTAX_EDITIONS. */ edition: string; } /** * Enum value definition. */ export interface EnumValue { /** * Enum value name. */ name: string; /** * Enum value number. */ number: number; /** * Protocol buffer options. */ options: Option[]; } /** * A protocol buffer option, which can be attached to a message, field, * enumeration, etc. */ export interface Option { /** * The option's name. For protobuf built-in options (options defined in * descriptor.proto), this is the short name. For example, `"map_entry"`. * For custom options, it should be the fully-qualified name. For example, * `"google.api.http"`. */ name: string; /** * The option's value packed in an Any message. If the value is a primitive, * the corresponding wrapper type defined in google/protobuf/wrappers.proto * should be used. If the value is an enum, it should be stored as an int32 * value using the google.protobuf.Int32Value type. */ value: protoscript.Any; } export declare const Syntax: { /** * Syntax `proto2`. */ readonly SYNTAX_PROTO2: "SYNTAX_PROTO2"; /** * Syntax `proto3`. */ readonly SYNTAX_PROTO3: "SYNTAX_PROTO3"; /** * Syntax `editions`. */ readonly SYNTAX_EDITIONS: "SYNTAX_EDITIONS"; /** * @private */ readonly _fromInt: (i: number) => Syntax; /** * @private */ readonly _toInt: (i: Syntax) => number; }; export declare const Type: { /** * Serializes Type to protobuf. */ encode: (msg: PartialDeep) => Uint8Array; /** * Deserializes Type from protobuf. */ decode: (bytes: ByteSource) => Type; /** * Initializes Type with all fields set to their default value. */ initialize: (msg?: Partial) => Type; /** * @private */ _writeMessage: (msg: PartialDeep, writer: protoscript.BinaryWriter) => protoscript.BinaryWriter; /** * @private */ _readMessage: (msg: Type, reader: protoscript.BinaryReader) => Type; }; export declare const Field: { /** * Serializes Field to protobuf. */ encode: (msg: PartialDeep) => Uint8Array; /** * Deserializes Field from protobuf. */ decode: (bytes: ByteSource) => Field; /** * Initializes Field with all fields set to their default value. */ initialize: (msg?: Partial) => Field; /** * @private */ _writeMessage: (msg: PartialDeep, writer: protoscript.BinaryWriter) => protoscript.BinaryWriter; /** * @private */ _readMessage: (msg: Field, reader: protoscript.BinaryReader) => Field; Kind: { /** * Field type unknown. */ readonly TYPE_UNKNOWN: "TYPE_UNKNOWN"; /** * Field type double. */ readonly TYPE_DOUBLE: "TYPE_DOUBLE"; /** * Field type float. */ readonly TYPE_FLOAT: "TYPE_FLOAT"; /** * Field type int64. */ readonly TYPE_INT64: "TYPE_INT64"; /** * Field type uint64. */ readonly TYPE_UINT64: "TYPE_UINT64"; /** * Field type int32. */ readonly TYPE_INT32: "TYPE_INT32"; /** * Field type fixed64. */ readonly TYPE_FIXED64: "TYPE_FIXED64"; /** * Field type fixed32. */ readonly TYPE_FIXED32: "TYPE_FIXED32"; /** * Field type bool. */ readonly TYPE_BOOL: "TYPE_BOOL"; /** * Field type string. */ readonly TYPE_STRING: "TYPE_STRING"; /** * Field type group. Proto2 syntax only, and deprecated. */ readonly TYPE_GROUP: "TYPE_GROUP"; /** * Field type message. */ readonly TYPE_MESSAGE: "TYPE_MESSAGE"; /** * Field type bytes. */ readonly TYPE_BYTES: "TYPE_BYTES"; /** * Field type uint32. */ readonly TYPE_UINT32: "TYPE_UINT32"; /** * Field type enum. */ readonly TYPE_ENUM: "TYPE_ENUM"; /** * Field type sfixed32. */ readonly TYPE_SFIXED32: "TYPE_SFIXED32"; /** * Field type sfixed64. */ readonly TYPE_SFIXED64: "TYPE_SFIXED64"; /** * Field type sint32. */ readonly TYPE_SINT32: "TYPE_SINT32"; /** * Field type sint64. */ readonly TYPE_SINT64: "TYPE_SINT64"; /** * @private */ readonly _fromInt: (i: number) => Field.Kind; /** * @private */ readonly _toInt: (i: Field.Kind) => number; }; Cardinality: { /** * For fields with unknown cardinality. */ readonly CARDINALITY_UNKNOWN: "CARDINALITY_UNKNOWN"; /** * For optional fields. */ readonly CARDINALITY_OPTIONAL: "CARDINALITY_OPTIONAL"; /** * For required fields. Proto2 syntax only. */ readonly CARDINALITY_REQUIRED: "CARDINALITY_REQUIRED"; /** * For repeated fields. */ readonly CARDINALITY_REPEATED: "CARDINALITY_REPEATED"; /** * @private */ readonly _fromInt: (i: number) => Field.Cardinality; /** * @private */ readonly _toInt: (i: Field.Cardinality) => number; }; }; export declare const Enum: { /** * Serializes Enum to protobuf. */ encode: (msg: PartialDeep) => Uint8Array; /** * Deserializes Enum from protobuf. */ decode: (bytes: ByteSource) => Enum; /** * Initializes Enum with all fields set to their default value. */ initialize: (msg?: Partial) => Enum; /** * @private */ _writeMessage: (msg: PartialDeep, writer: protoscript.BinaryWriter) => protoscript.BinaryWriter; /** * @private */ _readMessage: (msg: Enum, reader: protoscript.BinaryReader) => Enum; }; export declare const EnumValue: { /** * Serializes EnumValue to protobuf. */ encode: (msg: PartialDeep) => Uint8Array; /** * Deserializes EnumValue from protobuf. */ decode: (bytes: ByteSource) => EnumValue; /** * Initializes EnumValue with all fields set to their default value. */ initialize: (msg?: Partial) => EnumValue; /** * @private */ _writeMessage: (msg: PartialDeep, writer: protoscript.BinaryWriter) => protoscript.BinaryWriter; /** * @private */ _readMessage: (msg: EnumValue, reader: protoscript.BinaryReader) => EnumValue; }; export declare const Option: { /** * Serializes Option to protobuf. */ encode: (msg: PartialDeep