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

Tree-shakable library without Rest module shouldn't include Resource or PaginatedResource #1489

Closed
lawrence-forooghian opened this issue Nov 8, 2023 · 2 comments · Fixed by #1496
Assignees
Labels
bug Something isn't working. It's clear that this does need to be fixed.

Comments

@lawrence-forooghian
Copy link
Collaborator

These classes are only used for providing REST functionality, so if the library without the Rest module includes them then it means that there are some probably some further APIs that we need to make unavailable in the Rest-less client library.

One culprit is the token revocation functionality added in #1410, but I believe there are others, since this issue also exists in 7e21e56, i.e. before the merge of main which introduced the token revocation functionality.

@lawrence-forooghian lawrence-forooghian added the bug Something isn't working. It's clear that this does need to be fixed. label Nov 8, 2023
Copy link

sync-by-unito bot commented Nov 8, 2023

➤ Automation for Jira commented:

The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3936

lawrence-forooghian added a commit that referenced this issue Nov 9, 2023
There is code that’s exclusively needed by the REST version of these
classes (e.g. presence `get()`, channel `publish()`), and which, in
order to reduce bundle size, we don’t want to pull in when importing the
BaseRealtime class. In order to do this, we need to sever the
inheritance relation between the Realtime and REST version of these
classes. (It’s also worth noting that, similarly to what I mentioned in
69c35f1, the IDL doesn’t mention any inheritance relation.)

The REST versions of these classes also contain functionality (channel
history and presence history, channel status) that should only be
available to a BaseRealtime client if the user has explicitly requested
REST functionality (by importing the Rest module). So, we gate this
functionality behind the Rest module (I should really have done this in
89c0761) and in doing so further reduce the bundle size of a REST-less
BaseRealtime.

I’ve moved the channel and presence REST code that’s also conditionally
needed by Realtime into classes called RestChannelMixin and
RestPresenceMixin. There’s no massively compelling reason for these
classes to exist, I just thought it might be good not to dump everything
directly inside the Rest module.

Resolves #1489.

TODO fix tests
lawrence-forooghian added a commit that referenced this issue Nov 10, 2023
There is code that’s exclusively needed by the REST version of these
classes (e.g. presence `get()`, channel `publish()`), and which, in
order to reduce bundle size, we don’t want to pull in when importing the
BaseRealtime class. In order to do this, we need to sever the
inheritance relation between the Realtime and REST version of these
classes. (It’s also worth noting that, similarly to what I mentioned in
69c35f1, the IDL doesn’t mention any inheritance relation.)

The REST versions of these classes also contain functionality (channel
history and presence history, channel status) that should only be
available to a BaseRealtime client if the user has explicitly requested
REST functionality (by importing the Rest module). So, we gate this
functionality behind the Rest module (I should really have done this in
89c0761) and in doing so further reduce the bundle size of a REST-less
BaseRealtime.

I’ve moved the channel and presence REST code that’s also conditionally
needed by Realtime into classes called RestChannelMixin and
RestPresenceMixin. There’s no massively compelling reason for these
classes to exist, I just thought it might be good not to dump everything
directly inside the Rest module.

Resolves #1489.
lawrence-forooghian added a commit that referenced this issue Nov 10, 2023
There is code that’s exclusively needed by the REST version of these
classes (e.g. presence `get()`, channel `publish()`), and which, in
order to reduce bundle size, we don’t want to pull in when importing the
BaseRealtime class. In order to do this, we need to sever the
inheritance relation between the Realtime and REST version of these
classes. (It’s also worth noting that, similarly to what I mentioned in
69c35f1, the IDL doesn’t mention any inheritance relation.)

The REST versions of these classes also contain functionality (channel
history and presence history, channel status) that should only be
available to a BaseRealtime client if the user has explicitly requested
REST functionality (by importing the Rest module). So, we gate this
functionality behind the Rest module (I should really have done this in
89c0761) and in doing so further reduce the bundle size of a REST-less
BaseRealtime.

I’ve moved the channel and presence REST code that’s also conditionally
needed by Realtime into classes called RestChannelMixin and
RestPresenceMixin. There’s no massively compelling reason for these
classes to exist, I just thought it might be good not to dump everything
directly inside the Rest module.

Resolves #1489.
lawrence-forooghian added a commit that referenced this issue Nov 10, 2023
There is code that’s exclusively needed by the REST version of these
classes (e.g. presence `get()`, channel `publish()`), and which, in
order to reduce bundle size, we don’t want to pull in when importing the
BaseRealtime class. In order to do this, we need to sever the
inheritance relation between the Realtime and REST version of these
classes. (It’s also worth noting that, similarly to what I mentioned in
69c35f1, the IDL doesn’t mention any inheritance relation.)

The REST versions of these classes also contain functionality (channel
history and presence history, channel status) that should only be
available to a BaseRealtime client if the user has explicitly requested
REST functionality (by importing the Rest module). So, we gate this
functionality behind the Rest module (I should really have done this in
89c0761) and in doing so further reduce the bundle size of a REST-less
BaseRealtime.

I’ve moved the channel and presence REST code that’s also conditionally
needed by Realtime into classes called RestChannelMixin and
RestPresenceMixin. There’s no massively compelling reason for these
classes to exist, I just thought it might be good not to dump everything
directly inside the Rest module.

Resolves #1489.
lawrence-forooghian added a commit that referenced this issue Nov 14, 2023
There is code that’s exclusively needed by the REST version of these
classes (e.g. presence `get()`, channel `publish()`), and which, in
order to reduce bundle size, we don’t want to pull in when importing the
BaseRealtime class. In order to do this, we need to sever the
inheritance relation between the Realtime and REST version of these
classes. (It’s also worth noting that, similarly to what I mentioned in
69c35f1, the IDL doesn’t mention any inheritance relation.)

The REST versions of these classes also contain functionality (channel
history and presence history, channel status) that should only be
available to a BaseRealtime client if the user has explicitly requested
REST functionality (by importing the Rest module). So, we gate this
functionality behind the Rest module (I should really have done this in
89c0761) and in doing so further reduce the bundle size of a REST-less
BaseRealtime.

I’ve moved the channel and presence REST code that’s also conditionally
needed by Realtime into classes called RestChannelMixin and
RestPresenceMixin. There’s no massively compelling reason for these
classes to exist, I just thought it might be good not to dump everything
directly inside the Rest module.

Resolves #1489.
@lawrence-forooghian
Copy link
Collaborator Author

Closed in #1496.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. It's clear that this does need to be fixed.
Development

Successfully merging a pull request may close this issue.

1 participant