@webpieces/http-server 0.4.389 → 0.4.390

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/http-server",
3
- "version": "0.4.389",
3
+ "version": "0.4.390",
4
4
  "description": "WebPieces server with filter chain and dependency injection",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -22,10 +22,10 @@
22
22
  "access": "public"
23
23
  },
24
24
  "dependencies": {
25
- "@webpieces/core-context": "0.4.389",
26
- "@webpieces/core-util": "0.4.389",
27
- "@webpieces/gcp-identity": "0.4.389",
28
- "@webpieces/http-routing": "0.4.389",
25
+ "@webpieces/core-context": "0.4.390",
26
+ "@webpieces/core-util": "0.4.390",
27
+ "@webpieces/gcp-identity": "0.4.390",
28
+ "@webpieces/http-routing": "0.4.390",
29
29
  "cors": "2.8.5",
30
30
  "express": "5.1.0",
31
31
  "inversify": "7.10.4"
@@ -32,9 +32,13 @@ let LogApiFilter = class LogApiFilter extends http_routing_2.Filter {
32
32
  return wpResponse.response;
33
33
  };
34
34
  // LogApiCall is a singleton (use it directly, no `new`). It logs the text lines AND stamps the
35
- // structured `api={side:'server',...}` tag into RequestContext, so every log line during the
36
- // request carries jsonPayload.api. Correlation fields (requestId, ...) are added by the backend.
37
- const response = await core_util_2.LogApiCall.execute('server', meta.routeMeta, meta.requestDto, method);
35
+ // structured `api={method:{side:'server',...},...}` tag into RequestContext, so every log line
36
+ // during the request carries jsonPayload.api. Correlation fields (requestId, ...) are added by
37
+ // the backend. apiClass is the CONTRACT name (routeMeta.apiName, e.g. 'SaveApi') so a server log
38
+ // line MATCHES the client's for the same call; controllerName keeps the impl (e.g. 'SaveController').
39
+ const rm = meta.routeMeta;
40
+ const info = new core_util_2.ApiMethodInfo('server', rm.apiName ?? rm.controllerClassName ?? 'Unknown', rm.methodName, rm.controllerClassName);
41
+ const response = await core_util_2.LogApiCall.execute(info, meta.requestDto, method);
38
42
  return new http_routing_2.WpResponse(response);
39
43
  }
