Releases: ardatan/whatwg-node
March 25, 2025
@whatwg-node/node-fetch@0.7.15
Patch Changes
-
#2208
ff052a3
Thanks @ardatan! - When anyRequest
method is called outside
server adapter scope, it used to hang. This PR prevents it to hang and throw an error if the
readable stream is destroyed earlier.let request: Request const adapter = createServerAdapter(req => { request = req return new Response('Hello World') }) await request.text() // Was hanging but now throws an error
@whatwg-node/server@0.10.3
Patch Changes
-
#2208
ff052a3
Thanks @ardatan! - When anyRequest
method is called outside
server adapter scope, it used to hang. This PR prevents it to hang and throw an error if the
readable stream is destroyed earlier.let request: Request const adapter = createServerAdapter(req => { request = req return new Response('Hello World') }) await request.text() // Was hanging but now throws an error
March 21, 2025
March 19, 2025
March 17, 2025
@whatwg-node/promise-helpers@1.3.0
Minor Changes
- #2152
54a26bb
Thanks @EmrysMyrddin! - Allow to pass a finally callback to
handleMaybePromise
March 17, 2025
March 06, 2025
@whatwg-node/server@0.10.1
Patch Changes
- #2145
dac036c
Thanks @ardatan! - dependencies updates:- Added dependency
@envelop/instrumentation@^1.0.0
↗︎
(todependencies
) - Removed dependency
@envelop/instruments@1.0.0
↗︎
(fromdependencies
)
- Added dependency
March 05, 2025
March 05, 2025
@whatwg-node/promise-helpers@1.2.3
Patch Changes
- #2068
516bf60
Thanks @EmrysMyrddin! - Fix return type of the callback of
iterateAsync
. The callback can actually returnnull
orundefined
, the implementation is
already handling this case.
@whatwg-node/server@0.10.0
Minor Changes
-
#2068
516bf60
Thanks @EmrysMyrddin! - Add new Instruments APIIntroduction of a new API allowing to instrument the graphql pipeline.
This new API differs from already existing Hooks by not having access to input/output of phases.
The goal ofInstruments
is to run allow running code before, after or around the whole process
of a phase, including plugins hooks executions.The main use case of this new API is observability (monitoring, tracing, etc...).
Basic usage
import Sentry from '@sentry/node' import { createServerAdapter } from '@whatwg-node/server' const server = createServerAdapter( (req, res) => { //... }, { plugins: [ { instruments: { request: ({ request }, wrapped) => Sentry.startSpan({ name: 'Graphql Operation' }, async () => { try { await wrapped() } catch (err) { Sentry.captureException(err) } }) } } ] } )
Multiple instruments plugins
It is possible to have multiple instruments plugins (Prometheus and Sentry for example), they will
be automatically composed by envelop in the same order than the plugin array (first is outermost,
last is inner most).import { createServerAdapter } from '@whatwg-node/server' const server = createServerAdapter( (req, res) => { //... }, { plugins: [useSentry(), useOpentelemetry()] } )
sequenceDiagram Sentry->>Opentelemetry: ; Opentelemetry->>Server Adapter: ; Server Adapter->>Opentelemetry: ; Opentelemetry->>Sentry: ;
Custom instruments ordering
If the default composition ordering doesn't suite your need, you can manually compose instruments.
This allows to have a different execution order of hooks and instruments.import { composeInstruments, createServerAdapter } from '@whatwg-node/server' const { instruments: sentryInstruments, ...sentryPlugin } = useSentry() const { instruments: otelInstruments, ...otelPlugin } = useOpentelemetry() const instruments = composeInstruments([otelInstruments, sentryInstruments]) const server = createServerAdapter( (req, res) => { //... }, { plugins: [{ instruments }, sentryPlugin, otelPlugin] } )
sequenceDiagram Opentelemetry->>Sentry: ; Sentry->>Server Adapter: ; Server Adapter->>Sentry: ; Sentry->>Opentelemetry: ;
Patch Changes
- #2068
516bf60
Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
@whatwg-node/promise-helpers@^1.2.2
↗︎
(from^1.0.0
, independencies
) - Added dependency
@envelop/instruments@1.0.0
↗︎
(todependencies
)
- Updated dependency
- Updated dependencies
[516bf60
]:- @whatwg-node/promise-helpers@1.2.3