Support synapse API versioning#49
Merged
Merged
Conversation
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().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add ability for client to know what API version its on, as well as parse device API version