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: refactor middleware stack #1398

Merged
merged 4 commits into from
Jul 28, 2020

Conversation

AllanZhengYP
Copy link
Contributor

@AllanZhengYP AllanZhengYP commented Jul 23, 2020

Issue #, if available:
#1377

Description of changes:

  • This change refactors the middleware stack class into a factory. So that the private data are stored in closure instead of class "private" members. Now, you can instantiate a middleware stack by constructStack<Input, Output>(); instead of new MiddlewareStack<Input, Output>().

  • Remove step from the addRelativeTo options. This way the position of the middleware is solely depend on the toMiddleware and relation(before or after).

  • Refactor the middleware stack resolution implementation. Now the resolution algorithm is easier to follow & maintain.

/cc @trivikr

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link

codecov-commenter commented Jul 23, 2020

Codecov Report

Merging #1398 into master will increase coverage by 0.07%.
The diff coverage is 98.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1398      +/-   ##
==========================================
+ Coverage   79.08%   79.15%   +0.07%     
==========================================
  Files         287      287              
  Lines       11155    11092      -63     
  Branches     2360     2340      -20     
==========================================
- Hits         8822     8780      -42     
+ Misses       2333     2312      -21     
Impacted Files Coverage Δ
packages/middleware-stack/src/MiddlewareStack.ts 98.38% <98.31%> (+10.68%) ⬆️
...re-bucket-endpoint/src/bucketEndpointMiddleware.ts 91.30% <100.00%> (ø)
...iddleware-sdk-s3-control/src/prepend-account-id.ts 86.95% <100.00%> (ø)
...dk-transcribe-streaming/src/middleware-endpoint.ts 95.23% <100.00%> (ø)
packages/middleware-signing/src/middleware.ts 91.66% <100.00%> (ø)
packages/smithy-client/src/client.ts 84.21% <100.00%> (ø)
packages/util-create-request/src/foo.fixture.ts 76.92% <100.00%> (ø)
packages/util-create-request/src/index.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bcb5503...1e15a4b. Read the comment docs.

@AllanZhengYP AllanZhengYP marked this pull request as ready for review July 27, 2020 16:17
@AllanZhengYP AllanZhengYP changed the title [WIP]feat!: refactor middleware stack feat!: refactor middleware stack Jul 27, 2020
@trivikr trivikr changed the title feat!: refactor middleware stack feat: refactor middleware stack Jul 28, 2020
packages/middleware-stack/src/MiddlewareStack.ts Outdated Show resolved Hide resolved
packages/middleware-stack/src/MiddlewareStack.spec.ts Outdated Show resolved Hide resolved
packages/middleware-stack/src/MiddlewareStack.ts Outdated Show resolved Hide resolved
packages/middleware-stack/src/MiddlewareStack.ts Outdated Show resolved Hide resolved
packages/types/src/middleware.ts Outdated Show resolved Hide resolved
packages/middleware-stack/src/MiddlewareStack.ts Outdated Show resolved Hide resolved
packages/middleware-stack/src/MiddlewareStack.ts Outdated Show resolved Hide resolved
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants