parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

feat: RequestContextMiddleware and config in hooks

Open Moumouls opened this issue 2 years ago • 8 comments
trafficstars

Pull Request

Issue

Closes: #8479 8479

Approach

Add a middleware option and add config to hooks

Tasks

  • [x] Add tests
  • [ ] Add changes to documentation (guides, repository pages, code comments)
  • [x] Add security check
  • [x] Add new Parse Error codes to Parse JS SDK

Moumouls avatar Mar 12 '23 18:03 Moumouls

I will reformat the title to use the proper commit message syntax.

Thanks for opening this pull request!

I will reformat the title to use the proper commit message syntax.

Codecov Report

Patch coverage: 81.81% and project coverage change: -0.18 :warning:

Comparison is base (65e5879) 94.33% compared to head (415e417) 94.15%.

:exclamation: Current head 415e417 differs from pull request most recent head 748f68f. Consider uploading reports for the commit 748f68f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##            alpha    #8480      +/-   ##
==========================================
- Coverage   94.33%   94.15%   -0.18%     
==========================================
  Files         183      183              
  Lines       14515    14526      +11     
==========================================
- Hits        13692    13677      -15     
- Misses        823      849      +26     
Impacted Files Coverage Δ
src/Options/Definitions.js 100.00% <ø> (ø)
src/Options/index.js 100.00% <ø> (ø)
src/Routers/FunctionsRouter.js 94.20% <ø> (ø)
src/cloud-code/Parse.Cloud.js 99.29% <ø> (ø)
src/triggers.js 95.35% <ø> (ø)
src/GraphQL/ParseGraphQLServer.js 92.59% <80.00%> (-1.29%) :arrow_down:
src/ParseServer.js 92.37% <80.00%> (-0.27%) :arrow_down:
src/Controllers/HooksController.js 94.78% <100.00%> (+0.04%) :arrow_up:

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Mar 12 '23 18:03 codecov[bot]

@mtrezza @dblythy any feedback on this one ? I can fix the little fail after a first review.

Moumouls avatar Apr 08 '23 09:04 Moumouls

@Moumouls Any suggestion what we should do with this PR? Does this require more development? If so; I'd change this to draft, otherwise maybe we can get this merged?

mtrezza avatar Mar 24 '24 01:03 mtrezza

Hi @mtrezza we don't need more development here. This PR is to allow developers to mutate the config using a provided middleware.

It's super useful, when you need to inject globally on each request (after the Parse middleware) some providers, for monitoring, feature flags, based on the current user/ parse config. Then the injected prop will be available in each hooks, GQL API

Moumouls avatar May 31 '24 12:05 Moumouls

And no breaking change, right?

mtrezza avatar May 31 '24 21:05 mtrezza