@moostjs/event-http 0.7.4 → 0.7.6

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
@@ -782,6 +782,7 @@ const LOGGER_TITLE = "moost-http";
782
782
  }
783
783
  onInit(moost$1) {
784
784
  this.moost = moost$1;
785
+ (0, moost.claimWooks)(moost$1, this.httpApp.getWooks(), this.name, { created: this.createdApp });
785
786
  }
786
787
  /**
787
788
  * Called by `Moost.dispose()` before any `@MoostDispose` hook runs: stops the
@@ -853,6 +854,7 @@ const LOGGER_TITLE = "moost-http";
853
854
  */ constructor(httpApp) {
854
855
  _define_property(this, "name", "http");
855
856
  _define_property(this, "httpApp", void 0);
857
+ /** No `WooksHttp` was passed in: the one created routes through the global Wooks. */ _define_property(this, "createdApp", void 0);
856
858
  _define_property(this, "pathBuilders", {});
857
859
  _define_property(this, "moost", void 0);
858
860
  _define_property(this, "notFoundHandler", void 0);
@@ -860,8 +862,9 @@ const LOGGER_TITLE = "moost-http";
860
862
  image: "https://moost.org/moost-full-logo.svg",
861
863
  link: "https://moost.org/",
862
864
  poweredBy: "moostjs",
863
- version: "0.7.4"
865
+ version: "0.7.6"
864
866
  });
867
+ this.createdApp = !(httpApp instanceof _wooksjs_event_http.WooksHttp);
865
868
  if (httpApp && httpApp instanceof _wooksjs_event_http.WooksHttp) this.httpApp = httpApp;
