Skip to content

Support synapse API versioning#49

Merged
namthor9 merged 5 commits into
mainfrom
versioning
May 22, 2026
Merged

Support synapse API versioning#49
namthor9 merged 5 commits into
mainfrom
versioning

Conversation

@namthor9
Copy link
Copy Markdown
Contributor

Add ability for client to know what API version its on, as well as parse device API version

namthor9 added 4 commits May 22, 2026 12:00
scripts/generate.sh reads the canonical API version from the
synapse-api submodule's VERSION file and writes
src/api_version.ts. The constant is re-exported from both index
and browser entry points so clients can do:

    import { SYNAPSE_API_VERSION } from "@science-corporation/synapse";

to compare against a server's reported version.

src/api_version.ts is committed (with the current 2.4.0 value) so the
tsc build works on a fresh clone before generate.sh runs;
generate.sh overwrites it when the submodule is present.

NOTE: requires bumping the synapse-api submodule pointer to a commit
that contains VERSION before generate.sh's stamping path becomes
active. The current pointer (551e247) predates that file.
Picks up the new VERSION file so scripts/generate.sh now has a source
to read from. Without this bump the stamping was a no-op and
src/api_version.ts would have drifted as a hand-edited file.
DeviceInfo.synapse_version is encoded by the server as a uint32 with
the layout [major:8][minor:8][patch:16]. Add a decoder so consumers
(nexus-desktop and any other client) don't have to reimplement the
bit layout — they import decodeSynapseVersion from this package and
pass the value from Device.info().
@namthor9 namthor9 merged commit 40cd9d4 into main May 22, 2026
4 checks passed
@namthor9 namthor9 deleted the versioning branch May 22, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant