@dooboostore/simple-boot-http-server 1.0.24 → 1.0.25

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.
Files changed (164) hide show
  1. package/README.md +113 -0
  2. package/dist/cjs/SimpleBootHttpServer.js +2 -2
  3. package/dist/cjs/SimpleBootHttpServer.js.map +1 -1
  4. package/dist/cjs/decorators/MethodMapping.js +33 -3
  5. package/dist/cjs/decorators/MethodMapping.js.map +2 -2
  6. package/dist/cjs/errors/BadRequestError.js +2 -1
  7. package/dist/cjs/errors/BadRequestError.js.map +2 -2
  8. package/dist/cjs/errors/ForbiddenError.js +2 -1
  9. package/dist/cjs/errors/ForbiddenError.js.map +2 -2
  10. package/dist/cjs/errors/InternalServerError.js +2 -1
  11. package/dist/cjs/errors/InternalServerError.js.map +2 -2
  12. package/dist/cjs/errors/NotFoundError.js +2 -1
  13. package/dist/cjs/errors/NotFoundError.js.map +2 -2
  14. package/dist/cjs/errors/UnauthorizedError.js +2 -1
  15. package/dist/cjs/errors/UnauthorizedError.js.map +2 -2
  16. package/dist/cjs/filters/IntentSchemeFilter.js +1 -2
  17. package/dist/cjs/filters/IntentSchemeFilter.js.map +2 -2
  18. package/dist/cjs/filters/ResourceFilter.js +3 -2
  19. package/dist/cjs/filters/ResourceFilter.js.map +2 -2
  20. package/dist/cjs/filters/index.js +3 -1
  21. package/dist/cjs/filters/index.js.map +2 -2
  22. package/dist/cjs/index.js +2 -0
  23. package/dist/cjs/index.js.map +2 -2
  24. package/dist/cjs/inject/InjectSituationType.js +1 -1
  25. package/dist/cjs/inject/InjectSituationType.js.map +2 -2
  26. package/dist/cjs/models/RequestResponse.js +19 -2
  27. package/dist/cjs/models/RequestResponse.js.map +2 -2
  28. package/dist/cjs/models/datas/body/index.js +28 -0
  29. package/dist/cjs/models/datas/body/index.js.map +7 -0
  30. package/dist/cjs/models/datas/index.js +32 -0
  31. package/dist/cjs/models/datas/index.js.map +7 -0
  32. package/dist/cjs/models/datas/{body → path}/ReqPathData.js.map +1 -1
  33. package/dist/cjs/models/datas/{search → path}/ReqSearchParamsObj.js.map +1 -1
  34. package/dist/cjs/models/datas/path/index.js +24 -0
  35. package/dist/cjs/models/datas/path/index.js.map +7 -0
  36. package/dist/cjs/models/index.js +4 -16
  37. package/dist/cjs/models/index.js.map +2 -2
  38. package/dist/cjs/models/method/index.js +22 -0
  39. package/dist/cjs/models/method/index.js.map +7 -0
  40. package/dist/cjs/models/method/patch/index.js +22 -0
  41. package/dist/cjs/models/method/patch/index.js.map +7 -0
  42. package/dist/cjs/proxy/SymbolIntentApiServiceProxy.js +98 -95
  43. package/dist/cjs/proxy/SymbolIntentApiServiceProxy.js.map +3 -3
  44. package/dist/cjs/proxy/SymbolIntentApiServiceProxyBase.js +1 -1
  45. package/dist/cjs/proxy/SymbolIntentApiServiceProxyBase.js.map +2 -2
  46. package/dist/esm/SimpleBootHttpServer.js +2 -2
  47. package/dist/esm/SimpleBootHttpServer.js.map +1 -1
  48. package/dist/esm/decorators/MethodMapping.js +22 -2
  49. package/dist/esm/decorators/MethodMapping.js.map +2 -2
  50. package/dist/esm/errors/BadRequestError.js +2 -1
  51. package/dist/esm/errors/BadRequestError.js.map +2 -2
  52. package/dist/esm/errors/ForbiddenError.js +2 -1
  53. package/dist/esm/errors/ForbiddenError.js.map +2 -2
  54. package/dist/esm/errors/InternalServerError.js +2 -1
  55. package/dist/esm/errors/InternalServerError.js.map +2 -2
  56. package/dist/esm/errors/NotFoundError.js +2 -1
  57. package/dist/esm/errors/NotFoundError.js.map +2 -2
  58. package/dist/esm/errors/UnauthorizedError.js +2 -1
  59. package/dist/esm/errors/UnauthorizedError.js.map +2 -2
  60. package/dist/esm/filters/IntentSchemeFilter.js +2 -3
  61. package/dist/esm/filters/IntentSchemeFilter.js.map +2 -2
  62. package/dist/esm/filters/ResourceFilter.js +3 -2
  63. package/dist/esm/filters/ResourceFilter.js.map +2 -2
  64. package/dist/esm/filters/index.js +1 -0
  65. package/dist/esm/filters/index.js.map +2 -2
  66. package/dist/esm/index.js +1 -0
  67. package/dist/esm/index.js.map +2 -2
  68. package/dist/esm/inject/InjectSituationType.js +1 -1
  69. package/dist/esm/inject/InjectSituationType.js.map +2 -2
  70. package/dist/esm/models/RequestResponse.js +19 -2
  71. package/dist/esm/models/RequestResponse.js.map +2 -2
  72. package/dist/esm/models/datas/body/index.js +5 -0
  73. package/dist/esm/models/datas/body/index.js.map +7 -0
  74. package/dist/esm/models/datas/index.js +7 -0
  75. package/dist/esm/models/datas/index.js.map +7 -0
  76. package/dist/esm/models/datas/{body → path}/ReqPathData.js.map +1 -1
  77. package/dist/esm/models/datas/{search → path}/ReqSearchParamsObj.js.map +1 -1
  78. package/dist/esm/models/datas/path/index.js +3 -0
  79. package/dist/esm/models/datas/path/index.js.map +7 -0
  80. package/dist/esm/models/index.js +2 -8
  81. package/dist/esm/models/index.js.map +2 -2
  82. package/dist/esm/models/method/index.js +2 -0
  83. package/dist/esm/models/method/index.js.map +7 -0
  84. package/dist/esm/models/method/patch/index.js +2 -0
  85. package/dist/esm/models/method/patch/index.js.map +7 -0
  86. package/dist/esm/proxy/SymbolIntentApiServiceProxy.js +98 -95
  87. package/dist/esm/proxy/SymbolIntentApiServiceProxy.js.map +3 -3
  88. package/dist/esm/proxy/SymbolIntentApiServiceProxyBase.js +2 -2
  89. package/dist/esm/proxy/SymbolIntentApiServiceProxyBase.js.map +2 -2
  90. package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js +5580 -974
  91. package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js.map +4 -4
  92. package/dist/types/SimpleBootHttpServer.d.ts +1 -1
  93. package/dist/types/decorators/MethodMapping.d.ts +10 -0
  94. package/dist/types/decorators/MethodMapping.d.ts.map +1 -1
  95. package/dist/types/errors/BadRequestError.d.ts +2 -2
  96. package/dist/types/errors/BadRequestError.d.ts.map +1 -1
  97. package/dist/types/errors/ForbiddenError.d.ts +2 -2
  98. package/dist/types/errors/ForbiddenError.d.ts.map +1 -1
  99. package/dist/types/errors/InternalServerError.d.ts +2 -2
  100. package/dist/types/errors/InternalServerError.d.ts.map +1 -1
  101. package/dist/types/errors/NotFoundError.d.ts +2 -2
  102. package/dist/types/errors/NotFoundError.d.ts.map +1 -1
  103. package/dist/types/errors/UnauthorizedError.d.ts +2 -2
  104. package/dist/types/errors/UnauthorizedError.d.ts.map +1 -1
  105. package/dist/types/filters/ResourceFilter.d.ts.map +1 -1
  106. package/dist/types/filters/index.d.ts +1 -0
  107. package/dist/types/filters/index.d.ts.map +1 -1
  108. package/dist/types/index.d.ts +1 -0
  109. package/dist/types/index.d.ts.map +1 -1
  110. package/dist/types/inject/InjectSituationType.d.ts.map +1 -1
  111. package/dist/types/models/RequestResponse.d.ts +3 -1
  112. package/dist/types/models/RequestResponse.d.ts.map +1 -1
  113. package/dist/types/models/datas/body/index.d.ts +5 -0
  114. package/dist/types/models/datas/body/index.d.ts.map +1 -0
  115. package/dist/types/models/datas/index.d.ts +7 -0
  116. package/dist/types/models/datas/index.d.ts.map +1 -0
  117. package/dist/types/models/datas/{body → path}/ReqPathData.d.ts.map +1 -1
  118. package/dist/types/models/datas/path/ReqSearchParamsObj.d.ts.map +1 -0
  119. package/dist/types/models/datas/path/index.d.ts +3 -0
  120. package/dist/types/models/datas/path/index.d.ts.map +1 -0
  121. package/dist/types/models/index.d.ts +2 -8
  122. package/dist/types/models/index.d.ts.map +1 -1
  123. package/dist/types/models/method/index.d.ts +2 -0
  124. package/dist/types/models/method/index.d.ts.map +1 -0
  125. package/dist/types/models/method/patch/index.d.ts +2 -0
  126. package/dist/types/models/method/patch/index.d.ts.map +1 -0
  127. package/dist/types/proxy/SymbolIntentApiServiceProxy.d.ts +6 -8
  128. package/dist/types/proxy/SymbolIntentApiServiceProxy.d.ts.map +1 -1
  129. package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js +5583 -977
  130. package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js.map +4 -4
  131. package/dist/umd-bundle/websocket-client.umd.js +182 -2
  132. package/dist/umd-bundle/websocket-client.umd.js.map +4 -4
  133. package/package.json +6 -6
  134. package/src/SimpleBootHttpServer.ts +4 -4
  135. package/src/decorators/MethodMapping.ts +13 -1
  136. package/src/errors/BadRequestError.ts +7 -3
  137. package/src/errors/ForbiddenError.ts +7 -3
  138. package/src/errors/InternalServerError.ts +7 -3
  139. package/src/errors/NotFoundError.ts +7 -3
  140. package/src/errors/UnauthorizedError.ts +7 -3
  141. package/src/filters/IntentSchemeFilter.ts +2 -2
  142. package/src/filters/ResourceFilter.ts +5 -2
  143. package/src/filters/index.ts +1 -0
  144. package/src/index.ts +1 -0
  145. package/src/inject/InjectSituationType.ts +1 -1
  146. package/src/models/RequestResponse.ts +28 -2
  147. package/src/models/datas/body/index.ts +4 -0
  148. package/src/models/datas/index.ts +6 -0
  149. package/src/models/datas/path/index.ts +2 -0
  150. package/src/models/index.ts +2 -8
  151. package/src/models/method/index.ts +1 -0
  152. package/src/models/method/patch/index.ts +1 -0
  153. package/src/proxy/SymbolIntentApiServiceProxy.ts +103 -97
  154. package/src/proxy/SymbolIntentApiServiceProxyBase.ts +2 -2
  155. package/README.MD +0 -62
  156. package/dist/types/models/datas/search/ReqSearchParamsObj.d.ts.map +0 -1
  157. /package/dist/cjs/models/datas/{body → path}/ReqPathData.js +0 -0
  158. /package/dist/cjs/models/datas/{search → path}/ReqSearchParamsObj.js +0 -0
  159. /package/dist/esm/models/datas/{body → path}/ReqPathData.js +0 -0
  160. /package/dist/esm/models/datas/{search → path}/ReqSearchParamsObj.js +0 -0
  161. /package/dist/types/models/datas/{body → path}/ReqPathData.d.ts +0 -0
  162. /package/dist/types/models/datas/{search → path}/ReqSearchParamsObj.d.ts +0 -0
  163. /package/src/models/datas/{body → path}/ReqPathData.ts +0 -0
  164. /package/src/models/datas/{search → path}/ReqSearchParamsObj.ts +0 -0
package/README.md ADDED
@@ -0,0 +1,113 @@
1
+ # @dooboostore/simple-boot-http-server
2
+
3
+ [![NPM version](https://img.shields.io/npm/v/@dooboostore/simple-boot-http-server.svg?color=cb3837&style=flat-square)](https://www.npmjs.com/package/@dooboostore/simple-boot-http-server)
4
+ [![Build and Test](https://github.com/dooboostore-develop/packages/actions/workflows/main.yaml/badge.svg?branch=main)](https://github.com/dooboostore-develop/packages/actions/workflows/main.yaml)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
6
+
7
+ `@dooboostore/simple-boot-http-server` is a lightweight, high-performance HTTP web server framework for Node.js, built on top of `@dooboostore/simple-boot`. It provides a decorator-driven, declarative programming model that allows you to design complex backend architectures intuitively and robustly.
8
+
9
+ ---
10
+
11
+ ## 🚀 Key Features
12
+
13
+ - **Declarative Routing**: Map URL paths and HTTP methods directly to your controller methods using decorators like `@Router`, `@Route`, `@GET`, and `@POST`.
14
+ - **Dependency Injection (DI)**: Manage dependencies between services automatically using the `@Sim` decorator.
15
+ - **Middleware & Filters**: Systematically separate pre/post-processing logic (CORS, authentication, logging, etc.) through the `Filter` interface.
16
+ - **Powerful Exception Handling**: Leverage AOP-based `GlobalAdvice` to isolate business logic from error handling logic.
17
+ - **WebSocket Integration**: Includes a topic-based publish/subscribe model and automatic reconnection features.
18
+ - **Resource Resolvers**: Provides `ResourceResolver` for serving static files and templates effortlessly.
19
+
20
+ ---
21
+
22
+ ## 📦 Installation
23
+
24
+ ```bash
25
+ pnpm add @dooboostore/simple-boot-http-server reflect-metadata
26
+ ```
27
+
28
+ ---
29
+
30
+ ## 💻 Usage Example
31
+
32
+ ### 1. Define a Service (Dependency Injection)
33
+ Create a service that contains business logic using `@Sim`.
34
+
35
+ ```typescript
36
+ import { Sim } from '@dooboostore/simple-boot/decorators/SimDecorator';
37
+
38
+ @Sim
39
+ export class UserService {
40
+ private users = [{ id: 1, name: 'Dooboo' }];
41
+
42
+ getAllUsers() {
43
+ return this.users;
44
+ }
45
+ }
46
+ ```
47
+
48
+ ### 2. Configure Router and Controller
49
+ Define endpoints using decorators. Inject services through the constructor.
50
+
51
+ ```typescript
52
+ import { Sim } from '@dooboostore/simple-boot/decorators/SimDecorator';
53
+ import { Router, Route } from '@dooboostore/simple-boot/decorators/route/Router';
54
+ import { GET, POST } from '@dooboostore/simple-boot-http-server/decorators/MethodMapping';
55
+
56
+ @Sim
57
+ @Router({ path: '/api' })
58
+ export class ApiRouter {
59
+ constructor(private userService: UserService) {}
60
+
61
+ @Route({ path: '/users' })
62
+ @GET({ res: { contentType: 'application/json' } })
63
+ getUsers() {
64
+ return this.userService.getAllUsers();
65
+ }
66
+ }
67
+ ```
68
+
69
+ ### 3. Run the Server
70
+ Configure `HttpServerOption` and launch the server.
71
+
72
+ ```typescript
73
+ import 'reflect-metadata';
74
+ import { SimpleBootHttpServer } from '@dooboostore/simple-boot-http-server/SimpleBootHttpServer';
75
+ import { HttpServerOption } from '@dooboostore/simple-boot-http-server/option/HttpServerOption';
76
+
77
+ const option = new HttpServerOption(
78
+ { listen: { port: 8080 } },
79
+ { rootRouter: ApiRouter }
80
+ );
81
+
82
+ const server = new SimpleBootHttpServer(option).run();
83
+ console.log('🚀 Server running at http://localhost:8080');
84
+ ```
85
+
86
+ ---
87
+
88
+ ## 🛠️ Advanced Features
89
+
90
+ ### Filters
91
+ Implement the `Filter` interface to perform common request processing.
92
+
93
+ ```typescript
94
+ @Sim
95
+ export class MyAuthFilter implements Filter {
96
+ async onHandle(rr: RequestResponse): Promise<boolean> {
97
+ // Returning false stops the request execution.
98
+ return true;
99
+ }
100
+ }
101
+ ```
102
+
103
+ ---
104
+
105
+ ## 📖 Learn More
106
+ Check out the detailed guides and tutorials in the `document` folder.
107
+ - [WebSocket Detailed Guide](https://github.com/dooboostore-develop/packages/tree/main/simple-boot-http-server/document/websocket)
108
+ - [Project Template Generator](https://github.com/dooboostore-develop/packages/tree/main/simple-boot-http-server/create)
109
+
110
+ ---
111
+
112
+ ## License
113
+ [MIT License](LICENSE.md)
@@ -45,8 +45,8 @@ var import_simple_boot7 = require("@dooboostore/simple-boot");
45
45
  var import_url = require("url");
46
46
  var import_HttpMethod = require("./codes/HttpMethod");
47
47
  var import_SessionManager = require("./session/SessionManager");
48
- var import_ReqSearchParamsObj = require("./models/datas/search/ReqSearchParamsObj");
49
- var import_ReqPathData = require("./models/datas/body/ReqPathData");
48
+ var import_ReqSearchParamsObj = require("./models/datas/path/ReqSearchParamsObj");
49
+ var import_ReqPathData = require("./models/datas/path/ReqPathData");
50
50
  class SimpleBootHttpServer extends import_simple_boot.SimpleApplication {
51
51
  constructor(option = new import_HttpServerOption.HttpServerOption()) {
52
52
  super(option);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/SimpleBootHttpServer.ts"],
4
- "sourcesContent": ["import {SimpleApplication} from '@dooboostore/simple-boot';\nimport {HttpServerOption} from './option/HttpServerOption';\nimport {ConstructorType} from '@dooboostore/core';\nimport {IncomingMessage, Server as HttpServer, ServerResponse} from 'http'\nimport {Server as HttpsServer} from 'https'; // Add HTTPS support\nimport {WebSocketServer, WebSocket} from 'ws';\nimport {RequestResponse} from './models/RequestResponse';\nimport {getUrlMapping, getUrlMappings, SaveMappingConfig, UrlMappingSituationType} from './decorators/MethodMapping';\nimport {HttpStatus} from './codes/HttpStatus';\nimport {HttpHeaders} from './codes/HttpHeaders';\nimport {Mimes} from './codes/Mimes';\nimport {Filter} from './filters/Filter';\nimport {ExceptionHandlerSituationType, targetExceptionHandler} from '@dooboostore/simple-boot';\nimport {getInject, SituationTypeContainer, SituationTypeContainers} from '@dooboostore/simple-boot';\nimport {EndPoint} from './endpoints/EndPoint';\nimport {ReflectUtils} from '@dooboostore/core';\nimport {ReqFormUrlBody} from './models/datas/body/ReqFormUrlBody';\nimport {ReqJsonBody} from './models/datas/body/ReqJsonBody';\nimport {ReqHeader} from './models/datas/ReqHeader';\nimport {RouterModule} from '@dooboostore/simple-boot';\nimport {ReqMultipartFormBody} from './models/datas/body/ReqMultipartFormBody';\nimport {execValidationInValid, getValidIndex} from '@dooboostore/simple-boot';\nimport {ValidException} from '@dooboostore/simple-boot';\nimport {HttpError} from './errors/HttpError';\nimport {getRoute} from '@dooboostore/simple-boot';\nimport {OnInit} from './lifecycle/OnInit';\nimport {URLSearchParams} from 'url';\nimport {HttpMethod} from './codes/HttpMethod';\nimport {SessionManager} from './session/SessionManager';\nimport {InjectSituationType} from './inject/InjectSituationType';\nimport {ReqSearchParamsObj} from \"./models/datas/search/ReqSearchParamsObj\";\nimport {SimConfig} from '@dooboostore/simple-boot';\nimport {ReqPathData} from './models/datas/body/ReqPathData';\nimport {WebSocketEndPoint} from './endpoints/WebSocketEndPoint';\n\nexport class SimpleBootHttpServer extends SimpleApplication {\n public server?: HttpServer | HttpsServer;\n private sessionManager: SessionManager;\n private webSocketClients = new Map<WebSocket, { request: IncomingMessage }>();\n\n constructor(public option: HttpServerOption = new HttpServerOption()) {\n super(option);\n this.sessionManager = new SessionManager(this.option);\n }\n\n\n public run(otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | Symbol, any>) {\n otherInstanceSim ??= new Map<ConstructorType<any> | Function | SimConfig | Symbol, any>();\n otherInstanceSim.set(SimpleBootHttpServer, this);\n super.run(otherInstanceSim);\n const targets = [...this.option.closeEndPoints ?? [], ...this.option.errorEndPoints ?? [], ...this.option.requestEndPoints ?? [], ...this.option.filters ?? []];\n Promise.all(targets.map(it => (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it as ConstructorType<any>}) : it) as OnInit).map(it => it.onInit(this))).then(it => {\n this.startServer();\n });\n return this;\n }\n\n private startServer() {\n\n // const a = this.option.serverOption as HttpsServerOption;\n // this.option.serverOption?.\n\n if (this.option.serverOption && 'key' in this.option.serverOption && 'cert' in this.option.serverOption) {\n this.server = new HttpsServer(this.option.serverOption);\n const httpServer = new HttpServer();\n httpServer.on('request', (req: IncomingMessage, res: ServerResponse) => {\n res.writeHead(301, {Location: `https://${req.headers.host}${req.url}`});\n res.end();\n });\n httpServer.listen(80, this.option.listen.hostname, () => {\n console.log('HTTP redirect server running on port 80');\n });\n } else if (this.option.serverOption) {\n this.server = new HttpServer(this.option.serverOption);\n } else {\n this.server = new HttpServer();\n }\n // const thisRef = this;\n this.server.on('request', async (req: IncomingMessage, res: ServerResponse) => {\n // console.log('request', req.url);\n const transactionManager = this.option.transactionManagerFactory ? await this.option.transactionManagerFactory() : undefined;\n res.on('close', async () => {\n if (this.option.closeEndPoints) {\n for (const it of this.option.closeEndPoints) {\n try {\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it) as EndPoint;\n const endPoint = execute?.endPoint(rr, this);\n if (endPoint instanceof Promise) {\n await endPoint;\n }\n } catch (e) {\n }\n }\n }\n\n if (!rr.resIsDone()) {\n rr.resEnd();\n }\n });\n res.on('error', async () => {\n if (this.option.errorEndPoints) {\n for (const it of this.option.errorEndPoints) {\n try {\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it) as EndPoint;\n const endPoint = execute?.endPoint(rr, this);\n if (endPoint instanceof Promise) {\n await endPoint;\n }\n } catch (e) {\n }\n }\n }\n\n if (!rr.resIsDone()) {\n rr.resEnd();\n }\n });\n\n const rr = new RequestResponse(req, res, {sessionManager: this.sessionManager, option: this.option});\n /*\n default setting first\n */\n rr.resSetHeader(HttpHeaders.Server, 'simple-boot-http-server');\n const cookie = rr.reqCookieGet(this.option.sessionOption.key);\n if (!cookie) {\n const session = await this.sessionManager.session();\n\n const cookieParts: string[] = [];\n cookieParts.push(`${this.option.sessionOption.key}=${session.uuid}`);\n cookieParts.push(`Path=${this.option.sessionOption.path}`);\n if (this.option.sessionOption.httpOnly) cookieParts.push('HttpOnly');\n if (this.option.sessionOption.secure) cookieParts.push('Secure');\n if (this.option.sessionOption.sameSite != null && this.option.sessionOption.sameSite) cookieParts.push(`SameSite=${this.option.sessionOption.sameSite}`);\n const maxAge = (this.option.sessionOption as any).maxAge ?? (this.sessionManager.sessionOption)?.maxAge;\n if (maxAge != null) cookieParts.push(`Max-Age=${maxAge}`);\n rr.resSetHeader(HttpHeaders.SetCookie, cookieParts.join('; '));\n }\n\n const otherStorage = new Map<ConstructorType<any>, any>();\n otherStorage.set(RequestResponse, rr);\n otherStorage.set(IncomingMessage, req);\n otherStorage.set(ServerResponse, res);\n try {\n transactionManager?.try();\n if (this.option.requestEndPoints) {\n for (const it of this.option.requestEndPoints) {\n try {\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim<EndPoint>({target: it}) : it) as EndPoint;\n execute?.endPoint(rr, this);\n } catch (e) {\n }\n }\n }\n\n const filter = {\n carrier: new Map<string, any>(),\n filters: [] as { filter: Filter, sw: boolean }[]\n };\n for (let i = 0; this.option.filters && i < this.option.filters.length; i++) {\n const it = this.option.filters[i];\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it) as Filter;\n let sw = true;\n if (execute?.proceedBefore) {\n sw = await execute.proceedBefore({rr, app: this, carrier: filter.carrier});\n filter.filters.push({filter: execute, sw});\n }\n if (!sw) {\n break;\n }\n }\n\n // body.. something..\n if (!rr.resIsDone()) {\n const routerModule = await super.routing(rr.reqIntent);\n otherStorage.set(RouterModule, routerModule);\n const moduleInstance = routerModule?.getModuleInstance?.();\n let methods: SaveMappingConfig[] = [];\n if (routerModule && moduleInstance) {\n // router \uD074\uB798\uC2A4 \uB0B4\uBD80\uC5D0\uC11C \uC120\uC5B8\uB41C Route\uC77C\uB54C\n if (routerModule.propertyKeys) {\n const map = routerModule.propertyKeys?.map((it: string | symbol) => {\n return {propertyKey: it, config: getUrlMapping(moduleInstance, it)} as SaveMappingConfig\n });\n methods.push(...(map ?? []));\n } else {\n methods.push(...(getUrlMappings(moduleInstance).filter(it => !getRoute(moduleInstance, it.propertyKey)) ?? []));\n }\n\n // options\uB85C \uC694\uCCAD\uC624\uBA74\uC740 allow\uB85C \uB123\uACE0 \uADF8\uB0E5 200\uCC98\uB9AC\uD574\uC57C\uB428.\n if (rr.reqMethod()?.toUpperCase() === HttpMethod.OPTIONS.toUpperCase()) {\n rr.resSetHeader(HttpHeaders.Allow, methods.map(it => it.config.method).join(', '));\n rr.resStatusCode(HttpStatus.Ok);\n }\n\n // method \uCC3E\uAE30\n methods = methods.filter(it => it && it.propertyKey && it.config && rr.reqMethod()?.toUpperCase() === it.config.method.toUpperCase());\n methods.sort((a, b) => {\n return ((b.config?.req?.contentType?.length ?? 0) + (b.config?.req?.accept?.length ?? 0)) - ((a.config?.req?.contentType?.length ?? 0) + (a.config?.req?.accept?.length ?? 0));\n });\n methods = methods\n .filter(it => it.config?.req?.contentType ? (!!it.config?.req?.contentType?.find(sit => rr.reqHasContentTypeHeader(sit))) : true)\n .filter(it => it.config?.req?.accept ? (!!it.config?.req?.accept?.find(sit => rr.reqHasAcceptHeader(sit))) : true);\n\n if (methods[0]) {\n const it = methods[0];\n const paramTypes = ReflectUtils.getParameterTypes(moduleInstance, it.propertyKey)\n const injects = getInject(moduleInstance, it.propertyKey);\n const validIndexs = getValidIndex(moduleInstance, it.propertyKey);\n if (injects) {\n const isPathData = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_PATH_DATA);\n const isJson = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_JSON_BODY);\n const isSearchParamsObj = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_URL_SEARCH_PARAMS_OBJ);\n const isFormUrl = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_FORM_URL_BODY);\n // \uC6B0\uC120 \uB2E4\uC2DC \uC81C\uAC70\uD55C\uB2E4.. \uD2B8\uB79C\uC81D\uC158 \uC5B4\uB5BB\uAC8C \uD560\uC9C0 \uB2E4\uC2DC \uC0DD\uAC01\n // const isTransactionManager = injects.find(it => it.config?.situationType === InjectSituationType.TransactionManager);\n const siturationContainers = new SituationTypeContainers();\n if (isPathData) {\n let data = await routerModule.pathData\n if (isPathData.type) {\n data = Object.assign(new isPathData.type(), data);\n }\n if (validIndexs.includes(isPathData.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({\n situationType: UrlMappingSituationType.REQ_PATH_DATA,\n data\n }));\n }\n if (isJson) {\n let data = await rr.reqBodyJsonData();\n if (data !== null && isJson.type) {\n data = Object.assign(new isJson.type(), data);\n }\n if (validIndexs.includes(isJson.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({\n situationType: UrlMappingSituationType.REQ_JSON_BODY,\n data\n }));\n }\n if (isSearchParamsObj) {\n let data = rr.reqUrlSearchParamsObj\n if (validIndexs.includes(isSearchParamsObj.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({\n situationType: UrlMappingSituationType.REQ_URL_SEARCH_PARAMS_OBJ,\n data\n }));\n }\n if (isFormUrl) {\n let data = await rr.reqBodyFormUrlData()\n if (isFormUrl.type) {\n data = Object.assign(new isFormUrl.type(), data);\n }\n if (validIndexs.includes(isFormUrl.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({situationType: UrlMappingSituationType.REQ_FORM_URL_BODY, data}));\n }\n // \uD2B8\uB79C\uC81D\uC158 \uC6B0\uC120 \uC81C\uAC70 \uB098\uC911\uC5D0 \uC5B4\uB5BB\uAC8C \uAD6C\uD604\uD560\uC9C0 \uC0DD\uAC01..\n // if (isTransactionManager && isTransactionManager.type && transactionManager && transactionManager.hasTransaction(isTransactionManager.type)) {\n // let data = await transactionManager.getTransaction(isTransactionManager.type);\n // if (data) {\n // data = await data.try(isTransactionManager.config.argument);\n // siturationContainers.push(new SituationTypeContainer({situationType: InjectSituationType.TransactionManager, data, index: isTransactionManager.index}));\n // }\n // }\n if (siturationContainers.length) {\n otherStorage.set(SituationTypeContainers, siturationContainers);\n }\n }\n\n for (const paramType of paramTypes) {\n if (paramType === ReqFormUrlBody) {\n otherStorage.set(ReqFormUrlBody, await rr.reqBodyReqFormUrlBody())\n } else if (paramType === ReqPathData) {\n otherStorage.set(ReqPathData, routerModule.pathData)\n } else if (paramType === ReqJsonBody) {\n otherStorage.set(ReqJsonBody, await rr.reqBodyReqJsonBody())\n } else if (paramType === ReqSearchParamsObj) {\n otherStorage.set(ReqSearchParamsObj, rr.reqUrlSearchParamsObj)\n } else if (paramType === URLSearchParams) {\n otherStorage.set(URLSearchParams, rr.reqUrlSearchParams)\n } else if (paramType === ReqMultipartFormBody) {\n otherStorage.set(ReqMultipartFormBody, rr.reqBodyMultipartFormData())\n } else if (paramType === ReqHeader) {\n otherStorage.set(ReqHeader, rr.reqHeaderObj)\n }\n }\n\n // execute !!!\n let data = await this.simstanceManager.executeBindParameterSimPromise({\n target: moduleInstance,\n targetKey: it.propertyKey\n }, otherStorage);\n /*\n \uC5EC\uAE30\uC5D0\uC11C \uC815\uD574\uC9C4 \uD0C0\uC785 \uB9AC\uD134\uC5D0 \uB530\uB978 \uC870\uCE58\n ...\n */\n if (it.config?.resolver) {\n const execute = typeof it.config.resolver === 'function' ? this.simstanceManager.getOrNewSim({target: it.config.resolver}) : it.config.resolver;\n data = await execute?.resolve?.(data, rr);\n }\n const status = it.config?.res?.status ?? HttpStatus.Ok;\n const headers = it.config?.res?.header ?? {};\n if (it.config?.res?.contentType) {\n headers[HttpHeaders.ContentType] = it.config?.res?.contentType;\n }\n if ((it.config?.res?.contentType?.toLowerCase().indexOf(Mimes.ApplicationJson.toLowerCase()) ?? -1) > -1) {\n data = JSON.stringify(data);\n } else if (data && typeof data === 'object') {\n data = JSON.stringify(data);\n }\n rr.resSetHeaders(headers)\n rr.resSetStatusCode(status);\n rr.resWrite(data);\n }\n }\n\n if (this.option.noSuchRouteEndPointMappingThrow && methods.length <= 0 && rr.reqMethod()?.toUpperCase() !== HttpMethod.OPTIONS) {\n throw this.option.noSuchRouteEndPointMappingThrow(rr);\n }\n }\n\n // after\n for (const it of filter.filters.reverse()) {\n if (it.filter?.proceedAfter && !await it.filter.proceedAfter({rr, app: this, before: it.sw, carrier: filter.carrier})) {\n break;\n }\n }\n } catch (e) {\n console.error('request error:', e);\n transactionManager?.catch(e);\n rr.resStatusCode(e instanceof HttpError ? e.status : HttpStatus.InternalServerError)\n const execute = typeof this.option.globalAdvice === 'function' ? this.simstanceManager.getOrNewSim(this.option.globalAdvice) : this.option.globalAdvice;\n if (!execute) {\n rr.resEnd();\n // rr.resEnd().catch(e => {\n // });\n return;\n }\n if (e && typeof e === 'object') {\n otherStorage.set(e.constructor as ConstructorType<any>, e);\n otherStorage.set(SituationTypeContainer, new SituationTypeContainer({\n situationType: ExceptionHandlerSituationType.ERROR_OBJECT,\n data: e\n }));\n }\n const target = targetExceptionHandler(execute, e);\n if (target) {\n await this.simstanceManager.executeBindParameterSimPromise({\n target: execute,\n targetKey: target.propertyKey\n }, otherStorage);\n }\n } finally {\n transactionManager?.finally();\n }\n\n if (!rr.resIsDone()) {\n rr.resEnd();\n }\n });\n\n if (this.option.webSocketEndPoints) {\n const webSocketServer = new WebSocketServer({server: this.server});\n const execute = this.option.webSocketEndPoints.map(it => typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it);\n webSocketServer.on('connection', async (ws, request) => {\n this.webSocketClients.set(ws, {request});\n const wsSet = {socket: ws, request};\n execute.forEach(it => it.connect?.(wsSet));\n ws.on('error', err => execute.forEach(it => it.error?.(wsSet, err)));\n ws.on('message', (data, isBinary) => execute.forEach(it => it.message(wsSet, {data, isBinary})));\n ws.on('ping', () => execute.forEach(it => it.ping?.(wsSet)));\n ws.on('close', () => {\n this.webSocketClients.delete(ws);\n execute.forEach(it => it.close?.(wsSet));\n });\n });\n }\n this.server.listen(this.option.listen.port, this.option.listen.hostname, this.option.listen.backlog, () => {\n this.option.listen.listeningListener?.(this, this.server);\n });\n }\n}\n"],
4
+ "sourcesContent": ["import {SimpleApplication} from '@dooboostore/simple-boot';\nimport {HttpServerOption} from './option/HttpServerOption';\nimport {ConstructorType} from '@dooboostore/core';\nimport {IncomingMessage, Server as HttpServer, ServerResponse} from 'http'\nimport {Server as HttpsServer} from 'https'; // Add HTTPS support\nimport {WebSocketServer, WebSocket} from 'ws';\nimport {RequestResponse} from './models/RequestResponse';\nimport {getUrlMapping, getUrlMappings, SaveMappingConfig, UrlMappingSituationType} from './decorators/MethodMapping';\nimport {HttpStatus} from './codes/HttpStatus';\nimport {HttpHeaders} from './codes/HttpHeaders';\nimport {Mimes} from './codes/Mimes';\nimport {Filter} from './filters/Filter';\nimport {ExceptionHandlerSituationType, targetExceptionHandler} from '@dooboostore/simple-boot';\nimport {getInject, SituationTypeContainer, SituationTypeContainers} from '@dooboostore/simple-boot';\nimport {EndPoint} from './endpoints/EndPoint';\nimport {ReflectUtils} from '@dooboostore/core';\nimport {ReqFormUrlBody} from './models/datas/body/ReqFormUrlBody';\nimport {ReqJsonBody} from './models/datas/body/ReqJsonBody';\nimport {ReqHeader} from './models/datas/ReqHeader';\nimport {RouterModule} from '@dooboostore/simple-boot';\nimport {ReqMultipartFormBody} from './models/datas/body/ReqMultipartFormBody';\nimport {execValidationInValid, getValidIndex} from '@dooboostore/simple-boot';\nimport {ValidException} from '@dooboostore/simple-boot';\nimport {HttpError} from './errors/HttpError';\nimport {getRoute} from '@dooboostore/simple-boot';\nimport {OnInit} from './lifecycle/OnInit';\nimport {URLSearchParams} from 'url';\nimport {HttpMethod} from './codes/HttpMethod';\nimport {SessionManager} from './session/SessionManager';\nimport {InjectSituationType} from './inject/InjectSituationType';\nimport {ReqSearchParamsObj} from \"./models/datas/path/ReqSearchParamsObj\";\nimport {SimConfig} from '@dooboostore/simple-boot';\nimport {ReqPathData} from './models/datas/path/ReqPathData';\nimport {WebSocketEndPoint} from './endpoints/WebSocketEndPoint';\n\nexport class SimpleBootHttpServer extends SimpleApplication {\n public server?: HttpServer | HttpsServer;\n private sessionManager: SessionManager;\n private webSocketClients = new Map<WebSocket, { request: IncomingMessage }>();\n\n constructor(public option: HttpServerOption = new HttpServerOption()) {\n super(option);\n this.sessionManager = new SessionManager(this.option);\n }\n\n\n public run(otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>) {\n otherInstanceSim ??= new Map<ConstructorType<any> | Function | SimConfig | symbol, any>();\n otherInstanceSim.set(SimpleBootHttpServer, this);\n super.run(otherInstanceSim);\n const targets = [...this.option.closeEndPoints ?? [], ...this.option.errorEndPoints ?? [], ...this.option.requestEndPoints ?? [], ...this.option.filters ?? []];\n Promise.all(targets.map(it => (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it as ConstructorType<any>}) : it) as OnInit).map(it => it.onInit(this))).then(it => {\n this.startServer();\n });\n return this;\n }\n\n private startServer() {\n\n // const a = this.option.serverOption as HttpsServerOption;\n // this.option.serverOption?.\n\n if (this.option.serverOption && 'key' in this.option.serverOption && 'cert' in this.option.serverOption) {\n this.server = new HttpsServer(this.option.serverOption);\n const httpServer = new HttpServer();\n httpServer.on('request', (req: IncomingMessage, res: ServerResponse) => {\n res.writeHead(301, {Location: `https://${req.headers.host}${req.url}`});\n res.end();\n });\n httpServer.listen(80, this.option.listen.hostname, () => {\n console.log('HTTP redirect server running on port 80');\n });\n } else if (this.option.serverOption) {\n this.server = new HttpServer(this.option.serverOption);\n } else {\n this.server = new HttpServer();\n }\n // const thisRef = this;\n this.server.on('request', async (req: IncomingMessage, res: ServerResponse) => {\n // console.log('request', req.url);\n const transactionManager = this.option.transactionManagerFactory ? await this.option.transactionManagerFactory() : undefined;\n res.on('close', async () => {\n if (this.option.closeEndPoints) {\n for (const it of this.option.closeEndPoints) {\n try {\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it) as EndPoint;\n const endPoint = execute?.endPoint(rr, this);\n if (endPoint instanceof Promise) {\n await endPoint;\n }\n } catch (e) {\n }\n }\n }\n\n if (!rr.resIsDone()) {\n rr.resEnd();\n }\n });\n res.on('error', async () => {\n if (this.option.errorEndPoints) {\n for (const it of this.option.errorEndPoints) {\n try {\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it) as EndPoint;\n const endPoint = execute?.endPoint(rr, this);\n if (endPoint instanceof Promise) {\n await endPoint;\n }\n } catch (e) {\n }\n }\n }\n\n if (!rr.resIsDone()) {\n rr.resEnd();\n }\n });\n\n const rr = new RequestResponse(req, res, {sessionManager: this.sessionManager, option: this.option});\n /*\n default setting first\n */\n rr.resSetHeader(HttpHeaders.Server, 'simple-boot-http-server');\n const cookie = rr.reqCookieGet(this.option.sessionOption.key);\n if (!cookie) {\n const session = await this.sessionManager.session();\n\n const cookieParts: string[] = [];\n cookieParts.push(`${this.option.sessionOption.key}=${session.uuid}`);\n cookieParts.push(`Path=${this.option.sessionOption.path}`);\n if (this.option.sessionOption.httpOnly) cookieParts.push('HttpOnly');\n if (this.option.sessionOption.secure) cookieParts.push('Secure');\n if (this.option.sessionOption.sameSite != null && this.option.sessionOption.sameSite) cookieParts.push(`SameSite=${this.option.sessionOption.sameSite}`);\n const maxAge = (this.option.sessionOption as any).maxAge ?? (this.sessionManager.sessionOption)?.maxAge;\n if (maxAge != null) cookieParts.push(`Max-Age=${maxAge}`);\n rr.resSetHeader(HttpHeaders.SetCookie, cookieParts.join('; '));\n }\n\n const otherStorage = new Map<ConstructorType<any>, any>();\n otherStorage.set(RequestResponse, rr);\n otherStorage.set(IncomingMessage, req);\n otherStorage.set(ServerResponse, res);\n try {\n transactionManager?.try();\n if (this.option.requestEndPoints) {\n for (const it of this.option.requestEndPoints) {\n try {\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim<EndPoint>({target: it}) : it) as EndPoint;\n execute?.endPoint(rr, this);\n } catch (e) {\n }\n }\n }\n\n const filter = {\n carrier: new Map<string, any>(),\n filters: [] as { filter: Filter, sw: boolean }[]\n };\n for (let i = 0; this.option.filters && i < this.option.filters.length; i++) {\n const it = this.option.filters[i];\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it) as Filter;\n let sw = true;\n if (execute?.proceedBefore) {\n sw = await execute.proceedBefore({rr, app: this, carrier: filter.carrier});\n filter.filters.push({filter: execute, sw});\n }\n if (!sw) {\n break;\n }\n }\n\n // body.. something..\n if (!rr.resIsDone()) {\n const routerModule = await super.routing(rr.reqIntent);\n otherStorage.set(RouterModule, routerModule);\n const moduleInstance = routerModule?.getModuleInstance?.();\n let methods: SaveMappingConfig[] = [];\n if (routerModule && moduleInstance) {\n // router \uD074\uB798\uC2A4 \uB0B4\uBD80\uC5D0\uC11C \uC120\uC5B8\uB41C Route\uC77C\uB54C\n if (routerModule.propertyKeys) {\n const map = routerModule.propertyKeys?.map((it: string | symbol) => {\n return {propertyKey: it, config: getUrlMapping(moduleInstance, it)} as SaveMappingConfig\n });\n methods.push(...(map ?? []));\n } else {\n methods.push(...(getUrlMappings(moduleInstance).filter(it => !getRoute(moduleInstance, it.propertyKey)) ?? []));\n }\n\n // options\uB85C \uC694\uCCAD\uC624\uBA74\uC740 allow\uB85C \uB123\uACE0 \uADF8\uB0E5 200\uCC98\uB9AC\uD574\uC57C\uB428.\n if (rr.reqMethod()?.toUpperCase() === HttpMethod.OPTIONS.toUpperCase()) {\n rr.resSetHeader(HttpHeaders.Allow, methods.map(it => it.config.method).join(', '));\n rr.resStatusCode(HttpStatus.Ok);\n }\n\n // method \uCC3E\uAE30\n methods = methods.filter(it => it && it.propertyKey && it.config && rr.reqMethod()?.toUpperCase() === it.config.method.toUpperCase());\n methods.sort((a, b) => {\n return ((b.config?.req?.contentType?.length ?? 0) + (b.config?.req?.accept?.length ?? 0)) - ((a.config?.req?.contentType?.length ?? 0) + (a.config?.req?.accept?.length ?? 0));\n });\n methods = methods\n .filter(it => it.config?.req?.contentType ? (!!it.config?.req?.contentType?.find(sit => rr.reqHasContentTypeHeader(sit))) : true)\n .filter(it => it.config?.req?.accept ? (!!it.config?.req?.accept?.find(sit => rr.reqHasAcceptHeader(sit))) : true);\n\n if (methods[0]) {\n const it = methods[0];\n const paramTypes = ReflectUtils.getParameterTypes(moduleInstance, it.propertyKey)\n const injects = getInject(moduleInstance, it.propertyKey);\n const validIndexs = getValidIndex(moduleInstance, it.propertyKey);\n if (injects) {\n const isPathData = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_PATH_DATA);\n const isJson = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_JSON_BODY);\n const isSearchParamsObj = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_URL_SEARCH_PARAMS_OBJ);\n const isFormUrl = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_FORM_URL_BODY);\n // \uC6B0\uC120 \uB2E4\uC2DC \uC81C\uAC70\uD55C\uB2E4.. \uD2B8\uB79C\uC81D\uC158 \uC5B4\uB5BB\uAC8C \uD560\uC9C0 \uB2E4\uC2DC \uC0DD\uAC01\n // const isTransactionManager = injects.find(it => it.config?.situationType === InjectSituationType.TransactionManager);\n const siturationContainers = new SituationTypeContainers();\n if (isPathData) {\n let data = await routerModule.pathData\n if (isPathData.type) {\n data = Object.assign(new isPathData.type(), data);\n }\n if (validIndexs.includes(isPathData.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({\n situationType: UrlMappingSituationType.REQ_PATH_DATA,\n data\n }));\n }\n if (isJson) {\n let data = await rr.reqBodyJsonData();\n if (data !== null && isJson.type) {\n data = Object.assign(new isJson.type(), data);\n }\n if (validIndexs.includes(isJson.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({\n situationType: UrlMappingSituationType.REQ_JSON_BODY,\n data\n }));\n }\n if (isSearchParamsObj) {\n let data = rr.reqUrlSearchParamsObj\n if (validIndexs.includes(isSearchParamsObj.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({\n situationType: UrlMappingSituationType.REQ_URL_SEARCH_PARAMS_OBJ,\n data\n }));\n }\n if (isFormUrl) {\n let data = await rr.reqBodyFormUrlData()\n if (isFormUrl.type) {\n data = Object.assign(new isFormUrl.type(), data);\n }\n if (validIndexs.includes(isFormUrl.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({situationType: UrlMappingSituationType.REQ_FORM_URL_BODY, data}));\n }\n // \uD2B8\uB79C\uC81D\uC158 \uC6B0\uC120 \uC81C\uAC70 \uB098\uC911\uC5D0 \uC5B4\uB5BB\uAC8C \uAD6C\uD604\uD560\uC9C0 \uC0DD\uAC01..\n // if (isTransactionManager && isTransactionManager.type && transactionManager && transactionManager.hasTransaction(isTransactionManager.type)) {\n // let data = await transactionManager.getTransaction(isTransactionManager.type);\n // if (data) {\n // data = await data.try(isTransactionManager.config.argument);\n // siturationContainers.push(new SituationTypeContainer({situationType: InjectSituationType.TransactionManager, data, index: isTransactionManager.index}));\n // }\n // }\n if (siturationContainers.length) {\n otherStorage.set(SituationTypeContainers, siturationContainers);\n }\n }\n\n for (const paramType of paramTypes) {\n if (paramType === ReqFormUrlBody) {\n otherStorage.set(ReqFormUrlBody, await rr.reqBodyReqFormUrlBody())\n } else if (paramType === ReqPathData) {\n otherStorage.set(ReqPathData, routerModule.pathData)\n } else if (paramType === ReqJsonBody) {\n otherStorage.set(ReqJsonBody, await rr.reqBodyReqJsonBody())\n } else if (paramType === ReqSearchParamsObj) {\n otherStorage.set(ReqSearchParamsObj, rr.reqUrlSearchParamsObj)\n } else if (paramType === URLSearchParams) {\n otherStorage.set(URLSearchParams, rr.reqUrlSearchParams)\n } else if (paramType === ReqMultipartFormBody) {\n otherStorage.set(ReqMultipartFormBody, rr.reqBodyMultipartFormData())\n } else if (paramType === ReqHeader) {\n otherStorage.set(ReqHeader, rr.reqHeaderObj)\n }\n }\n\n // execute !!!\n let data = await this.simstanceManager.executeBindParameterSimPromise({\n target: moduleInstance,\n targetKey: it.propertyKey\n }, otherStorage);\n /*\n \uC5EC\uAE30\uC5D0\uC11C \uC815\uD574\uC9C4 \uD0C0\uC785 \uB9AC\uD134\uC5D0 \uB530\uB978 \uC870\uCE58\n ...\n */\n if (it.config?.resolver) {\n const execute = typeof it.config.resolver === 'function' ? this.simstanceManager.getOrNewSim({target: it.config.resolver}) : it.config.resolver;\n data = await execute?.resolve?.(data, rr);\n }\n const status = it.config?.res?.status ?? HttpStatus.Ok;\n const headers = it.config?.res?.header ?? {};\n if (it.config?.res?.contentType) {\n headers[HttpHeaders.ContentType] = it.config?.res?.contentType;\n }\n if ((it.config?.res?.contentType?.toLowerCase().indexOf(Mimes.ApplicationJson.toLowerCase()) ?? -1) > -1) {\n data = JSON.stringify(data);\n } else if (data && typeof data === 'object') {\n data = JSON.stringify(data);\n }\n rr.resSetHeaders(headers)\n rr.resSetStatusCode(status);\n rr.resWrite(data);\n }\n }\n\n if (this.option.noSuchRouteEndPointMappingThrow && methods.length <= 0 && rr.reqMethod()?.toUpperCase() !== HttpMethod.OPTIONS) {\n throw this.option.noSuchRouteEndPointMappingThrow(rr);\n }\n }\n\n // after\n for (const it of filter.filters.reverse()) {\n if (it.filter?.proceedAfter && !await it.filter.proceedAfter({rr, app: this, before: it.sw, carrier: filter.carrier})) {\n break;\n }\n }\n } catch (e) {\n console.error('request error:', e);\n transactionManager?.catch(e);\n rr.resStatusCode(e instanceof HttpError ? e.status : HttpStatus.InternalServerError)\n const execute = typeof this.option.globalAdvice === 'function' ? this.simstanceManager.getOrNewSim(this.option.globalAdvice) : this.option.globalAdvice;\n if (!execute) {\n rr.resEnd();\n // rr.resEnd().catch(e => {\n // });\n return;\n }\n if (e && typeof e === 'object') {\n otherStorage.set(e.constructor as ConstructorType<any>, e);\n otherStorage.set(SituationTypeContainer, new SituationTypeContainer({\n situationType: ExceptionHandlerSituationType.ERROR_OBJECT,\n data: e\n }));\n }\n const target = targetExceptionHandler(execute, e);\n if (target) {\n await this.simstanceManager.executeBindParameterSimPromise({\n target: execute,\n targetKey: target.propertyKey\n }, otherStorage);\n }\n } finally {\n transactionManager?.finally();\n }\n\n if (!rr.resIsDone()) {\n rr.resEnd();\n }\n });\n\n if (this.option.webSocketEndPoints) {\n const webSocketServer = new WebSocketServer({server: this.server});\n const execute = this.option.webSocketEndPoints.map(it => typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it);\n webSocketServer.on('connection', async (ws, request) => {\n this.webSocketClients.set(ws, {request});\n const wsSet = {socket: ws, request};\n execute.forEach(it => it.connect?.(wsSet));\n ws.on('error', err => execute.forEach(it => it.error?.(wsSet, err)));\n ws.on('message', (data, isBinary) => execute.forEach(it => it.message(wsSet, {data, isBinary})));\n ws.on('ping', () => execute.forEach(it => it.ping?.(wsSet)));\n ws.on('close', () => {\n this.webSocketClients.delete(ws);\n execute.forEach(it => it.close?.(wsSet));\n });\n });\n }\n this.server.listen(this.option.listen.port, this.option.listen.hostname, this.option.listen.backlog, () => {\n this.option.listen.listeningListener?.(this, this.server);\n });\n }\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAgC;AAChC,8BAA+B;AAE/B,kBAAoE;AACpE,mBAAoC;AACpC,gBAAyC;AACzC,6BAA8B;AAC9B,2BAAwF;AACxF,wBAAyB;AACzB,yBAA0B;AAC1B,mBAAoB;AAEpB,IAAAA,sBAAoE;AACpE,IAAAA,sBAAyE;AAEzE,IAAAC,eAA2B;AAC3B,4BAA6B;AAC7B,yBAA0B;AAC1B,uBAAwB;AACxB,IAAAD,sBAA2B;AAC3B,kCAAmC;AACnC,IAAAA,sBAAmD;AACnD,IAAAA,s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AI,QAAO;AAClC,gBAAQ,QAAQ,QAAM,GAAG,UAAU,KAAK,CAAC;AACzC,WAAG,GAAG,SAAS,SAAO,QAAQ,QAAQ,QAAM,GAAG,QAAQ,OAAO,GAAG,CAAC,CAAC;AACnE,WAAG,GAAG,WAAW,CAAC,MAAM,aAAa,QAAQ,QAAQ,QAAM,GAAG,QAAQ,OAAO,EAAC,MAAM,SAAQ,CAAC,CAAC,CAAC;AAC/F,WAAG,GAAG,QAAQ,MAAM,QAAQ,QAAQ,QAAM,GAAG,OAAO,KAAK,CAAC,CAAC;AAC3D,WAAG,GAAG,SAAS,MAAM;AACnB,eAAK,iBAAiB,OAAO,EAAE;AAC/B,kBAAQ,QAAQ,QAAM,GAAG,QAAQ,KAAK,CAAC;AAAA,QACzC,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AACA,SAAK,OAAO,OAAO,KAAK,OAAO,OAAO,MAAM,KAAK,OAAO,OAAO,UAAU,KAAK,OAAO,OAAO,SAAS,MAAM;AACzG,WAAK,OAAO,OAAO,oBAAoB,MAAM,KAAK,MAAM;AAAA,IAC1D,CAAC;AAAA,EACH;AACF;",
6
6
  "names": ["import_simple_boot", "import_core", "HttpsServer", "HttpServer", "it", "data"]
7
7
  }
@@ -28,6 +28,8 @@ __export(MethodMapping_exports, {
28
28
  TRACE: () => TRACE,
29
29
  UrlMapping: () => UrlMapping,
30
30
  UrlMappingSituationType: () => UrlMappingSituationType,
31
+ connectMethod: () => connectMethod,
32
+ deleteMethod: () => deleteMethod,
31
33
  getCONNECT: () => getCONNECT,
32
34
  getCONNECTS: () => getCONNECTS,
33
35
  getDELETE: () => getDELETE,
@@ -36,6 +38,7 @@ __export(MethodMapping_exports, {
36
38
  getGETS: () => getGETS,
37
39
  getHEAD: () => getHEAD,
38
40
  getHEADS: () => getHEADS,
41
+ getMethod: () => getMethod,
39
42
  getOPTIONS: () => getOPTIONS,
40
43
  getOPTIONSS: () => getOPTIONSS,
41
44
  getPATCH: () => getPATCH,
@@ -47,7 +50,14 @@ __export(MethodMapping_exports, {
47
50
  getTRACE: () => getTRACE,
48
51
  getTRACES: () => getTRACES,
49
52
  getUrlMapping: () => getUrlMapping,
50
- getUrlMappings: () => getUrlMappings
53
+ getUrlMappings: () => getUrlMappings,
54
+ headMethod: () => headMethod,
55
+ optionsMethod: () => optionsMethod,
56
+ patchMethod: () => patchMethod,
57
+ postMethod: () => postMethod,
58
+ putMethod: () => putMethod,
59
+ traceMethod: () => traceMethod,
60
+ urlMapping: () => urlMapping
51
61
  });
52
62
  module.exports = __toCommonJS(MethodMapping_exports);
53
63
  var import_core2 = require("@dooboostore/core");
@@ -59,7 +69,7 @@ var UrlMappingSituationType = /* @__PURE__ */ ((UrlMappingSituationType2) => {
59
69
  UrlMappingSituationType2["REQ_FORM_URL_BODY"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_FORM_URL_BODY";
60
70
  return UrlMappingSituationType2;
61
71
  })(UrlMappingSituationType || {});
62
- const MappingMetadataKey = Symbol("MappingMetadataKey");
72
+ const MappingMetadataKey = Symbol.for("simple-boot-http-server:mapping-metadata");
63
73
  const process = (config, target, propertyKey, descriptor) => {
64
74
  const saveMappingConfigs = import_core2.ReflectUtils.getMetadata(MappingMetadataKey, target.constructor) ?? [];
65
75
  saveMappingConfigs.push({ propertyKey, config });
@@ -228,6 +238,16 @@ const getCONNECT = (target, propertyKey) => {
228
238
  const getCONNECTS = (target) => {
229
239
  return getUrlMappings(target)?.filter((it) => it.config?.method.toUpperCase() === import_HttpMethod.HttpMethod.CONNECT);
230
240
  };
241
+ const urlMapping = UrlMapping;
242
+ const getMethod = GET;
243
+ const postMethod = POST;
244
+ const patchMethod = PATCH;
245
+ const putMethod = PUT;
246
+ const deleteMethod = DELETE;
247
+ const optionsMethod = OPTIONS;
248
+ const headMethod = HEAD;
249
+ const traceMethod = TRACE;
250
+ const connectMethod = CONNECT;
231
251
  // Annotate the CommonJS export names for ESM import in node:
232
252
  0 && (module.exports = {
233
253
  CONNECT,
@@ -241,6 +261,8 @@ const getCONNECTS = (target) => {
241
261
  TRACE,
242
262
  UrlMapping,
243
263
  UrlMappingSituationType,
264
+ connectMethod,
265
+ deleteMethod,
244
266
  getCONNECT,
245
267
  getCONNECTS,
246
268
  getDELETE,
@@ -249,6 +271,7 @@ const getCONNECTS = (target) => {
249
271
  getGETS,
250
272
  getHEAD,
251
273
  getHEADS,
274
+ getMethod,
252
275
  getOPTIONS,
253
276
  getOPTIONSS,
254
277
  getPATCH,
@@ -260,6 +283,13 @@ const getCONNECTS = (target) => {
260
283
  getTRACE,
261
284
  getTRACES,
262
285
  getUrlMapping,
263
- getUrlMappings
286
+ getUrlMappings,
287
+ headMethod,
288
+ optionsMethod,
289
+ patchMethod,
290
+ postMethod,
291
+ putMethod,
292
+ traceMethod,
293
+ urlMapping
264
294
  });
265
295
  //# sourceMappingURL=MethodMapping.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/decorators/MethodMapping.ts"],
4
- "sourcesContent": ["import { ConstructorType } from '@dooboostore/core';\nimport { ReflectMethod } from '@dooboostore/simple-boot';\nimport { ReflectUtils } from '@dooboostore/core';\nimport { Resolver } from '../resolvers/Resolver';\nimport { Mimes } from '../codes/Mimes';\nimport { HttpMethod } from '../codes/HttpMethod';\n\nexport enum UrlMappingSituationType {\n REQ_JSON_BODY = 'SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_JSON_BODY',\n REQ_PATH_DATA = 'SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_PATH_DATA',\n // REQ_URL_SEARCH_PARAMS = 'SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_URL_SEARCH_PARAMS',\n REQ_URL_SEARCH_PARAMS_OBJ = 'SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_URL_SEARCH_PARAMS_OBJ',\n REQ_FORM_URL_BODY = 'SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_FORM_URL_BODY'\n}\nexport type MappingConfig = {\n method: HttpMethod | string,\n description?: {\n name?: string;\n detail?: string;\n };\n\n req?: {\n contentType?: (Mimes|string)[];\n accept?: (Mimes|string)[];\n };\n\n res?: {\n status?: number;\n header?: {[key: string]: string};\n contentType?: Mimes | string;\n }\n resolver?: Resolver|ConstructorType<Resolver>;\n}\nexport type SaveMappingConfig = {propertyKey: string | symbol; config: MappingConfig}\nconst MappingMetadataKey = Symbol('MappingMetadataKey');\n// const GETSMappingMetadataKey = Symbol('GET_METHODS');\n// const GETMappingMetadataKey = Symbol('GET_METHOD');\n\nconst process = (config: MappingConfig, target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const saveMappingConfigs = (ReflectUtils.getMetadata(MappingMetadataKey, target.constructor) ?? []) as SaveMappingConfig[];\n saveMappingConfigs.push({propertyKey, config});\n ReflectUtils.defineMetadata(MappingMetadataKey, saveMappingConfigs, target.constructor);\n ReflectUtils.defineMetadata(MappingMetadataKey, config, target, propertyKey);\n}\nexport function UrlMapping(config: MappingConfig): ReflectMethod;\nexport function UrlMapping(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function UrlMapping(configOrtarget?: MappingConfig | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.GET}, configOrtarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n process(configOrtarget, target, propertyKey, descriptor);\n }\n }\n}\nexport const getUrlMapping = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return ReflectUtils.getMetadata(MappingMetadataKey, target, propertyKey);\n}\n\nexport const getUrlMappings = (target: any): SaveMappingConfig[] => {\n if (target !== null && undefined !== target && typeof target === 'object') {\n target = target.constructor;\n }\n return ReflectUtils.getMetadata(MappingMetadataKey, target);\n}\nexport function GET(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function GET(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function GET(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.GET}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.GET;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getGET = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getGETS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.GET);\n}\nexport function POST(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function POST(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function POST(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.POST}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.POST;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getPOST = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getPOSTS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.POST);\n}\nexport function DELETE(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function DELETE(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function DELETE(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.DELETE}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.DELETE;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getDELETE = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getDELETES = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.DELETE);\n}\nexport function PUT(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function PUT(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function PUT(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.PUT}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.PUT;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getPUT = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getPUTS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.PUT);\n}\nexport function PATCH(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function PATCH(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function PATCH(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.PATCH}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.PATCH;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getPATCH = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getPATCHS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.GET);\n}\nexport function OPTIONS(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function OPTIONS(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function OPTIONS(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.OPTIONS}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.OPTIONS;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getOPTIONS = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getOPTIONSS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.OPTIONS);\n}\nexport function HEAD(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function HEAD(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function HEAD(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.HEAD}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.HEAD;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getHEAD = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getHEADS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.GET);\n}\nexport function TRACE(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function TRACE(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function TRACE(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.TRACE}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.TRACE;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getTRACE = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getTRACES = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.TRACE);\n}\nexport function CONNECT(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function CONNECT(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function CONNECT(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.CONNECT}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.CONNECT;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getCONNECT = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getCONNECTS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.CONNECT);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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MAAM,WAAW,CAAC,QAAa,gBAA4D;AAC9F,SAAO,cAAc,QAAQ,WAAW;AAC5C;AACO,MAAM,YAAY,CAAC,WAAqC;AAC3D,SAAO,eAAe,MAAM,GAAG,OAAO,QAAM,GAAG,QAAQ,OAAO,YAAY,MAAM,6BAAW,KAAK;AACpG;AAGO,SAAS,QAAQ,gBAAsD,aAA+B,YAAuD;AAChK,MAAI,eAAe,YAAY;AAC3B,YAAQ,EAAC,QAAQ,6BAAW,QAAO,GAAG,gBAAgB,aAAa,UAAU;AAAA,EACjF,OAAO;AACH,WAAO,CAAC,QAAaD,cAA8BC,gBAAmC;AAClF,qBAAe,SAAS,6BAAW;AACnC,cAAQ,gBAAgB,QAAQD,cAAaC,WAAU;AAAA,IAC3D;AAAA,EACJ;AACJ;AAEO,MAAM,aAAa,CAAC,QAAa,gBAA4D;AAChG,SAAO,cAAc,QAAQ,WAAW;AAC5C;AACO,MAAM,cAAc,CAAC,WAAqC;AAC7D,SAAO,eAAe,MAAM,GAAG,OAAO,QAAM,GAAG,QAAQ,OAAO,YAAY,MAAM,6BAAW,OAAO;AACtG;",
4
+ "sourcesContent": ["import { ConstructorType } from '@dooboostore/core';\nimport { ReflectMethod } from '@dooboostore/simple-boot';\nimport { ReflectUtils } from '@dooboostore/core';\nimport { Resolver } from '../resolvers/Resolver';\nimport { Mimes } from '../codes/Mimes';\nimport { HttpMethod } from '../codes/HttpMethod';\n\nexport enum UrlMappingSituationType {\n REQ_JSON_BODY = 'SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_JSON_BODY',\n REQ_PATH_DATA = 'SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_PATH_DATA',\n // REQ_URL_SEARCH_PARAMS = 'SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_URL_SEARCH_PARAMS',\n REQ_URL_SEARCH_PARAMS_OBJ = 'SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_URL_SEARCH_PARAMS_OBJ',\n REQ_FORM_URL_BODY = 'SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_FORM_URL_BODY'\n}\nexport type MappingConfig = {\n method: HttpMethod | string,\n description?: {\n name?: string;\n detail?: string;\n };\n\n req?: {\n contentType?: (Mimes|string)[];\n accept?: (Mimes|string)[];\n };\n\n res?: {\n status?: number;\n header?: {[key: string]: string};\n contentType?: Mimes | string;\n }\n resolver?: Resolver|ConstructorType<Resolver>;\n}\nexport type SaveMappingConfig = {propertyKey: string | symbol; config: MappingConfig}\nconst MappingMetadataKey = Symbol.for('simple-boot-http-server:mapping-metadata');\n// const GETSMappingMetadataKey = Symbol('GET_METHODS');\n// const GETMappingMetadataKey = Symbol('GET_METHOD');\n\nconst process = (config: MappingConfig, target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const saveMappingConfigs = (ReflectUtils.getMetadata(MappingMetadataKey, target.constructor) ?? []) as SaveMappingConfig[];\n saveMappingConfigs.push({propertyKey, config});\n ReflectUtils.defineMetadata(MappingMetadataKey, saveMappingConfigs, target.constructor);\n ReflectUtils.defineMetadata(MappingMetadataKey, config, target, propertyKey);\n}\nexport function UrlMapping(config: MappingConfig): ReflectMethod;\nexport function UrlMapping(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function UrlMapping(configOrtarget?: MappingConfig | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.GET}, configOrtarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n process(configOrtarget, target, propertyKey, descriptor);\n }\n }\n}\nexport const getUrlMapping = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return ReflectUtils.getMetadata(MappingMetadataKey, target, propertyKey);\n}\n\nexport const getUrlMappings = (target: any): SaveMappingConfig[] => {\n if (target !== null && undefined !== target && typeof target === 'object') {\n target = target.constructor;\n }\n return ReflectUtils.getMetadata(MappingMetadataKey, target);\n}\nexport function GET(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function GET(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function GET(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.GET}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.GET;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getGET = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getGETS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.GET);\n}\nexport function POST(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function POST(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function POST(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.POST}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.POST;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getPOST = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getPOSTS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.POST);\n}\nexport function DELETE(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function DELETE(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function DELETE(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.DELETE}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.DELETE;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getDELETE = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getDELETES = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.DELETE);\n}\nexport function PUT(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function PUT(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function PUT(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.PUT}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.PUT;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getPUT = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getPUTS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.PUT);\n}\nexport function PATCH(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function PATCH(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function PATCH(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.PATCH}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.PATCH;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getPATCH = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getPATCHS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.GET);\n}\nexport function OPTIONS(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function OPTIONS(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function OPTIONS(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.OPTIONS}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.OPTIONS;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getOPTIONS = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getOPTIONSS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.OPTIONS);\n}\nexport function HEAD(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function HEAD(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function HEAD(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.HEAD}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.HEAD;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getHEAD = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getHEADS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.GET);\n}\nexport function TRACE(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function TRACE(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function TRACE(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.TRACE}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.TRACE;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getTRACE = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getTRACES = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.TRACE);\n}\nexport function CONNECT(config: Omit<MappingConfig, 'method'>): ReflectMethod;\nexport function CONNECT(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;\nexport function CONNECT(configOrTarget?: Omit<MappingConfig, 'method'> | any, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): ReflectMethod | void {\n if (propertyKey && descriptor) {\n process({method: HttpMethod.CONNECT}, configOrTarget, propertyKey, descriptor);\n } else {\n return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n configOrTarget.method = HttpMethod.CONNECT;\n process(configOrTarget, target, propertyKey, descriptor);\n }\n }\n}\n\nexport const getCONNECT = (target: any, propertyKey: string | symbol): MappingConfig | undefined => {\n return getUrlMapping(target, propertyKey);\n}\nexport const getCONNECTS = (target: any): SaveMappingConfig[] => {\n return getUrlMappings(target)?.filter(it => it.config?.method.toUpperCase() === HttpMethod.CONNECT);\n}\n\n// Aliases for lowercase\nexport const urlMapping = UrlMapping;\nexport const getMethod = GET;\nexport const postMethod = POST;\nexport const patchMethod = PATCH;\nexport const putMethod = PUT;\nexport const deleteMethod = DELETE;\nexport const optionsMethod = OPTIONS;\nexport const headMethod = HEAD;\nexport const traceMethod = TRACE;\nexport const connectMethod = CONNECT;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,eAA6B;AAG7B,wBAA2B;AAEpB,IAAK,0BAAL,kBAAKC,6BAAL;AACH,EAAAA,yBAAA,mBAAgB;AAChB,EAAAA,yBAAA,mBAAgB;AAEhB,EAAAA,yBAAA,+BAA4B;AAC5B,EAAAA,yBAAA,uBAAoB;AALZ,SAAAA;AAAA,GAAA;AA2BZ,MAAM,qBAAqB,OAAO,IAAI,0CAA0C;AAIhF,MAAM,UAAU,CAAC,QAAuB,QAAa,aAA8B,eAAmC;AAClH,QAAM,qBAAsB,0BAAa,YAAY,oBAAoB,OAAO,WAAW,KAAK,CAAC;AACjG,qBAAmB,KAAK,EAAC,aAAa,OAAM,CAAC;AAC7C,4BAAa,eAAe,oBAAoB,oBAAoB,OAAO,WAAW;AACtF,4BAAa,eAAe,oBAAoB,QAAQ,QAAQ,WAAW;AAC/E;AAGO,SAAS,WAAW,gBAAsC,aAA+B,YAAuD;AACnJ,MAAI,eAAe,YAAY;AAC3B,YAAQ,EAAC,QAAQ,6BAAW,IAAG,GAAG,gBAAgB,aAAa,UAAU;AAAA,EAC7E,OAAO;AACH,WAAO,CAAC,QAAaC,cAA8BC,gBAAmC;AAClF,cAAQ,gBAAgB,QAAQD,cAAaC,WAAU;AAAA,IAC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names": ["import_core", "UrlMappingSituationType", "propertyKey", "descriptor"]
7
7
  }
@@ -23,7 +23,8 @@ module.exports = __toCommonJS(BadRequestError_exports);
23
23
  var import_HttpError = require("./HttpError");
24
24
  var import_HttpStatus = require("../codes/HttpStatus");
25
25
  class BadRequestError extends import_HttpError.HttpError {
26
- constructor({ status = import_HttpStatus.HttpStatus.BadRequest, message = "Bad Request" } = {}) {
26
+ constructor(input = {}) {
27
+ const { status = import_HttpStatus.HttpStatus.BadRequest, message = "Bad Request" } = typeof input === "string" ? { message: input } : input;
27
28
  super({ status, message });
28
29
  }
29
30
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/errors/BadRequestError.ts"],
4
- "sourcesContent": ["import {HttpError} from './HttpError';\nimport {HttpStatus} from '../codes/HttpStatus';\n\nexport class BadRequestError extends HttpError {\n constructor({status = HttpStatus.BadRequest, message = 'Bad Request'}: {status?: number, message?: string} = {}) {\n super({status, message});\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,wBAAyB;AAElB,MAAM,wBAAwB,2BAAU;AAAA,EAC3C,YAAY,EAAC,SAAS,6BAAW,YAAY,UAAU,cAAa,IAAyC,CAAC,GAAG;AAC7G,UAAM,EAAC,QAAQ,QAAO,CAAC;AAAA,EAC3B;AACJ;",
4
+ "sourcesContent": ["import {HttpError} from './HttpError';\nimport {HttpStatus} from '../codes/HttpStatus';\n\nexport class BadRequestError extends HttpError {\n constructor(\n input: { status?: number; message?: string } | string = {},\n ) {\n const {status = HttpStatus.BadRequest, message = 'Bad Request'} =\n typeof input === 'string' ? {message: input} : input;\n super({status, message});\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,wBAAyB;AAElB,MAAM,wBAAwB,2BAAU;AAAA,EAC7C,YACE,QAAwD,CAAC,GACzD;AACA,UAAM,EAAC,SAAS,6BAAW,YAAY,UAAU,cAAa,IAC5D,OAAO,UAAU,WAAW,EAAC,SAAS,MAAK,IAAI;AACjD,UAAM,EAAC,QAAQ,QAAO,CAAC;AAAA,EACzB;AACF;",
6
6
  "names": []
7
7
  }
@@ -23,7 +23,8 @@ module.exports = __toCommonJS(ForbiddenError_exports);
23
23
  var import_HttpError = require("./HttpError");
24
24
  var import_HttpStatus = require("../codes/HttpStatus");
25
25
  class ForbiddenError extends import_HttpError.HttpError {
26
- constructor({ status = import_HttpStatus.HttpStatus.Forbidden, message = "Forbidden" } = {}) {
26
+ constructor(input = {}) {
27
+ const { status = import_HttpStatus.HttpStatus.Forbidden, message = "Forbidden" } = typeof input === "string" ? { message: input } : input;
27
28
  super({ status, message });
28
29
  }
29
30
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/errors/ForbiddenError.ts"],
4
- "sourcesContent": ["import {HttpError} from './HttpError';\nimport {HttpStatus} from '../codes/HttpStatus';\n\nexport class ForbiddenError extends HttpError {\n constructor({status = HttpStatus.Forbidden, message = 'Forbidden'}: {status?: number, message?: string} = {}) {\n super({status, message});\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,wBAAyB;AAElB,MAAM,uBAAuB,2BAAU;AAAA,EAC1C,YAAY,EAAC,SAAS,6BAAW,WAAW,UAAU,YAAW,IAAyC,CAAC,GAAG;AAC1G,UAAM,EAAC,QAAQ,QAAO,CAAC;AAAA,EAC3B;AACJ;",
4
+ "sourcesContent": ["import {HttpError} from './HttpError';\nimport {HttpStatus} from '../codes/HttpStatus';\n\nexport class ForbiddenError extends HttpError {\n constructor(\n input: { status?: number; message?: string } | string = {},\n ) {\n const {status = HttpStatus.Forbidden, message = 'Forbidden'} =\n typeof input === 'string' ? {message: input} : input;\n super({status, message});\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,wBAAyB;AAElB,MAAM,uBAAuB,2BAAU;AAAA,EAC5C,YACE,QAAwD,CAAC,GACzD;AACA,UAAM,EAAC,SAAS,6BAAW,WAAW,UAAU,YAAW,IACzD,OAAO,UAAU,WAAW,EAAC,SAAS,MAAK,IAAI;AACjD,UAAM,EAAC,QAAQ,QAAO,CAAC;AAAA,EACzB;AACF;",
6
6
  "names": []
7
7
  }
@@ -23,7 +23,8 @@ module.exports = __toCommonJS(InternalServerError_exports);
23
23
  var import_HttpError = require("./HttpError");
24
24
  var import_HttpStatus = require("../codes/HttpStatus");
25
25
  class InternalServerError extends import_HttpError.HttpError {
26
- constructor({ status = import_HttpStatus.HttpStatus.InternalServerError, message = "Internal Server Error" } = {}) {
26
+ constructor(input = {}) {
27
+ const { status = import_HttpStatus.HttpStatus.InternalServerError, message = "Internal Server Error" } = typeof input === "string" ? { message: input } : input;
27
28
  super({ status, message });
28
29
  }
29
30
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/errors/InternalServerError.ts"],
4
- "sourcesContent": ["import {HttpError} from './HttpError';\nimport {HttpStatus} from '../codes/HttpStatus';\n\nexport class InternalServerError extends HttpError {\n constructor({status = HttpStatus.InternalServerError, message = 'Internal Server Error'}: {status?: number, message?: string} = {}) {\n super({status, message});\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,wBAAyB;AAElB,MAAM,4BAA4B,2BAAU;AAAA,EAC/C,YAAY,EAAC,SAAS,6BAAW,qBAAqB,UAAU,wBAAuB,IAAyC,CAAC,GAAG;AAChI,UAAM,EAAC,QAAQ,QAAO,CAAC;AAAA,EAC3B;AACJ;",
4
+ "sourcesContent": ["import {HttpError} from './HttpError';\nimport {HttpStatus} from '../codes/HttpStatus';\n\nexport class InternalServerError extends HttpError {\n constructor(\n input: { status?: number; message?: string } | string = {},\n ) {\n const {status = HttpStatus.InternalServerError, message = 'Internal Server Error'} =\n typeof input === 'string' ? {message: input} : input;\n super({status, message});\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,wBAAyB;AAElB,MAAM,4BAA4B,2BAAU;AAAA,EACjD,YACE,QAAwD,CAAC,GACzD;AACA,UAAM,EAAC,SAAS,6BAAW,qBAAqB,UAAU,wBAAuB,IAC/E,OAAO,UAAU,WAAW,EAAC,SAAS,MAAK,IAAI;AACjD,UAAM,EAAC,QAAQ,QAAO,CAAC;AAAA,EACzB;AACF;",
6
6
  "names": []
7
7
  }
@@ -23,7 +23,8 @@ module.exports = __toCommonJS(NotFoundError_exports);
23
23
  var import_HttpError = require("./HttpError");
24
24
  var import_HttpStatus = require("../codes/HttpStatus");
25
25
  class NotFoundError extends import_HttpError.HttpError {
26
- constructor({ status = import_HttpStatus.HttpStatus.NotFound, message = "Not Found" } = {}) {
26
+ constructor(input = {}) {
27
+ const { status = import_HttpStatus.HttpStatus.NotFound, message = "Not Found" } = typeof input === "string" ? { message: input } : input;
27
28
  super({ status, message });
28
29
  }
29
30
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/errors/NotFoundError.ts"],
4
- "sourcesContent": ["import {HttpError} from './HttpError';\nimport {HttpStatus} from '../codes/HttpStatus';\n\nexport class NotFoundError extends HttpError {\n constructor({status = HttpStatus.NotFound, message = 'Not Found'}: {status?: number, message?: string} = {}) {\n super({status, message});\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,wBAAyB;AAElB,MAAM,sBAAsB,2BAAU;AAAA,EACzC,YAAY,EAAC,SAAS,6BAAW,UAAU,UAAU,YAAW,IAAyC,CAAC,GAAG;AACzG,UAAM,EAAC,QAAQ,QAAO,CAAC;AAAA,EAC3B;AACJ;",
4
+ "sourcesContent": ["import {HttpError} from './HttpError';\nimport {HttpStatus} from '../codes/HttpStatus';\n\nexport class NotFoundError extends HttpError {\n constructor(\n input: { status?: number; message?: string } | string = {},\n ) {\n const {status = HttpStatus.NotFound, message = 'Not Found'} =\n typeof input === 'string' ? {message: input} : input;\n super({status, message});\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,wBAAyB;AAElB,MAAM,sBAAsB,2BAAU;AAAA,EAC3C,YACE,QAAwD,CAAC,GACzD;AACA,UAAM,EAAC,SAAS,6BAAW,UAAU,UAAU,YAAW,IACxD,OAAO,UAAU,WAAW,EAAC,SAAS,MAAK,IAAI;AACjD,UAAM,EAAC,QAAQ,QAAO,CAAC;AAAA,EACzB;AACF;",
6
6
  "names": []
7
7
  }
@@ -23,7 +23,8 @@ module.exports = __toCommonJS(UnauthorizedError_exports);
23
23
  var import_HttpError = require("./HttpError");
24
24
  var import_HttpStatus = require("../codes/HttpStatus");
25
25
  class UnauthorizedError extends import_HttpError.HttpError {
26
- constructor({ status = import_HttpStatus.HttpStatus.Unauthorized, message = "Unauthorized" } = {}) {
26
+ constructor(input = {}) {
27
+ const { status = import_HttpStatus.HttpStatus.Unauthorized, message = "Unauthorized" } = typeof input === "string" ? { message: input } : input;
27
28
  super({ status, message });
28
29
  }
29
30
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/errors/UnauthorizedError.ts"],
4
- "sourcesContent": ["import {HttpError} from './HttpError';\nimport {HttpStatus} from '../codes/HttpStatus';\n\nexport class UnauthorizedError extends HttpError {\n constructor({status = HttpStatus.Unauthorized, message = 'Unauthorized'}: {status?: number, message?: string} = {}) {\n super({status, message});\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,wBAAyB;AAElB,MAAM,0BAA0B,2BAAU;AAAA,EAC7C,YAAY,EAAC,SAAS,6BAAW,cAAc,UAAU,eAAc,IAAyC,CAAC,GAAG;AAChH,UAAM,EAAC,QAAQ,QAAO,CAAC;AAAA,EAC3B;AACJ;",
4
+ "sourcesContent": ["import {HttpError} from './HttpError';\nimport {HttpStatus} from '../codes/HttpStatus';\n\nexport class UnauthorizedError extends HttpError {\n constructor(\n input: { status?: number; message?: string } | string = {},\n ) {\n const {status = HttpStatus.Unauthorized, message = 'Unauthorized'} =\n typeof input === 'string' ? {message: input} : input;\n super({status, message});\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,wBAAyB;AAElB,MAAM,0BAA0B,2BAAU;AAAA,EAC/C,YACE,QAAwD,CAAC,GACzD;AACA,UAAM,EAAC,SAAS,6BAAW,cAAc,UAAU,eAAc,IAC/D,OAAO,UAAU,WAAW,EAAC,SAAS,MAAK,IAAI;AACjD,UAAM,EAAC,QAAQ,QAAO,CAAC;AAAA,EACzB;AACF;",
6
6
  "names": []
7
7
  }
@@ -23,7 +23,6 @@ module.exports = __toCommonJS(IntentSchemeFilter_exports);
23
23
  var import_HttpHeaders = require("../codes/HttpHeaders");
24
24
  var import_simple_boot = require("@dooboostore/simple-boot");
25
25
  var import_simple_boot2 = require("@dooboostore/simple-boot");
26
- var import_simple_boot3 = require("@dooboostore/simple-boot");
27
26
  var import_HttpStatus = require("../codes/HttpStatus");
28
27
  var import_Mimes = require("../codes/Mimes");
29
28
  var import_NotFoundError = require("../errors/NotFoundError");
@@ -88,7 +87,7 @@ let IntentSchemeFilter = class IntentSchemeFilter2 {
88
87
  }
89
88
  };
90
89
  IntentSchemeFilter = __decorate([
91
- import_simple_boot3.Sim,
90
+ import_simple_boot.sim,
92
91
  __metadata("design:paramtypes", [typeof (_a = typeof import_simple_boot2.IntentManager !== "undefined" && import_simple_boot2.IntentManager) === "function" ? _a : Object])
93
92
  ], IntentSchemeFilter);
94
93
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/filters/IntentSchemeFilter.ts"],
4
- "sourcesContent": ["import { Filter } from './Filter';\nimport { HttpHeaders } from '../codes/HttpHeaders';\nimport { Intent } from '@dooboostore/simple-boot';\nimport { IntentManager } from '@dooboostore/simple-boot';\nimport { Sim } from '@dooboostore/simple-boot';\nimport { HttpStatus } from '../codes/HttpStatus';\nimport { RequestResponse } from '../models/RequestResponse';\nimport { SimpleBootHttpServer } from '../SimpleBootHttpServer';\nimport { Mimes } from '../codes/Mimes';\nimport { NotFoundError } from '../errors/NotFoundError';\n\n@Sim\nexport class IntentSchemeFilter implements Filter {\n constructor(private intentManager: IntentManager) {}\n\n async onInit(app: SimpleBootHttpServer) {}\n\n async proceedBefore({ rr, app }: { rr: RequestResponse; app: SimpleBootHttpServer; carrier: Map<string, any> }) {\n // const rr = rrr;\n const url = rr.reqUrl;\n const contentLength = Number(rr.reqHeader(HttpHeaders.ContentLength.toLowerCase() ?? '0'));\n const acceptType = rr.reqHeader(HttpHeaders.Accept);\n const contentType = rr.reqHeader(HttpHeaders.ContentType);\n const intentScheme = rr.reqHeader(HttpHeaders.XSimpleBootSsrIntentScheme);\n if (acceptType === Mimes.ApplicationJsonPostSimpleBootSsrIntentScheme && intentScheme) {\n let intent = new Intent(`${intentScheme}:/${url}`);\n // console.log('---------1--intent request', intentScheme, url, contentLength, contentType );\n // const responseHeader = {} as any;\n // responseHeader[HttpHeaders.ContentType] = Mimes.ApplicationJson;\n if (contentLength > 0) {\n if (contentType.includes(Mimes.ApplicationJson)) {\n intent.data = [await rr.reqBodyJsonData(), rr];\n } else if (contentType.includes(Mimes.MultipartFormData)) {\n intent.data = [await rr.reqBodyMultipartFormDataObject(), rr];\n }\n // console.log('---------2--intent request',intent);\n const { return: rdatas, target } = await this.intentManager.publishMeta(intent);\n if (target.length <= 0) {\n throw new NotFoundError({ message: 'Not found intent target' });\n }\n const rdata = rdatas[0];\n const wdata = rdata instanceof Promise ? await rdata : rdata;\n rr.resStatusCode(HttpStatus.Ok);\n rr.resSetHeader(HttpHeaders.ContentType, [Mimes.ApplicationJson]);\n await rr.resEnd(wdata ? JSON.stringify(wdata) : undefined);\n } else {\n intent.data = rr.reqUrlSearchParamTuples.length > 0 ? [rr.reqUrlSearchParamsObj, rr] : [rr];\n const { return: rdatas, target } = await this.intentManager.publishMeta(intent);\n if (target.length <= 0) {\n throw new NotFoundError({ message: 'Not found intent target' });\n }\n const rdata = rdatas[0];\n const wdata = rdata instanceof Promise ? await rdata : rdata;\n // const wdata =undefined;\n rr.resStatusCode(HttpStatus.Ok);\n rr.resSetHeader(HttpHeaders.ContentType, [Mimes.ApplicationJson]);\n await rr.resEnd(wdata ? JSON.stringify(wdata) : undefined);\n }\n // console.log('---------3--intent request', rr.req.readable, rr.req.readableLength);\n return false;\n } else {\n return true;\n }\n }\n\n async proceedAfter({ rr, app }: { rr: RequestResponse; app: SimpleBootHttpServer; carrier: Map<string, any> }) {\n return true;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AACA,yBAA4B;AAC5B,yBAAuB;AACvB,IAAAA,sBAA8B;AAC9B,IAAAA,sBAAoB;AACpB,wBAA2B;AAG3B,mBAAsB;AACtB,2BAA8B;;;;;;;;;;;AAGvB,IAAM,qBAAN,MAAMC,oBAAkB;EAC7B,YAAoB,eAA4B;AAA5B,SAAA,gBAAA;EAA+B;EAEnD,MAAM,OAAO,KAAyB;EAAG;EAEzC,MAAM,cAAc,EAAE,IAAI,IAAG,GAAiF;AAE5G,UAAM,MAAM,GAAG;AACf,UAAM,gBAAgB,OAAO,GAAG,UAAU,+BAAY,cAAc,YAAW,KAAM,GAAG,CAAC;AACzF,UAAM,aAAa,GAAG,UAAU,+BAAY,MAAM;AAClD,UAAM,c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eAAe,CAAC;AAChE,cAAM,GAAG,OAAO,QAAQ,KAAK,UAAU,KAAK,IAAI,MAAS;MAC3D;AAEA,aAAO;IACT,OAAO;AACL,aAAO;IACT;EACF;EAEA,MAAM,aAAa,EAAE,IAAI,IAAG,GAAiF;AAC3G,WAAO;EACT;;AAvDW,qBAAkB,WAAA;EAD9B;uDAEoC,sCAAa,eAAb,uCAAa,aAAA,KAAA,MAAA,CAAA;GADrC,kBAAkB;",
4
+ "sourcesContent": ["import { Filter } from './Filter';\nimport { HttpHeaders } from '../codes/HttpHeaders';\nimport {Intent, sim} from '@dooboostore/simple-boot';\nimport { IntentManager } from '@dooboostore/simple-boot';\nimport { Sim } from '@dooboostore/simple-boot';\nimport { HttpStatus } from '../codes/HttpStatus';\nimport { RequestResponse } from '../models/RequestResponse';\nimport { SimpleBootHttpServer } from '../SimpleBootHttpServer';\nimport { Mimes } from '../codes/Mimes';\nimport { NotFoundError } from '../errors/NotFoundError';\n\n@sim\nexport class IntentSchemeFilter implements Filter {\n constructor(private intentManager: IntentManager) {}\n\n async onInit(app: SimpleBootHttpServer) {}\n\n async proceedBefore({ rr, app }: { rr: RequestResponse; app: SimpleBootHttpServer; carrier: Map<string, any> }) {\n // const rr = rrr;\n const url = rr.reqUrl;\n const contentLength = Number(rr.reqHeader(HttpHeaders.ContentLength.toLowerCase() ?? '0'));\n const acceptType = rr.reqHeader(HttpHeaders.Accept);\n const contentType = rr.reqHeader(HttpHeaders.ContentType);\n const intentScheme = rr.reqHeader(HttpHeaders.XSimpleBootSsrIntentScheme);\n if (acceptType === Mimes.ApplicationJsonPostSimpleBootSsrIntentScheme && intentScheme) {\n let intent = new Intent(`${intentScheme}:/${url}`);\n // console.log('---------1--intent request', intentScheme, url, contentLength, contentType );\n // const responseHeader = {} as any;\n // responseHeader[HttpHeaders.ContentType] = Mimes.ApplicationJson;\n if (contentLength > 0) {\n if (contentType.includes(Mimes.ApplicationJson)) {\n intent.data = [await rr.reqBodyJsonData(), rr];\n } else if (contentType.includes(Mimes.MultipartFormData)) {\n intent.data = [await rr.reqBodyMultipartFormDataObject(), rr];\n }\n // console.log('---------2--intent request',intent);\n const { return: rdatas, target } = await this.intentManager.publishMeta(intent);\n if (target.length <= 0) {\n throw new NotFoundError({ message: 'Not found intent target' });\n }\n const rdata = rdatas[0];\n const wdata = rdata instanceof Promise ? await rdata : rdata;\n rr.resStatusCode(HttpStatus.Ok);\n rr.resSetHeader(HttpHeaders.ContentType, [Mimes.ApplicationJson]);\n await rr.resEnd(wdata ? JSON.stringify(wdata) : undefined);\n } else {\n intent.data = rr.reqUrlSearchParamTuples.length > 0 ? [rr.reqUrlSearchParamsObj, rr] : [rr];\n const { return: rdatas, target } = await this.intentManager.publishMeta(intent);\n if (target.length <= 0) {\n throw new NotFoundError({ message: 'Not found intent target' });\n }\n const rdata = rdatas[0];\n const wdata = rdata instanceof Promise ? await rdata : rdata;\n // const wdata =undefined;\n rr.resStatusCode(HttpStatus.Ok);\n rr.resSetHeader(HttpHeaders.ContentType, [Mimes.ApplicationJson]);\n await rr.resEnd(wdata ? JSON.stringify(wdata) : undefined);\n }\n // console.log('---------3--intent request', rr.req.readable, rr.req.readableLength);\n return false;\n } else {\n return true;\n }\n }\n\n async proceedAfter({ rr, app }: { rr: RequestResponse; app: SimpleBootHttpServer; carrier: Map<string, any> }) {\n return true;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AACA,yBAA4B;AAC5B,yBAA0B;AAC1B,IAAAA,sBAA8B;AAE9B,wBAA2B;AAG3B,mBAAsB;AACtB,2BAA8B;;;;;;;;;;;AAGvB,IAAM,qBAAN,MAAMC,oBAAkB;EAC7B,YAAoB,eAA4B;AAA5B,SAAA,gBAAA;EAA+B;EAEnD,MAAM,OAAO,KAAyB;EAAG;EAEzC,MAAM,cAAc,EAAE,IAAI,IAAG,GAAiF;AAE5G,UAAM,MAAM,GAAG;AACf,UAAM,gBAAgB,OAAO,GAAG,UAAU,+BAAY,cAAc,Y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