Merge https://github.com/meshtastic/protobufs into 8226-persisted-favorites

This commit is contained in:
ford-jones 2025-10-13 11:27:38 +13:00
commit a916c49299
35 changed files with 375 additions and 55 deletions

View file

@ -1,30 +1,132 @@
name: Push new version to schema registry
permissions:
contents: read
name: Publish to Cargo, JSR, & NPM
on:
push:
tags:
- "**"
- "v*"
workflow_dispatch:
inputs:
version:
description: "Version to publish (e.g. v1.2.3). Used when manually dispatching."
required: false
type: string
permissions: write-all
jobs:
push_to_registry:
runs-on: ubuntu-latest
codegen:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Show files exist
run: |
set -euxo pipefail
ls -la packages/ts || true
ls -la packages/rust || true
cat packages/ts/deno.json
cat packages/ts/package.json
cat packages/rust/Cargo.toml
- name: Determine VERSION
run: |
set -euo pipefail
if [ "${{ github.ref_type }}" = "tag" ]; then
VERSION="${{ github.ref_name }}"
elif [ -n "${{ inputs.version || '' }}" ]; then
VERSION="${{ inputs.version }}"
else
echo "No tag ref and no 'version' input. Provide a tag (push a tag) or pass inputs.version." >&2
exit 1
fi
# If you don't want the leading 'v' inside files, strip it:
STRIPPED="${VERSION#v}"
echo "VERSION=$STRIPPED" >> "$GITHUB_ENV"
echo "Resolved VERSION=$STRIPPED"
- name: Set Package Versions to current tag
run: |
set -euxo pipefail
for f in \
packages/ts/deno.json \
packages/ts/package.json \
packages/rust/Cargo.toml
do
test -f "$f" || { echo "Missing $f" >&2; exit 1; }
# replace __PACKAGE_VERSION__ with env VERSION
sed -i "s/__PACKAGE_VERSION__/${VERSION//\//-}/g" "$f"
done
- name: Setup Buf
uses: bufbuild/buf-action@v1.2.0
uses: bufbuild/buf-setup-action@main
with:
github_token: ${{ github.token }}
token: ${{ secrets.BUF_TOKEN }}
setup_only: true
- name: Generate code
run: buf generate
- name: Copy license & README
run: |
cp LICENSE packages/ts
cp LICENSE packages/rust
cp README.md packages/ts
cp README.md packages/rust
- name: Upload Rust code
uses: actions/upload-artifact@v4
with:
name: rust_code
path: packages/rust
- name: Upload TypeScript code
uses: actions/upload-artifact@v4
with:
name: ts_code
path: packages/ts
- name: Push to schema registry
env:
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
run: |
buf push --tag ${{ github.ref_name }}
publish-jsr:
runs-on: ubuntu-24.04
needs: codegen
permissions:
contents: read
id-token: write
steps:
- name: Download TypeScript code
uses: actions/download-artifact@v4
with:
name: ts_code
- name: Remove package.json (JSR doesnt need it)
run: rm -f package.json
- name: Set up Deno
uses: denoland/setup-deno@main
with:
deno-version: rc
- name: Publish to JSR
run: deno publish --unstable-sloppy-imports
publish-cargo:
runs-on: ubuntu-24.04
needs: codegen
steps:
- name: Download Rust code
uses: actions/download-artifact@v4
with:
name: rust_code
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Check Library
run: cargo check
- name: Publish to crates.io
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_TOKEN }}
ignore-unpublished-changes: true

10
buf.gen.yaml Normal file
View file

@ -0,0 +1,10 @@
version: v2
plugins:
- remote: buf.build/bufbuild/es:v2.1.0
out: packages/ts/lib
opt: target=ts
- remote: buf.build/community/neoeinstein-prost:v0.4.0
out: packages/rust/src/generated
- remote: buf.build/community/neoeinstein-prost-crate:v0.4.1
out: packages/rust/src/generated
opt: no_features

View file

@ -1,14 +1,19 @@
version: v1
name: buf.build/meshtastic/protobufs
deps: []
build:
excludes: []
breaking:
use:
- FILE
lint:
ignore_only:
PACKAGE_DEFINED:
- nanopb.proto
use:
- MINIMAL
version: v2
modules:
- path: meshtastic
name: buf.build/meshtastic/protobufs
excludes:
- meshtastic/device_only/
lint:
use:
- MINIMAL
except:
- PACKAGE_NO_IMPORT_CYCLE
disallow_comment_ignores: true
breaking:
use:
- FILE
except:
- EXTENSION_NO_DELETE
- FIELD_SAME_DEFAULT

View file

@ -12,7 +12,7 @@ import "meshtastic/module_config.proto";
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "AdminProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -8,7 +8,7 @@ import "meshtastic/config.proto";
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "AppOnlyProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "ATAKProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "CannedMessageConfigProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "ChannelProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*
@ -86,11 +86,6 @@ message ChannelSettings {
* Per-channel module settings.
*/
ModuleSettings module_settings = 7;
/*
* Whether or not we should receive notifactions / alerts through this channel
*/
bool mute = 8;
}
/*
@ -103,10 +98,10 @@ message ModuleSettings {
uint32 position_precision = 1;
/*
* Controls whether or not the phone / clients should mute the current channel
* Controls whether or not the client / device should mute the current channel
* Useful for noisy public channels you don't necessarily want to disable
*/
bool is_client_muted = 2;
bool is_muted = 2;
}
/*

View file

@ -8,7 +8,7 @@ import "meshtastic/mesh.proto";
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "ClientOnlyProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -7,7 +7,7 @@ import "meshtastic/device_ui.proto";
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "ConfigProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
message Config {

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "ConnStatusProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
message DeviceConnectionStatus {

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "DeviceUIProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -12,7 +12,7 @@ import "nanopb.proto";
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "DeviceOnly";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
option (nanopb_fileopt).include = "<vector>";

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "InterdeviceProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
// encapsulate up to 1k of NMEA string data

View file

@ -8,7 +8,7 @@ import "meshtastic/module_config.proto";
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "LocalOnlyProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -13,7 +13,7 @@ import "meshtastic/xmodem.proto";
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "MeshProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "ModuleConfigProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -8,7 +8,7 @@ import "meshtastic/mesh.proto";
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "MQTTProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "PaxcountProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "Portnums";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "PowerMonProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/* Note: There are no 'PowerMon' messages normally in use (PowerMons are sent only as structured logs - slogs).

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "RemoteHardware";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "RTTTLConfigProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "StoreAndForwardProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "TelemetryProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
/*

View file

@ -5,7 +5,7 @@ package meshtastic;
option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
option java_outer_classname = "XmodemProtos";
option java_package = "com.geeksville.mesh";
option java_package = "org.meshtastic.proto";
option swift_prefix = "";
message XModem {

105
packages/rust/Cargo.lock generated Normal file
View file

@ -0,0 +1,105 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "anyhow"
version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
[[package]]
name = "bytes"
version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3"
[[package]]
name = "either"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]]
name = "itertools"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
dependencies = [
"either",
]
[[package]]
name = "meshtastic_protobufs"
version = "2.5.5"
dependencies = [
"prost",
"prost-types",
]
[[package]]
name = "proc-macro2"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
dependencies = [
"unicode-ident",
]
[[package]]
name = "prost"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f"
dependencies = [
"bytes",
"prost-derive",
]
[[package]]
name = "prost-derive"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5"
dependencies = [
"anyhow",
"itertools",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "prost-types"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4759aa0d3a6232fb8dbdb97b61de2c20047c68aca932c7ed76da9d788508d670"
dependencies = [
"prost",
]
[[package]]
name = "quote"
version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [
"proc-macro2",
]
[[package]]
name = "syn"
version = "2.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"

15
packages/rust/Cargo.toml Normal file
View file

@ -0,0 +1,15 @@
[package]
name = "meshtastic_protobufs"
edition = "2021"
version = "__PACKAGE_VERSION__"
description = "Meshtastic Protobuf definitions"
repository = "https://github.com/meshtastic/protobufs"
license-file = "LICENSE"
include = [
"**/*.rs",
"Cargo.toml",
]
[dependencies]
prost = "0.13.3"
prost-types = "0.13.3"

