Copy createServicePolicy to base-data-service#9350
Draft
mcmire wants to merge 1 commit into
Draft
Conversation
Currently `createServicePolicy` lives in `controller-utils`, as originally we wrote it as an abstract utility that could theoretically be used for any kind of data access. However, there are a few reasons why this is suboptimal now: 1. `controller-utils` is too large and serves as a dependent of almost every package in the monorepo, so extreme care must be taken when changing this package to avoid breaking changes. 2. `createServicePolicy` was added before we formalized data services. Now we have a `BaseDataService` class, and this class sets up `createServicePolicy` by default, so it's highly unlikely that `createServicePolicy` will be used independently going forward. 3. Also, we only use `createServicePolicy` for HTTP requests, so making it abstract is kind of unnecessary. This commit deprecates the existing exports in `controller-utils`, copies them to `base-data-service`, and changes `BaseDataService` to use the copied version instead. In the future we will remove the symbols from `controller-utils` and modify `createServicePolicy` further so it works better for HTTP requests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Currently
createServicePolicylives incontroller-utils, as originally we wrote it as an abstract utility that could theoretically be used for any kind of data access. However, there are a few reasons why this is suboptimal now:controller-utilsis too large and serves as a dependent of almost every package in the monorepo, so extreme care must be taken when changing this package to avoid breaking changes.createServicePolicywas added before we formalized data services. Now we have aBaseDataServiceclass, and this class sets upcreateServicePolicyby default, so it's highly unlikely thatcreateServicePolicywill be used independently going forward.createServicePolicyfor HTTP requests, so making it abstract is kind of unnecessary.This commit deprecates the existing exports in
controller-utils, copies them tobase-data-service, and changesBaseDataServiceto use the copied version instead.In the future we will remove the symbols from
controller-utilsand modifycreateServicePolicyfurther so it works better for HTTP requests.References
No ticket yet, but this is related to https://consensyssoftware.atlassian.net/browse/WPC-1037 in that BaseDataService needs to be more fully-fledged to be as easy to use.
Checklist