Skip to content

fix: expose QueryOptions and MutationOptions type#1414

Merged
HendrikThePendric merged 3 commits intomasterfrom
fix/expose-query-and-mutation-type
Jun 5, 2025
Merged

fix: expose QueryOptions and MutationOptions type#1414
HendrikThePendric merged 3 commits intomasterfrom
fix/expose-query-and-mutation-type

Conversation

@HendrikThePendric
Copy link
Copy Markdown
Contributor

@HendrikThePendric HendrikThePendric commented Jun 5, 2025

This PR exposes the Query and Mutation type as QueryOptions and MutationOptions. Use case for this is that I am trying to hook the DataEngine up with the RTK Query / Redux Toolkit. I am adding an instance of the DataEngine using createDynamicMiddleWare. This allows me to then access the the data engine in my customBaseQuery. However, I need to accurately type the arguments which may be passed to this base query and these arguments should match whatever I can pass to engine.query or engine.mutate. Hence this PR.

In my second commit 49b7155 I export QueryExecuteOptions as ExecuteOptions. I'm a bit unsure about this because it makes the name more generic, which probably isn't a good thing... The thinking behind it is as follows:

  • engine.query and engine.mutate take two positional arguments and the second one for each is of type QueryExecuteOptions
  • I thought having a prefix with Query for the second positional argument which is also used by engine.mutate is a bit confusing

@HendrikThePendric HendrikThePendric requested a review from kabaros June 5, 2025 08:00
@kabaros kabaros requested a review from a team June 5, 2025 08:07
Copy link
Copy Markdown
Collaborator

@kabaros kabaros left a comment

Choose a reason for hiding this comment

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

lgtm

@HendrikThePendric HendrikThePendric requested a review from kabaros June 5, 2025 08:35
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 5, 2025

@HendrikThePendric HendrikThePendric merged commit a1d2315 into master Jun 5, 2025
16 checks passed
@HendrikThePendric HendrikThePendric deleted the fix/expose-query-and-mutation-type branch June 5, 2025 10:07
dhis2-bot added a commit that referenced this pull request Jun 5, 2025
## [3.14.4](v3.14.3...v3.14.4) (2025-06-05)

### Bug Fixes

* expose Query, Mutation and ExecuteOptions types ([#1414](#1414)) ([a1d2315](a1d2315))
@dhis2-bot
Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants