@webpieces/http-server 0.4.777 → 0.4.778

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.777",
3
+ "version": "0.4.778",
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.777",
26
- "@webpieces/core-util": "0.4.777",
27
- "@webpieces/gcp-identity": "0.4.777",
28
- "@webpieces/http-routing": "0.4.777",
25
+ "@webpieces/core-context": "0.4.778",
26
+ "@webpieces/core-util": "0.4.778",
27
+ "@webpieces/gcp-identity": "0.4.778",
28
+ "@webpieces/http-routing": "0.4.778",
29
29
  "cors": "2.8.5",
30
30
  "express": "5.1.0",
31
31
  "inversify": "7.10.4"
@@ -13,8 +13,13 @@ class ApiErrorHttpMapper {
13
13
  [403, 'Forbidden'],
14
14
  [404, 'Not Found'],
15
15
  [408, 'Request Timeout'],
16
+ [409, 'Conflict'],
17
+ [412, 'Precondition Failed'],
18
+ [415, 'Unsupported Media Type'],
19
+ [422, 'Unprocessable Content'],
16
20
  [429, 'Too Many Requests'],
17
21
  [500, 'Internal Server Error'],
22
+ [501, 'Not Implemented'],
18
23
  [502, 'Bad Gateway'],
19
24
  [503, 'Service Unavailable'],
20
25
  [504, 'Gateway Timeout'],
@@ -1 +1 @@
1
- {"version":3,"file":"ApiErrorHttpMapper.js","sourceRoot":"","sources":["../../../../../packages/http/http-server/src/ApiErrorHttpMapper.ts"],"names":[],"mappings":";;;AAAA,oDAS8B;AAE9B,MAAM,GAAG,GAAG,sBAAU,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;AAEvD,iEAAiE;AACjE,MAAa,kBAAkB;IACV,QAAQ,GAAG,IAAI,4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AgB,CAAC;IAC9D,CAAC;CACJ;AAvCD,gDAuCC","sourcesContent":["import {\n ApiDependencyBackoffError,\n ApiErrorBoundary,\n ApiErrorCodec,\n ApiErrorHttpStatus,\n HttpHeader,\n HttpResponseDto,\n HttpResponseStatus,\n LogManager,\n} from '@webpieces/core-util';\n\nconst log = LogManager.getLogger('ApiErrorHttpMapper');\n\n/** HTTP adapter for the transport-neutral API error taxonomy. */\nexport class ApiErrorHttpMapper {\n private readonly boundary = new ApiErrorBoundary(log);\n private readonly genericMessages: Map<number, string> = new Map<number, string>([\n [266, 'End User Error'],\n [400, 'Bad Request'],\n [401, 'Unauthorized'],\n [403, 'Forbidden'],\n [404, 'Not Found'],\n [408, 'Request Timeout'],\n [429, 'Too Many Requests'],\n [500, 'Internal Server Error'],\n [502, 'Bad Gateway'],\n [503, 'Service Unavailable'],\n [504, 'Gateway Timeout'],\n ]);\n\n /**\n * Unknown throws and caller-local failures become a concrete implementation failure at this\n * owning API boundary. ApiError itself has no fallback status mapping.\n */\n // webpieces-disable no-any-unknown -- thrown values are unknown until normalized at this boundary\n public toResponse(thrown: unknown): HttpResponseDto {\n const error = this.boundary.normalize(thrown);\n const status = ApiErrorHttpStatus.code(error);\n this.boundary.logOperatorDetail(error);\n const headers =\n error instanceof ApiDependencyBackoffError\n ? [new HttpHeader('retry-after', String(error.retryAfterSeconds))]\n : [];\n return new HttpResponseDto(\n new HttpResponseStatus(status, this.genericMessage(status)),\n headers,\n ApiErrorCodec.encode(error),\n );\n }\n\n public genericMessage(code: number): string {\n return this.genericMessages.get(code) ?? 'Request Failed';\n }\n}\n"]}
1
+ {"version":3,"file":"ApiErrorHttpMapper.js","sourceRoot":"","sources":["../../../../../packages/http/http-server/src/ApiErrorHttpMapper.ts"],"names":[],"mappings":";;;AAAA,oDAS8B;AAE9B,MAAM,GAAG,GAAG,sBAAU,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;AAEvD,iEAAiE;AACjE,MAAa,kBAAkB;IACV,QAA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CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,EAC3D,OAAO,EACP,yBAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAC9B,CAAC;IACN,CAAC;IAEM,cAAc,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,gBAAgB,CAAC;IAC9D,CAAC;CACJ;AA5CD,gDA4CC","sourcesContent":["import {\n ApiDependencyBackoffError,\n ApiErrorBoundary,\n ApiErrorCodec,\n ApiErrorHttpStatus,\n HttpHeader,\n HttpResponseDto,\n HttpResponseStatus,\n LogManager,\n} from '@webpieces/core-util';\n\nconst log = LogManager.getLogger('ApiErrorHttpMapper');\n\n/** HTTP adapter for the transport-neutral API error taxonomy. */\nexport class ApiErrorHttpMapper {\n private readonly boundary = new ApiErrorBoundary(log);\n private readonly genericMessages: Map<number, string> = new Map<number, string>([\n [266, 'End User Error'],\n [400, 'Bad Request'],\n [401, 'Unauthorized'],\n [403, 'Forbidden'],\n [404, 'Not Found'],\n [408, 'Request Timeout'],\n [409, 'Conflict'],\n [412, 'Precondition Failed'],\n [415, 'Unsupported Media Type'],\n [422, 'Unprocessable Content'],\n [429, 'Too Many Requests'],\n [500, 'Internal Server Error'],\n [501, 'Not Implemented'],\n [502, 'Bad Gateway'],\n [503, 'Service Unavailable'],\n [504, 'Gateway Timeout'],\n ]);\n\n /**\n * Unknown throws and caller-local failures become a concrete implementation failure at this\n * owning API boundary. ApiError itself has no fallback status mapping.\n */\n // webpieces-disable no-any-unknown -- thrown values are unknown until normalized at this boundary\n public toResponse(thrown: unknown): HttpResponseDto {\n const error = this.boundary.normalize(thrown);\n const status = ApiErrorHttpStatus.code(error);\n this.boundary.logOperatorDetail(error);\n const headers =\n error instanceof ApiDependencyBackoffError\n ? [new HttpHeader('retry-after', String(error.retryAfterSeconds))]\n : [];\n return new HttpResponseDto(\n new HttpResponseStatus(status, this.genericMessage(status)),\n headers,\n ApiErrorCodec.encode(error),\n );\n }\n\n public genericMessage(code: number): string {\n return this.genericMessages.get(code) ?? 'Request Failed';\n }\n}\n"]}