Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ts-proto with protobuf-es #700

Merged
merged 19 commits into from
Jul 18, 2023
Merged

Replace ts-proto with protobuf-es #700

merged 19 commits into from
Jul 18, 2023

Conversation

lukasIO
Copy link
Contributor

@lukasIO lukasIO commented May 11, 2023

The only inconsistency that I could find was that we were using protobuf enum values of Enum.UNRECOGNIZED in two places. The generated types of protobuf-es do not expose that UNRECOGNIZED option, so not sure what the best way to work around this would be.

@changeset-bot
Copy link

changeset-bot bot commented May 11, 2023

🦋 Changeset detected

Latest commit: 2874e05

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
livekit-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented May 11, 2023

size-limit report 📦

Path Size
dist/livekit-client.esm.mjs 73.84 KB (-14.16% 🔽)
dist/livekit-client.umd.js 78.78 KB (-13.47% 🔽)

@lukasIO lukasIO requested a review from davidzhao May 11, 2023 12:30
@lukasIO lukasIO mentioned this pull request May 11, 2023
Copy link
Member

@davidzhao davidzhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! This actually looks like a clean switch.

@@ -63,7 +70,7 @@ export interface SignalOptions {

type SignalMessage = SignalRequest['message'];

type SignalKind = NonNullable<SignalMessage>['$case'];
type SignalKind = NonNullable<SignalMessage>['case'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting to see they kept this design

@@ -404,7 +406,8 @@ export function videoQualityForRid(rid: string): VideoQuality {
case 'q':
return VideoQuality.LOW;
default:
return VideoQuality.UNRECOGNIZED;
// FIXME should be unrecognized
return VideoQuality.OFF;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe default to something other than off? I know this is likely an invalid case.. but OFF is a reserved enum that only the server uses

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe default to HIGH?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense!
I think protobuf behaviour generally would be to default to the first enum value, but HIGH does make more sense in this context.

@lukasIO
Copy link
Contributor Author

lukasIO commented May 15, 2023

the test-workflow compat check is failing is due to robatwilliams/es-compat#72.
We are working around this issue already for globalThis by claiming to have a polyfill for it (which we don't).

But it's currently failing on this branch, because protobuf-es is making use of BigInt if it is available. It verifies that via runtime checks. There is no (well working) polyfill for BigInt, that's why es-compat doesn't support it as a polyfill option. So we can't use the same workaround that we use for globalThis.

The runtime check of protobuf-es also probably still needs some tweaking, opened an issue to hopefully address this.

@lukasIO
Copy link
Contributor Author

lukasIO commented Jul 17, 2023

the test-workflow compat check is failing is due to robatwilliams/es-compat#72.

temporarily set the log level of this check to warn instead of error to make the CI succeed. Added a comment to revert that change, once the plugin allows for additional customisation of rules.

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.

2 participants