Migrate protobuf layer to @teslemetry/tesla-protocol (ts-proto API)#4
Merged
Conversation
…y/tesla-protocol Ports the Session HMAC signing code (the only real protobuf call site) from google-protobuf's setter API to tesla-protocol's ts-proto-generated create/encode/decode API, and removes src/pb2 and google-protobuf. Also fixes three pre-existing bugs (two unbalanced-brace syntax errors and a bad import path) and a missing tsconfig moduleResolution setting that left the repo unable to build or typecheck at all.
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.
What
src/pb2/*protobuf types +google-protobufruntime with the published@teslemetry/tesla-protocolpackage.@teslemetry/tesla-protocolis ts-proto generated: plain-object messages withType.create()/Type.encode().finish()/Type.decode(), notgoogle-protobuf's.setX()/.serializeBinary()classes.Sessioninsrc/vehiclesigned.ts(builds/tags the HMAC-personalized signature for signed commands); it's ported to the new API andHMAC_Personalized_Signature_Datais nowHMACPersonalizedSignatureDatafrom@teslemetry/tesla-protocol/command/signatures.src/pb2/*and thegoogle-protobuf/ts-protoc-gendependencies are removed.src/vehiclesigned.tshad a stray closing brace that ended theVehicleSignedclass early, leaving every command method declared outside any class.src/teslafleetapi.tshad an unbalanced brace inloadPrivateKey, leavingTeslaFleetApi's class body unclosed.src/vehiclesigned.tsandsrc/vehiclespecific.tsimportedFleetTelemetryConfigfrom a./types/fleet_telemetry_config.jsmodule that doesn't exist (the type actually lives in./types/commands.js); once the import path was fixed, a second latent bug surfaced where the wrapper type ({ vins, config }) was used in place of just itsconfigfield.moduleResolution: NodeNextalongsidemodule: NodeNextintsconfig.json. Without it, TypeScript's classic resolution can't see theexportsmap that scoped packages like@teslemetry/tesla-protocol(and even@types/node's own internals) gate their subpath types behind, so nothing innode_modulesresolved.typescript/@types/nodeto versions whoseUint8Arraytypings are generic, matching what@teslemetry/tesla-protocol's own@bufbuild/protobufruntime dependency expects.No public API or behavior change - this is an internal proto-source swap.
pnpm install(which runstscviaprepare) andnpx tsc --noEmitare both clean; there's no test suite in this repo yet.