View file

5
packages/rust/src/lib.rs Normal file
View file

@ -0,0 +1,5 @@
extern crate prost;
extern crate core;
extern crate prost_types;
include!("generated/mod.rs");

15
packages/ts/deno.json Normal file
View file

@ -0,0 +1,15 @@
{
"name": "@meshtastic/protobufs",
"version": "__PACKAGE_VERSION__",
"exports": {
".": "./mod.ts"
},
"imports": {
"@bufbuild/protobuf": "npm:@bufbuild/protobuf@^2.2.3"
},
"publish": {
"exclude": [
"!lib"
]
}
}

16
packages/ts/deno.lock generated Normal file
View file

@ -0,0 +1,16 @@
{
"version": "4",
"specifiers": {
"npm:@bufbuild/protobuf@^2.2.3": "2.2.3"
},
"npm": {
"@bufbuild/protobuf@2.2.3": {
"integrity": "sha512-tFQoXHJdkEOSwj5tRIZSPNUuXK3RaR7T1nUrPgbYX1pUbvqqaaZAsfo+NXBPsz5rZMSKVFrgK1WL8Q/MSLvprg=="
}
},
"workspace": {
"dependencies": [
"npm:@bufbuild/protobuf@^2.2.3"
]
}
}

0
packages/ts/lib/.gitkeep Normal file
View file

20
packages/ts/mod.ts Normal file
View file

@ -0,0 +1,20 @@
export * as Admin from "./lib/admin_pb.ts";
export * as AppOnly from "./lib/apponly_pb.ts";
export * as ATAK from "./lib/atak_pb.ts";
export * as CannedMessages from "./lib/cannedmessages_pb.ts";
export * as Channel from "./lib/channel_pb.ts";
export * as ClientOnly from "./lib/clientonly_pb.ts";
export * as Config from "./lib/config_pb.ts";
export * as ConnectionStatus from "./lib/connection_status_pb.ts";
export * as LocalOnly from "./lib/localonly_pb.ts";
export * as Mesh from "./lib/mesh_pb.ts";
export * as ModuleConfig from "./lib/module_config_pb.ts";
export * as Mqtt from "./lib/mqtt_pb.ts";
export * as PaxCount from "./lib/paxcount_pb.ts";
export * as Portnums from "./lib/portnums_pb.ts";
export * as PowerMon from "./lib/powermon_pb.ts";
export * as RemoteHardware from "./lib/remote_hardware_pb.ts";
export * as Rtttl from "./lib/rtttl_pb.ts";
export * as StoreForward from "./lib/storeforward_pb.ts";
export * as Telemetry from "./lib/telemetry_pb.ts";
export * as Xmodem from "./lib/xmodem_pb.ts";

32
packages/ts/package.json Executable file
View file

@ -0,0 +1,32 @@
{
"name": "@meshtastic/protobufs",
"description": "Protobuf definitions for the Meshtastic project",
"version": "__PACKAGE_VERSION__",
"homepage": "https://github.com/meshtastic/protobufs",
"license": "GPLV3",
"publishConfig": {
"access": "public"
},
"type": "module",
"main": "./dist/mod.js",
"module": "./dist/mod.js",
"types": "./dist/mod.d.ts",
"dependencies": {
"@bufbuild/protobuf": "^2.2.3"
},
"devDependencies": {
"tsdown": "^0.13.4",
"typescript": "^5.8.3"
},
"scripts": {
"build": "tsdown"
},
"tsdown": {
"entry": "mod.ts",
"dts": true,
"format": [
"esm"
],
"splitting": false
}
}