@celljs/web 3.8.0 → 4.0.0

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 (235) hide show
  1. package/cell.yml +5 -3
  2. package/esm/browser/module.d.ts +2 -0
  3. package/esm/browser/module.js +3 -0
  4. package/esm/browser/module.js.map +1 -0
  5. package/esm/common/constants.d.ts +4 -0
  6. package/esm/common/constants.js +5 -0
  7. package/esm/common/constants.js.map +1 -0
  8. package/esm/common/index.d.ts +4 -0
  9. package/esm/common/index.js +5 -0
  10. package/esm/common/index.js.map +1 -0
  11. package/esm/common/module.d.ts +3 -0
  12. package/esm/common/module.js +4 -0
  13. package/esm/common/module.js.map +1 -0
  14. package/esm/common/pipe/index.d.ts +5 -0
  15. package/esm/common/pipe/index.js +6 -0
  16. package/esm/common/pipe/index.js.map +1 -0
  17. package/esm/common/pipe/pipe-manager.d.ts +5 -0
  18. package/esm/common/pipe/pipe-manager.js +34 -0
  19. package/esm/common/pipe/pipe-manager.js.map +1 -0
  20. package/esm/common/pipe/pipe-protocol.d.ts +22 -0
  21. package/esm/common/pipe/pipe-protocol.js +4 -0
  22. package/esm/common/pipe/pipe-protocol.js.map +1 -0
  23. package/esm/common/pipe/pipe-provider.d.ts +7 -0
  24. package/esm/common/pipe/pipe-provider.js +33 -0
  25. package/esm/common/pipe/pipe-provider.js.map +1 -0
  26. package/esm/common/pipe/pipe-transtorm.d.ts +17 -0
  27. package/esm/common/pipe/pipe-transtorm.js +110 -0
  28. package/esm/common/pipe/pipe-transtorm.js.map +1 -0
  29. package/esm/common/pipe/validation-errors.d.ts +5 -0
  30. package/esm/common/pipe/validation-errors.js +7 -0
  31. package/esm/common/pipe/validation-errors.js.map +1 -0
  32. package/esm/common/resolver/index.d.ts +2 -0
  33. package/esm/common/resolver/index.js +3 -0
  34. package/esm/common/resolver/index.js.map +1 -0
  35. package/esm/common/resolver/path-resolver.d.ts +5 -0
  36. package/esm/common/resolver/path-resolver.js +37 -0
  37. package/esm/common/resolver/path-resolver.js.map +1 -0
  38. package/esm/common/resolver/resolver-protocol.d.ts +4 -0
  39. package/esm/common/resolver/resolver-protocol.js +2 -0
  40. package/esm/common/resolver/resolver-protocol.js.map +1 -0
  41. package/esm/common/utils/index.d.ts +1 -0
  42. package/esm/common/utils/index.js +2 -0
  43. package/esm/common/utils/index.js.map +1 -0
  44. package/esm/common/utils/url-util.d.ts +10 -0
  45. package/esm/common/utils/url-util.js +33 -0
  46. package/esm/common/utils/url-util.js.map +1 -0
  47. package/esm/node/application/dev-application-entry.d.ts +6 -0
  48. package/esm/node/application/dev-application-entry.js +7 -0
  49. package/esm/node/application/dev-application-entry.js.map +1 -0
  50. package/esm/node/body/body-middleware.d.ts +10 -0
  51. package/esm/node/body/body-middleware.js +41 -0
  52. package/esm/node/body/body-middleware.js.map +1 -0
  53. package/esm/node/body/body-protocol.d.ts +1 -0
  54. package/esm/node/body/body-protocol.js +3 -0
  55. package/esm/node/body/body-protocol.js.map +1 -0
  56. package/esm/node/body/index.d.ts +2 -0
  57. package/esm/node/body/index.js +3 -0
  58. package/esm/node/body/index.js.map +1 -0
  59. package/esm/node/context.d.ts +32 -0
  60. package/esm/node/context.js +74 -0
  61. package/esm/node/context.js.map +1 -0
  62. package/esm/node/cookies/cookies-factory.d.ts +6 -0
  63. package/esm/node/cookies/cookies-factory.js +34 -0
  64. package/esm/node/cookies/cookies-factory.js.map +1 -0
  65. package/esm/node/cookies/cookies-middleware.d.ts +8 -0
  66. package/esm/node/cookies/cookies-middleware.js +34 -0
  67. package/esm/node/cookies/cookies-middleware.js.map +1 -0
  68. package/esm/node/cookies/cookies-protocol.d.ts +6 -0
  69. package/esm/node/cookies/cookies-protocol.js +4 -0
  70. package/esm/node/cookies/cookies-protocol.js.map +1 -0
  71. package/esm/node/cookies/index.d.ts +3 -0
  72. package/esm/node/cookies/index.js +4 -0
  73. package/esm/node/cookies/index.js.map +1 -0
  74. package/esm/node/cors/cors-middleware.d.ts +10 -0
  75. package/esm/node/cors/cors-middleware.js +48 -0
  76. package/esm/node/cors/cors-middleware.js.map +1 -0
  77. package/esm/node/cors/cors-protocol.d.ts +1 -0
  78. package/esm/node/cors/cors-protocol.js +3 -0
  79. package/esm/node/cors/cors-protocol.js.map +1 -0
  80. package/esm/node/cors/index.d.ts +2 -0
  81. package/esm/node/cors/index.js +3 -0
  82. package/esm/node/cors/index.js.map +1 -0
  83. package/esm/node/dispatcher/dispatcher-protocol.d.ts +5 -0
  84. package/esm/node/dispatcher/dispatcher-protocol.js +2 -0
  85. package/esm/node/dispatcher/dispatcher-protocol.js.map +1 -0
  86. package/esm/node/dispatcher/dispatcher.d.ts +15 -0
  87. package/esm/node/dispatcher/dispatcher.js +68 -0
  88. package/esm/node/dispatcher/dispatcher.js.map +1 -0
  89. package/esm/node/dispatcher/index.d.ts +2 -0
  90. package/esm/node/dispatcher/index.js +3 -0
  91. package/esm/node/dispatcher/index.js.map +1 -0
  92. package/esm/node/error/error-handler-provider.d.ts +27 -0
  93. package/esm/node/error/error-handler-provider.js +94 -0
  94. package/esm/node/error/error-handler-provider.js.map +1 -0
  95. package/esm/node/error/error-protocol.d.ts +13 -0
  96. package/esm/node/error/error-protocol.js +5 -0
  97. package/esm/node/error/error-protocol.js.map +1 -0
  98. package/esm/node/error/http-error.d.ts +5 -0
  99. package/esm/node/error/http-error.js +8 -0
  100. package/esm/node/error/http-error.js.map +1 -0
  101. package/esm/node/error/index.d.ts +4 -0
  102. package/esm/node/error/index.js +5 -0
  103. package/esm/node/error/index.js.map +1 -0
  104. package/esm/node/error/not-found-error.d.ts +6 -0
  105. package/esm/node/error/not-found-error.js +10 -0
  106. package/esm/node/error/not-found-error.js.map +1 -0
  107. package/esm/node/handler/handler-execution-chain.d.ts +5 -0
  108. package/esm/node/handler/handler-execution-chain.js +24 -0
  109. package/esm/node/handler/handler-execution-chain.js.map +1 -0
  110. package/esm/node/handler/handler-mapping.d.ts +7 -0
  111. package/esm/node/handler/handler-mapping.js +53 -0
  112. package/esm/node/handler/handler-mapping.js.map +1 -0
  113. package/esm/node/handler/handler-protocol.d.ts +15 -0
  114. package/esm/node/handler/handler-protocol.js +4 -0
  115. package/esm/node/handler/handler-protocol.js.map +1 -0
  116. package/esm/node/handler/index.d.ts +3 -0
  117. package/esm/node/handler/index.js +4 -0
  118. package/esm/node/handler/index.js.map +1 -0
  119. package/esm/node/health/health-errors.d.ts +5 -0
  120. package/esm/node/health/health-errors.js +8 -0
  121. package/esm/node/health/health-errors.js.map +1 -0
  122. package/esm/node/health/health-executor.d.ts +7 -0
  123. package/esm/node/health/health-executor.js +60 -0
  124. package/esm/node/health/health-executor.js.map +1 -0
  125. package/esm/node/health/health-indicator.d.ts +7 -0
  126. package/esm/node/health/health-indicator.js +21 -0
  127. package/esm/node/health/health-indicator.js.map +1 -0
  128. package/esm/node/health/health-middleware.d.ts +16 -0
  129. package/esm/node/health/health-middleware.js +65 -0
  130. package/esm/node/health/health-middleware.js.map +1 -0
  131. package/esm/node/health/health-protocol.d.ts +82 -0
  132. package/esm/node/health/health-protocol.js +27 -0
  133. package/esm/node/health/health-protocol.js.map +1 -0
  134. package/esm/node/health/health-status-aggregator.d.ts +4 -0
  135. package/esm/node/health/health-status-aggregator.js +28 -0
  136. package/esm/node/health/health-status-aggregator.js.map +1 -0
  137. package/esm/node/health/index.d.ts +6 -0
  138. package/esm/node/health/index.js +7 -0
  139. package/esm/node/health/index.js.map +1 -0
  140. package/esm/node/http/http-middleware.d.ts +8 -0
  141. package/esm/node/http/http-middleware.js +43 -0
  142. package/esm/node/http/http-middleware.js.map +1 -0
  143. package/esm/node/http/http-protocol.d.ts +12 -0
  144. package/esm/node/http/http-protocol.js +4 -0
  145. package/esm/node/http/http-protocol.js.map +1 -0
  146. package/esm/node/http/index.d.ts +3 -0
  147. package/esm/node/http/index.js +4 -0
  148. package/esm/node/http/index.js.map +1 -0
  149. package/esm/node/http/server-aware.d.ts +5 -0
  150. package/esm/node/http/server-aware.js +18 -0
  151. package/esm/node/http/server-aware.js.map +1 -0
  152. package/esm/node/index.d.ts +14 -0
  153. package/esm/node/index.js +15 -0
  154. package/esm/node/index.js.map +1 -0
  155. package/esm/node/matcher/index.d.ts +2 -0
  156. package/esm/node/matcher/index.js +3 -0
  157. package/esm/node/matcher/index.js.map +1 -0
  158. package/esm/node/matcher/matcher-protocol.d.ts +4 -0
  159. package/esm/node/matcher/matcher-protocol.js +2 -0
  160. package/esm/node/matcher/matcher-protocol.js.map +1 -0
  161. package/esm/node/matcher/request-matcher.d.ts +7 -0
  162. package/esm/node/matcher/request-matcher.js +49 -0
  163. package/esm/node/matcher/request-matcher.js.map +1 -0
  164. package/esm/node/middleware/compose.d.ts +3 -0
  165. package/esm/node/middleware/compose.js +21 -0
  166. package/esm/node/middleware/compose.js.map +1 -0
  167. package/esm/node/middleware/express-middleware-converter.d.ts +3 -0
  168. package/esm/node/middleware/express-middleware-converter.js +21 -0
  169. package/esm/node/middleware/express-middleware-converter.js.map +1 -0
  170. package/esm/node/middleware/index.d.ts +3 -0
  171. package/esm/node/middleware/index.js +4 -0
  172. package/esm/node/middleware/index.js.map +1 -0
  173. package/esm/node/middleware/middleware-provider.d.ts +12 -0
  174. package/esm/node/middleware/middleware-provider.js +33 -0
  175. package/esm/node/middleware/middleware-provider.js.map +1 -0
  176. package/esm/node/module.d.ts +3 -0
  177. package/esm/node/module.js +4 -0
  178. package/esm/node/module.js.map +1 -0
  179. package/esm/node/redirect/index.d.ts +2 -0
  180. package/esm/node/redirect/index.js +3 -0
  181. package/esm/node/redirect/index.js.map +1 -0
  182. package/esm/node/redirect/redirect-protocol.d.ts +4 -0
  183. package/esm/node/redirect/redirect-protocol.js +2 -0
  184. package/esm/node/redirect/redirect-protocol.js.map +1 -0
  185. package/esm/node/redirect/redirect-strategy.d.ts +6 -0
  186. package/esm/node/redirect/redirect-strategy.js +30 -0
  187. package/esm/node/redirect/redirect-strategy.js.map +1 -0
  188. package/esm/node/session/index.d.ts +5 -0
  189. package/esm/node/session/index.js +6 -0
  190. package/esm/node/session/index.js.map +1 -0
  191. package/esm/node/session/session-manager.d.ts +11 -0
  192. package/esm/node/session/session-manager.js +72 -0
  193. package/esm/node/session/session-manager.js.map +1 -0
  194. package/esm/node/session/session-middleware.d.ts +9 -0
  195. package/esm/node/session/session-middleware.js +42 -0
  196. package/esm/node/session/session-middleware.js.map +1 -0
  197. package/esm/node/session/session-protocol.d.ts +30 -0
  198. package/esm/node/session/session-protocol.js +8 -0
  199. package/esm/node/session/session-protocol.js.map +1 -0
  200. package/esm/node/session/session-store.d.ts +11 -0
  201. package/esm/node/session/session-store.js +56 -0
  202. package/esm/node/session/session-store.js.map +1 -0
  203. package/esm/node/session/session-strategy.d.ts +7 -0
  204. package/esm/node/session/session-strategy.js +47 -0
  205. package/esm/node/session/session-strategy.js.map +1 -0
  206. package/esm/node/session/session.d.ts +12 -0
  207. package/esm/node/session/session.js +40 -0
  208. package/esm/node/session/session.js.map +1 -0
  209. package/esm/node/trace/index.d.ts +4 -0
  210. package/esm/node/trace/index.js +5 -0
  211. package/esm/node/trace/index.js.map +1 -0
  212. package/esm/node/trace/trace-id-provider.d.ts +4 -0
  213. package/esm/node/trace/trace-id-provider.js +18 -0
  214. package/esm/node/trace/trace-id-provider.js.map +1 -0
  215. package/esm/node/trace/trace-id-resolver.d.ts +5 -0
  216. package/esm/node/trace/trace-id-resolver.js +32 -0
  217. package/esm/node/trace/trace-id-resolver.js.map +1 -0
  218. package/esm/node/trace/trace-middleware.d.ts +9 -0
  219. package/esm/node/trace/trace-middleware.js +37 -0
  220. package/esm/node/trace/trace-middleware.js.map +1 -0
  221. package/esm/node/trace/trace-protocol.d.ts +7 -0
  222. package/esm/node/trace/trace-protocol.js +6 -0
  223. package/esm/node/trace/trace-protocol.js.map +1 -0
  224. package/esm/package.json +3 -0
  225. package/lib/common/pipe/pipe-transtorm.d.ts +7 -0
  226. package/lib/common/pipe/pipe-transtorm.d.ts.map +1 -1
  227. package/lib/common/pipe/pipe-transtorm.js +17 -1
  228. package/lib/common/pipe/pipe-transtorm.js.map +1 -1
  229. package/lib/common/pipe/pipe-transtorm.spec.d.ts +2 -0
  230. package/lib/common/pipe/pipe-transtorm.spec.d.ts.map +1 -0
  231. package/lib/common/pipe/pipe-transtorm.spec.js +69 -0
  232. package/lib/common/pipe/pipe-transtorm.spec.js.map +1 -0
  233. package/package.json +107 -6
  234. package/src/common/pipe/pipe-transtorm.spec.ts +62 -0
  235. package/src/common/pipe/pipe-transtorm.ts +18 -1