866
869
  else {
867
870
  const transform = httpApp?.transformErrorBody;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as moost from 'moost';
2
2
  import { TInterceptorPriority, TOvertakeFn, TInterceptorDef, TClassConstructor, TMoostAdapter, MOOST_ADAPTER_BRAND, TIsolatedSlot, EventContext, Moost, TConsoleBase, TMoostAdapterOptions } from 'moost';
3
3
  import * as _wooksjs_event_http from '@wooksjs/event-http';
4
4
  import { TCookieAttributes as TCookieAttributes$1, TCookieAttributesInput, THttpCompressionOptions, WooksHttp, TWooksHttpOptions, TFetchPeer } from '@wooksjs/event-http';
5
- export { DEFAULT_HTTP_STATUS, HttpError, TCacheControl, TCookieAttributesInput, TFetchPeer, TForwardedInfo, THttpCompressionEncoding, THttpCompressionOptions, THttpErrorBody, TPrerenderJsonOptions, TProxyHeaders, TSetCookieData, TTransformErrorBody, TTrustProxy, TTrustProxyFn, getDefaultHttpStatus, httpKind, isCompressibleType, prerenderJson, useAcceptLanguage, useHttpContext } from '@wooksjs/event-http';
5
+ export { DEFAULT_HTTP_STATUS, HttpError, TCacheControl, TCookieAttributesInput, TFetchPeer, TForwardedInfo, THttpCompressionEncoding, THttpCompressionOptions, THttpErrorBody, TPrerenderJsonOptions, TProxyHeaders, TSetCookieData, TTransformErrorBody, TTrustProxy, TTrustProxyCapped, TTrustProxyFn, getDefaultHttpStatus, httpKind, isCompressibleType, prerenderJson, useAcceptLanguage, useHttpContext } from '@wooksjs/event-http';
6
6
  import { IncomingMessage, ServerResponse } from 'http';
7
7
  import { Buffer } from 'buffer';
8
8
  import { ListenOptions } from 'net';
@@ -481,6 +481,8 @@ declare class MoostHttp implements TMoostAdapter<THttpHandlerMeta> {
481
481
  static readonly [MOOST_ADAPTER_BRAND] = "@moostjs/event-http/MoostHttp";
482
482
  readonly name = "http";
483
483
  protected httpApp: WooksHttp;
484
+ /** No `WooksHttp` was passed in: the one created routes through the global Wooks. */
485
+ private readonly createdApp;
484
486
  /**
485
487
  * @param httpApp - A `WooksHttp` to use as is, or the options of the one `MoostHttp` creates.
486
488
  * A created app translates error bodies (`translateErrorBody`, before your
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { current, eventTypeKey, key } from "@wooksjs/event-core";
2
2
  import { DEFAULT_HTTP_STATUS, HttpError, HttpError as HttpError$1, WooksHttp, WooksHttpResponse, createHttpApp, getDefaultHttpStatus, httpKind, httpKind as httpKind$1, isCompressibleType, prerenderJson, useAcceptLanguage, useAcceptLanguage as useAcceptLanguage$1, useAuthorization, useCookies, useHeaders, useHttpContext, useRequest, useResponse, useUrlParams } from "@wooksjs/event-http";
3
- import { Before, Intercept, Interceptor, MOOST_ADAPTER_BRAND, Overtake, Resolve, TInterceptorPriority, current as current$1, defineBeforeInterceptor, defineMoostEventHandler, forkEventContext, getMoostMate, getTranslatorLocales, globalKey, run, translateErrorBody, useLogger } from "moost";
3
+ import { Before, Intercept, Interceptor, MOOST_ADAPTER_BRAND, Overtake, Resolve, TInterceptorPriority, claimWooks, current as current$1, defineBeforeInterceptor, defineMoostEventHandler, forkEventContext, getMoostMate, getTranslatorLocales, globalKey, run, translateErrorBody, useLogger } from "moost";
4
4
  import { seedBody, useBody } from "@wooksjs/http-body";
5
5
  import { createProvideRegistry } from "@prostojs/infact";
6
6
  import { Server } from "http";
@@ -781,6 +781,7 @@ const LOGGER_TITLE = "moost-http";
781
781
  }
782
782
  onInit(moost) {
783
783
  this.moost = moost;
784
+ claimWooks(moost, this.httpApp.getWooks(), this.name, { created: this.createdApp });
784
785
  }
785
786
  /**
786
787
  * Called by `Moost.dispose()` before any `@MoostDispose` hook runs: stops the
@@ -852,6 +853,7 @@ const LOGGER_TITLE = "moost-http";
852
853
  */ constructor(httpApp) {
853
854
  _define_property(this, "name", "http");
854
855
  _define_property(this, "httpApp", void 0);
856
+ /** No `WooksHttp` was passed in: the one created routes through the global Wooks. */ _define_property(this, "createdApp", void 0);
855
857
  _define_property(this, "pathBuilders", {});
856
858
  _define_property(this, "moost", void 0);
857
859
  _define_property(this, "notFoundHandler", void 0);
@@ -859,8 +861,9 @@ const LOGGER_TITLE = "moost-http";
859
861
  image: "https://moost.org/moost-full-logo.svg",
860
862
  link: "https://moost.org/",
861
863
  poweredBy: "moostjs",
862
- version: "0.7.4"
864
+ version: "0.7.6"
863
865
  });
866
+ this.createdApp = !(httpApp instanceof WooksHttp);
864
867
  if (httpApp && httpApp instanceof WooksHttp) this.httpApp = httpApp;
865
868
  else {
866
869
  const transform = httpApp?.transformErrorBody;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moostjs/event-http",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "description": "@moostjs/event-http",
5
5
  "keywords": [
6
6
  "composables",
@@ -38,17 +38,17 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@wooksjs/event-http": "^0.8.1",
42
- "@wooksjs/http-body": "^0.8.1"
41
+ "@wooksjs/event-http": "^0.8.3",
42
+ "@wooksjs/http-body": "^0.8.3"
43
43
  },
44
44
  "devDependencies": {
45
45
  "vitest": "4.1.12",
46
- "@moostjs/event-wf": "^0.7.4"
46
+ "@moostjs/event-wf": "^0.7.6"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@prostojs/infact": "^0.6.1",
50
- "@wooksjs/event-core": "^0.8.1",
51
- "moost": "^0.7.4"
50
+ "@wooksjs/event-core": "^0.8.3",
51
+ "moost": "^0.7.6"
52
52
  },
53
53
  "scripts": {
54
54
  "pub": "pnpm publish --access public",