-
Notifications
You must be signed in to change notification settings - Fork 60
feat(toolkit-lib)!: improved types for BaseCredentials #542
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(toolkit-lib)!: improved types for BaseCredentials #542
Conversation
| requestResponse<T>(msg: IoRequest<unknown, T>): Promise<T>; | ||
| } | ||
|
|
||
| export interface IActionAwareIoHost { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only exists so that we can pass it to sdkBaseConfig of awsCliCompatible without having to also pass the action. I'm a bit on the fence w.r.t to that though.
Alternatively we could make it a regular IIoHost and do some trickery by conditionally checking if the received IoHost is already an IoHelper or not. If it is, we can use it as is and if it's not we set an action value like auth. In practice this will always be an IoHelper when used with the Toolkit. Only if used externally this might be something else.
However I thought this IActionAwareIoHost might come handy elsewhere.
1294775 to
6d92764
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #542 +/- ##
==========================================
+ Coverage 78.88% 79.09% +0.20%
==========================================
Files 47 47
Lines 7072 7074 +2
Branches 785 791 +6
==========================================
+ Hits 5579 5595 +16
+ Misses 1474 1460 -14
Partials 19 19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This PR refactors the
BaseCredentialsimplementation to provide better type safety and a cleaner API surface. By converting from an abstract class to a static factory pattern with proper interfaces, we improve the developer experience and make the code more maintainable.The changes also reduce external dependencies by removing the direct dependency on
@smithy/node-http-handlerand creating our own simplified interface for request handler settings.Reason for this change is that in the previous version
SdkProviderServiceswas used but not publicly exported since this interface wasn't meant for public consumption. That however made it difficult to implement customBaseCredentialssolutions. Instead ofSdkProviderServiceswe have no reduced the public API surface to the exactly needed properties.BREAKING CHANGE: Custom implementations of
BaseCredentialshave changed. If you previously extended the abstractBaseCredentialsclass and implemented the abstract method, you can now pass any object implementing the newIBaseCredentialsProviderinterface. The method name change tosdkBaseConfigand it now receives two parameters: anioHostthat can be used to emit messages and aclientConfigto should be honored for all SDK requests. However theclientConfigmay be extended as needed.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license