@dooboostore/simple-boot-http-server 1.0.23 → 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 (259) hide show
  1. package/README.md +113 -0
  2. package/dist/cjs/SimpleBootHttpServer.js +80 -40
  3. package/dist/cjs/SimpleBootHttpServer.js.map +3 -3
  4. package/dist/cjs/codes/HttpHeaders.js +14 -3
  5. package/dist/cjs/codes/HttpHeaders.js.map +2 -2
  6. package/dist/cjs/codes/Mimes.js +2 -0
  7. package/dist/cjs/codes/Mimes.js.map +2 -2
  8. package/dist/cjs/decorators/MethodMapping.js +40 -9
  9. package/dist/cjs/decorators/MethodMapping.js.map +3 -3
  10. package/dist/cjs/endpoints/WebSocketEndPoint.js +16 -0
  11. package/dist/cjs/endpoints/WebSocketEndPoint.js.map +7 -0
  12. package/dist/cjs/errors/BadRequestError.js +2 -1
  13. package/dist/cjs/errors/BadRequestError.js.map +2 -2
  14. package/dist/cjs/errors/ForbiddenError.js +2 -1
  15. package/dist/cjs/errors/ForbiddenError.js.map +2 -2
  16. package/dist/cjs/errors/InternalServerError.js +2 -1
  17. package/dist/cjs/errors/InternalServerError.js.map +2 -2
  18. package/dist/cjs/errors/NotFoundError.js +2 -1
  19. package/dist/cjs/errors/NotFoundError.js.map +2 -2
  20. package/dist/cjs/errors/UnauthorizedError.js +2 -1
  21. package/dist/cjs/errors/UnauthorizedError.js.map +2 -2
  22. package/dist/cjs/filters/CacheFilter.js +75 -35
  23. package/dist/cjs/filters/CacheFilter.js.map +3 -3
  24. package/dist/cjs/filters/IntentSchemeFilter.js +97 -0
  25. package/dist/cjs/filters/IntentSchemeFilter.js.map +7 -0
  26. package/dist/cjs/filters/ResourceFilter.js +6 -2
  27. package/dist/cjs/filters/ResourceFilter.js.map +2 -2
  28. package/dist/cjs/filters/TopicProtocolFilter.js +343 -0
  29. package/dist/cjs/filters/TopicProtocolFilter.js.map +7 -0
  30. package/dist/cjs/filters/index.js +5 -1
  31. package/dist/cjs/filters/index.js.map +2 -2
  32. package/dist/cjs/index.js +30 -0
  33. package/dist/cjs/index.js.map +2 -2
  34. package/dist/cjs/inject/InjectSituationType.js +1 -1
  35. package/dist/cjs/inject/InjectSituationType.js.map +2 -2
  36. package/dist/cjs/models/RequestResponse.js +70 -91
  37. package/dist/cjs/models/RequestResponse.js.map +3 -3
  38. package/dist/cjs/models/datas/body/index.js +28 -0
  39. package/dist/cjs/models/datas/body/index.js.map +7 -0
  40. package/dist/cjs/models/datas/index.js +32 -0
  41. package/dist/cjs/models/datas/index.js.map +7 -0
  42. package/dist/cjs/models/datas/path/ReqPathData.js +29 -0
  43. package/dist/cjs/models/datas/path/ReqPathData.js.map +7 -0
  44. package/dist/cjs/models/datas/{search → path}/ReqSearchParamsObj.js.map +1 -1
  45. package/dist/cjs/models/datas/path/index.js +24 -0
  46. package/dist/cjs/models/datas/path/index.js.map +7 -0
  47. package/dist/cjs/models/index.js +4 -16
  48. package/dist/cjs/models/index.js.map +2 -2
  49. package/dist/cjs/models/method/index.js +22 -0
  50. package/dist/cjs/models/method/index.js.map +7 -0
  51. package/dist/cjs/models/method/patch/index.js +22 -0
  52. package/dist/cjs/models/method/patch/index.js.map +7 -0
  53. package/dist/cjs/option/HttpServerOption.js +25 -5
  54. package/dist/cjs/option/HttpServerOption.js.map +2 -2
  55. package/dist/cjs/proxy/SymbolIntentApiServiceProxy.js +144 -0
  56. package/dist/cjs/proxy/SymbolIntentApiServiceProxy.js.map +7 -0
  57. package/dist/cjs/proxy/SymbolIntentApiServiceProxyBase.js +35 -0
  58. package/dist/cjs/proxy/SymbolIntentApiServiceProxyBase.js.map +7 -0
  59. package/dist/cjs/proxy/TopicProtocolApiServiceProxy.js +324 -0
  60. package/dist/cjs/proxy/TopicProtocolApiServiceProxy.js.map +7 -0
  61. package/dist/cjs/proxy/index.js +26 -0
  62. package/dist/cjs/proxy/index.js.map +7 -0
  63. package/dist/cjs/resolvers/ResourceResolver.js +2 -2
  64. package/dist/cjs/resolvers/ResourceResolver.js.map +2 -2
  65. package/dist/cjs/session/SessionManager.js +2 -2
  66. package/dist/cjs/session/SessionManager.js.map +2 -2
  67. package/dist/cjs/websocket/WebSocketClient.js +554 -0
  68. package/dist/cjs/websocket/WebSocketClient.js.map +7 -0
  69. package/dist/cjs/websocket/WebSocketManager.js +652 -0
  70. package/dist/cjs/websocket/WebSocketManager.js.map +7 -0
  71. package/dist/cjs/websocket/index.js +24 -0
  72. package/dist/cjs/websocket/index.js.map +7 -0
  73. package/dist/esm/SimpleBootHttpServer.js +60 -20
  74. package/dist/esm/SimpleBootHttpServer.js.map +2 -2
  75. package/dist/esm/codes/HttpHeaders.js +12 -2
  76. package/dist/esm/codes/HttpHeaders.js.map +2 -2
  77. package/dist/esm/codes/Mimes.js +2 -0
  78. package/dist/esm/codes/Mimes.js.map +2 -2
  79. package/dist/esm/decorators/MethodMapping.js +24 -3
  80. package/dist/esm/decorators/MethodMapping.js.map +2 -2
  81. package/dist/esm/endpoints/WebSocketEndPoint.js +1 -0
  82. package/dist/esm/endpoints/WebSocketEndPoint.js.map +7 -0
  83. package/dist/esm/errors/BadRequestError.js +2 -1
  84. package/dist/esm/errors/BadRequestError.js.map +2 -2
  85. package/dist/esm/errors/ForbiddenError.js +2 -1
  86. package/dist/esm/errors/ForbiddenError.js.map +2 -2
  87. package/dist/esm/errors/InternalServerError.js +2 -1
  88. package/dist/esm/errors/InternalServerError.js.map +2 -2
  89. package/dist/esm/errors/NotFoundError.js +2 -1
  90. package/dist/esm/errors/NotFoundError.js.map +2 -2
  91. package/dist/esm/errors/UnauthorizedError.js +2 -1
  92. package/dist/esm/errors/UnauthorizedError.js.map +2 -2
  93. package/dist/esm/filters/CacheFilter.js +67 -27
  94. package/dist/esm/filters/CacheFilter.js.map +2 -2
  95. package/dist/esm/filters/IntentSchemeFilter.js +74 -0
  96. package/dist/esm/filters/IntentSchemeFilter.js.map +7 -0
  97. package/dist/esm/filters/ResourceFilter.js +6 -2
  98. package/dist/esm/filters/ResourceFilter.js.map +2 -2
  99. package/dist/esm/filters/TopicProtocolFilter.js +310 -0
  100. package/dist/esm/filters/TopicProtocolFilter.js.map +7 -0
  101. package/dist/esm/filters/index.js +2 -0
  102. package/dist/esm/filters/index.js.map +2 -2
  103. package/dist/esm/index.js +13 -0
  104. package/dist/esm/index.js.map +2 -2
  105. package/dist/esm/inject/InjectSituationType.js +1 -1
  106. package/dist/esm/inject/InjectSituationType.js.map +2 -2
  107. package/dist/esm/models/RequestResponse.js +65 -86
  108. package/dist/esm/models/RequestResponse.js.map +2 -2
  109. package/dist/esm/models/datas/body/index.js +5 -0
  110. package/dist/esm/models/datas/body/index.js.map +7 -0
  111. package/dist/esm/models/datas/index.js +7 -0
  112. package/dist/esm/models/datas/index.js.map +7 -0
  113. package/dist/esm/models/datas/path/ReqPathData.js +6 -0
  114. package/dist/esm/models/datas/path/ReqPathData.js.map +7 -0
  115. package/dist/esm/models/datas/{search → path}/ReqSearchParamsObj.js.map +1 -1
  116. package/dist/esm/models/datas/path/index.js +3 -0
  117. package/dist/esm/models/datas/path/index.js.map +7 -0
  118. package/dist/esm/models/index.js +2 -8
  119. package/dist/esm/models/index.js.map +2 -2
  120. package/dist/esm/models/method/index.js +2 -0
  121. package/dist/esm/models/method/index.js.map +7 -0
  122. package/dist/esm/models/method/patch/index.js +2 -0
  123. package/dist/esm/models/method/patch/index.js.map +7 -0
  124. package/dist/esm/option/HttpServerOption.js +24 -4
  125. package/dist/esm/option/HttpServerOption.js.map +2 -2
  126. package/dist/esm/proxy/SymbolIntentApiServiceProxy.js +121 -0
  127. package/dist/esm/proxy/SymbolIntentApiServiceProxy.js.map +7 -0
  128. package/dist/esm/proxy/SymbolIntentApiServiceProxyBase.js +12 -0
  129. package/dist/esm/proxy/SymbolIntentApiServiceProxyBase.js.map +7 -0
  130. package/dist/esm/proxy/TopicProtocolApiServiceProxy.js +301 -0
  131. package/dist/esm/proxy/TopicProtocolApiServiceProxy.js.map +7 -0
  132. package/dist/esm/proxy/index.js +4 -0
  133. package/dist/esm/proxy/index.js.map +7 -0
  134. package/dist/esm/resolvers/ResourceResolver.js +1 -1
  135. package/dist/esm/resolvers/ResourceResolver.js.map +1 -1
  136. package/dist/esm/session/SessionManager.js +1 -1
  137. package/dist/esm/session/SessionManager.js.map +1 -1
  138. package/dist/esm/websocket/WebSocketClient.js +529 -0
  139. package/dist/esm/websocket/WebSocketClient.js.map +7 -0
  140. package/dist/esm/websocket/WebSocketManager.js +622 -0
  141. package/dist/esm/websocket/WebSocketManager.js.map +7 -0
  142. package/dist/esm/websocket/index.js +3 -0
  143. package/dist/esm/websocket/index.js.map +7 -0
  144. package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js +18209 -5299
  145. package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js.map +4 -4
  146. package/dist/types/SimpleBootHttpServer.d.ts +5 -3
  147. package/dist/types/SimpleBootHttpServer.d.ts.map +1 -1
  148. package/dist/types/codes/HttpHeaders.d.ts +3 -0
  149. package/dist/types/codes/HttpHeaders.d.ts.map +1 -1
  150. package/dist/types/codes/Mimes.d.ts +3 -1
  151. package/dist/types/codes/Mimes.d.ts.map +1 -1
  152. package/dist/types/decorators/MethodMapping.d.ts +13 -2
  153. package/dist/types/decorators/MethodMapping.d.ts.map +1 -1
  154. package/dist/types/endpoints/WebSocketEndPoint.d.ts +17 -0
  155. package/dist/types/endpoints/WebSocketEndPoint.d.ts.map +1 -0
  156. package/dist/types/errors/BadRequestError.d.ts +2 -2
  157. package/dist/types/errors/BadRequestError.d.ts.map +1 -1
  158. package/dist/types/errors/ForbiddenError.d.ts +2 -2
  159. package/dist/types/errors/ForbiddenError.d.ts.map +1 -1
  160. package/dist/types/errors/InternalServerError.d.ts +2 -2
  161. package/dist/types/errors/InternalServerError.d.ts.map +1 -1
  162. package/dist/types/errors/NotFoundError.d.ts +2 -2
  163. package/dist/types/errors/NotFoundError.d.ts.map +1 -1
  164. package/dist/types/errors/UnauthorizedError.d.ts +2 -2
  165. package/dist/types/errors/UnauthorizedError.d.ts.map +1 -1
  166. package/dist/types/filters/CacheFilter.d.ts +6 -0
  167. package/dist/types/filters/CacheFilter.d.ts.map +1 -1
  168. package/dist/types/filters/IntentSchemeFilter.d.ts +20 -0
  169. package/dist/types/filters/IntentSchemeFilter.d.ts.map +1 -0
  170. package/dist/types/filters/ResourceFilter.d.ts.map +1 -1
  171. package/dist/types/filters/TopicProtocolFilter.d.ts +34 -0
  172. package/dist/types/filters/TopicProtocolFilter.d.ts.map +1 -0
  173. package/dist/types/filters/index.d.ts +2 -0
  174. package/dist/types/filters/index.d.ts.map +1 -1
  175. package/dist/types/index.d.ts +13 -0
  176. package/dist/types/index.d.ts.map +1 -1
  177. package/dist/types/inject/InjectSituationType.d.ts.map +1 -1
  178. package/dist/types/models/RequestResponse.d.ts +12 -7
  179. package/dist/types/models/RequestResponse.d.ts.map +1 -1
  180. package/dist/types/models/datas/body/index.d.ts +5 -0
  181. package/dist/types/models/datas/body/index.d.ts.map +1 -0
  182. package/dist/types/models/datas/index.d.ts +7 -0
  183. package/dist/types/models/datas/index.d.ts.map +1 -0
  184. package/dist/types/models/datas/path/ReqPathData.d.ts +4 -0
  185. package/dist/types/models/datas/path/ReqPathData.d.ts.map +1 -0
  186. package/dist/types/models/datas/path/ReqSearchParamsObj.d.ts.map +1 -0
  187. package/dist/types/models/datas/path/index.d.ts +3 -0
  188. package/dist/types/models/datas/path/index.d.ts.map +1 -0
  189. package/dist/types/models/index.d.ts +2 -8
  190. package/dist/types/models/index.d.ts.map +1 -1
  191. package/dist/types/models/method/index.d.ts +2 -0
  192. package/dist/types/models/method/index.d.ts.map +1 -0
  193. package/dist/types/models/method/patch/index.d.ts +2 -0
  194. package/dist/types/models/method/patch/index.d.ts.map +1 -0
  195. package/dist/types/option/HttpServerOption.d.ts +30 -20
  196. package/dist/types/option/HttpServerOption.d.ts.map +1 -1
  197. package/dist/types/proxy/SymbolIntentApiServiceProxy.d.ts +16 -0
  198. package/dist/types/proxy/SymbolIntentApiServiceProxy.d.ts.map +1 -0
  199. package/dist/types/proxy/SymbolIntentApiServiceProxyBase.d.ts +5 -0
  200. package/dist/types/proxy/SymbolIntentApiServiceProxyBase.d.ts.map +1 -0
  201. package/dist/types/proxy/TopicProtocolApiServiceProxy.d.ts +28 -0
  202. package/dist/types/proxy/TopicProtocolApiServiceProxy.d.ts.map +1 -0
  203. package/dist/types/proxy/index.d.ts +4 -0
  204. package/dist/types/proxy/index.d.ts.map +1 -0
  205. package/dist/types/session/SessionManager.d.ts +2 -17
  206. package/dist/types/session/SessionManager.d.ts.map +1 -1
  207. package/dist/types/websocket/WebSocketClient.d.ts +88 -0
  208. package/dist/types/websocket/WebSocketClient.d.ts.map +1 -0
  209. package/dist/types/websocket/WebSocketManager.d.ts +163 -0
  210. package/dist/types/websocket/WebSocketManager.d.ts.map +1 -0
  211. package/dist/types/websocket/index.d.ts +3 -0
  212. package/dist/types/websocket/index.d.ts.map +1 -0
  213. package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js +18108 -5198
  214. package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js.map +4 -4
  215. package/dist/umd-bundle/websocket-client.umd.js +11374 -0
  216. package/dist/umd-bundle/websocket-client.umd.js.map +7 -0
  217. package/package.json +24 -15
  218. package/src/SimpleBootHttpServer.ts +367 -313
  219. package/src/codes/HttpHeaders.ts +13 -2
  220. package/src/codes/Mimes.ts +27 -25
  221. package/src/decorators/MethodMapping.ts +17 -4
  222. package/src/endpoints/WebSocketEndPoint.ts +12 -0
  223. package/src/errors/BadRequestError.ts +7 -3
  224. package/src/errors/ForbiddenError.ts +7 -3
  225. package/src/errors/InternalServerError.ts +7 -3
  226. package/src/errors/NotFoundError.ts +7 -3
  227. package/src/errors/UnauthorizedError.ts +7 -3
  228. package/src/filters/CacheFilter.ts +112 -67
  229. package/src/filters/IntentSchemeFilter.ts +69 -0
  230. package/src/filters/ResourceFilter.ts +10 -2
  231. package/src/filters/TopicProtocolFilter.ts +349 -0
  232. package/src/filters/index.ts +2 -0
  233. package/src/index.ts +13 -12
  234. package/src/inject/InjectSituationType.ts +1 -1
  235. package/src/models/RequestResponse.ts +136 -242
  236. package/src/models/datas/body/index.ts +4 -0
  237. package/src/models/datas/index.ts +6 -0
  238. package/src/models/datas/path/ReqPathData.ts +3 -0
  239. package/src/models/datas/path/index.ts +2 -0
  240. package/src/models/index.ts +2 -8
  241. package/src/models/method/index.ts +1 -0
  242. package/src/models/method/patch/index.ts +1 -0
  243. package/src/option/HttpServerOption.ts +73 -23
  244. package/src/proxy/SymbolIntentApiServiceProxy.ts +126 -0
  245. package/src/proxy/SymbolIntentApiServiceProxyBase.ts +16 -0
  246. package/src/proxy/TopicProtocolApiServiceProxy.ts +328 -0
  247. package/src/proxy/index.ts +3 -0
  248. package/src/resolvers/ResourceResolver.ts +1 -1
  249. package/src/session/SessionManager.ts +3 -3
  250. package/src/websocket/WebSocketClient.ts +637 -0
  251. package/src/websocket/WebSocketManager.ts +713 -0
  252. package/src/websocket/index.ts +2 -0
  253. package/tsconfig.json +3 -1
  254. package/README.MD +0 -36
  255. package/dist/types/models/datas/search/ReqSearchParamsObj.d.ts.map +0 -1
  256. /package/dist/cjs/models/datas/{search → path}/ReqSearchParamsObj.js +0 -0
  257. /package/dist/esm/models/datas/{search → path}/ReqSearchParamsObj.js +0 -0
  258. /package/dist/types/models/datas/{search → path}/ReqSearchParamsObj.d.ts +0 -0
  259. /package/src/models/datas/{search → path}/ReqSearchParamsObj.ts +0 -0