40
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"LogApiFilter.js","sourceRoot":"","sources":["../../../../../../packages/http/http-server/src/filters/LogApiFilter.ts"],"names":[],"mappings":";;;;AAAA,yCAAuC;AACvC,0DAA8E;AAC9E,0DAAsE;AACtE,oDAAkD;AAClD,oDAAkD;AAElD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,GAAG,GAAG,sBAAU,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;AAI1C,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,qBAAuC;IAErE,KAAK,CAAC,MAAM,CACR,IAAgB,EAChB,UAAoD;QAEpD,+DAA+D;QAC/D,MAAM,MAAM,GAAG,KAAK,IAAsB,EAAE;YACxC,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACjD,OAAO,UAAU,CAAC,QAAQ,CAAC;QAC/B,CAAC,CAAC;QAEF,+FAA+F;QAC/F,6FAA6F;QAC7F,iGAAiG;QACjG,MAAM,QAAQ,GAAG,MAAM,sBAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAC7F,OAAO,IAAI,yBAAU,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;CACJ,CAAA;AAlBY,oCAAY;uBAAZ,YAAY;IAFxB,IAAA,wCAAyB,GAAE;IAC3B,IAAA,sBAAU,GAAE;GACA,YAAY,CAkBxB","sourcesContent":["import { injectable } from 'inversify';\nimport {provideFrameworkSingleton, MethodMeta} from '@webpieces/http-routing';\nimport { Filter, WpResponse, Service } from '@webpieces/http-routing';\nimport { LogManager } from '@webpieces/core-util';\nimport { LogApiCall } from '@webpieces/core-util';\n\n/**\n * LogApiFilter - Structured API logging for all requests/responses.\n * Priority: 1800 (after ContextFilter at 2000, before custom filters)\n *\n * Logging patterns (via LogApiCall):\n * - [API-server-req] Class.method /url request={...}\n * - [API-server-resp-SUCCESS] Class.method response={...}\n * - [API-server-resp-FAIL] Class.method error=... (server errors: 500, 502, 504)\n * - [API-server-resp-OTHER] Class.method errorType=... (user errors: 400, 401, 403, 404, 266)\n *\n * Headers are read from RequestContext (NOT from meta.requestHeaders which is undefined\n * after ContextFilter runs at priority 2000).\n *\n * User errors (HttpBadRequestError, etc.) are logged as OTHER, not FAIL,\n * because they are expected behavior from the server's perspective.\n */\nconst log = LogManager.getLogger('LogApiFilter');\n\n@provideFrameworkSingleton()\n@injectable()\nexport class LogApiFilter extends Filter<MethodMeta, WpResponse<unknown>> {\n\n async filter(\n meta: MethodMeta,\n nextFilter: Service<MethodMeta, WpResponse<unknown>>,\n ): Promise<WpResponse<unknown>> {\n // Wrap nextFilter.invoke in a method that returns the response\n const method = async (): Promise<unknown> => {\n const wpResponse = await nextFilter.invoke(meta);\n return wpResponse.response;\n };\n\n // LogApiCall is a singleton (use it directly, no `new`). It logs the text lines AND stamps the\n // structured `api={side:'server',...}` tag into RequestContext, so every log line during the\n // request carries jsonPayload.api. Correlation fields (requestId, ...) are added by the backend.\n const response = await LogApiCall.execute('server', meta.routeMeta, meta.requestDto, method);\n return new WpResponse(response);\n }\n}\n"]}
1
+ {"version":3,"file":"LogApiFilter.js","sourceRoot":"","sources":["../../../../../../packages/http/http-server/src/filters/LogApiFilter.ts"],"names":[],"mappings":";;;;AAAA,yCAAuC;AACvC,0DAA8E;AAC9E,0DAAsE;AACtE,oDAAkD;AAClD,oDAAiE;AAEjE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,GAAG,GAAG,sBAAU,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;AAI1C,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,qBAAuC;IAErE,KAAK,CAAC,MAAM,CACR,IAAgB,EAChB,UAAoD;QAEpD,+DAA+D;QAC/D,MAAM,MAAM,GAAG,KAAK,IAAsB,EAAE;YACxC,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACjD,OAAO,UAAU,CAAC,QAAQ,CAAC;QAC/B,CAAC,CAAC;QAEF,+FAA+F;QAC/F,+FAA+F;QAC/F,+FAA+F;QAC/F,iGAAiG;QACjG,sGAAsG;QACtG,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;QAC1B,MAAM,IAAI,GAAG,IAAI,yBAAa,CAC1B,QAAQ,EACR,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC,mBAAmB,IAAI,SAAS,EACjD,EAAE,CAAC,UAAU,EACb,EAAE,CAAC,mBAAmB,CACzB,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,sBAAU,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACzE,OAAO,IAAI,yBAAU,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;CACJ,CAAA;AA3BY,oCAAY;uBAAZ,YAAY;IAFxB,IAAA,wCAAyB,GAAE;IAC3B,IAAA,sBAAU,GAAE;GACA,YAAY,CA2BxB","sourcesContent":["import { injectable } from 'inversify';\nimport {provideFrameworkSingleton, MethodMeta} from '@webpieces/http-routing';\nimport { Filter, WpResponse, Service } from '@webpieces/http-routing';\nimport { LogManager } from '@webpieces/core-util';\nimport { LogApiCall, ApiMethodInfo } from '@webpieces/core-util';\n\n/**\n * LogApiFilter - Structured API logging for all requests/responses.\n * Priority: 1800 (after ContextFilter at 2000, before custom filters)\n *\n * Logging patterns (via LogApiCall):\n * - [API-server-req] Class.method /url request={...}\n * - [API-server-resp-SUCCESS] Class.method response={...}\n * - [API-server-resp-FAIL] Class.method error=... (server errors: 500, 502, 504)\n * - [API-server-resp-OTHER] Class.method errorType=... (user errors: 400, 401, 403, 404, 266)\n *\n * Headers are read from RequestContext (NOT from meta.requestHeaders which is undefined\n * after ContextFilter runs at priority 2000).\n *\n * User errors (HttpBadRequestError, etc.) are logged as OTHER, not FAIL,\n * because they are expected behavior from the server's perspective.\n */\nconst log = LogManager.getLogger('LogApiFilter');\n\n@provideFrameworkSingleton()\n@injectable()\nexport class LogApiFilter extends Filter<MethodMeta, WpResponse<unknown>> {\n\n async filter(\n meta: MethodMeta,\n nextFilter: Service<MethodMeta, WpResponse<unknown>>,\n ): Promise<WpResponse<unknown>> {\n // Wrap nextFilter.invoke in a method that returns the response\n const method = async (): Promise<unknown> => {\n const wpResponse = await nextFilter.invoke(meta);\n return wpResponse.response;\n };\n\n // LogApiCall is a singleton (use it directly, no `new`). It logs the text lines AND stamps the\n // structured `api={method:{side:'server',...},...}` tag into RequestContext, so every log line\n // during the request carries jsonPayload.api. Correlation fields (requestId, ...) are added by\n // the backend. apiClass is the CONTRACT name (routeMeta.apiName, e.g. 'SaveApi') so a server log\n // line MATCHES the client's for the same call; controllerName keeps the impl (e.g. 'SaveController').\n const rm = meta.routeMeta;\n const info = new ApiMethodInfo(\n 'server',\n rm.apiName ?? rm.controllerClassName ?? 'Unknown',\n rm.methodName,\n rm.controllerClassName,\n );\n const response = await LogApiCall.execute(info, meta.requestDto, method);\n return new WpResponse(response);\n }\n}\n"]}
@@ -1,13 +0,0 @@
1
- import { ContextKey } from '@webpieces/core-util';
2
- /**
3
- * Framework-level context keys for non-HTTP values stored in RequestContext.
4
- *
5
- * These are set by ContextFilter and can be read by downstream filters/controllers.
6
- * They have no httpHeader (never transferred) and isLogged=false (they hold objects
7
- * / internal values that must not be serialized into log lines).
8
- */
9
- export declare class ContextKeys {
10
- static readonly METHOD_META: ContextKey;
11
- static readonly REQUEST_PATH: ContextKey;
12
- static readonly HTTP_METHOD: ContextKey;
13
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContextKeys = void 0;
4
- const core_util_1 = require("@webpieces/core-util");
5
- /**
6
- * Framework-level context keys for non-HTTP values stored in RequestContext.
7
- *
8
- * These are set by ContextFilter and can be read by downstream filters/controllers.
9
- * They have no httpHeader (never transferred) and isLogged=false (they hold objects
10
- * / internal values that must not be serialized into log lines).
11
- */
12
- class ContextKeys {
13
- static METHOD_META = new core_util_1.ContextKey('webpieces:method-meta', undefined, false, /*isLogged*/ false);
14
- static REQUEST_PATH = new core_util_1.ContextKey('webpieces:request-path', undefined, false, /*isLogged*/ false);
15
- static HTTP_METHOD = new core_util_1.ContextKey('webpieces:http-method', undefined, false, /*isLogged*/ false);
16
- }
17
- exports.ContextKeys = ContextKeys;
18
- //# sourceMappingURL=ContextKeys.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContextKeys.js","sourceRoot":"","sources":["../../../../../../packages/http/http-server/src/headers/ContextKeys.ts"],"names":[],"mappings":";;;AAAA,oDAAkD;AAElD;;;;;;GAMG;AACH,MAAa,WAAW;IACpB,MAAM,CAAU,WAAW,GAAG,IAAI,sBAAU,CAAC,uBAAuB,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IAC5G,MAAM,CAAU,YAAY,GAAG,IAAI,sBAAU,CAAC,wBAAwB,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IAC9G,MAAM,CAAU,WAAW,GAAG,IAAI,sBAAU,CAAC,uBAAuB,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;;AAHhH,kCAIC","sourcesContent":["import { ContextKey } from '@webpieces/core-util';\n\n/**\n * Framework-level context keys for non-HTTP values stored in RequestContext.\n *\n * These are set by ContextFilter and can be read by downstream filters/controllers.\n * They have no httpHeader (never transferred) and isLogged=false (they hold objects\n * / internal values that must not be serialized into log lines).\n */\nexport class ContextKeys {\n static readonly METHOD_META = new ContextKey('webpieces:method-meta', undefined, false, /*isLogged*/ false);\n static readonly REQUEST_PATH = new ContextKey('webpieces:request-path', undefined, false, /*isLogged*/ false);\n static readonly HTTP_METHOD = new ContextKey('webpieces:http-method', undefined, false, /*isLogged*/ false);\n}\n"]}