Page MenuHomePhabricator

[web] Introduce types for identity service communication
ClosedPublic

Authored by ashoat on Apr 4 2023, 1:29 PM.
Tags
None
Referenced Files
F3736911: D7306.diff
Thu, Jan 9, 7:00 AM
Unknown Object (File)
Sun, Jan 5, 2:42 PM
Unknown Object (File)
Thu, Jan 2, 7:35 PM
Unknown Object (File)
Thu, Jan 2, 6:52 AM
Unknown Object (File)
Thu, Jan 2, 6:52 AM
Unknown Object (File)
Thu, Jan 2, 6:52 AM
Unknown Object (File)
Thu, Jan 2, 6:47 AM
Unknown Object (File)
Dec 7 2024, 8:33 PM
Subscribers

Details

Summary
  1. I added the latest version of google-protobuf to web/package.json
  2. I installed its Flow types via flow-typed install google-protobuf
  3. I generated web/protobufs/identity-client.cjs and web/protobufs/identity-structs.cjs by running protoc -I=shared/protos/ identity_client.proto --js_out=import_style=commonjs:web/protobufs and then added the @generated line to hide them from Phabricator diffs
  4. I wrote web/protobufs/identity-client.cjs.flow and web/protobufs/identity-structs.cjs.flow, which were inspired by TypeScript bindings generated with protoc -I=shared/protos/ identity_client.proto --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:.
  5. I wrote flow-typed/npm/grpc-web_v1.x.x.js, only typing the things that were needed for the last step
Test Plan

I tested the code and the Flow types with this patch: https://gist.github.com/Ashoat/7cf4a0fbdebc152d585884184bc0ac07

Diff Detail

Repository
rCOMM Comm
Branch
ashoat/grpcweb
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ashoat requested review of this revision.Apr 4 2023, 1:46 PM

Gave it a very brief skim, but looks reasonable. Assuming we don't care about the 80char/line limit for these files.

which were inspired by TypeScript bindings generated with protoc -I=shared/protos/ identity_client.proto --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:.

Might've been helpful to have a link to a Gist or something so I could quickly do a side-by-side, have caught minor discrepancies in the past that way.

This revision is now accepted and ready to land.Apr 5 2023, 6:45 AM

Might've been helpful to have a link to a Gist or something so I could quickly do a side-by-side, have caught minor discrepancies in the past that way.

Roger, will make sure to do that next time