4.9 KiB · text History b868907
# Hex registry v2 messages — see priv/proto/hex/registry.proto.
#
# Written by hand rather than generated: this repo's toolchain has no
# protoc, and these definitions are transcribed from the ones compiled
# into hex_core, which is what `mix` actually decodes with. Keep the
# field numbers and `required:` flags in step with the .proto.

defmodule GitGud.Packages.Formats.Hex.Pb.Signed do
  @moduledoc false

  use Protobuf, full_name: "hex.Signed", syntax: :proto2

  field :payload, 1, required: true, type: :bytes
  field :signature, 2, optional: true, type: :bytes
end

defmodule GitGud.Packages.Formats.Hex.Pb.Timestamp do
  @moduledoc false

  use Protobuf, full_name: "hex.Timestamp", syntax: :proto2

  field :seconds, 1, required: true, type: :int64
  field :nanos, 2, required: true, type: :int32
end

defmodule GitGud.Packages.Formats.Hex.Pb.RetirementReason do
  @moduledoc false

  use Protobuf, enum: true, full_name: "hex.RetirementReason", syntax: :proto2

  field :RETIRED_OTHER, 0
  field :RETIRED_INVALID, 1
  field :RETIRED_SECURITY, 2
  field :RETIRED_DEPRECATED, 3
  field :RETIRED_RENAMED, 4
end

defmodule GitGud.Packages.Formats.Hex.Pb.AdvisorySeverity do
  @moduledoc false

  use Protobuf, enum: true, full_name: "hex.AdvisorySeverity", syntax: :proto2

  field :SEVERITY_NONE, 0
  field :SEVERITY_LOW, 1
  field :SEVERITY_MEDIUM, 2
  field :SEVERITY_HIGH, 3
  field :SEVERITY_CRITICAL, 4
end

defmodule GitGud.Packages.Formats.Hex.Pb.Names.Package do
  @moduledoc false

  use Protobuf, full_name: "hex.Names.Package", syntax: :proto2

  field :name, 1, required: true, type: :string
  field :updated_at, 3, optional: true, type: GitGud.Packages.Formats.Hex.Pb.Timestamp
end

defmodule GitGud.Packages.Formats.Hex.Pb.Names do
  @moduledoc false

  use Protobuf, full_name: "hex.Names", syntax: :proto2

  field :packages, 1, repeated: true, type: GitGud.Packages.Formats.Hex.Pb.Names.Package
  field :repository, 2, required: true, type: :string
end

defmodule GitGud.Packages.Formats.Hex.Pb.Versions.Package do
  @moduledoc false

  use Protobuf, full_name: "hex.Versions.Package", syntax: :proto2

  field :name, 1, required: true, type: :string
  field :versions, 2, repeated: true, type: :string
  field :retired, 3, repeated: true, type: :int32, packed: true
  field :with_advisories, 5, repeated: true, type: :int32, packed: true
end

defmodule GitGud.Packages.Formats.Hex.Pb.Versions do
  @moduledoc false

  use Protobuf, full_name: "hex.Versions", syntax: :proto2

  field :packages, 1, repeated: true, type: GitGud.Packages.Formats.Hex.Pb.Versions.Package
  field :repository, 2, required: true, type: :string
end

defmodule GitGud.Packages.Formats.Hex.Pb.RetirementStatus do
  @moduledoc false

  use Protobuf, full_name: "hex.RetirementStatus", syntax: :proto2

  field :reason, 1,
    required: true,
    type: GitGud.Packages.Formats.Hex.Pb.RetirementReason,
    enum: true

  field :message, 2, optional: true, type: :string
end

defmodule GitGud.Packages.Formats.Hex.Pb.Dependency do
  @moduledoc false

  use Protobuf, full_name: "hex.Dependency", syntax: :proto2

  field :package, 1, required: true, type: :string
  field :requirement, 2, required: true, type: :string
  field :optional, 3, optional: true, type: :bool
  field :app, 4, optional: true, type: :string
  field :repository, 5, optional: true, type: :string
end

defmodule GitGud.Packages.Formats.Hex.Pb.SecurityAdvisory do
  @moduledoc false

  use Protobuf, full_name: "hex.SecurityAdvisory", syntax: :proto2

  field :id, 1, required: true, type: :string
  field :summary, 2, required: true, type: :string
  field :html_url, 3, required: true, type: :string

  field :severity, 4,
    optional: true,
    type: GitGud.Packages.Formats.Hex.Pb.AdvisorySeverity,
    enum: true

  field :cvss_score, 5, optional: true, type: :float
  field :api_url, 6, required: true, type: :string
  field :aliases, 7, repeated: true, type: :string
end

defmodule GitGud.Packages.Formats.Hex.Pb.Release do
  @moduledoc false

  use Protobuf, full_name: "hex.Release", syntax: :proto2

  field :version, 1, required: true, type: :string
  field :inner_checksum, 2, required: true, type: :bytes
  field :dependencies, 3, repeated: true, type: GitGud.Packages.Formats.Hex.Pb.Dependency
  field :retired, 4, optional: true, type: GitGud.Packages.Formats.Hex.Pb.RetirementStatus
  field :outer_checksum, 5, optional: true, type: :bytes
  field :advisory_indexes, 6, repeated: true, type: :uint32
  field :published_at, 7, optional: true, type: GitGud.Packages.Formats.Hex.Pb.Timestamp
end

defmodule GitGud.Packages.Formats.Hex.Pb.Package do
  @moduledoc false

  use Protobuf, full_name: "hex.Package", syntax: :proto2

  field :releases, 1, repeated: true, type: GitGud.Packages.Formats.Hex.Pb.Release
  field :name, 2, required: true, type: :string
  field :repository, 3, required: true, type: :string
  field :advisories, 4, repeated: true, type: GitGud.Packages.Formats.Hex.Pb.SecurityAdvisory
end