bootifyjs 0.0.3 → 0.1.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 (188) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +116 -510
  3. package/dist/api.d.ts +32 -0
  4. package/dist/api.js +149 -0
  5. package/dist/api.js.map +1 -0
  6. package/dist/config/app.config.d.ts +29 -0
  7. package/dist/config/app.config.js +55 -0
  8. package/dist/config/app.config.js.map +1 -0
  9. package/dist/controllers/config.controller.d.ts +16 -0
  10. package/dist/controllers/config.controller.js +66 -0
  11. package/dist/controllers/config.controller.js.map +1 -0
  12. package/dist/controllers/events.controller.d.ts +66 -0
  13. package/dist/controllers/events.controller.js +145 -0
  14. package/dist/controllers/events.controller.js.map +1 -0
  15. package/dist/controllers/health.controller.d.ts +20 -0
  16. package/dist/controllers/health.controller.js +92 -0
  17. package/dist/controllers/health.controller.js.map +1 -0
  18. package/dist/controllers/user.controller.d.ts +13 -0
  19. package/dist/controllers/user.controller.js +209 -0
  20. package/dist/controllers/user.controller.js.map +1 -0
  21. package/dist/core/application.d.ts +21 -0
  22. package/dist/core/application.js +90 -0
  23. package/dist/core/application.js.map +1 -0
  24. package/dist/core/config.d.ts +3 -0
  25. package/dist/core/config.js +78 -0
  26. package/dist/core/config.js.map +1 -0
  27. package/dist/core/container.d.ts +17 -0
  28. package/dist/core/container.js +92 -0
  29. package/dist/core/container.js.map +1 -0
  30. package/dist/core/decorators.d.ts +28 -0
  31. package/dist/core/decorators.js +204 -0
  32. package/dist/core/decorators.js.map +1 -0
  33. package/dist/core/errors.d.ts +18 -0
  34. package/dist/core/errors.js +74 -0
  35. package/dist/core/errors.js.map +1 -0
  36. package/dist/core/middleware.d.ts +8 -0
  37. package/dist/core/middleware.js +23 -0
  38. package/dist/core/middleware.js.map +1 -0
  39. package/dist/core/openapi.d.ts +80 -0
  40. package/dist/core/openapi.js +189 -0
  41. package/dist/core/openapi.js.map +1 -0
  42. package/dist/core/router.d.ts +32 -0
  43. package/dist/core/router.js +266 -0
  44. package/dist/core/router.js.map +1 -0
  45. package/dist/core/utils.d.ts +7 -0
  46. package/dist/core/utils.js +75 -0
  47. package/dist/core/utils.js.map +1 -0
  48. package/dist/core/validation.d.ts +15 -0
  49. package/dist/core/validation.js +161 -0
  50. package/dist/core/validation.js.map +1 -0
  51. package/dist/events/core/event-bus.d.ts +26 -0
  52. package/dist/events/core/event-bus.js +253 -0
  53. package/dist/events/core/event-bus.js.map +1 -0
  54. package/dist/events/core/event-registry.d.ts +31 -0
  55. package/dist/events/core/event-registry.js +170 -0
  56. package/dist/events/core/event-registry.js.map +1 -0
  57. package/dist/events/decorators/event.decorators.d.ts +11 -0
  58. package/dist/events/decorators/event.decorators.js +123 -0
  59. package/dist/events/decorators/event.decorators.js.map +1 -0
  60. package/dist/events/examples/system.events.d.ts +15 -0
  61. package/dist/events/examples/system.events.js +28 -0
  62. package/dist/events/examples/system.events.js.map +1 -0
  63. package/dist/events/examples/user.events.d.ts +68 -0
  64. package/dist/events/examples/user.events.js +73 -0
  65. package/dist/events/examples/user.events.js.map +1 -0
  66. package/dist/events/examples/user.handlers.d.ts +20 -0
  67. package/dist/events/examples/user.handlers.js +157 -0
  68. package/dist/events/examples/user.handlers.js.map +1 -0
  69. package/dist/events/index.d.ts +13 -0
  70. package/dist/events/index.js +71 -0
  71. package/dist/events/index.js.map +1 -0
  72. package/dist/events/middleware/logging.middleware.d.ts +7 -0
  73. package/dist/events/middleware/logging.middleware.js +44 -0
  74. package/dist/events/middleware/logging.middleware.js.map +1 -0
  75. package/dist/events/middleware/metrics.middleware.d.ts +11 -0
  76. package/dist/events/middleware/metrics.middleware.js +87 -0
  77. package/dist/events/middleware/metrics.middleware.js.map +1 -0
  78. package/dist/events/middleware/validation.middleware.d.ts +8 -0
  79. package/dist/events/middleware/validation.middleware.js +63 -0
  80. package/dist/events/middleware/validation.middleware.js.map +1 -0
  81. package/dist/events/store/memory-event-store.d.ts +21 -0
  82. package/dist/events/store/memory-event-store.js +81 -0
  83. package/dist/events/store/memory-event-store.js.map +1 -0
  84. package/dist/events/types/event.types.d.ts +57 -0
  85. package/dist/{decorators/cache/ICacheClient.js → events/types/event.types.js} +1 -1
  86. package/dist/events/types/event.types.js.map +1 -0
  87. package/dist/examples/basic-api.d.ts +1 -0
  88. package/dist/examples/basic-api.js +120 -0
  89. package/dist/examples/basic-api.js.map +1 -0
  90. package/dist/index.d.ts +17 -11
  91. package/dist/index.js +95 -31
  92. package/dist/index.js.map +1 -1
  93. package/dist/logging/config/logging.config.d.ts +5 -0
  94. package/dist/logging/config/logging.config.js +101 -0
  95. package/dist/logging/config/logging.config.js.map +1 -0
  96. package/dist/logging/core/log-context.service.d.ts +11 -0
  97. package/dist/logging/core/log-context.service.js +40 -0
  98. package/dist/logging/core/log-context.service.js.map +1 -0
  99. package/dist/logging/core/logger.service.d.ts +29 -0
  100. package/dist/logging/core/logger.service.js +178 -0
  101. package/dist/logging/core/logger.service.js.map +1 -0
  102. package/dist/logging/core/startup-logger.service.d.ts +17 -0
  103. package/dist/logging/core/startup-logger.service.js +156 -0
  104. package/dist/logging/core/startup-logger.service.js.map +1 -0
  105. package/dist/logging/decorators/log.decorator.d.ts +11 -0
  106. package/dist/logging/decorators/log.decorator.js +80 -0
  107. package/dist/logging/decorators/log.decorator.js.map +1 -0
  108. package/dist/logging/index.d.ts +15 -0
  109. package/dist/logging/index.js +46 -0
  110. package/dist/logging/index.js.map +1 -0
  111. package/dist/logging/middleware/context.middleware.d.ts +2 -0
  112. package/dist/logging/middleware/context.middleware.js +29 -0
  113. package/dist/logging/middleware/context.middleware.js.map +1 -0
  114. package/dist/logging/middleware/request-logging.middleware.d.ts +3 -0
  115. package/dist/logging/middleware/request-logging.middleware.js +78 -0
  116. package/dist/logging/middleware/request-logging.middleware.js.map +1 -0
  117. package/dist/logging/types/logging.types.d.ts +79 -0
  118. package/dist/{decorators/transaction/IDatabaseClient.js → logging/types/logging.types.js} +1 -1
  119. package/dist/logging/types/logging.types.js.map +1 -0
  120. package/dist/middlewares/auth.middleware.d.ts +2 -0
  121. package/dist/middlewares/auth.middleware.js +20 -0
  122. package/dist/middlewares/auth.middleware.js.map +1 -0
  123. package/dist/middlewares/cors.middleware.d.ts +2 -0
  124. package/dist/middlewares/cors.middleware.js +16 -0
  125. package/dist/middlewares/cors.middleware.js.map +1 -0
  126. package/dist/middlewares/swagger.middleware.d.ts +6 -0
  127. package/dist/middlewares/swagger.middleware.js +84 -0
  128. package/dist/middlewares/swagger.middleware.js.map +1 -0
  129. package/dist/repositories/user.repository.d.ts +16 -0
  130. package/dist/repositories/user.repository.js +110 -0
  131. package/dist/repositories/user.repository.js.map +1 -0
  132. package/dist/schemas/user.schemas.d.ts +214 -0
  133. package/dist/schemas/user.schemas.js +71 -0
  134. package/dist/schemas/user.schemas.js.map +1 -0
  135. package/dist/services/config-demo.service.d.ts +10 -0
  136. package/dist/services/config-demo.service.js +88 -0
  137. package/dist/services/config-demo.service.js.map +1 -0
  138. package/dist/services/user.service.d.ts +21 -0
  139. package/dist/services/user.service.js +201 -0
  140. package/dist/services/user.service.js.map +1 -0
  141. package/package.json +49 -14
  142. package/dist/application/Application.d.ts +0 -43
  143. package/dist/application/Application.d.ts.map +0 -1
  144. package/dist/application/Application.js +0 -283
  145. package/dist/application/Application.js.map +0 -1
  146. package/dist/container/container.d.ts +0 -9
  147. package/dist/container/container.d.ts.map +0 -1
  148. package/dist/container/container.js +0 -23
  149. package/dist/container/container.js.map +0 -1
  150. package/dist/decorators/cache/ICacheClient.d.ts +0 -6
  151. package/dist/decorators/cache/ICacheClient.d.ts.map +0 -1
  152. package/dist/decorators/cache/ICacheClient.js.map +0 -1
  153. package/dist/decorators/cache/cache.decorator.d.ts +0 -2
  154. package/dist/decorators/cache/cache.decorator.d.ts.map +0 -1
  155. package/dist/decorators/cache/cache.decorator.js +0 -38
  156. package/dist/decorators/cache/cache.decorator.js.map +0 -1
  157. package/dist/decorators/controller.decorator.d.ts +0 -9
  158. package/dist/decorators/controller.decorator.d.ts.map +0 -1
  159. package/dist/decorators/controller.decorator.js +0 -99
  160. package/dist/decorators/controller.decorator.js.map +0 -1
  161. package/dist/decorators/http.decorator.d.ts +0 -7
  162. package/dist/decorators/http.decorator.d.ts.map +0 -1
  163. package/dist/decorators/http.decorator.js +0 -26
  164. package/dist/decorators/http.decorator.js.map +0 -1
  165. package/dist/decorators/timing.decorator.d.ts +0 -2
  166. package/dist/decorators/timing.decorator.d.ts.map +0 -1
  167. package/dist/decorators/timing.decorator.js +0 -26
  168. package/dist/decorators/timing.decorator.js.map +0 -1
  169. package/dist/decorators/transaction/IDatabaseClient.d.ts +0 -9
  170. package/dist/decorators/transaction/IDatabaseClient.d.ts.map +0 -1
  171. package/dist/decorators/transaction/IDatabaseClient.js.map +0 -1
  172. package/dist/decorators/transaction/transactional.decorator.d.ts +0 -2
  173. package/dist/decorators/transaction/transactional.decorator.d.ts.map +0 -1
  174. package/dist/decorators/transaction/transactional.decorator.js +0 -27
  175. package/dist/decorators/transaction/transactional.decorator.js.map +0 -1
  176. package/dist/index.d.ts.map +0 -1
  177. package/dist/logger/Logger.d.ts +0 -37
  178. package/dist/logger/Logger.d.ts.map +0 -1
  179. package/dist/logger/Logger.js +0 -142
  180. package/dist/logger/Logger.js.map +0 -1
  181. package/dist/middleware/http.d.ts +0 -2
  182. package/dist/middleware/http.d.ts.map +0 -1
  183. package/dist/middleware/http.js +0 -80
  184. package/dist/middleware/http.js.map +0 -1
  185. package/dist/middleware/requestcontext.d.ts +0 -12
  186. package/dist/middleware/requestcontext.d.ts.map +0 -1
  187. package/dist/middleware/requestcontext.js +0 -6
  188. package/dist/middleware/requestcontext.js.map +0 -1
