n1ru4l / envelop

Envelop is a lightweight library allowing developers to easily develop, share, collaborate and extend their GraphQL execution layer. Envelop is the missing GraphQL plugin system.
https://envelop.dev
MIT License
771 stars 119 forks source link

[response-cache] deprecate `ttlPerType` option in favor of `ttlPerSchemaCoordinate` #2258

Open EmrysMyrddin opened 3 weeks ago

EmrysMyrddin commented 3 weeks ago

Description

There is an incoherence in the options API. TTL is configured using 2 parameters: ttlPerType and ttlPerSchemaCoordinate while scope is configured only via scopeBySchemaCoordinate which can contain typeName only or typeName+fieldName keys.

This PR is deprecating the ttlPerType in favor of ttlPerSchemaCoordinate to be more coherent. ttlPerType is still supported but will be removed in future major release.

Type of change

changeset-bot[bot] commented 3 weeks ago

🦋 Changeset detected

Latest commit: c72a73635a7dcb6b91104450d4faded8f38f67cd

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

This PR includes changesets to release 2 packages | Name | Type | | ------------------------------------- | ----- | | @envelop/response-cache | Minor | | @envelop/response-cache-cloudflare-kv | Major |

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

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets): Package Version Info
@envelop/response-cache 6.3.0-alpha-20240710083620-c72a7363 npm ↗︎ unpkg ↗︎
@envelop/response-cache-cloudflare-kv 2.0.0-alpha-20240710083620-c72a7363 npm ↗︎ unpkg ↗︎
github-actions[bot] commented 1 week ago
### 💻 Website Preview The latest changes are available as preview in: [https://14a7b1b8.envelop.pages.dev](https://14a7b1b8.envelop.pages.dev)
theguild-bot commented 1 week ago

✅ Benchmark Results

     ✓ no_errors
     ✓ expected_result

     checks.............................................: 100.00% ✓ 910810      ✗ 0     
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: 100.00% ✓ 215636      ✗ 0     
     ✓ { mode:envelop-cache-jit }.......................: 100.00% ✓ 355918      ✗ 0     
     ✓ { mode:envelop-just-cache }......................: 100.00% ✓ 211114      ✗ 0     
     ✓ { mode:graphql-js }..............................: 100.00% ✓ 128142      ✗ 0     
     data_received......................................: 3.5 GB  29 MB/s
     data_sent..........................................: 198 MB  1.7 MB/s
     envelop_init.......................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     envelop_total......................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     event_loop_lag.....................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     graphql_context....................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     graphql_execute....................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     graphql_parse......................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     graphql_validate...................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     http_req_blocked...................................: avg=2µs     min=701ns    med=1.78µs  max=6.04ms  p(90)=2.38µs  p(95)=2.69µs 
     http_req_connecting................................: avg=13ns    min=0s       med=0s      max=1.16ms  p(90)=0s      p(95)=0s     
     http_req_duration..................................: avg=2.33ms  min=147.6µs  med=2.05ms  max=74.5ms  p(90)=4.23ms  p(95)=4.78ms 
       { expected_response:true }.......................: avg=2.33ms  min=147.6µs  med=2.05ms  max=74.5ms  p(90)=4.23ms  p(95)=4.78ms 
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: avg=2.49ms  min=271.34µs med=2.21ms  max=15.75ms p(90)=4.34ms  p(95)=4.71ms 
     ✓ { mode:envelop-cache-jit }.......................: avg=1.38ms  min=147.6µs  med=1.08ms  max=14.46ms p(90)=2.19ms  p(95)=2.39ms 
     ✓ { mode:envelop-just-cache }......................: avg=2.53ms  min=273.74µs med=2.22ms  max=27.91ms p(90)=4.38ms  p(95)=4.76ms 
     ✓ { mode:graphql-js }..............................: avg=4.4ms   min=640.26µs med=3.69ms  max=74.5ms  p(90)=7.39ms  p(95)=8.08ms 
     http_req_failed....................................: 0.00%   ✓ 0           ✗ 455405
     http_req_receiving.................................: avg=32.14µs min=12.51µs  med=27.82µs max=12.11ms p(90)=42.68µs p(95)=47.48µs
     http_req_sending...................................: avg=12.92µs min=4.23µs   med=10.45µs max=20.51ms p(90)=15.59µs p(95)=19.73µs
     http_req_tls_handshaking...........................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     http_req_waiting...................................: avg=2.29ms  min=120.7µs  med=2.01ms  max=74.43ms p(90)=4.18ms  p(95)=4.73ms 
     http_reqs..........................................: 455405  3794.992409/s
     iteration_duration.................................: avg=2.62ms  min=347.78µs med=2.33ms  max=75.09ms p(90)=4.51ms  p(95)=5.11ms 
     iterations.........................................: 455405  3794.992409/s
     vus................................................: 10      min=10        max=10  
     vus_max............................................: 20      min=20        max=20  
EmrysMyrddin commented 1 week ago

I just realized that I didn't updated tests. I have to do this before merging.