@moostjs/event-http 0.6.30 → 0.6.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -591,6 +591,15 @@ const LOGGER_TITLE = "moost-http";
591
591
  */ request(input, init) {
592
592
  return this.httpApp.request(input, init);
593
593
  }
594
+ /**
595
+ * Runs `fn` inside an HTTP event context seeded from a real `(req, res)` pair,
596
+ * without route dispatch. Nested `fetch()`/`request()` calls made during `fn`
597
+ * see this context as their caller, so `forwardHeaders` and parent `Set-Cookie`
598
+ * propagation apply. Never writes to `res` — apply buffered response state
599
+ * (e.g. `response.getSetCookieStrings()`) yourself.
600
+ */ withHttpContext(req, res, fn) {
601
+ return this.httpApp.withHttpContext(req, res, fn);
602
+ }
594
603
  listen(port, hostname, backlog, listeningListener) {
595
604
  return this.httpApp.listen(port, hostname, backlog, listeningListener);
596
605
  }
@@ -665,7 +674,7 @@ const LOGGER_TITLE = "moost-http";
665
674
  image: "https://moost.org/moost-full-logo.svg",
666
675
  link: "https://moost.org/",
667
676
  poweredBy: "moostjs",
668
- version: "0.6.30"
677
+ version: "0.6.31"
669
678
  });
670
679
  if (httpApp && httpApp instanceof _wooksjs_event_http.WooksHttp) this.httpApp = httpApp;
671
680
  else if (httpApp) this.httpApp = (0, _wooksjs_event_http.createHttpApp)({
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as moost from 'moost';
2
2
  import { TInterceptorPriority, TOvertakeFn, TInterceptorDef, TClassConstructor, TMoostAdapter, Moost, TConsoleBase, TMoostAdapterOptions } from 'moost';
3
+ import * as _wooksjs_event_http from '@wooksjs/event-http';
3
4
  import { TCookieAttributes as TCookieAttributes$1, TCookieAttributesInput, WooksHttp, TWooksHttpOptions } from '@wooksjs/event-http';
4
5
  export { HttpError, TCacheControl, TCookieAttributesInput, TSetCookieData, httpKind, useHttpContext } from '@wooksjs/event-http';
5
6
  import { IncomingMessage, ServerResponse } from 'http';
@@ -418,6 +419,17 @@ declare class MoostHttp implements TMoostAdapter<THttpHandlerMeta> {
418
419
  * Returns `null` when no route matches the request.
419
420
  */
420
421
  request(input: string | URL | Request, init?: RequestInit): Promise<Response | null>;
422
+ /**
423
+ * Runs `fn` inside an HTTP event context seeded from a real `(req, res)` pair,
424
+ * without route dispatch. Nested `fetch()`/`request()` calls made during `fn`
425
+ * see this context as their caller, so `forwardHeaders` and parent `Set-Cookie`
426
+ * propagation apply. Never writes to `res` — apply buffered response state
427
+ * (e.g. `response.getSetCookieStrings()`) yourself.
428
+ */
429
+ withHttpContext<T>(req: IncomingMessage, res: ServerResponse, fn: () => T): Promise<{
430
+ result: Awaited<T>;
431
+ response: _wooksjs_event_http.HttpResponse;
432
+ }>;
421
433
  listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): Promise<void>;
422
434
  listen(port?: number, hostname?: string, listeningListener?: () => void): Promise<void>;
423
435
  listen(port?: number, backlog?: number, listeningListener?: () => void): Promise<void>;
package/dist/index.mjs CHANGED
@@ -590,6 +590,15 @@ const LOGGER_TITLE = "moost-http";
590
590
  */ request(input, init) {
591
591
  return this.httpApp.request(input, init);
592
592
  }
593
+ /**
594
+ * Runs `fn` inside an HTTP event context seeded from a real `(req, res)` pair,
595
+ * without route dispatch. Nested `fetch()`/`request()` calls made during `fn`
596
+ * see this context as their caller, so `forwardHeaders` and parent `Set-Cookie`
597
+ * propagation apply. Never writes to `res` — apply buffered response state
598
+ * (e.g. `response.getSetCookieStrings()`) yourself.
599
+ */ withHttpContext(req, res, fn) {
600
+ return this.httpApp.withHttpContext(req, res, fn);
601
+ }
593
602
  listen(port, hostname, backlog, listeningListener) {
594
603
  return this.httpApp.listen(port, hostname, backlog, listeningListener);
595
604
  }
@@ -664,7 +673,7 @@ const LOGGER_TITLE = "moost-http";
664
673
  image: "https://moost.org/moost-full-logo.svg",
665
674
  link: "https://moost.org/",
666
675
  poweredBy: "moostjs",
667
- version: "0.6.30"
676
+ version: "0.6.31"
668
677
  });
669
678
  if (httpApp && httpApp instanceof WooksHttp) this.httpApp = httpApp;
670
679
  else if (httpApp) this.httpApp = createHttpApp({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moostjs/event-http",
3
- "version": "0.6.30",
3
+ "version": "0.6.31",
4
4
  "description": "@moostjs/event-http",
5
5
  "keywords": [
6
6
  "composables",
@@ -38,16 +38,16 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@wooksjs/event-http": "^0.7.19",
42
- "@wooksjs/http-body": "^0.7.19"
41
+ "@wooksjs/event-http": "^0.7.20",
42
+ "@wooksjs/http-body": "^0.7.20"
43
43
  },
44
44
  "devDependencies": {
45
45
  "vitest": "3.2.4"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@prostojs/infact": "^0.4.1",
49
- "@wooksjs/event-core": "^0.7.19",
50
- "moost": "^0.6.30"
49
+ "@wooksjs/event-core": "^0.7.20",
50
+ "moost": "^0.6.31"
51
51
  },
52
52
  "scripts": {
53
53
  "pub": "pnpm publish --access public",