@@ -0,0 +1,28 @@
1
+ import 'reflect-metadata';
2
+ import { Scope } from './container';
3
+ import { Middleware } from './middleware';
4
+ import { ZodSchema } from './validation';
5
+ import { OpenAPIOperation, OpenAPIResponse } from './openapi';
6
+ export declare const Injectable: (scope?: Scope) => ClassDecorator;
7
+ export declare const Service: (scope?: Scope) => ClassDecorator;
8
+ export declare const Repository: (scope?: Scope) => ClassDecorator;
9
+ export declare const Controller: (prefix?: string) => ClassDecorator;
10
+ export declare const Get: (path?: string) => MethodDecorator;
11
+ export declare const Post: (path?: string) => MethodDecorator;
12
+ export declare const Put: (path?: string) => MethodDecorator;
13
+ export declare const Delete: (path?: string) => MethodDecorator;
14
+ export declare const Req: () => ParameterDecorator;
15
+ export declare const Res: () => ParameterDecorator;
16
+ export declare const Body: () => ParameterDecorator;
17
+ export declare const Param: (name: string) => ParameterDecorator;
18
+ export declare const Query: (name?: string) => ParameterDecorator;
19
+ export declare const UseMiddleware: (...middlewares: Middleware[]) => MethodDecorator & ClassDecorator;
20
+ export declare const ValidateBody: (schema: ZodSchema) => MethodDecorator;
21
+ export declare const ValidateQuery: (schema: ZodSchema) => MethodDecorator;
22
+ export declare const ValidateParams: (schema: ZodSchema) => MethodDecorator;
23
+ export declare const ValidateResponse: (schema: ZodSchema) => MethodDecorator;
24
+ export declare const InjectConfig: <T>(configClass: new () => T) => ParameterDecorator;
25
+ export declare const ApiTags: (...tags: string[]) => ClassDecorator;
26
+ export declare const ApiSecurity: (security: any[]) => ClassDecorator & MethodDecorator;
27
+ export declare const ApiResponse: (statusCode: number, response: OpenAPIResponse) => ClassDecorator & MethodDecorator;
28
+ export declare const ApiOperation: (operation: OpenAPIOperation) => MethodDecorator;
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiOperation = exports.ApiResponse = exports.ApiSecurity = exports.ApiTags = exports.InjectConfig = exports.ValidateResponse = exports.ValidateParams = exports.ValidateQuery = exports.ValidateBody = exports.UseMiddleware = exports.Query = exports.Param = exports.Body = exports.Res = exports.Req = exports.Delete = exports.Put = exports.Post = exports.Get = exports.Controller = exports.Repository = exports.Service = exports.Injectable = void 0;
4
+ require("reflect-metadata");
5
+ const container_1 = require("./container");
6
+ // Class Decorators
7
+ const Injectable = (scope = container_1.Scope.SINGLETON) => {
8
+ return (target) => {
9
+ container_1.container.register(target, scope);
10
+ };
11
+ };
12
+ exports.Injectable = Injectable;
13
+ const Service = (scope = container_1.Scope.SINGLETON) => {
14
+ return (target) => {
15
+ container_1.container.register(target, scope);
16
+ };
17
+ };
18
+ exports.Service = Service;
19
+ const Repository = (scope = container_1.Scope.SINGLETON) => {
20
+ return (target) => {
21
+ container_1.container.register(target, scope);
22
+ };
23
+ };
24
+ exports.Repository = Repository;
25
+ const Controller = (prefix = '') => {
26
+ return (target) => {
27
+ Reflect.defineMetadata('controller:prefix', prefix, target);
28
+ container_1.container.register(target);
29
+ };
30
+ };
31
+ exports.Controller = Controller;
32
+ // HTTP Method Decorators
33
+ const Get = (path = '') => {
34
+ return (target, propertyKey) => {
35
+ Reflect.defineMetadata('route:method', 'GET', target, propertyKey);
36
+ Reflect.defineMetadata('route:path', path, target, propertyKey);
37
+ };
38
+ };
39
+ exports.Get = Get;
40
+ const Post = (path = '') => {
41
+ return (target, propertyKey) => {
42
+ Reflect.defineMetadata('route:method', 'POST', target, propertyKey);
43
+ Reflect.defineMetadata('route:path', path, target, propertyKey);
44
+ };
45
+ };
46
+ exports.Post = Post;
47
+ const Put = (path = '') => {
48
+ return (target, propertyKey) => {
49
+ Reflect.defineMetadata('route:method', 'PUT', target, propertyKey);
50
+ Reflect.defineMetadata('route:path', path, target, propertyKey);
51
+ };
52
+ };
53
+ exports.Put = Put;
54
+ const Delete = (path = '') => {
55
+ return (target, propertyKey) => {
56
+ Reflect.defineMetadata('route:method', 'DELETE', target, propertyKey);
57
+ Reflect.defineMetadata('route:path', path, target, propertyKey);
58
+ };
59
+ };
60
+ exports.Delete = Delete;
61
+ // Parameter Decorators
62
+ const Req = () => {
63
+ return (target, propertyKey, parameterIndex) => {
64
+ Reflect.defineMetadata(`param:${parameterIndex}`, { type: 'request' }, target, propertyKey);
65
+ };
66
+ };
67
+ exports.Req = Req;
68
+ const Res = () => {
69
+ return (target, propertyKey, parameterIndex) => {
70
+ Reflect.defineMetadata(`param:${parameterIndex}`, { type: 'response' }, target, propertyKey);
71
+ };
72
+ };
73
+ exports.Res = Res;
74
+ const Body = () => {
75
+ return (target, propertyKey, parameterIndex) => {
76
+ Reflect.defineMetadata(`param:${parameterIndex}`, { type: 'body' }, target, propertyKey);
77
+ };
78
+ };
79
+ exports.Body = Body;
80
+ const Param = (name) => {
81
+ return (target, propertyKey, parameterIndex) => {
82
+ Reflect.defineMetadata(`param:${parameterIndex}`, { type: 'param', name }, target, propertyKey);
83
+ };
84
+ };
85
+ exports.Param = Param;
86
+ const Query = (name) => {
87
+ return (target, propertyKey, parameterIndex) => {
88
+ Reflect.defineMetadata(`param:${parameterIndex}`, { type: 'query', name }, target, propertyKey);
89
+ };
90
+ };
91
+ exports.Query = Query;
92
+ // Middleware Decorators
93
+ const UseMiddleware = (...middlewares) => {
94
+ return (target, propertyKey) => {
95
+ if (propertyKey) {
96
+ // Method decorator
97
+ Reflect.defineMetadata('middlewares', middlewares, target, propertyKey);
98
+ }
99
+ else {
100
+ // Class decorator
101
+ Reflect.defineMetadata('middlewares', middlewares, target);
102
+ }
103
+ };
104
+ };
105
+ exports.UseMiddleware = UseMiddleware;
106
+ // Validation Decorators
107
+ const ValidateBody = (schema) => {
108
+ return (target, propertyKey) => {
109
+ const existingValidation = Reflect.getMetadata('validation', target, propertyKey) || {};
110
+ existingValidation.body = schema;
111
+ Reflect.defineMetadata('validation', existingValidation, target, propertyKey);
112
+ };
113
+ };
114
+ exports.ValidateBody = ValidateBody;
115
+ const ValidateQuery = (schema) => {
116
+ return (target, propertyKey) => {
117
+ const existingValidation = Reflect.getMetadata('validation', target, propertyKey) || {};
118
+ existingValidation.query = schema;
119
+ Reflect.defineMetadata('validation', existingValidation, target, propertyKey);
120
+ };
121
+ };
122
+ exports.ValidateQuery = ValidateQuery;
123
+ const ValidateParams = (schema) => {
124
+ return (target, propertyKey) => {
125
+ const existingValidation = Reflect.getMetadata('validation', target, propertyKey) || {};
126
+ existingValidation.params = schema;
127
+ Reflect.defineMetadata('validation', existingValidation, target, propertyKey);
128
+ };
129
+ };
130
+ exports.ValidateParams = ValidateParams;
131
+ const ValidateResponse = (schema) => {
132
+ return (target, propertyKey) => {
133
+ const existingValidation = Reflect.getMetadata('validation', target, propertyKey) || {};
134
+ existingValidation.response = schema;
135
+ Reflect.defineMetadata('validation', existingValidation, target, propertyKey);
136
+ };
137
+ };
138
+ exports.ValidateResponse = ValidateResponse;
139
+ // Configuration injection decorator
140
+ const InjectConfig = (configClass) => {
141
+ return (target, propertyKey, parameterIndex) => {
142
+ const existingTypes = Reflect.getMetadata('design:paramtypes', target, propertyKey) || [];
143
+ const existingConfigs = Reflect.getMetadata('inject:configs', target, propertyKey) || [];
144
+ existingConfigs[parameterIndex] = configClass;
145
+ Reflect.defineMetadata('inject:configs', existingConfigs, target, propertyKey);
146
+ };
147
+ };
148
+ exports.InjectConfig = InjectConfig;
149
+ // OpenAPI Documentation Decorators
150
+ const ApiTags = (...tags) => {
151
+ return (target) => {
152
+ const existingMeta = Reflect.getMetadata('openapi:controller', target) || {};
153
+ existingMeta.tags = [...(existingMeta.tags || []), ...tags];
154
+ Reflect.defineMetadata('openapi:controller', existingMeta, target);
155
+ };
156
+ };
157
+ exports.ApiTags = ApiTags;
158
+ const ApiSecurity = (security) => {
159
+ return (target, propertyKey) => {
160
+ if (propertyKey) {
161
+ // Method decorator
162
+ const existingMeta = Reflect.getMetadata('openapi:method', target, propertyKey) || {};
163
+ existingMeta.security = security;
164
+ Reflect.defineMetadata('openapi:method', existingMeta, target, propertyKey);
165
+ }
166
+ else {
167
+ // Class decorator
168
+ const existingMeta = Reflect.getMetadata('openapi:controller', target) || {};
169
+ existingMeta.security = security;
170
+ Reflect.defineMetadata('openapi:controller', existingMeta, target);
171
+ }
172
+ };
173
+ };
174
+ exports.ApiSecurity = ApiSecurity;
175
+ const ApiResponse = (statusCode, response) => {
176
+ return (target, propertyKey) => {
177
+ if (propertyKey) {
178
+ // Method decorator
179
+ const existingMeta = Reflect.getMetadata('openapi:method', target, propertyKey) || {};
180
+ if (!existingMeta.responses)
181
+ existingMeta.responses = {};
182
+ existingMeta.responses[statusCode.toString()] = response;
183
+ Reflect.defineMetadata('openapi:method', existingMeta, target, propertyKey);
184
+ }
185
+ else {
186
+ // Class decorator
187
+ const existingMeta = Reflect.getMetadata('openapi:controller', target) || {};
188
+ if (!existingMeta.responses)
189
+ existingMeta.responses = {};
190
+ existingMeta.responses[statusCode.toString()] = response;
191
+ Reflect.defineMetadata('openapi:controller', existingMeta, target);
192
+ }
193
+ };
194
+ };
195
+ exports.ApiResponse = ApiResponse;
196
+ const ApiOperation = (operation) => {
197
+ return (target, propertyKey) => {
198
+ const existingMeta = Reflect.getMetadata('openapi:method', target, propertyKey) || {};
199
+ existingMeta.operation = operation;
200
+ Reflect.defineMetadata('openapi:method', existingMeta, target, propertyKey);
201
+ };
202
+ };
203
+ exports.ApiOperation = ApiOperation;
204
+ //# sourceMappingURL=decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/core/decorators.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,2CAA+C;AAM/C,mBAAmB;AACZ,MAAM,UAAU,GAAG,CAAC,QAAe,iBAAK,CAAC,SAAS,EAAkB,EAAE;IAC3E,OAAO,CAAC,MAAW,EAAE,EAAE;QACrB,qBAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,UAAU,cAIrB;AAEK,MAAM,OAAO,GAAG,CAAC,QAAe,iBAAK,CAAC,SAAS,EAAkB,EAAE;IACxE,OAAO,CAAC,MAAW,EAAE,EAAE;QACrB,qBAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,OAAO,WAIlB;AA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C,SAAS,GAAG,EAAE,CAAC;YACzD,YAAY,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC;YACzD,OAAO,CAAC,cAAc,CAAC,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QAC9E,CAAC;aAAM,CAAC;YACN,kBAAkB;YAClB,MAAM,YAAY,GAA8B,OAAO,CAAC,WAAW,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;YACxG,IAAI,CAAC,YAAY,CAAC,SAAS;gBAAE,YAAY,CAAC,SAAS,GAAG,EAAE,CAAC;YACzD,YAAY,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC;YACzD,OAAO,CAAC,cAAc,CAAC,oBAAoB,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;QACrE,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,WAAW,eAgBtB;AAEK,MAAM,YAAY,GAAG,CAAC,SAA2B,EAAmB,EAAE;IAC3E,OAAO,CAAC,MAAW,EAAE,WAA4B,EAAE,EAAE;QACnD,MAAM,YAAY,GAA0B,OAAO,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC;QAC7G,YAAY,CAAC,SAAS,GAAG,SAAS,CAAC;QACnC,OAAO,CAAC,cAAc,CAAC,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IAC9E,CAAC,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB"}
@@ -0,0 +1,18 @@
1
+ import { ServerResponse } from 'http';
2
+ export declare class HttpError extends Error {
3
+ status: number;
4
+ constructor(status: number, message: string);
5
+ }
6
+ export declare class ValidationError extends HttpError {
7
+ constructor(message: string);
8
+ }
9
+ export declare class NotFoundError extends HttpError {
10
+ constructor(message?: string);
11
+ }
12
+ export declare class UnauthorizedError extends HttpError {
13
+ constructor(message?: string);
14
+ }
15
+ export declare class ForbiddenError extends HttpError {
16
+ constructor(message?: string);
17
+ }
18
+ export declare function errorHandler(error: unknown, res: ServerResponse): void;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ForbiddenError = exports.UnauthorizedError = exports.NotFoundError = exports.ValidationError = exports.HttpError = void 0;
4
+ exports.errorHandler = errorHandler;
5
+ class HttpError extends Error {
6
+ constructor(status, message) {
7
+ super(message);
8
+ this.status = status;
9
+ this.name = 'HttpError';
10
+ }
11
+ }
12
+ exports.HttpError = HttpError;
13
+ class ValidationError extends HttpError {
14
+ constructor(message) {
15
+ super(400, message);
16
+ this.name = 'ValidationError';
17
+ }
18
+ }
19
+ exports.ValidationError = ValidationError;
20
+ class NotFoundError extends HttpError {
21
+ constructor(message = 'Resource not found') {
22
+ super(404, message);
23
+ this.name = 'NotFoundError';
24
+ }
25
+ }
26
+ exports.NotFoundError = NotFoundError;
27
+ class UnauthorizedError extends HttpError {
28
+ constructor(message = 'Unauthorized') {
29
+ super(401, message);
30
+ this.name = 'UnauthorizedError';
31
+ }
32
+ }
33
+ exports.UnauthorizedError = UnauthorizedError;
34
+ class ForbiddenError extends HttpError {
35
+ constructor(message = 'Forbidden') {
36
+ super(403, message);
37
+ this.name = 'ForbiddenError';
38
+ }
39
+ }
40
+ exports.ForbiddenError = ForbiddenError;
41
+ function errorHandler(error, res) {
42
+ // Check if headers have already been sent to prevent ERR_HTTP_HEADERS_SENT
43
+ if (res.headersSent) {
44
+ console.error('Cannot send error response - headers already sent:', error);
45
+ return;
46
+ }
47
+ if (error instanceof HttpError) {
48
+ res.writeHead(error.status, { 'Content-Type': 'application/json' });
49
+ res.end(JSON.stringify({
50
+ error: error.message,
51
+ status: error.status,
52
+ timestamp: new Date().toISOString()
53
+ }));
54
+ }
55
+ else if (error instanceof Error) {
56
+ console.error('Unhandled error:', error);
57
+ res.writeHead(500, { 'Content-Type': 'application/json' });
58
+ res.end(JSON.stringify({
59
+ error: 'Internal Server Error',
60
+ status: 500,
61
+ timestamp: new Date().toISOString()
62
+ }));
63
+ }
64
+ else {
65
+ console.error('Unknown error:', error);
66
+ res.writeHead(500, { 'Content-Type': 'application/json' });
67
+ res.end(JSON.stringify({
68
+ error: 'Internal Server Error',
69
+ status: 500,
70
+ timestamp: new Date().toISOString()
71
+ }));
72
+ }
73
+ }
74
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":";;;AAqCA,oCA+BC;AAlED,MAAa,SAAU,SAAQ,KAAK;IAClC,YAAmB,MAAc,EAAE,OAAe;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,WAAM,GAAN,MAAM,CAAQ;QAE/B,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF;AALD,8BAKC;AAED,MAAa,eAAgB,SAAQ,SAAS;IAC5C,YAAY,OAAe;QACzB,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED,MAAa,aAAc,SAAQ,SAAS;IAC1C,YAAY,UAAkB,oBAAoB;QAChD,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AALD,sCAKC;AAED,MAAa,iBAAkB,SAAQ,SAAS;IAC9C,YAAY,UAAkB,cAAc;QAC1C,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AALD,8CAKC;AAED,MAAa,cAAe,SAAQ,SAAS;IAC3C,YAAY,UAAkB,WAAW;QACvC,KAAK,CAA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AI,CAAC,SAAS,CAAC;YACrB,KAAK,EAAE,uBAAuB;YAC9B,MAAM,EAAE,GAAG;YACX,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC,CAAC;IACN,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { IncomingMessage, ServerResponse } from 'http';
2
+ export type NextFunction = () => Promise<void> | void;
3
+ export type Middleware = (req: IncomingMessage, res: ServerResponse, next: NextFunction) => Promise<void> | void;
4
+ export declare class MiddlewareStack {
5
+ private middlewares;
6
+ use(middleware: Middleware): void;
7
+ execute(req: IncomingMessage, res: ServerResponse): Promise<void>;
8
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MiddlewareStack = void 0;
4
+ class MiddlewareStack {
5
+ constructor() {
6
+ this.middlewares = [];
7
+ }
8
+ use(middleware) {
9
+ this.middlewares.push(middleware);
10
+ }
11
+ async execute(req, res) {
12
+ let index = 0;
13
+ const next = async () => {
14
+ if (index < this.middlewares.length) {
15
+ const middleware = this.middlewares[index++];
16
+ await middleware(req, res, next);
17
+ }
18
+ };
19
+ await next();
20
+ }
21
+ }
22
+ exports.MiddlewareStack = MiddlewareStack;
23
+ //# sourceMappingURL=middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../src/core/middleware.ts"],"names":[],"mappings":";;;AAUA,MAAa,eAAe;IAA5B;QACU,gBAAW,GAAiB,EAAE,CAAC;IAkBzC,CAAC;IAhBC,GAAG,CAAC,UAAsB;QACxB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAoB,EAAE,GAAmB;QACrD,IAAI,KAAK,GAAG,CAAC,CAAC;QAEd,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;YACrC,IAAI,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;gBACpC,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;gBAC7C,MAAM,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;YACnC,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,IAAI,EAAE,CAAC;IACf,CAAC;CACF;AAnBD,0CAmBC"}
@@ -0,0 +1,80 @@
1
+ import { ZodSchema } from './validation';
2
+ export interface OpenAPIInfo {
3
+ title: string;
4
+ version: string;
5
+ description?: string;
6
+ contact?: {
7
+ name?: string;
8
+ email?: string;
9
+ url?: string;
10
+ };
11
+ license?: {
12
+ name: string;
13
+ url?: string;
14
+ };
15
+ }
16
+ export interface OpenAPIServer {
17
+ url: string;
18
+ description?: string;
19
+ }
20
+ export interface OpenAPITag {
21
+ name: string;
22
+ description?: string;
23
+ externalDocs?: {
24
+ description?: string;
25
+ url: string;
26
+ };
27
+ }
28
+ export interface OpenAPIOperation {
29
+ summary?: string;
30
+ description?: string;
31
+ operationId?: string;
32
+ tags?: string[];
33
+ deprecated?: boolean;
34
+ security?: any[];
35
+ externalDocs?: {
36
+ description?: string;
37
+ url: string;
38
+ };
39
+ }
40
+ export interface OpenAPIResponse {
41
+ description: string;
42
+ schema?: ZodSchema;
43
+ examples?: Record<string, any>;
44
+ headers?: Record<string, any>;
45
+ }
46
+ export interface OpenAPISpec {
47
+ openapi: string;
48
+ info: OpenAPIInfo;
49
+ servers?: OpenAPIServer[];
50
+ paths: Record<string, any>;
51
+ components: {
52
+ schemas: Record<string, any>;
53
+ securitySchemes?: Record<string, any>;
54
+ };
55
+ tags?: OpenAPITag[];
56
+ security?: any[];
57
+ }
58
+ export interface ControllerOpenAPIMetadata {
59
+ tags?: string[];
60
+ security?: any[];
61
+ responses?: Record<string, OpenAPIResponse>;
62
+ }
63
+ export interface MethodOpenAPIMetadata {
64
+ operation?: OpenAPIOperation;
65
+ responses?: Record<string, OpenAPIResponse>;
66
+ security?: any[];
67
+ }
68
+ export declare class OpenAPIGenerator {
69
+ private spec;
70
+ private schemaCounter;
71
+ private schemaCache;
72
+ constructor(info: OpenAPIInfo, servers?: OpenAPIServer[]);
73
+ addControllers(controllers: any[]): void;
74
+ private processController;
75
+ private addPathOperation;
76
+ private formatResponse;
77
+ private addSchema;
78
+ private normalizePath;
79
+ getSpec(): OpenAPISpec;
80
+ }
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenAPIGenerator = void 0;
4
+ const validation_1 = require("./validation");
5
+ class OpenAPIGenerator {
6
+ constructor(info, servers) {
7
+ this.schemaCounter = 0;
8
+ this.schemaCache = new Map();
9
+ this.spec = {
10
+ openapi: '3.0.0',
11
+ info,
12
+ servers: servers || [
13
+ { url: 'http://localhost:3000', description: 'Development server' }
14
+ ],
15
+ paths: {},
16
+ components: {
17
+ schemas: {},
18
+ securitySchemes: {
19
+ bearerAuth: {
20
+ type: 'http',
21
+ scheme: 'bearer',
22
+ bearerFormat: 'JWT'
23
+ }
24
+ }
25
+ },
26
+ tags: []
27
+ };
28
+ }
29
+ addControllers(controllers) {
30
+ controllers.forEach(Controller => {
31
+ this.processController(Controller);
32
+ });
33
+ }
34
+ processController(Controller) {
35
+ const controllerPrefix = Reflect.getMetadata('controller:prefix', Controller) || '';
36
+ const controllerMeta = Reflect.getMetadata('openapi:controller', Controller) || {};
37
+ // Add controller tags to global tags if not exists
38
+ if (controllerMeta.tags) {
39
+ controllerMeta.tags.forEach(tagName => {
40
+ if (!this.spec.tags?.find(tag => tag.name === tagName)) {
41
+ if (!this.spec.tags)
42
+ this.spec.tags = [];
43
+ this.spec.tags.push({ name: tagName });
44
+ }
45
+ });
46
+ }
47
+ const methodNames = Object.getOwnPropertyNames(Controller.prototype);
48
+ methodNames.forEach(methodName => {
49
+ if (methodName === 'constructor')
50
+ return;
51
+ const httpMethod = Reflect.getMetadata('route:method', Controller.prototype, methodName);
52
+ const routePath = Reflect.getMetadata('route:path', Controller.prototype, methodName);
53
+ if (httpMethod && routePath !== undefined) {
54
+ const fullPath = this.normalizePath(controllerPrefix + routePath);
55
+ const method = httpMethod.toLowerCase();
56
+ this.addPathOperation(fullPath, method, Controller.prototype, methodName, controllerMeta);
57
+ }
58
+ });
59
+ }
60
+ addPathOperation(path, method, prototype, methodName, controllerMeta) {
61
+ if (!this.spec.paths[path]) {
62
+ this.spec.paths[path] = {};
63
+ }
64
+ const methodMeta = Reflect.getMetadata('openapi:method', prototype, methodName) || {};
65
+ const validationMeta = Reflect.getMetadata('validation', prototype, methodName) || {};
66
+ const operation = {
67
+ summary: methodMeta.operation?.summary,
68
+ description: methodMeta.operation?.description,
69
+ operationId: methodMeta.operation?.operationId || `${method}${path.replace(/[^a-zA-Z0-9]/g, '')}`,
70
+ tags: [
71
+ ...(controllerMeta.tags || []),
72
+ ...(methodMeta.operation?.tags || [])
73
+ ],
74
+ parameters: [],
75
+ responses: {}
76
+ };
77
+ // Add parameters from validation metadata
78
+ if (validationMeta.params) {
79
+ const paramsSchema = (0, validation_1.zodToOpenAPI)(validationMeta.params);
80
+ if (paramsSchema.properties) {
81
+ Object.entries(paramsSchema.properties).forEach(([paramName, paramSchema]) => {
82
+ operation.parameters.push({
83
+ name: paramName,
84
+ in: 'path',
85
+ required: paramsSchema.required?.includes(paramName) || false,
86
+ schema: paramSchema
87
+ });
88
+ });
89
+ }
90
+ }
91
+ if (validationMeta.query) {
92
+ const querySchema = (0, validation_1.zodToOpenAPI)(validationMeta.query);
93
+ if (querySchema.properties) {
94
+ Object.entries(querySchema.properties).forEach(([queryName, propSchema]) => {
95
+ operation.parameters.push({
96
+ name: queryName,
97
+ in: 'query',
98
+ required: querySchema.required?.includes(queryName) || false,
99
+ schema: propSchema
100
+ });
101
+ });
102
+ }
103
+ }
104
+ // Add request body from validation metadata
105
+ if (validationMeta.body) {
106
+ const bodySchemaName = this.addSchema(validationMeta.body);
107
+ operation.requestBody = {
108
+ required: true,
109
+ content: {
110
+ 'application/json': {
111
+ schema: { $ref: `#/components/schemas/${bodySchemaName}` }
112
+ }
113
+ }
114
+ };
115
+ }
116
+ // Add responses
117
+ const allResponses = {
118
+ ...controllerMeta.responses,
119
+ ...methodMeta.responses
120
+ };
121
+ if (Object.keys(allResponses).length > 0) {
122
+ Object.entries(allResponses).forEach(([statusCode, response]) => {
123
+ operation.responses[statusCode] = this.formatResponse(response);
124
+ });
125
+ }
126
+ else {
127
+ // Default response
128
+ operation.responses['200'] = {
129
+ description: 'Successful response',
130
+ content: {
131
+ 'application/json': {
132
+ schema: validationMeta.response
133
+ ? { $ref: `#/components/schemas/${this.addSchema(validationMeta.response)}` }
134
+ : { type: 'object' }
135
+ }
136
+ }
137
+ };
138
+ }
139
+ // Add security
140
+ const security = methodMeta.security || controllerMeta.security;
141
+ if (security) {
142
+ operation.security = security;
143
+ }
144
+ // Set deprecated flag
145
+ if (methodMeta.operation?.deprecated) {
146
+ operation.deprecated = true;
147
+ }
148
+ this.spec.paths[path][method] = operation;
149
+ }
150
+ formatResponse(response) {
151
+ const formatted = {
152
+ description: response.description
153
+ };
154
+ if (response.schema) {
155
+ const schemaName = this.addSchema(response.schema);
156
+ formatted.content = {
157
+ 'application/json': {
158
+ schema: { $ref: `#/components/schemas/${schemaName}` }
159
+ }
160
+ };
161
+ if (response.examples) {
162
+ formatted.content['application/json'].examples = response.examples;
163
+ }
164
+ }
165
+ if (response.headers) {
166
+ formatted.headers = response.headers;
167
+ }
168
+ return formatted;
169
+ }
170
+ addSchema(zodSchema) {
171
+ // Check if schema already exists in cache
172
+ if (this.schemaCache.has(zodSchema)) {
173
+ return this.schemaCache.get(zodSchema);
174
+ }
175
+ const schemaName = `Schema${++this.schemaCounter}`;
176
+ const openApiSchema = (0, validation_1.zodToOpenAPI)(zodSchema);
177
+ this.spec.components.schemas[schemaName] = openApiSchema;
178
+ this.schemaCache.set(zodSchema, schemaName);
179
+ return schemaName;
180
+ }
181
+ normalizePath(path) {
182
+ return path.replace(/\/+/g, '/').replace(/\/$/, '') || '/';
183
+ }
184
+ getSpec() {
185
+ return this.spec;
186
+ }
187
+ }
188
+ exports.OpenAPIGenerator = OpenAPIGenerator;
189
+ //# sourceMappingURL=openapi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi.js","sourceRoot":"","sources":["../../src/core/openapi.ts"],"names":[],"mappings":";;;AAAA,6CAAuD;AA4EvD,MAAa,gBAAgB;IAK3B,YAAY,IAAiB,EAAE,OAAyB;QAHhD,kBAAa,GAAG,CAAC,CAAC;QAClB,gBAAW,GAAG,IAAI,GAAG,EAAqB,CAAC;QAGjD,IAAI,CAAC,IAAI,GAAG;YACV,OAAO,EAAE,OAAO;YAChB,IAAI;YACJ,OAAO,EAAE,OAAO,IAAI;gBAClB,EAAE,GAAG,EAAE,uBAAuB,EAAE,WAAW,EAAE,oBAAoB,EAAE;aACpE;YACD,KAAK,EAAE,EAAE;YACT,UAAU,EAAE;gBACV,OAAO,EAAE,EAAE;gBACX,eAAe,EAAE;oBACf,UAAU,EAAE;wBACV,IAAI,EAAE,MAAM;wBACZ,MAAM,EAAE,QAAQ;wBAChB,YAAY,EAAE,KAAK;qBACpB;iBACF;aACF;YACD,IAAI,EAAE,EAAE;SACT,CAAC;IACJ,CAAC;IAED,cAAc,CAAC,WAAkB;QAC/B,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAC/B,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,iBAAiB,CAAC,UAAe;QACvC,MAAM,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC;QACpF,MAAM,cAAc,GAA8B,OAAO,CAAC,WAAW,CAAC,oBAAoB,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC;QAE9G,mDAAmD;QACnD,IAAI,cAAc,CAAC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