@@ -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,23 +50,31 @@ __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
- var import_ReflectUtils = require("@dooboostore/core/reflect/ReflectUtils");
63
+ var import_core2 = require("@dooboostore/core");
54
64
  var import_HttpMethod = require("../codes/HttpMethod");
55
65
  var UrlMappingSituationType = /* @__PURE__ */ ((UrlMappingSituationType2) => {
56
66
  UrlMappingSituationType2["REQ_JSON_BODY"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_JSON_BODY";
67
+ UrlMappingSituationType2["REQ_PATH_DATA"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_PATH_DATA";
57
68
  UrlMappingSituationType2["REQ_URL_SEARCH_PARAMS_OBJ"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_URL_SEARCH_PARAMS_OBJ";
58
69
  UrlMappingSituationType2["REQ_FORM_URL_BODY"] = "SIMPLE_BOOT_HTTP_SERVER://URLMAPPING/REQ_FORM_URL_BODY";
59
70
  return UrlMappingSituationType2;
60
71
  })(UrlMappingSituationType || {});
61
- const MappingMetadataKey = Symbol("MappingMetadataKey");
72
+ const MappingMetadataKey = Symbol.for("simple-boot-http-server:mapping-metadata");
62
73
  const process = (config, target, propertyKey, descriptor) => {
63
- const saveMappingConfigs = import_ReflectUtils.ReflectUtils.getMetadata(MappingMetadataKey, target.constructor) ?? [];
74
+ const saveMappingConfigs = import_core2.ReflectUtils.getMetadata(MappingMetadataKey, target.constructor) ?? [];
64
75
  saveMappingConfigs.push({ propertyKey, config });
65
- import_ReflectUtils.ReflectUtils.defineMetadata(MappingMetadataKey, saveMappingConfigs, target.constructor);
66
- import_ReflectUtils.ReflectUtils.defineMetadata(MappingMetadataKey, config, target, propertyKey);
76
+ import_core2.ReflectUtils.defineMetadata(MappingMetadataKey, saveMappingConfigs, target.constructor);
77
+ import_core2.ReflectUtils.defineMetadata(MappingMetadataKey, config, target, propertyKey);
67
78
  };
68
79
  function UrlMapping(configOrtarget, propertyKey, descriptor) {
69
80
  if (propertyKey && descriptor) {
@@ -75,13 +86,13 @@ function UrlMapping(configOrtarget, propertyKey, descriptor) {
75
86
  }
76
87
  }
77
88
  const getUrlMapping = (target, propertyKey) => {
78
- return import_ReflectUtils.ReflectUtils.getMetadata(MappingMetadataKey, target, propertyKey);
89
+ return import_core2.ReflectUtils.getMetadata(MappingMetadataKey, target, propertyKey);
79
90
  };
80
91
  const getUrlMappings = (target) => {
81
92
  if (target !== null && void 0 !== target && typeof target === "object") {
82
93
  target = target.constructor;
83
94
  }
84
- return import_ReflectUtils.ReflectUtils.getMetadata(MappingMetadataKey, target);
95
+ return import_core2.ReflectUtils.getMetadata(MappingMetadataKey, target);
85
96
  };
86
97
  function GET(configOrTarget, propertyKey, descriptor) {
87
98
  if (propertyKey && descriptor) {
@@ -227,6 +238,16 @@ const getCONNECT = (target, propertyKey) => {
227
238
  const getCONNECTS = (target) => {
228
239
  return getUrlMappings(target)?.filter((it) => it.config?.method.toUpperCase() === import_HttpMethod.HttpMethod.CONNECT);
229
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;
230
251
  // Annotate the CommonJS export names for ESM import in node:
231
252
  0 && (module.exports = {
232
253
  CONNECT,
@@ -240,6 +261,8 @@ const getCONNECTS = (target) => {
240
261
  TRACE,
241
262
  UrlMapping,
242
263
  UrlMappingSituationType,
264
+ connectMethod,
265
+ deleteMethod,
243
266
  getCONNECT,
244
267
  getCONNECTS,
245
268
  getDELETE,
@@ -248,6 +271,7 @@ const getCONNECTS = (target) => {
248
271
  getGETS,
249
272
  getHEAD,
250
273
  getHEADS,
274
+ getMethod,
251
275
  getOPTIONS,
252
276
  getOPTIONSS,
253
277
  getPATCH,
@@ -259,6 +283,13 @@ const getCONNECTS = (target) => {
259
283
  getTRACE,
260
284
  getTRACES,
261
285
  getUrlMapping,
262
- getUrlMappings
286
+ getUrlMappings,
287
+ headMethod,
288
+ optionsMethod,
289
+ patchMethod,
290
+ postMethod,
291
+ putMethod,
292
+ traceMethod,
293
+ urlMapping
263
294
  });
264
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/types';\nimport { ReflectMethod } from '@dooboostore/simple-boot/types/Types';\nimport { ReflectUtils } from '@dooboostore/core/reflect/ReflectUtils';\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_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
-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AAW;AACnC,cAAQ,gBAAgB,QAAQD,cAAaC,WAAU;AAAA,IAC3D;AAAA,EACJ;AACJ;AAEO,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;",
6
- "names": ["UrlMappingSituationType", "propertyKey", "descriptor"]
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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c;AACpB,MAAM,YAAY;AAClB,MAAM,eAAe;AACrB,MAAM,gBAAgB;AACtB,MAAM,aAAa;AACnB,MAAM,cAAc;AACpB,MAAM,gBAAgB;",
6
+ "names": ["import_core", "UrlMappingSituationType", "propertyKey", "descriptor"]
7
7
  }
@@ -0,0 +1,16 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var WebSocketEndPoint_exports = {};
15
+ module.exports = __toCommonJS(WebSocketEndPoint_exports);
16
+ //# sourceMappingURL=WebSocketEndPoint.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/endpoints/WebSocketEndPoint.ts"],
4
+ "sourcesContent": ["import { RawData, WebSocket } from 'ws';\nimport { IncomingMessage } from 'http';\n\nexport type WebSocketSet ={ socket: WebSocket, request: IncomingMessage };\nexport interface WebSocketEndPoint {\n\n connect?(wsSet: WebSocketSet): void;\n ping?(wsSet: WebSocketSet): void;\n close?(wsSet: WebSocketSet): void;\n message(wsSet: WebSocketSet, data: {data: RawData, isBinary: boolean}): void;\n error?(wsSet: WebSocketSet, error: Error): void;\n}"],
5
+ "mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
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
  }
@@ -20,17 +20,20 @@ __export(CacheFilter_exports, {
20
20
  CacheFilter: () => CacheFilter
21
21
  });
22
22
  module.exports = __toCommonJS(CacheFilter_exports);
23
- var import_FileUtils = require("@dooboostore/core-node/file/FileUtils");
24
- var import_ConvertUtils = require("@dooboostore/core-node/convert/ConvertUtils");
25
- var import_RandomUtils = require("@dooboostore/core/random/RandomUtils");
23
+ var import_core_node = require("@dooboostore/core-node");
24
+ var import_core_node2 = require("@dooboostore/core-node");
25
+ var import_core = require("@dooboostore/core");
26
26
  class CacheFilter {
27
27
  constructor(config) {
28
28
  this.config = config;
29
29
  this.storage = /* @__PURE__ */ new Map();
30
30
  if (config.config.cacheDir && config.config.startUpClean) {
31
- import_FileUtils.FileUtils.deleteSync(config.config.cacheDir, { options: { recursive: true } });
31
+ import_core_node.FileUtils.deleteSync(config.config.cacheDir, { options: { recursive: true } });
32
32
  }
33
33
  }
34
+ static {
35
+ this.SYMBOL = Symbol.for("CacheFilter");
36
+ }
34
37
  static {
35
38
  this.CARRIER_KEY_NAME = "_CARRIER_CACHE_FILTER_KEY_NAME";
36
39
  }
@@ -41,34 +44,15 @@ class CacheFilter {
41
44
  if (!filter) {
42
45
  return true;
43
46
  }
44
- if (this.config.config.cacheDir) {
45
- import_FileUtils.FileUtils.mkdirSync(this.config.config.cacheDir, { recursive: true });
46
- }
47
- if (!this.cacheConfig && this.config.config.cacheDir) {
48
- try {
49
- this.cacheConfig = JSON.parse(import_ConvertUtils.ConvertUtils.toString(import_FileUtils.FileUtils.readSync([this.config.config.cacheDir, "cacheConfig.json"], { option: { encoding: "utf-8" } })));
50
- } catch (e) {
51
- }
52
- }
53
- const date = (/* @__PURE__ */ new Date()).toISOString();
54
- this.cacheConfig ??= {
55
- createDate: date,
56
- updateDate: date,
57
- // accessDate: date,
58
- caches: {}
59
- };
60
- this.cacheConfig.createDate ??= date;
61
- this.cacheConfig.updateDate ??= date;
62
- this.cacheConfig.caches ??= {};
47
+ this.initCacheConfig();
63
48
  const rkey = this.config.key(rr, app);
64
49
  const sessionData = { key: rkey.key, lifeTime: rkey.lifeTime ?? this.config.config.lifeTime, isUpdate: false, responseHeaders: rkey.responseHeaders };
65
50
  const cache = this.cacheConfig.caches[sessionData.key];
66
51
  if (cache) {
67
- const existes = this.config.config.cacheDir ? import_FileUtils.FileUtils.existsSync(cache.path) : this.storage.has(cache.path);
52
+ const existes = this.config.config.cacheDir ? import_core_node.FileUtils.existsSync(cache.path) : this.storage.has(cache.path);
68
53
  const diffTime = Date.now() - cache.createTime;
69
54
  if (!existes || diffTime > cache.lifeTime) {
70
- delete this.cacheConfig[sessionData.key];
71
- this.deleteChunk(cache.path);
55
+ this.clear(sessionData.key);
72
56
  sessionData.isUpdate = true;
73
57
  } else {
74
58
  rr.resSetHeaders({
@@ -88,29 +72,87 @@ class CacheFilter {
88
72
  carrier.set(CacheFilter.CARRIER_KEY_NAME, sessionData);
89
73
  return sessionData.isUpdate;
90
74
  }
75
+ async refresh(path2, app) {
76
+ this.clear(path2);
77
+ const url = `${app.option.protocol}://${app.option.hostname}:${app.option.port}${path2}`;
78
+ try {
79
+ await fetch(url, {
80
+ method: "GET",
81
+ headers: {
82
+ "x-cache-force-refresh": "true",
83
+ "User-Agent": "SimpleBootHttpServer-Internal-Refresh"
84
+ }
85
+ });
86
+ } catch (e) {
87
+ console.error("CacheFilter.refresh fetch error:", e);
88
+ }
89
+ }
90
+ clear(key) {
91
+ this.initCacheConfig();
92
+ const cache = this.cacheConfig.caches[key];
93
+ if (cache) {
94
+ this.deleteChunk(cache.path);
95
+ delete this.cacheConfig.caches[key];
96
+ this.saveCacheConfig();
97
+ }
98
+ }
99
+ clearAll() {
100
+ this.initCacheConfig();
101
+ Object.keys(this.cacheConfig.caches).forEach((key) => {
102
+ this.deleteChunk(this.cacheConfig.caches[key].path);
103
+ });
104
+ this.cacheConfig.caches = {};
105
+ this.saveCacheConfig();
106
+ }
107
+ initCacheConfig() {
108
+ if (this.config.config.cacheDir) {
109
+ import_core_node.FileUtils.mkdirSync(this.config.config.cacheDir, { recursive: true });
110
+ }
111
+ if (!this.cacheConfig && this.config.config.cacheDir) {
112
+ try {
113
+ this.cacheConfig = JSON.parse(import_core_node2.ConvertUtils.toString(import_core_node.FileUtils.readSync([this.config.config.cacheDir, "cacheConfig.json"], { option: { encoding: "utf-8" } })));
114
+ } catch (e) {
115
+ }
116
+ }
117
+ const date = (/* @__PURE__ */ new Date()).toISOString();
118
+ this.cacheConfig ??= {
119
+ createDate: date,
120
+ updateDate: date,
121
+ // accessDate: date,
122
+ caches: {}
123
+ };
124
+ this.cacheConfig.createDate ??= date;
125
+ this.cacheConfig.updateDate ??= date;
126
+ this.cacheConfig.caches ??= {};
127
+ }
128
+ saveCacheConfig() {
129
+ if (this.config.config.cacheDir && this.cacheConfig) {
130
+ import_core_node.FileUtils.write(JSON.stringify(this.cacheConfig), { path: [this.config.config.cacheDir, "cacheConfig.json"] });
131
+ }
132
+ }
91
133
  deleteChunk(path2) {
92
- if (this.config.config.cacheDir && import_FileUtils.FileUtils.existsSync(path2)) {
93
- import_FileUtils.FileUtils.deleteFileSync(path2);
134
+ if (this.config.config.cacheDir && import_core_node.FileUtils.existsSync(path2)) {
135
+ import_core_node.FileUtils.deleteFileSync(path2);
94
136
  } else if (this.storage.has(path2)) {
95
137
  this.storage.delete(path2);
96
138
  }
97
139
  }
98
140
  getChunk(path2) {
99
- return this.config.config.cacheDir ? import_FileUtils.FileUtils.readSync(path2) : this.storage.get(path2);
141
+ return this.config.config.cacheDir ? import_core_node.FileUtils.readSync(path2) : this.storage.get(path2);
100
142
  }
101
143
  async proceedAfter({ rr, app, carrier }) {
102
144
  const sessionData = carrier.get(CacheFilter.CARRIER_KEY_NAME);
103
145
  if (sessionData && sessionData.isUpdate) {
104
146
  try {
105
147
  if (this.config.config.cacheDir) {
106
- import_FileUtils.FileUtils.mkdirSync([this.config.config.cacheDir, "caches"], { recursive: true });
148
+ import_core_node.FileUtils.mkdirSync([this.config.config.cacheDir, "caches"], { recursive: true });
107
149
  }
108
150
  const resBody = rr.resBodyData();
109
151
  if (!resBody) {
110
152
  return true;
111
153
  }
112
154
  let p = void 0;
113
- const destFileUUID = import_RandomUtils.RandomUtils.uuid4();
155
+ const destFileUUID = import_core.RandomUtils.uuid4();
114
156
  p = this.writeChunk(destFileUUID, resBody);
115
157
  const updateDateNow = Date.now();
116
158
  const updateDate = new Date(updateDateNow).toISOString();
@@ -126,9 +168,7 @@ class CacheFilter {
126
168
  lifeTime: sessionData.lifeTime,
127
169
  responseHeader: responseHeaders
128
170
  };
129
- if (this.config.config.cacheDir) {
130
- import_FileUtils.FileUtils.write(JSON.stringify(this.cacheConfig), { path: [this.config.config.cacheDir, "cacheConfig.json"] });
131
- }
171
+ this.saveCacheConfig();
132
172
  } catch (e) {
133
173
  console.log("---", e);
134
174
  }
@@ -137,7 +177,7 @@ class CacheFilter {
137
177
  }
138
178
  writeChunk(destFileUUID, resBody) {
139
179
  if (this.config.config.cacheDir) {
140
- return import_FileUtils.FileUtils.write(resBody, { path: [this.config.config.cacheDir, "caches", destFileUUID] });
180
+ return import_core_node.FileUtils.write(resBody, { path: [this.config.config.cacheDir, "caches", destFileUUID] });
141
181
  } else {
142
182
  this.storage.set(destFileUUID, resBody);
143
183
  return destFileUUID;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/filters/CacheFilter.ts"],
4
- "sourcesContent": ["import { Filter } from '../filters/Filter';\nimport { HttpStatus } from '../codes/HttpStatus';\nimport { RequestResponse } from '../models/RequestResponse';\nimport { SimpleBootHttpServer } from '../SimpleBootHttpServer';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { FileUtils } from '@dooboostore/core-node/file/FileUtils';\nimport { ConvertUtils } from '@dooboostore/core-node/convert/ConvertUtils';\nimport { RandomUtils } from '@dooboostore/core/random/RandomUtils';\n\nexport type CacheFilterSessionType = { key: string, lifeTime: number, isUpdate: boolean, responseHeaders?: string[] };\n\ntype CacheConfigCacheItemType = { path: string, createTime: number, lifeTime: number, responseHeader: { [key: string]: string | number | string[] } };\n\ntype KeyAndConfig = { key: string, lifeTime?: number, responseHeaders?: string[] } ;\n\nexport class CacheFilter implements Filter {\n public static readonly CARRIER_KEY_NAME = '_CARRIER_CACHE_FILTER_KEY_NAME';\n private storage = new Map<string, string | Buffer>();\n private cacheConfig: {\n createDate: string;\n updateDate: string;\n caches: { [key: string]: CacheConfigCacheItemType }\n }\n\n constructor(private config: {\n config: {\n cacheDir?: string;\n lifeTime: number;\n startUpClean?: boolean;\n },\n filter?: (rr: RequestResponse, app: SimpleBootHttpServer) => boolean;\n key: (rr: RequestResponse, app: SimpleBootHttpServer) => KeyAndConfig;\n }) {\n\n if (config.config.cacheDir && config.config.startUpClean) {\n FileUtils.deleteSync(config.config.cacheDir, {options: {recursive: true}});\n }\n }\n\n async onInit(app: SimpleBootHttpServer) {\n }\n\n async proceedBefore({rr, app, carrier}: {rr: RequestResponse, app: SimpleBootHttpServer, carrier: Map<string, any>}) {\n // this.key = undefined;\n // this.lifeTime = undefined;\n // this.isUpdate = false;\n const filter = this.config.filter?.(rr,app);\n if (!filter) {\n return true;\n }\n if (this.config.config.cacheDir) {\n FileUtils.mkdirSync(this.config.config.cacheDir, {recursive: true});\n }\n if (!this.cacheConfig && this.config.config.cacheDir) {\n try {\n this.cacheConfig = JSON.parse(ConvertUtils.toString(FileUtils.readSync([this.config.config.cacheDir, 'cacheConfig.json'], { option: {encoding: 'utf-8'}})));\n } catch (e) {\n }\n }\n const date = new Date().toISOString();\n this.cacheConfig ??= {\n createDate: date,\n updateDate: date,\n // accessDate: date,\n caches: {}\n };\n this.cacheConfig.createDate ??= date;\n this.cacheConfig.updateDate ??= date;\n // this.cacheConfig.accessDate ??= date;\n this.cacheConfig.caches ??= {};\n\n\n const rkey = this.config.key(rr, app);\n // console.log('--path filter', rr.reqMethod(), rr.reqUrlPathName, filter, rkey)\n const sessionData: CacheFilterSessionType = {key: rkey.key, lifeTime: rkey.lifeTime ?? this.config.config.lifeTime, isUpdate: false, responseHeaders: rkey.responseHeaders};\n\n\n const cache = this.cacheConfig.caches[sessionData.key];\n if (cache) {\n const existes = this.config.config.cacheDir ? FileUtils.existsSync(cache.path) : this.storage.has(cache.path);\n const diffTime = Date.now() - cache.createTime;\n if (!existes || diffTime > cache.lifeTime) {\n delete this.cacheConfig[sessionData.key];\n this.deleteChunk(cache.path);\n sessionData.isUpdate = true;\n } else {\n rr.resSetHeaders({\n ...cache.responseHeader,\n cacheFilter: `true;remainTime=${cache.lifeTime - diffTime}`\n });\n // console.log('chunk--->', cache.path);\n try {\n const chunk = this.getChunk(cache.path);\n // console.log('chunk--->', chunk);\n await rr.resEnd(chunk);\n } catch (e) {\n console.log('--------e', e)\n }\n }\n } else {\n sessionData.isUpdate = true;\n }\n carrier.set(CacheFilter.CARRIER_KEY_NAME, sessionData);\n return sessionData.isUpdate;\n }\n\n private deleteChunk(path: string) {\n if (this.config.config.cacheDir && FileUtils.existsSync(path)) {\n FileUtils.deleteFileSync(path);\n } else if (this.storage.has(path)) {\n this.storage.delete(path);\n }\n }\n\n private getChunk(path: string) {\n return this.config.config.cacheDir ? FileUtils.readSync(path) : this.storage.get(path);\n }\n\n async proceedAfter({rr, app, carrier}: {rr: RequestResponse, app: SimpleBootHttpServer, carrier: Map<string, any>}) {\n // const data = await rr.resBodyStringData()\n const sessionData = carrier.get(CacheFilter.CARRIER_KEY_NAME) as CacheFilterSessionType ;\n if (sessionData && sessionData.isUpdate) {\n try {\n if (this.config.config.cacheDir) {\n FileUtils.mkdirSync([this.config.config.cacheDir, 'caches'], {recursive: true});\n }\n const resBody = rr.resBodyData();\n if (!resBody) {\n return true;\n }\n let p: string | undefined = undefined;\n const destFileUUID = RandomUtils.uuid4();\n p = this.writeChunk(destFileUUID, resBody);\n const updateDateNow = Date.now();\n const updateDate = new Date(updateDateNow).toISOString();\n this.cacheConfig.createDate ??= updateDate;\n this.cacheConfig.updateDate = updateDate;\n const responseHeaders: {[key: string]: string | number | string[]} = {}\n sessionData.responseHeaders?.map(it=>it.toLowerCase()).forEach(it => {\n responseHeaders[it] = rr.resHeader(it);\n })\n this.cacheConfig.caches[sessionData.key] = {\n path: p,\n createTime: updateDateNow,\n lifeTime: sessionData.lifeTime,\n responseHeader: responseHeaders\n };\n\n if (this.config.config.cacheDir) {\n FileUtils.write(JSON.stringify(this.cacheConfig), {path: [this.config.config.cacheDir, 'cacheConfig.json']});\n }\n } catch (e) {\n console.log('---', e)\n }\n }\n\n return true;\n }\n\n private writeChunk(destFileUUID: string, resBody: string | Buffer ) {\n if (this.config.config.cacheDir) {\n return FileUtils.write(resBody, {path: [this.config.config.cacheDir, 'caches', destFileUUID]});\n } else {\n this.storage.set(destFileUUID, resBody);\n return destFileUUID;\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,uBAA2B;AAC3B,0BAA6B;AAC7B,yBAA4B;AAQrB,MAAM,YAA8B;AAAA,EAS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;AAAA,EACF;AACF;",
6
- "names": ["path"]
4
+ "sourcesContent": ["import { Filter } from '../filters/Filter';\nimport { HttpStatus } from '../codes/HttpStatus';\nimport { RequestResponse } from '../models/RequestResponse';\nimport { SimpleBootHttpServer } from '../SimpleBootHttpServer';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { FileUtils } from '@dooboostore/core-node';\nimport { ConvertUtils } from '@dooboostore/core-node';\nimport { RandomUtils } from '@dooboostore/core';\n\nexport type CacheFilterSessionType = { key: string; lifeTime: number; isUpdate: boolean; responseHeaders?: string[] };\n\ntype CacheConfigCacheItemType = { path: string; createTime: number; lifeTime: number; responseHeader: { [key: string]: string | number | string[] } };\n\ntype KeyAndConfig = { key: string; lifeTime?: number; responseHeaders?: string[] };\n\nexport class CacheFilter implements Filter {\n public static readonly SYMBOL = Symbol.for('CacheFilter');\n public static readonly CARRIER_KEY_NAME = '_CARRIER_CACHE_FILTER_KEY_NAME';\n private storage = new Map<string, string | Buffer>();\n private cacheConfig: {\n createDate: string;\n updateDate: string;\n caches: { [key: string]: CacheConfigCacheItemType };\n };\n\n constructor(\n private config: {\n config: {\n cacheDir?: string;\n lifeTime: number;\n startUpClean?: boolean;\n };\n filter?: (rr: RequestResponse, app: SimpleBootHttpServer) => boolean;\n key: (rr: RequestResponse, app: SimpleBootHttpServer) => KeyAndConfig;\n }\n ) {\n if (config.config.cacheDir && config.config.startUpClean) {\n FileUtils.deleteSync(config.config.cacheDir, { options: { recursive: true } });\n }\n }\n\n async onInit(app: SimpleBootHttpServer) {}\n\n async proceedBefore({ rr, app, carrier }: { rr: RequestResponse; app: SimpleBootHttpServer; carrier: Map<string, any> }) {\n // this.key = undefined;\n // this.lifeTime = undefined;\n // this.isUpdate = false;\n const filter = this.config.filter?.(rr, app);\n if (!filter) {\n return true;\n }\n this.initCacheConfig();\n const rkey = this.config.key(rr, app);\n // console.log('--path filter', rr.reqMethod(), rr.reqUrlPathName, filter, rkey)\n const sessionData: CacheFilterSessionType = { key: rkey.key, lifeTime: rkey.lifeTime ?? this.config.config.lifeTime, isUpdate: false, responseHeaders: rkey.responseHeaders };\n\n const cache = this.cacheConfig.caches[sessionData.key];\n if (cache) {\n const existes = this.config.config.cacheDir ? FileUtils.existsSync(cache.path) : this.storage.has(cache.path);\n const diffTime = Date.now() - cache.createTime;\n if (!existes || diffTime > cache.lifeTime) {\n this.clear(sessionData.key);\n sessionData.isUpdate = true;\n } else {\n rr.resSetHeaders({\n ...cache.responseHeader,\n cacheFilter: `true;remainTime=${cache.lifeTime - diffTime}`\n });\n // console.log('chunk--->', cache.path);\n try {\n const chunk = this.getChunk(cache.path);\n // console.log('chunk--->', chunk);\n await rr.resEnd(chunk);\n } catch (e) {\n console.log('--------e', e);\n }\n }\n } else {\n sessionData.isUpdate = true;\n }\n carrier.set(CacheFilter.CARRIER_KEY_NAME, sessionData);\n return sessionData.isUpdate;\n }\n\n public async refresh(path: string, app: SimpleBootHttpServer) {\n // 1. \uAE30\uC874 \uCE90\uC2DC \uD30C\uC77C \uC0AD\uC81C\n this.clear(path);\n\n // 2. HTTP Fetch\uB97C \uD1B5\uD55C \uC678\uBD80 \uD638\uCD9C (GET)\n // \uC544\uD0A4\uD14D\uD2B8\uB2D8\uC758 \uC9C0\uC2DC\uC5D0 \uB530\uB77C \uB124\uD2B8\uC6CC\uD06C \uB808\uC774\uC5B4\uB97C \uD1B5\uD574 \uC815\uC11D\uB300\uB85C \uD638\uCD9C\uD569\uB2C8\uB2E4.\n const url = `${app.option.protocol}://${app.option.hostname}:${app.option.port}${path}`;\n try {\n await fetch(url, {\n method: 'GET',\n headers: {\n 'x-cache-force-refresh': 'true',\n 'User-Agent': 'SimpleBootHttpServer-Internal-Refresh'\n }\n });\n } catch (e) {\n console.error('CacheFilter.refresh fetch error:', e);\n }\n }\n\n public clear(key: string) {\n this.initCacheConfig();\n const cache = this.cacheConfig.caches[key];\n if (cache) {\n this.deleteChunk(cache.path);\n delete this.cacheConfig.caches[key];\n this.saveCacheConfig();\n }\n }\n\n public clearAll() {\n this.initCacheConfig();\n Object.keys(this.cacheConfig.caches).forEach(key => {\n this.deleteChunk(this.cacheConfig.caches[key].path);\n });\n this.cacheConfig.caches = {};\n this.saveCacheConfig();\n }\n\n private initCacheConfig() {\n if (this.config.config.cacheDir) {\n FileUtils.mkdirSync(this.config.config.cacheDir, { recursive: true });\n }\n if (!this.cacheConfig && this.config.config.cacheDir) {\n try {\n this.cacheConfig = JSON.parse(ConvertUtils.toString(FileUtils.readSync([this.config.config.cacheDir, 'cacheConfig.json'], { option: { encoding: 'utf-8' } })));\n } catch (e) {}\n }\n const date = new Date().toISOString();\n this.cacheConfig ??= {\n createDate: date,\n updateDate: date,\n // accessDate: date,\n caches: {}\n };\n this.cacheConfig.createDate ??= date;\n this.cacheConfig.updateDate ??= date;\n // this.cacheConfig.accessDate ??= date;\n this.cacheConfig.caches ??= {};\n }\n\n private saveCacheConfig() {\n if (this.config.config.cacheDir && this.cacheConfig) {\n FileUtils.write(JSON.stringify(this.cacheConfig), { path: [this.config.config.cacheDir, 'cacheConfig.json'] });\n }\n }\n\n private deleteChunk(path: string) {\n if (this.config.config.cacheDir && FileUtils.existsSync(path)) {\n FileUtils.deleteFileSync(path);\n } else if (this.storage.has(path)) {\n this.storage.delete(path);\n }\n }\n\n private getChunk(path: string) {\n return this.config.config.cacheDir ? FileUtils.readSync(path) : this.storage.get(path);\n }\n\n async proceedAfter({ rr, app, carrier }: { rr: RequestResponse; app: SimpleBootHttpServer; carrier: Map<string, any> }) {\n // const data = await rr.resBodyStringData()\n const sessionData = carrier.get(CacheFilter.CARRIER_KEY_NAME) as CacheFilterSessionType;\n if (sessionData && sessionData.isUpdate) {\n try {\n if (this.config.config.cacheDir) {\n FileUtils.mkdirSync([this.config.config.cacheDir, 'caches'], { recursive: true });\n }\n const resBody = rr.resBodyData();\n if (!resBody) {\n return true;\n }\n let p: string | undefined = undefined;\n const destFileUUID = RandomUtils.uuid4();\n p = this.writeChunk(destFileUUID, resBody);\n const updateDateNow = Date.now();\n const updateDate = new Date(updateDateNow).toISOString();\n this.cacheConfig.createDate ??= updateDate;\n this.cacheConfig.updateDate = updateDate;\n const responseHeaders: { [key: string]: string | number | string[] } = {};\n sessionData.responseHeaders\n ?.map(it => it.toLowerCase())\n .forEach(it => {\n responseHeaders[it] = rr.resHeader(it);\n });\n this.cacheConfig.caches[sessionData.key] = {\n path: p,\n createTime: updateDateNow,\n lifeTime: sessionData.lifeTime,\n responseHeader: responseHeaders\n };\n\n this.saveCacheConfig();\n } catch (e) {\n console.log('---', e);\n }\n }\n\n return true;\n }\n\n private writeChunk(destFileUUID: string, resBody: string | Buffer) {\n if (this.config.config.cacheDir) {\n return FileUtils.write(resBody, { path: [this.config.config.cacheDir, 'caches', destFileUUID] });\n } else {\n this.storage.set(destFileUUID, resBody);\n return destFileUUID;\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,uBAA0B;AAC1B,IAAAA,oBAA6B;AAC7B,kBAA4B;AAQrB,MAAM,YAA8B;AAAA,EAUzC,YACU,QASR;AATQ;AARV,SAAQ,UAAU,oBAAI,IAA6B;AAkBjD,QAAI,OAAO,OAAO,YAAY,OAAO,OAAO,cAAc;AACxD,iCAAU,WAAW,OAAO,OAAO,UAAU,EAAE,SAAS,EAAE,WAAW,KAAK,EAAE,CAAC;AAAA,IAC/E;AAAA,EACF;AAAA,EAvBA;AAAA,SAAuB,SAAS,OAAO,IAAI,aAAa;AAAA;AAAA,EACxD;AAAA,SAAuB,mBAAmB;AAAA;AAAA,EAwB1C,MAAM,OAAO,KAA2B;AAAA,EAAC;AAAA,EAEzC,MAAM,cAAc,EAAE,IAAI,KAAK,QAAQ,GAAkF;AAIvH,UAAM,SAAS,KAAK,OAAO,SAAS,IAAI,GAAG;AAC3C,QAAI,CAAC,QAAQ;AACX,aAAO;AAAA,IACT;AACA,SAAK,gBAAgB;AACrB,UAAM,OAAO,KAAK,OAAO,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