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(base config builder): allow async overrides #2177

Merged
merged 4 commits into from
May 22, 2024

Conversation

odinr
Copy link
Collaborator

@odinr odinr commented May 22, 2024

Why

This PR introduces changes to the BaseConfigBuilder class in the @equinor/fusion-framework package. The current behavior of the BaseConfigBuilder class is that it provides a way to build and configure modules by defining configuration callbacks for different parts of the module's configuration. However, the implementation has some limitations and lacks proper documentation.

The new behavior introduced by this PR is an improved and more flexible implementation of the BaseConfigBuilder class. It includes better handling of nested configurations, improved type safety, and more comprehensive documentation. Additionally, it introduces new helper methods for working with configuration callbacks and adds examples to illustrate the usage of the class.

This PR does not introduce any breaking changes, as it maintains backward compatibility with the existing API.

Changes

  • Improved documentation for the BaseConfigBuilder class, including a detailed example of how to use it.
  • Added new methods _get and _has to retrieve and check for the existence of configuration callbacks.
  • Improved the implementation of _createConfig to use switchMap instead of mergeMap for better handling of asynchronous operations.
  • Updated the _buildConfig method to use more descriptive comments and better variable naming.
  • Added an example for the _processConfig method to illustrate how it can be used for post-processing and validating the configuration.

Benefits

  • Improved code readability and maintainability through better documentation and code organization.
  • Enhanced type safety and better handling of nested configurations.
  • Provided more flexibility and control over the configuration building process through new helper methods.
  • Added examples to make it easier for developers to understand and use the BaseConfigBuilder class.

Check off the following:

  • Confirm that I checked changes to branch which I am merging into.
    • I have validated included files
    • My code does not generate new linting warnings
    • My PR is not a duplicate, check existing pr`s
  • Confirm that the I have completed the self-review checklist.
  • Confirm that my changes meet our code of conduct.

Copy link

changeset-bot bot commented May 22, 2024

🦋 Changeset detected

Latest commit: 7f86a26

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

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 github-actions bot added 🚀 feature New feature or request 🧬 Modules labels May 22, 2024
@odinr odinr changed the title Feat/base config builder/allow async overrides Feat(base config builder): allow async overrides May 22, 2024
@odinr odinr force-pushed the feat/base-config-builder/allow-async-overrides branch 2 times, most recently from 3feb2d6 to 17d3a59 Compare May 22, 2024 12:03
odinr added 4 commits May 22, 2024 14:04
Allow `_createConfig` method in `BaseConfigBuilder` to return `ObservableInput<TConfig>` instead of `Observable<TConfig>`. This enables more flexibility in how the config is created, as the method can return a Promise or other observable-like type.
…lbacks

- Add `_get` method to retrieve the configuration callback for a given target path
- Add `_has` method to check if a target path exists in the configuration callbacks
- Improve documentation and examples for BaseConfigBuilder
- Update type annotations and JSDoc comments for better type safety and clarity
- Add `@sealed` decorator to public methods in `BaseConfigBuilder`
- Change access modifiers of some methods to `@protected`
@odinr odinr force-pushed the feat/base-config-builder/allow-async-overrides branch from 17d3a59 to 7f86a26 Compare May 22, 2024 12:04
@odinr odinr marked this pull request as ready for review May 22, 2024 12:07
@odinr odinr requested a review from a team as a code owner May 22, 2024 12:07
Copy link
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 12.92% 3678 / 28453
🔵 Statements 12.92% 3678 / 28453
🔵 Functions 12.81% 92 / 718
🔵 Branches 27.53% 225 / 817
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
packages/modules/module/src/BaseConfigBuilder.ts 0% 0% 0% 0% 1-353
Generated in workflow #6226

@odinr odinr merged commit fb424be into main May 22, 2024
14 checks passed
@odinr odinr deleted the feat/base-config-builder/allow-async-overrides branch May 22, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 feature New feature or request 🧬 Modules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants