@whatwg-node/server 0.9.61 → 0.9.62-rc-20241212140811-17d867cd8c5fe89df0d3471ca2e58da244e38bc5

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/server",
3
- "version": "0.9.61",
3
+ "version": "0.9.62-rc-20241212140811-17d867cd8c5fe89df0d3471ca2e58da244e38bc5",
4
4
  "description": "Fetch API compliant HTTP Server adapter",
5
5
  "sideEffects": false,
6
6
  "dependencies": {
@@ -1,8 +1,35 @@
1
1
  import { FetchAPI, ServerAdapterRequestHandler, type ServerAdapterInitialContext } from '../types.cjs';
2
2
  export interface ServerAdapterPlugin<TServerContext = {}> {
3
+ /**
4
+ * This hook is invoked for ANY incoming HTTP request. Here you can manipulate the request,
5
+ * create a short circuit before the request handler takes it over.
6
+ *
7
+ * Warning: Exceptions thrown by this hook are not caught.
8
+ * This means they will buble up to the HTTP server underlying implementation.
9
+ * For example, the `node:http` server crashes the entire process on uncaught exceptions.
10
+ */
3
11
  onRequest?: OnRequestHook<TServerContext & ServerAdapterInitialContext>;
12
+ /**
13
+ * This hook is invoked after a HTTP request (both GraphQL and NON GraphQL) has been processed
14
+ * and after the response has been forwarded to the client. Here you can perform any cleanup
15
+ * or logging operations, or you can manipulate the outgoing response object.
16
+ *
17
+ * Warning: Exceptions thrown by this hook are not caught.
18
+ * This means they will buble up to the HTTP server underlying implementation.
19
+ * For example, the `node:http` server crashes the entire process on uncaught exceptions.
20
+ */
4
21
  onResponse?: OnResponseHook<TServerContext & ServerAdapterInitialContext>;
22
+ /**
23
+ * This hook is invoked when the server is being disposed.
24
+ * The server disposal is triggered either by the request termination or the explicit server disposal.
25
+ * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html
26
+ */
5
27
  [Symbol.dispose]?: () => void;
28
+ /**
29
+ * This hook is invoked when the server is being disposed.
30
+ * The server disposal is triggered either by the request termination or the explicit server disposal.
31
+ * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html
32
+ */
6
33
  [Symbol.asyncDispose]?: () => PromiseLike<void> | void;
7
34
  }
8
35
  export type OnRequestHook<TServerContext> = (payload: OnRequestEventPayload<TServerContext>) => Promise<void> | void;
@@ -1,8 +1,35 @@
1
1
  import { FetchAPI, ServerAdapterRequestHandler, type ServerAdapterInitialContext } from '../types.js';
2
2
  export interface ServerAdapterPlugin<TServerContext = {}> {
3
+ /**
4
+ * This hook is invoked for ANY incoming HTTP request. Here you can manipulate the request,
5
+ * create a short circuit before the request handler takes it over.
6
+ *
7
+ * Warning: Exceptions thrown by this hook are not caught.
8
+ * This means they will buble up to the HTTP server underlying implementation.
9
+ * For example, the `node:http` server crashes the entire process on uncaught exceptions.
10
+ */
3
11
  onRequest?: OnRequestHook<TServerContext & ServerAdapterInitialContext>;
12
+ /**
13
+ * This hook is invoked after a HTTP request (both GraphQL and NON GraphQL) has been processed
14
+ * and after the response has been forwarded to the client. Here you can perform any cleanup
15
+ * or logging operations, or you can manipulate the outgoing response object.
16
+ *
17
+ * Warning: Exceptions thrown by this hook are not caught.
18
+ * This means they will buble up to the HTTP server underlying implementation.
19
+ * For example, the `node:http` server crashes the entire process on uncaught exceptions.
20
+ */
4
21
  onResponse?: OnResponseHook<TServerContext & ServerAdapterInitialContext>;
22
+ /**
23
+ * This hook is invoked when the server is being disposed.
24
+ * The server disposal is triggered either by the request termination or the explicit server disposal.
25
+ * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html
26
+ */
5
27
  [Symbol.dispose]?: () => void;
28
+ /**
29
+ * This hook is invoked when the server is being disposed.
30
+ * The server disposal is triggered either by the request termination or the explicit server disposal.
31
+ * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html
32
+ */
6
33
  [Symbol.asyncDispose]?: () => PromiseLike<void> | void;
7
34
  }
8
35
  export type OnRequestHook<TServerContext> = (payload: OnRequestEventPayload<TServerContext>) => Promise<void> | void;