dotansimha / graphql-yoga

🧘 Rewrite of a fully-featured GraphQL Server with focus on easy setup, performance & great developer experience. The core of Yoga implements WHATWG Fetch API and can run/deploy on any JS environment.
https://the-guild.dev/graphql/yoga-server
MIT License
8.25k stars 574 forks source link

feat: pass context to onParams hook #3464

Closed n1ru4l closed 1 week ago

n1ru4l commented 1 week ago

Alternative approach for https://github.com/dotansimha/graphql-yoga/pull/3463

This is required for solving https://github.com/graphql-hive/platform/pull/5875 as the request can not be used as a internal cache key for batched requests.

changeset-bot[bot] commented 1 week ago

🦋 Changeset detected

Latest commit: 65c4ec64d939b7fa2e401d61b4ec5548f910994e

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

This PR includes changesets to release 24 packages | Name | Type | | ------------------------------------------ | ----- | | @graphql-yoga/plugin-persisted-operations | Major | | graphql-yoga | Minor | | @graphql-yoga/nestjs | Major | | @graphql-yoga/render-graphiql | Major | | @graphql-yoga/plugin-apollo-inline-trace | Major | | @graphql-yoga/apollo-managed-federation | Major | | @graphql-yoga/plugin-apollo-usage-report | Major | | @graphql-yoga/plugin-apq | Major | | @graphql-yoga/plugin-csrf-prevention | Major | | @graphql-yoga/plugin-defer-stream | Major | | @graphql-yoga/plugin-disable-introspection | Major | | @graphql-yoga/plugin-graphql-sse | Major | | @graphql-yoga/plugin-jwt | Major | | @graphql-yoga/plugin-prometheus | Major | | @graphql-yoga/plugin-response-cache | Major | | @graphql-yoga/plugin-sofa | Major | | apollo-federation-gateway-with-yoga | Patch | | apollo-subgraph-with-yoga | Patch | | graphql-lambda | Patch | | cloudflare-advanced | Patch | | cloudflare | Patch | | nextjs-app | Patch | | hello-world-benchmark | Patch | | @graphql-yoga/nestjs-federation | Patch |

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[bot] commented 1 week ago

Apollo Federation Subgraph Compatibility Results

Federation 1 Support Federation 2 Support
_service🟢
@key (single)🟢
@key (multi)🟢
@key (composite)🟢
repeatable @key🟢
@requires🟢
@provides🟢
federated tracing🟢
@link🟢
@shareable🟢
@tag🟢
@override🟢
@inaccessible🟢
@composeDirective🟢
@interfaceObject🟢

Learn more:

github-actions[bot] commented 1 week ago
### 💻 Website Preview The latest changes are available as preview in: [https://d1ebd460.graphql-yoga.pages.dev](https://d1ebd460.graphql-yoga.pages.dev)
github-actions[bot] commented 1 week ago

✅ Benchmark Results

     ✓ no_errors{mode:graphql}
     ✓ expected_result{mode:graphql}
     ✓ no_errors{mode:graphql-jit}
     ✓ expected_result{mode:graphql-jit}
     ✓ no_errors{mode:graphql-response-cache}
     ✓ expected_result{mode:graphql-response-cache}
     ✓ no_errors{mode:graphql-no-parse-validate-cache}
     ✓ expected_result{mode:graphql-no-parse-validate-cache}
     ✓ no_errors{mode:uws}
     ✓ expected_result{mode:uws}

     checks.......................................: 100.00% ✓ 512846      ✗ 0     
     data_received................................: 2.1 GB  14 MB/s
     data_sent....................................: 103 MB  687 kB/s
     http_req_blocked.............................: avg=1.5µs    min=982ns    med=1.31µs   max=243.78µs p(90)=2.02µs   p(95)=2.22µs  
     http_req_connecting..........................: avg=2ns      min=0s       med=0s       max=138.61µs p(90)=0s       p(95)=0s      
     http_req_duration............................: avg=368.99µs min=222.2µs  med=330.17µs max=15.98ms  p(90)=471.75µs p(95)=493.96µs
       { expected_response:true }.................: avg=368.99µs min=222.2µs  med=330.17µs max=15.98ms  p(90)=471.75µs p(95)=493.96µs
     ✓ { mode:graphql-jit }.......................: avg=297.09µs min=222.2µs  med=273.39µs max=15.98ms  p(90)=305.4µs  p(95)=323.05µs
     ✓ { mode:graphql-no-parse-validate-cache }...: avg=504.15µs min=407.37µs med=471.94µs max=9.88ms   p(90)=513.83µs p(95)=552.96µs
     ✓ { mode:graphql-response-cache }............: avg=349.67µs min=268.29µs med=329.64µs max=6.71ms   p(90)=360.71µs p(95)=373.3µs 
     ✓ { mode:graphql }...........................: avg=376.8µs  min=276.7µs  med=337.67µs max=13.84ms  p(90)=392.28µs p(95)=489.84µs
     ✓ { mode:uws }...............................: avg=354.91µs min=274.08µs med=330.42µs max=9.68ms   p(90)=364.56µs p(95)=383.24µs
     http_req_failed..............................: 0.00%   ✓ 0           ✗ 256423
     http_req_receiving...........................: avg=34.31µs  min=16.66µs  med=34.08µs  max=6.01ms   p(90)=40.05µs  p(95)=42.45µs 
     http_req_sending.............................: avg=8.7µs    min=5.85µs   med=7.62µs   max=857.37µs p(90)=11.23µs  p(95)=12.45µs 
     http_req_tls_handshaking.....................: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting.............................: avg=325.97µs min=185.59µs med=288.31µs max=15.82ms  p(90)=427.75µs p(95)=447.57µs
     http_reqs....................................: 256423  1709.468359/s
     iteration_duration...........................: avg=579.98µs min=393.94µs med=537.79µs max=16.64ms  p(90)=687.57µs p(95)=715.93µs
     iterations...................................: 256423  1709.468359/s
     vus..........................................: 1       min=1         max=1   
     vus_max......................................: 2       min=2         max=2