package/cell.yml CHANGED
@@ -4,11 +4,11 @@ cell:
4
4
  maxAge: 86400000
5
5
  sessionIdKey: cell:sessionId
6
6
  sessionKey: cell:session
7
- cookies:
8
- keys: ${ ['abcdef'] | onTarget('backend')}
9
7
  server:
10
8
  path: /
11
9
  port: 3000
10
+ # Listen on all interfaces in containers: CELL_BACKEND__SERVER__HOST=0.0.0.0
11
+ host: 127.0.0.1
12
12
  endpoint: http://localhost:${cell.server.port}
13
13
  trace:
14
14
  requestField: X-Cell-Trace-ID
@@ -26,4 +26,6 @@ cell:
26
26
  # body:
27
27
  # limit: 5mb
28
28
  backend:
29
- devEntry: lib/node/application/dev-application-entry
29
+ cell:
30
+ cookies:
31
+ keys: ['abcdef']
@@ -0,0 +1,2 @@
1
+ declare const _default: import("inversify").interfaces.ContainerModule;
2
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { autoBind } from '@celljs/core';
2
+ export default autoBind();
3
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/browser/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,eAAe,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const ENDPOINT = "cell.server.endpoint";
2
+ export declare const SERVER_PATH = "cell.server.path";
3
+ export declare const CORS = "cell.web.cors";
4
+ export declare const AOP_POINTCUT = "Endpoint";
@@ -0,0 +1,5 @@
1
+ export const ENDPOINT = 'cell.server.endpoint';
2
+ export const SERVER_PATH = 'cell.server.path';
3
+ export const CORS = 'cell.web.cors';
4
+ export const AOP_POINTCUT = 'Endpoint';
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,QAAQ,GAAG,sBAAsB,CAAC;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAC9C,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC;AACpC,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './resolver/index.js';
2
+ export * from './constants.js';
3
+ export * from './utils/index.js';
4
+ export * from './pipe/index.js';
@@ -0,0 +1,5 @@
1
+ export * from './resolver/index.js';
2
+ export * from './constants.js';
3
+ export * from './utils/index.js';
4
+ export * from './pipe/index.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import './resolver/index.js';
2
+ declare const _default: import("inversify").interfaces.ContainerModule;
3
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { autoBind } from '@celljs/core';
2
+ import './resolver/index.js';
3
+ export default autoBind();
4
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/common/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,YAAY,CAAC;AAEpB,eAAe,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './pipe-manager.js';
2
+ export * from './pipe-protocol.js';
3
+ export * from './pipe-provider.js';
4
+ export * from './pipe-transtorm.js';
5
+ export * from './validation-errors.js';
@@ -0,0 +1,6 @@
1
+ export * from './pipe-manager.js';
2
+ export * from './pipe-protocol.js';
3
+ export * from './pipe-provider.js';
4
+ export * from './pipe-transtorm.js';
5
+ export * from './validation-errors.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/pipe/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { PipeManager, PipeProvider, MethodMetadata } from './pipe-protocol.js';
2
+ export declare class PipeManagerImpl implements PipeManager {
3
+ protected readonly pipeProvider: PipeProvider;
4
+ apply(metadata: MethodMetadata, args: any[]): Promise<void>;
5
+ }
@@ -0,0 +1,34 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Component, Autowired, getTarget } from '@celljs/core';
11
+ import { PipeManager, PipeProvider } from './pipe-protocol.js';
12
+ let PipeManagerImpl = class PipeManagerImpl {
13
+ async apply(metadata, args) {
14
+ const paramTypes = Reflect.getMetadata('design:paramtypes', getTarget(metadata.target), metadata.method);
15
+ if (paramTypes) {
16
+ for (let index = 0; index < args.length; index++) {
17
+ let arg = args[index];
18
+ for (const pipe of this.pipeProvider.provide()) {
19
+ arg = await pipe.transform(arg, { argType: index < paramTypes.length ? paramTypes[index] : undefined });
20
+ }
21
+ args[index] = arg;
22
+ }
23
+ }
24
+ }
25
+ };
26
+ __decorate([
27
+ Autowired(PipeProvider),
28
+ __metadata("design:type", Object)
29
+ ], PipeManagerImpl.prototype, "pipeProvider", void 0);
30
+ PipeManagerImpl = __decorate([
31
+ Component(PipeManager)
32
+ ], PipeManagerImpl);
33
+ export { PipeManagerImpl };
34
+ //# sourceMappingURL=pipe-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipe-manager.js","sourceRoot":"","sources":["../../../src/common/pipe/pipe-manager.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AAGrE,IAAM,eAAe,GAArB,MAAM,eAAe;IAKxB,KAAK,CAAC,KAAK,CAAC,QAAwB,EAAE,IAAW;QAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QACzG,IAAI,UAAU,EAAE,CAAC;YACb,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;gBAC/C,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;gBACtB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC;oBAC7C,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;gBAC5G,CAAC;gBACD,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;YACtB,CAAC;QACL,CAAC;IACL,CAAC;CAEJ,CAAA;AAfsB;IADlB,SAAS,CAAC,YAAY,CAAC;;qDACsB;AAHrC,eAAe;IAD3B,SAAS,CAAC,WAAW,CAAC;GACV,eAAe,CAkB3B"}
@@ -0,0 +1,22 @@
1
+ import { Type } from '@celljs/core';
2
+ export declare const PipeTransform: unique symbol;
3
+ export declare const PipeProvider: unique symbol;
4
+ export declare const PipeManager: unique symbol;
5
+ export interface ArgumentMetadata {
6
+ readonly argType?: Type<any>;
7
+ readonly data?: string;
8
+ }
9
+ export interface MethodMetadata {
10
+ readonly target: Type<any>;
11
+ readonly method: string | symbol;
12
+ }
13
+ export interface PipeTransform<T = any, R = any> {
14
+ readonly priority: number;
15
+ transform(value: T, metadata: ArgumentMetadata): R;
16
+ }
17
+ export interface PipeProvider {
18
+ provide(): PipeTransform[];
19
+ }
20
+ export interface PipeManager {
21
+ apply(metadata: MethodMetadata, args: any[]): Promise<void>;
22
+ }
@@ -0,0 +1,4 @@
1
+ export const PipeTransform = Symbol('PipeTransform');
2
+ export const PipeProvider = Symbol('PipeProvider');
3
+ export const PipeManager = Symbol('PipeManager');
4
+ //# sourceMappingURL=pipe-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipe-protocol.js","sourceRoot":"","sources":["../../../src/common/pipe/pipe-protocol.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AACrD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { PipeTransform, PipeProvider } from './pipe-protocol.js';
2
+ export declare class PipeProviderImpl implements PipeProvider {
3
+ protected readonly pipes: PipeTransform[];
4
+ protected prioritized: PipeTransform[];
5
+ constructor(pipes: PipeTransform[]);
6
+ provide(): PipeTransform[];
7
+ }
@@ -0,0 +1,33 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Component, Autowired, Optional, Prioritizeable } from '@celljs/core';
14
+ import { PipeTransform, PipeProvider } from './pipe-protocol.js';
15
+ let PipeProviderImpl = class PipeProviderImpl {
16
+ constructor(pipes) {
17
+ this.pipes = pipes;
18
+ }
19
+ provide() {
20
+ if (!this.prioritized) {
21
+ this.prioritized = Prioritizeable.prioritizeAllSync(this.pipes).map(c => c.value);
22
+ }
23
+ return this.prioritized;
24
+ }
25
+ };
26
+ PipeProviderImpl = __decorate([
27
+ Component(PipeProvider),
28
+ __param(0, Autowired(PipeTransform)),
29
+ __param(0, Optional()),
30
+ __metadata("design:paramtypes", [Array])
31
+ ], PipeProviderImpl);
32
+ export { PipeProviderImpl };
33
+ //# sourceMappingURL=pipe-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipe-provider.js","sourceRoot":"","sources":["../../../src/common/pipe/pipe-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGvD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAIzB,YAEuB,KAAsB;qBAAtB,KAAK;IACxB,CAAC;IAEL,OAAO;QACH,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACtF,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;CAEJ,CAAA;AAhBY,gBAAgB;IAD5B,SAAS,CAAC,YAAY,CAAC;IAMf,WAAA,SAAS,CAAC,aAAa,CAAC,CAAA;IAAE,WAAA,QAAQ,EAAE,CAAA;;GALhC,gBAAgB,CAgB5B"}
@@ -0,0 +1,17 @@
1
+ import { PipeTransform, ArgumentMetadata } from './pipe-protocol.js';
2
+ export declare class ValidationPipe implements PipeTransform<any> {
3
+ protected options: any;
4
+ readonly priority = 1000;
5
+ transform(value: any, metadata: ArgumentMetadata): Promise<any>;
6
+ private toValidate;
7
+ private toEmptyIfNil;
8
+ private stripProtoKeys;
9
+ /**
10
+ * Request data: primitives, arrays and plain objects, as parsed from JSON, query strings or RPC
11
+ * messages. Objects the framework passes in (request, response, session, cookies, errors) are
12
+ * class instances and pass through: converting them would copy them property by property, which
13
+ * never ends for the circular request and response.
14
+ */
15
+ private isData;
16
+ private isPrimitive;
17
+ }
@@ -0,0 +1,110 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Component, Value } from '@celljs/core';
11
+ import { PipeTransform } from './pipe-protocol.js';
12
+ import { ValidationErrors } from './validation-errors.js';
13
+ import { validate } from 'class-validator';
14
+ import { instanceToPlain, plainToInstance } from 'class-transformer';
15
+ let ValidationPipe = class ValidationPipe {
16
+ constructor() {
17
+ this.priority = 1000;
18
+ }
19
+ async transform(value, metadata) {
20
+ const opts = this.options || {};
21
+ const { argType } = metadata;
22
+ if (!argType || !this.isData(value)) {
23
+ return value;
24
+ }
25
+ if (!this.toValidate(metadata)) {
26
+ return plainToInstance(argType, value, opts.transformOptions);
27
+ }
28
+ const originalValue = value;
29
+ value = this.toEmptyIfNil(value);
30
+ const isNil = value !== originalValue;
31
+ const isPrimitive = this.isPrimitive(value);
32
+ this.stripProtoKeys(value);
33
+ let entity = plainToInstance(argType, value, opts.transformOptions);
34
+ const originalEntity = entity;
35
+ const isCtorNotEqual = entity.constructor !== argType;
36
+ if (isCtorNotEqual && !isPrimitive) {
37
+ entity.constructor = argType;
38
+ }
39
+ else if (isCtorNotEqual) {
40
+ // when "entity" is a primitive value, we have to temporarily
41
+ // replace the entity to perform the validation against the original
42
+ // metatype defined inside the handler
43
+ entity = { constructor: argType };
44
+ }
45
+ const errors = await validate(entity, opts.validatorOptions);
46
+ if (errors.length > 0) {
47
+ throw new ValidationErrors(opts.detailedOutputDisabled ? undefined : errors);
48
+ }
49
+ if (isPrimitive) {
50
+ // if the value is a primitive value and the validation process has been successfully completed
51
+ // we have to revert the original value passed through the pipe
52
+ entity = originalEntity;
53
+ }
54
+ if (opts.transformEnabled) {
55
+ return entity;
56
+ }
57
+ if (isNil) {
58
+ // if the value was originally undefined or null, revert it back
59
+ return originalValue;
60
+ }
61
+ return Object.keys(opts.validatorOptions).length > 0
62
+ ? instanceToPlain(entity, opts.transformOptions)
63
+ : value;
64
+ }
65
+ toValidate(metadata) {
66
+ const { argType } = metadata;
67
+ const types = [String, Boolean, Number, Array, Object];
68
+ // eslint-disable-next-line no-null/no-null
69
+ return argType !== null && !types.some(t => argType === t);
70
+ }
71
+ toEmptyIfNil(value) {
72
+ // eslint-disable-next-line no-null/no-null
73
+ return value === null ? {} : value;
74
+ }
75
+ stripProtoKeys(value) {
76
+ delete value.__proto__;
77
+ const keys = Object.keys(value);
78
+ keys
79
+ .filter(key => typeof value[key] === 'object' && value[key])
80
+ .forEach(key => this.stripProtoKeys(value[key]));
81
+ }
82
+ /**
83
+ * Request data: primitives, arrays and plain objects, as parsed from JSON, query strings or RPC
84
+ * messages. Objects the framework passes in (request, response, session, cookies, errors) are
85
+ * class instances and pass through: converting them would copy them property by property, which
86
+ * never ends for the circular request and response.
87
+ */
88
+ isData(value) {
89
+ if (typeof value === 'function') {
90
+ return false;
91
+ }
92
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) {
93
+ return true;
94
+ }
95
+ const proto = Object.getPrototypeOf(value);
96
+ return proto === Object.prototype || proto === null;
97
+ }
98
+ isPrimitive(value) {
99
+ return ['number', 'boolean', 'string'].indexOf(typeof value) !== -1;
100
+ }
101
+ };
102
+ __decorate([
103
+ Value('cell.web.validationPipeOptions'),
104
+ __metadata("design:type", Object)
105
+ ], ValidationPipe.prototype, "options", void 0);
106
+ ValidationPipe = __decorate([
107
+ Component(PipeTransform)
108
+ ], ValidationPipe);
109
+ export { ValidationPipe };
110
+ //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S,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACxE,CAAC;CACJ,CAAA;AAtGa;IADT,KAAK,CAAC,gCAAgC,CAAC;;+CACjB;AAHd,cAAc;IAD1B,SAAS,CAAC,aAAa,CAAC;GACZ,cAAc,CAyG1B"}
@@ -0,0 +1,5 @@
1
+ import { CustomError } from '@celljs/core';
2
+ import { ValidationError } from 'class-validator';
3
+ export declare class ValidationErrors extends CustomError {
4
+ constructor(errors?: ValidationError[]);
5
+ }
@@ -0,0 +1,7 @@
1
+ import { CustomError } from '@celljs/core';
2
+ export class ValidationErrors extends CustomError {
3
+ constructor(errors) {
4
+ super(errors === undefined ? undefined : JSON.stringify(errors));
5
+ }
6
+ }
7
+ //# sourceMappingURL=validation-errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-errors.js","sourceRoot":"","sources":["../../../src/common/pipe/validation-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAE7C,YAAY,MAA0B;QAClC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IACrE,CAAC;CAEJ"}
@@ -0,0 +1,2 @@
1
+ export * from './resolver-protocol.js';
2
+ export * from './path-resolver.js';
@@ -0,0 +1,3 @@
1
+ export * from './resolver-protocol.js';
2
+ export * from './path-resolver.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/resolver/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { PathResolver } from './resolver-protocol.js';
2
+ export declare class PathResolverImpl implements PathResolver {
3
+ protected readonly serverPath: string;
4
+ resolve(...parts: string[]): Promise<string>;
5
+ }
@@ -0,0 +1,37 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { PathResolver } from './resolver-protocol.js';
11
+ import { Value, Component, UrlUtil as CoreUrlUtil } from '@celljs/core';
12
+ import { SERVER_PATH } from '../constants.js';
13
+ import { UrlUtil } from '../utils/index.js';
14
+ let PathResolverImpl = class PathResolverImpl {
15
+ async resolve(...parts) {
16
+ const [first, ...rest] = parts.filter(v => !!v);
17
+ if (!first) {
18
+ return this.serverPath;
19
+ }
20
+ else if (UrlUtil.isAbsoluteUrl(first)) {
21
+ return CoreUrlUtil.join(first, ...rest);
22
+ }
23
+ else if (first.startsWith(this.serverPath)) {
24
+ return CoreUrlUtil.join(first, ...rest);
25
+ }
26
+ return CoreUrlUtil.join(this.serverPath, ...[first, ...rest]);
27
+ }
28
+ };
29
+ __decorate([
30
+ Value(SERVER_PATH),
31
+ __metadata("design:type", String)
32
+ ], PathResolverImpl.prototype, "serverPath", void 0);
33
+ PathResolverImpl = __decorate([
34
+ Component(PathResolver)
35
+ ], PathResolverImpl);
36
+ export { PathResolverImpl };
37
+ //# sourceMappingURL=path-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-resolver.js","sourceRoot":"","sources":["../../../src/common/resolver/path-resolver.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAG5B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAKzB,KAAK,CAAC,OAAO,CAAC,GAAG,KAAe;QAC5B,MAAM,CAAE,KAAK,EAAE,GAAG,IAAI,CAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAO,IAAI,CAAC,UAAU,CAAC;QAC3B,CAAC;aAAM,IAAI,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;QAC5C,CAAC;aAAM,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3C,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAE,KAAK,EAAE,GAAG,IAAI,CAAE,CAAC,CAAC;IACpE,CAAC;CACJ,CAAA;AAbsB;IADlB,KAAK,CAAC,WAAW,CAAC;;oDACmB;AAH7B,gBAAgB;IAD5B,SAAS,CAAC,YAAY,CAAC;GACX,gBAAgB,CAgB5B"}
@@ -0,0 +1,4 @@
1
+ export declare const PathResolver: unique symbol;
2
+ export interface PathResolver {
3
+ resolve(...parts: string[]): Promise<string>;
4
+ }
@@ -0,0 +1,2 @@
1
+ export const PathResolver = Symbol('PathResolver');
2
+ //# sourceMappingURL=resolver-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver-protocol.js","sourceRoot":"","sources":["../../../src/common/resolver/resolver-protocol.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './url-util.js';
@@ -0,0 +1,2 @@
1
+ export * from './url-util.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare namespace UrlUtil {
2
+ function isValidRedirectUrl(url?: string): "" | boolean | undefined;
3
+ /**
4
+ * Decides if a URL is absolute based on whether it contains a valid scheme name, as
5
+ * defined in RFC 1738.
6
+ */
7
+ function isAbsoluteUrl(url?: string): boolean;
8
+ function getUrl(...paths: string[]): Promise<string>;
9
+ function getPath(...paths: string[]): Promise<string>;
10
+ }
@@ -0,0 +1,33 @@
1
+ import { ConfigUtil, ContainerUtil } from '@celljs/core';
2
+ import { ENDPOINT } from '../constants.js';
3
+ import { PathResolver } from '../resolver/index.js';
4
+ export var UrlUtil;
5
+ (function (UrlUtil) {
6
+ function isValidRedirectUrl(url) {
7
+ return url && (url.startsWith('/') || isAbsoluteUrl(url));
8
+ }
9
+ UrlUtil.isValidRedirectUrl = isValidRedirectUrl;
10
+ /**
11
+ * Decides if a URL is absolute based on whether it contains a valid scheme name, as
12
+ * defined in RFC 1738.
13
+ */
14
+ function isAbsoluteUrl(url) {
15
+ if (!url) {
16
+ return false;
17
+ }
18
+ return /^[a-z0-9.+-]+:\/\/.*/i.test(url);
19
+ }
20
+ UrlUtil.isAbsoluteUrl = isAbsoluteUrl;
21
+ async function getUrl(...paths) {
22
+ const endpoint = ConfigUtil.get(ENDPOINT);
23
+ const pathResolver = ContainerUtil.get(PathResolver);
24
+ return pathResolver.resolve(endpoint, await pathResolver.resolve(...paths));
25
+ }
26
+ UrlUtil.getUrl = getUrl;
27
+ async function getPath(...paths) {
28
+ const pathResolver = ContainerUtil.get(PathResolver);
29
+ return pathResolver.resolve(...paths);
30
+ }
31
+ UrlUtil.getPath = getPath;
32
+ })(UrlUtil || (UrlUtil = {}));
33
+ //# sourceMappingURL=url-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-util.js","sourceRoot":"","sources":["../../../src/common/utils/url-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,KAAW,OAAO,CA4BvB;AA5BD,WAAiB,OAAO;IAEpB,SAAgB,kBAAkB,CAAC,GAAY;QAC3C,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9D,CAAC;IAFe,QAAA,kBAAkB,qBAEjC,CAAA;IAED;;;OAGG;IACH,SAAgB,aAAa,CAAC,GAAY;QACtC,IAAI,CAAC,GAAG,EAAE,CAAC;YACP,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,uBAAuB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,CAAC;IALe,QAAA,aAAa,gBAK5B,CAAA;IAEM,KAAK,UAAU,MAAM,CAAC,GAAG,KAAe;QAC3C,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAS,QAAQ,CAAC,CAAC;QAClD,MAAM,YAAY,GAAG,aAAa,CAAC,GAAG,CAAe,YAAY,CAAC,CAAC;QACnE,OAAO,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,YAAY,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAChF,CAAC;IAJqB,QAAA,MAAM,SAI3B,CAAA;IAEM,KAAK,UAAU,OAAO,CAAC,GAAG,KAAe;QAC5C,MAAM,YAAY,GAAG,aAAa,CAAC,GAAG,CAAe,YAAY,CAAC,CAAC;QACnE,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IAC1C,CAAC;IAHqB,QAAA,OAAO,UAG5B,CAAA;AAEL,CAAC,EA5BgB,OAAO,KAAP,OAAO,QA4BvB"}
@@ -0,0 +1,6 @@
1
+ export * from '@celljs/core/lib/common/container/dynamic-container';
2
+ export * from '@celljs/core/lib/common/container/container-provider';
3
+ export * from '../context.js';
4
+ export * from '../dispatcher/index.js';
5
+ export * from '@celljs/core/lib/common/application';
6
+ export * from '../http/http-protocol.js';
@@ -0,0 +1,7 @@
1
+ export * from '@celljs/core/lib/common/container/dynamic-container';
2
+ export * from '@celljs/core/lib/common/container/container-provider';
3
+ export * from '../context.js';
4
+ export * from '../dispatcher/index.js';
5
+ export * from '@celljs/core/lib/common/application';
6
+ export * from '../http/http-protocol.js';
7
+ //# sourceMappingURL=dev-application-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-application-entry.js","sourceRoot":"","sources":["../../../src/node/application/dev-application-entry.ts"],"names":[],"mappings":"AAAA,cAAc,qDAAqD,CAAC;AACpE,cAAc,sDAAsD,CAAC;AACrE,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,qCAAqC,CAAC;AACpD,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Middleware } from '../middleware/index.js';
2
+ import { Context } from '../context.js';
3
+ import { Options } from 'body-parser';
4
+ import { HandlerExecutionChain } from '../handler/index.js';
5
+ export declare class BodyMiddleware implements Middleware {
6
+ protected handlerExecutionChain: HandlerExecutionChain;
7
+ protected readonly options: Options;
8
+ handle(ctx: Context, next: () => Promise<void>): Promise<void>;
9
+ readonly priority: number;
10
+ }
@@ -0,0 +1,41 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { convertExpressMiddleware, Middleware } from '../middleware/index.js';
11
+ import { Component, Autowired, Value } from '@celljs/core';
12
+ import __cellCjs0 from 'body-parser';
13
+ const { json, text, raw, urlencoded } = __cellCjs0;
14
+ import { BODY_MIDDLEWARE_PRIORITY } from './body-protocol.js';
15
+ import { HandlerExecutionChain } from '../handler/index.js';
16
+ let BodyMiddleware = class BodyMiddleware {
17
+ constructor() {
18
+ this.priority = BODY_MIDDLEWARE_PRIORITY;
19
+ }
20
+ async handle(ctx, next) {
21
+ return this.handlerExecutionChain.execute([
22
+ convertExpressMiddleware(json({ ...this.options })),
23
+ convertExpressMiddleware(text({ ...this.options })),
24
+ convertExpressMiddleware(raw({ ...this.options })),
25
+ convertExpressMiddleware(urlencoded({ ...this.options, ...{ extended: true } }))
26
+ ], next);
27
+ }
28
+ };
29
+ __decorate([
30
+ Autowired(HandlerExecutionChain),
31
+ __metadata("design:type", Object)
32
+ ], BodyMiddleware.prototype, "handlerExecutionChain", void 0);
33
+ __decorate([
34
+ Value('cell.web.body'),
35
+ __metadata("design:type", Object)
36
+ ], BodyMiddleware.prototype, "options", void 0);
37
+ BodyMiddleware = __decorate([
38
+ Component(Middleware)
39
+ ], BodyMiddleware);
40
+ export { BodyMiddleware };
41
+ //# sourceMappingURL=body-middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"body-middleware.js","sourceRoot":"","sources":["../../../src/node/body/body-middleware.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAW,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAG5C,IAAM,cAAc,GAApB,MAAM,cAAc;IAApB;QAiBM,aAAQ,GAAG,wBAAwB,CAAC;IAEjD,CAAC;IAXG,KAAK,CAAC,MAAM,CAAC,GAAY,EAAE,IAAyB;QAChD,OAAO,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC;YACtC,wBAAwB,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;YACnD,wBAAwB,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;YACnD,wBAAwB,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;YAClD,wBAAwB,CAAC,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;SACnF,EAAE,IAAI,CAAC,CAAC;IACb,CAAC;CAIJ,CAAA;AAhBa;IADT,SAAS,CAAC,qBAAqB,CAAC;;6DACsB;AAGpC;IADlB,KAAK,CAAC,eAAe,CAAC;;+CACa;AAN3B,cAAc;IAD1B,SAAS,CAAC,UAAU,CAAC;GACT,cAAc,CAmB1B"}
@@ -0,0 +1 @@
1
+ export declare const BODY_MIDDLEWARE_PRIORITY: number;
@@ -0,0 +1,3 @@
1
+ import { CORS_MIDDLEWARE_PRIORITY } from '../cors/index.js';
2
+ export const BODY_MIDDLEWARE_PRIORITY = CORS_MIDDLEWARE_PRIORITY - 100;
3
+ //# sourceMappingURL=body-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"body-protocol.js","sourceRoot":"","sources":["../../../src/node/body/body-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,wBAAwB,GAAG,GAAG,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './body-protocol.js';
2
+ export * from './body-middleware.js';