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

feat: fluent extensions, throws extension, gen static interfaces #1107

Merged
merged 36 commits into from
Sep 24, 2024

Conversation

jasonkuhrt
Copy link
Member

@jasonkuhrt jasonkuhrt commented Sep 18, 2024

This PR is a major re-architecting of the generator system motivated by pursuing best possible (practical) IDE performance.

The major change is moving as much as possible to generation time:

  • request methods are now generated, no more mapped types to derive them
  • selection sets are now generated interfaces, no more mapped types to derive them

One disadvantage of this approach is that extensions will not have core schema types that are fully dog-fooded internally as well. That drift may lead to core schema types being removed (because they become unused internally) or a degree toward there. Perhaps a way to make up for this is enabling extensions to tap into the CLI generator. For example OrThrow emitting types instead of using in-memory type transformations.

One unintentional advantage is that we now can generate awesome JSDoc. This is actually a significant benefit in its own right.


Additional work on this PR came about in order to re-realize the OrThrow extension. I devised a way to extend the fluent chain in a type-safe way that I'm actually rather proud of (perf seems ok too!). Internally now each fluent method is actually entirely modular and that ability now gets exposed to extensions. Therefore we changed the OrThrow extension into something much simpler that just adds a chaining method called throws(). Everything about it became simpler and its IDE perf is much better too. 🤩

Also closes #1104

@jasonkuhrt jasonkuhrt changed the title perf: generate root method definitions perf: generate a more static client interface Sep 19, 2024
@jasonkuhrt jasonkuhrt changed the title perf: generate a more static client interface feat: fluent extensions, throws extension, gen static interfaces Sep 23, 2024
@jasonkuhrt jasonkuhrt marked this pull request as ready for review September 24, 2024 01:08
@jasonkuhrt jasonkuhrt merged commit a3b1d75 into main Sep 24, 2024
8 checks passed
@jasonkuhrt jasonkuhrt deleted the perf/static-root-method-definitions branch September 24, 2024 01:08
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.

Error "Cannot find module '../_.js'" when trying to compile the generated client
1 participant