quantum-flow 1.21.0 → 2.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 (99) hide show
  1. package/README.md +13 -12
  2. package/dist/app/aws/lambda.js +15 -18
  3. package/dist/app/aws/lambda.js.map +1 -1
  4. package/dist/app/http/Application.d.ts +2 -3
  5. package/dist/app/http/Application.js +70 -118
  6. package/dist/app/http/Application.js.map +1 -1
  7. package/dist/app/http/index.d.ts +0 -1
  8. package/dist/app/http/index.js.map +1 -1
  9. package/dist/app/plugin.js +2 -2
  10. package/dist/app/plugin.js.map +1 -1
  11. package/dist/core/Controller.d.ts +10 -5
  12. package/dist/core/Controller.js +33 -120
  13. package/dist/core/Controller.js.map +1 -1
  14. package/dist/core/index.d.ts +1 -1
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/types/common.d.ts +15 -52
  17. package/dist/types/common.js.map +1 -1
  18. package/dist/types/controller.d.ts +3 -2
  19. package/dist/types/error.d.ts +4 -0
  20. package/dist/types/error.js.map +1 -1
  21. package/dist/types/http.d.ts +6 -11
  22. package/dist/types/index.d.ts +2 -0
  23. package/dist/types/index.js +2 -0
  24. package/dist/types/index.js.map +1 -1
  25. package/dist/types/lambda.d.ts +2 -1
  26. package/dist/types/plugins.d.ts +4 -3
  27. package/dist/types/request.d.ts +65 -0
  28. package/dist/types/request.js +3 -0
  29. package/dist/types/request.js.map +1 -0
  30. package/dist/types/response.d.ts +49 -0
  31. package/dist/types/response.js +3 -0
  32. package/dist/types/response.js.map +1 -0
  33. package/dist/utils/controller.d.ts +5 -6
  34. package/dist/utils/controller.js +7 -9
  35. package/dist/utils/controller.js.map +1 -1
  36. package/dist/utils/cors.d.ts +2 -2
  37. package/dist/utils/cors.js.map +1 -1
  38. package/dist/utils/error/apperror.d.ts +4 -7
  39. package/dist/utils/error/apperror.js +10 -13
  40. package/dist/utils/error/apperror.js.map +1 -1
  41. package/dist/utils/error/dependencyFailed.d.ts +7 -0
  42. package/dist/utils/error/dependencyFailed.js +17 -0
  43. package/dist/utils/error/dependencyFailed.js.map +1 -0
  44. package/dist/utils/error/duplicateEntry.d.ts +7 -0
  45. package/dist/utils/error/duplicateEntry.js +17 -0
  46. package/dist/utils/error/duplicateEntry.js.map +1 -0
  47. package/dist/utils/error/forbidden.d.ts +7 -0
  48. package/dist/utils/error/forbidden.js +17 -0
  49. package/dist/utils/error/forbidden.js.map +1 -0
  50. package/dist/utils/error/index.d.ts +6 -0
  51. package/dist/utils/error/index.js +6 -0
  52. package/dist/utils/error/index.js.map +1 -1
  53. package/dist/utils/error/invalidState.d.ts +7 -0
  54. package/dist/utils/error/invalidState.js +17 -0
  55. package/dist/utils/error/invalidState.js.map +1 -0
  56. package/dist/utils/error/rateLimit.d.ts +7 -0
  57. package/dist/utils/error/rateLimit.js +17 -0
  58. package/dist/utils/error/rateLimit.js.map +1 -0
  59. package/dist/utils/error/serviceUnavailable.d.ts +7 -0
  60. package/dist/utils/error/serviceUnavailable.js +17 -0
  61. package/dist/utils/error/serviceUnavailable.js.map +1 -0
  62. package/dist/utils/headers.d.ts +2 -2
  63. package/dist/utils/headers.js.map +1 -1
  64. package/dist/utils/index.d.ts +3 -0
  65. package/dist/utils/index.js +3 -0
  66. package/dist/utils/index.js.map +1 -1
  67. package/dist/utils/lambda.d.ts +2 -1
  68. package/dist/utils/lambda.js +28 -48
  69. package/dist/utils/lambda.js.map +1 -1
  70. package/dist/utils/parsers.d.ts +3 -1
  71. package/dist/utils/parsers.js +106 -23
  72. package/dist/utils/parsers.js.map +1 -1
  73. package/dist/utils/request/factory.d.ts +18 -0
  74. package/dist/utils/request/factory.js +141 -0
  75. package/dist/utils/request/factory.js.map +1 -0
  76. package/dist/utils/request/helpers.d.ts +3 -0
  77. package/dist/utils/request/helpers.js +35 -0
  78. package/dist/utils/request/helpers.js.map +1 -0
  79. package/dist/utils/request/index.d.ts +2 -0
  80. package/dist/utils/request/index.js +19 -0
  81. package/dist/utils/request/index.js.map +1 -0
  82. package/dist/utils/request/request.d.ts +103 -0
  83. package/dist/utils/request/request.js +218 -0
  84. package/dist/utils/request/request.js.map +1 -0
  85. package/dist/utils/response/factory.d.ts +13 -0
  86. package/dist/utils/response/factory.js +20 -0
  87. package/dist/utils/response/factory.js.map +1 -0
  88. package/dist/utils/response/index.d.ts +2 -0
  89. package/dist/utils/response/index.js +19 -0
  90. package/dist/utils/response/index.js.map +1 -0
  91. package/dist/utils/response/response.d.ts +46 -0
  92. package/dist/utils/response/response.js +269 -0
  93. package/dist/utils/response/response.js.map +1 -0
  94. package/dist/utils/routeWalker.d.ts +2 -0
  95. package/dist/utils/routeWalker.js +115 -0
  96. package/dist/utils/routeWalker.js.map +1 -0
  97. package/dist/utils/sanitize.d.ts +2 -2
  98. package/dist/utils/sanitize.js.map +1 -1
  99. package/package.json +1 -1
@@ -52,150 +52,63 @@ function Controller(config, middlewares = []) {
52
52
  sse;
53
53
  executeControllerMethod = _utils_1.executeControllerMethod;
54
54
  getControllerMethods = _utils_1.getControllerMethods;
55
+ routePrefix;
56
+ middlewares = [];
57
+ interceptor;
58
+ subControllers = [];
59
+ errorHandler;
60
+ cors;
61
+ sanitizers;
55
62
  constructor(...args) {
56
63
  super(...args);
57
64
  this.lookupWS();
58
65
  this.lookupSSE();
59
66
  }
60
67
  handleRequest = async (request, response) => {
61
- const middlewares = []
68
+ const middlewares = this.middlewares
62
69
  .concat(Reflect.getMetadata(_constants_1.MIDDLEWARES, proto))
63
70
  .concat(Reflect.getMetadata(_constants_1.USE_MIDDLEWARE, constructor))
64
71
  .filter((el) => !!el);
72
+ const routePrefix = this.routePrefix ?? Reflect.getMetadata(_constants_1.ROUTE_PREFIX, proto) ?? '/';
73
+ const interceptor = this.interceptor ?? Reflect.getMetadata(_constants_1.INTERCEPTOR, proto);
74
+ const subControllers = this.subControllers.concat(Reflect.getMetadata(_constants_1.CONTROLLERS, proto)) ?? [];
75
+ const errorHandler = this.errorHandler ?? Reflect.getMetadata(_constants_1.CATCH, constructor);
76
+ const cors = this.cors ?? Reflect.getMetadata(_constants_1.CORS_METADATA, proto);
77
+ const sanitizers = this.sanitizers ?? Reflect.getMetadata(_constants_1.SANITIZE, proto) ?? [];
65
78
  const context = {
66
79
  controllerInstance: this,
67
80
  controllerMeta: {
68
- routePrefix: Reflect.getMetadata(_constants_1.ROUTE_PREFIX, proto) || '',
81
+ routePrefix,
69
82
  middlewares,
70
- interceptor: Reflect.getMetadata(_constants_1.INTERCEPTOR, proto),
71
- subControllers: Reflect.getMetadata(_constants_1.CONTROLLERS, proto) || [],
72
- errorHandler: Reflect.getMetadata(_constants_1.CATCH, constructor),
73
- cors: Reflect.getMetadata(_constants_1.CORS_METADATA, proto),
74
- sanitizers: Reflect.getMetadata(_constants_1.SANITIZE, proto) || [],
83
+ interceptor,
84
+ subControllers,
85
+ errorHandler,
86
+ cors,
87
+ sanitizers,
75
88
  },
76
89
  path: (request.requestUrl.pathname ?? '').replace(/^\/+/g, ''),
77
90
  method: request.method.toUpperCase(),
78
91
  middlewareChain: [],
79
92
  interceptorChain: [],
80
93
  sanitizersChain: [],
81
- corsChain: [Reflect.getMetadata(_constants_1.CORS_METADATA, proto)],
82
- errorHandlerChain: [Reflect.getMetadata(_constants_1.CATCH, proto)],
83
- subPath: Reflect.getMetadata(_constants_1.ROUTE_PREFIX, proto) || '',
94
+ corsChain: [cors],
95
+ errorHandlerChain: [errorHandler],
96
+ subPath: routePrefix,
84
97
  };
85
- return this.routeWalker(context, request, response);
86
- };
87
- async routeWalker(context, request, response) {
88
- const { controllerInstance, controllerMeta, path, method, subPath } = context;
89
- for (const SubController of controllerMeta.subControllers) {
90
- const subInstance = new SubController();
91
- const middlewares = []
92
- .concat(Reflect.getMetadata(_constants_1.MIDDLEWARES, SubController.prototype))
93
- .concat(Reflect.getMetadata(_constants_1.USE_MIDDLEWARE, SubController))
94
- .filter((el) => !!el);
95
- const sanitizers = []
96
- .concat(Reflect.getMetadata(_constants_1.SANITIZE, SubController.prototype))
97
- .concat(Reflect.getMetadata(_constants_1.SANITIZE, SubController))
98
- .filter((el) => !!el);
99
- const subMeta = {
100
- routePrefix: Reflect.getMetadata(_constants_1.ROUTE_PREFIX, SubController.prototype) || '',
101
- middlewares,
102
- interceptor: Reflect.getMetadata(_constants_1.INTERCEPTOR, SubController.prototype),
103
- errorHandler: Reflect.getMetadata(_constants_1.CATCH, SubController),
104
- subControllers: Reflect.getMetadata(_constants_1.CONTROLLERS, SubController.prototype) || [],
105
- cors: Reflect.getMetadata(_constants_1.CORS_METADATA, SubController.prototype) || [],
106
- sanitizers,
107
- };
108
- const fullSubPath = [subPath, subMeta.routePrefix]
109
- .filter(Boolean)
110
- .join('/')
111
- .replace(/\/+/g, '/');
112
- if ((0, _utils_1.pathStartsWithPrefix)(path, fullSubPath)) {
113
- const walkerData = {
114
- ...context,
115
- subPath: fullSubPath,
116
- controllerInstance: subInstance,
117
- controllerMeta: subMeta,
118
- path,
119
- middlewareChain: [...context.middlewareChain, ...controllerMeta.middlewares],
120
- sanitizersChain: [...context.sanitizersChain, ...controllerMeta.sanitizers],
121
- errorHandlerChain: [...context.errorHandlerChain, subMeta.errorHandler].filter((el) => !!el),
122
- interceptorChain: [...context.interceptorChain, controllerMeta.interceptor].filter((el) => !!el),
123
- corsChain: [...context.corsChain, subMeta.cors].filter((el) => !!el),
124
- };
125
- return this.routeWalker(walkerData, request, response);
126
- }
127
- }
128
- const routeMatch = (0, _utils_1.findRouteInController)(controllerInstance, subPath, path, method);
129
- if (!routeMatch) {
130
- return {};
131
- }
132
- let data;
133
98
  try {
134
- const { name, pathParams, middlewares, cors, sanitizers } = routeMatch;
135
- Object.assign(request, { params: pathParams });
136
- const handledCors = context.corsChain
137
- .concat(cors ?? [])
138
- .flat()
139
- .filter((el) => !!el)
140
- .reduce((acc, conf) => {
141
- const cors = (0, _utils_1.handleCORS)(request, response, conf);
142
- return {
143
- permitted: acc.permitted && cors.permitted,
144
- continue: acc.continue && cors.continue,
145
- };
146
- }, { permitted: true, continue: true });
147
- if (!handledCors.permitted) {
148
- response.statusCode = 403;
149
- data = 'Cors: Origin not allowed';
150
- return { routeMatch, data };
151
- }
152
- if (!handledCors.continue && handledCors.permitted) {
153
- response.statusCode = 204;
154
- return { routeMatch };
155
- }
156
- const controllerMiddlewares = [...context.middlewareChain, ...controllerMeta.middlewares];
157
- const controllerSanitizers = [
158
- ...context.sanitizersChain,
159
- ...controllerMeta.sanitizers,
160
- ].filter((el) => !!el);
161
- await (0, _utils_1.applyMiddlewaresVsSanitizers)(request, response, {
162
- sanitizers: [controllerSanitizers, sanitizers],
163
- middlewares: [controllerMiddlewares, middlewares],
164
- });
165
- data = await (0, _utils_1.getResponse)({
166
- interceptors: [...context.interceptorChain, controllerMeta.interceptor].filter((el) => !!el),
167
- controllerInstance,
168
- name,
169
- response: response,
170
- request: request,
171
- });
172
- }
173
- catch (error) {
174
- let catched = error;
175
- let statusCode = error.status ?? error.statusCode ?? 500;
176
- catched.status = statusCode;
177
- for (const handler of context.errorHandlerChain?.reverse() || []) {
178
- try {
179
- catched = await Promise.resolve(handler(catched, request, response))
180
- .then((resp) => {
181
- statusCode = 200;
182
- return resp;
183
- })
184
- .catch((err) => {
185
- statusCode = err.status ?? err.statusCode ?? statusCode;
186
- return err;
187
- });
188
- }
189
- catch (errs) { }
99
+ const done = await (0, _utils_1.routeWalker)(context, request, response);
100
+ if (!done) {
101
+ response.status = 404;
102
+ response.data = 'Route not found';
103
+ return false;
190
104
  }
191
- response.statusCode = statusCode;
192
- data = catched;
105
+ return true;
193
106
  }
194
- if ((0, _utils_1.getErrorType)(data).isError && response.statusCode === 200) {
195
- response.statusCode = 500;
107
+ catch (err) {
108
+ response.error(err);
109
+ return true;
196
110
  }
197
- return { routeMatch, data };
198
- }
111
+ };
199
112
  lookupWS() {
200
113
  const connection = this.getWSHandlers('connection');
201
114
  const message = this.getWSHandlers('message');
@@ -1 +1 @@
1
- {"version":3,"file":"Controller.js","sourceRoot":"","sources":["../../src/core/Controller.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CAAC,IAAY;gBACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,6BAAgB,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;gBAE/E,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC5C,CAAC;YAED,WAAW;gBACT,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,yBAAY,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;gBAEzE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC;oBAC7B,GAAG,CAAC;oBACJ,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;iBAC9B,CAAC,CAAC,CAAC;YACN,CAAC;YAED,aAAa,GAAG,CAAC,QAAe,EAAE,IAAY,EAAE,EAAE;gBAChD,OAAO,QAAQ;qBACZ,MAAM,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC;qBACnC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC;oBAChB,GAAG,CAAC;oBACJ,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;iBAC9B,CAAC,CAAC,CAAC;YACR,CAAC,CAAC;SACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * This module provides centralized exports for controller and endpoint decorators,
5
5
  * as well as related types and utility functions used throughout the core framework.
6
6
  */
7
- export { AppRequest, CORSConfig, EndpointResponse, ErrorCB, HttpError, IController, InterceptorCB, IWebSocketService, MiddlewareCB, MultipartFile, ResponseWithStatus, WebSocketClient, WebSocketEvent, WebSocketMessage, } from '../types/index.js';
7
+ export { AppError, CORSConfig, ErrorCB, InterceptorCB, IRequest, IResponse, IWebSocketService, MiddlewareCB, MultipartFile, WebSocketClient, WebSocketEvent, WebSocketMessage, } from '../types/index.js';
8
8
  export { SANITIZER } from '../utils/index.js';
9
9
  export * from './Controller';
10
10
  export * from './decorators';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAsBA,iCAAmC;AAA1B,mGAAA,SAAS,OAAA;AAClB,+CAA6B;AAC7B,+CAA6B;AAC7B,6CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAoBA,iCAAmC;AAA1B,mGAAA,SAAS,OAAA;AAClB,+CAA6B;AAC7B,+CAA6B;AAC7B,6CAA2B"}
@@ -1,50 +1,17 @@
1
- import { IncomingMessage, ServerResponse } from 'http';
2
- import { LambdaRequestMeta } from './lambda';
3
- import { MultipartFile } from './multipart';
4
- export interface HttpError extends Error {
5
- statusCode?: number;
6
- status: number;
7
- data?: any;
8
- messages?: string[];
9
- errors?: Array<{
10
- message: string;
11
- }>;
12
- }
13
- type Request = {
14
- requestUrl: URL;
15
- method: HTTP_METHODS;
16
- path?: string;
17
- id: string;
18
- headers: Record<string, string | string[]>;
19
- query?: Record<string, string | string[]>;
20
- params?: Record<string, string>;
21
- body: any;
22
- rawBody: Buffer<ArrayBufferLike>;
23
- isBase64Encoded?: boolean;
24
- cookies: Record<string, string>;
25
- multipart?: Record<string, MultipartFile | MultipartFile[]>;
26
- _startTime: number;
27
- ip: string;
28
- end: () => any;
29
- };
30
- export type AppRequest = Request & (IncomingMessage | LambdaRequestMeta);
31
- export type HttpRequest = Request & IncomingMessage;
32
- export type Router = (req: AppRequest, res?: ServerResponse) => Promise<{
1
+ import { IRequest, IResponse } from './index.js';
2
+ import { ServerResponse } from 'http';
3
+ import { AppError } from './error';
4
+ export type Router = (req: IRequest, res?: ServerResponse) => Promise<{
33
5
  status: number;
34
6
  data: any;
35
7
  message?: string;
36
8
  }>;
37
- export type EndpointResponse<T = any> = {
38
- status: number;
39
- data?: T;
40
- error?: any;
41
- };
42
9
  export interface IController {
43
10
  handleRequest: Router;
44
11
  }
45
- export type MiddlewareCB = (request: AppRequest, response: ServerResponse, next: (args?: any) => any) => void | Promise<AppRequest> | AppRequest | Promise<void> | void;
46
- export type InterceptorCB = (data: any, req?: AppRequest, res?: ServerResponse) => Promise<unknown> | unknown;
47
- export type ErrorCB = (error: HttpError, req?: AppRequest, res?: ServerResponse) => any;
12
+ export type MiddlewareCB = (request: IRequest, response: IResponse, next: (args?: any) => any) => void | Promise<IRequest> | IRequest | Promise<void> | void;
13
+ export type InterceptorCB = (data: any, req?: IRequest, res?: IResponse) => Promise<unknown> | unknown;
14
+ export type ErrorCB = (error: AppError, req?: IRequest, res?: IResponse) => any;
48
15
  export type ParamDecoratorType = 'body' | 'params' | 'query' | 'request' | 'headers' | 'cookies' | 'response' | 'multipart' | 'event' | 'context' | 'sse' | 'ws';
49
16
  export interface ParamMetadata {
50
17
  index: number;
@@ -66,15 +33,11 @@ export declare enum HTTP_METHODS {
66
33
  OPTIONS = "OPTIONS",
67
34
  HEAD = "HEAD"
68
35
  }
69
- export interface CookieOptions {
70
- maxAge?: number;
71
- expires?: Date;
72
- domain?: string;
73
- path?: string;
74
- secure?: boolean;
75
- httpOnly?: boolean;
76
- sameSite?: 'Strict' | 'Lax' | 'None';
77
- priority?: 'Low' | 'Medium' | 'High';
78
- partitioned?: boolean;
79
- }
80
- export {};
36
+ export type Meta = {
37
+ requestUrl: URL;
38
+ method: string;
39
+ requestId: string;
40
+ sourceIp: string;
41
+ userAgent: string;
42
+ startTime: number;
43
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":";;;AAyFA,IAAY,YASX;AATD,WAAY,YAAY;IACtB,2BAAW,CAAA;IACX,2BAAW,CAAA;IACX,6BAAa,CAAA;IACb,+BAAe,CAAA;IACf,iCAAiB,CAAA;IACjB,2BAAW,CAAA;IACX,mCAAmB,CAAA;IACnB,6BAAa,CAAA;AACf,CAAC,EATW,YAAY,4BAAZ,YAAY,QASvB"}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":";;;AAsDA,IAAY,YASX;AATD,WAAY,YAAY;IACtB,2BAAW,CAAA;IACX,2BAAW,CAAA;IACX,6BAAa,CAAA;IACb,+BAAe,CAAA;IACf,iCAAiB,CAAA;IACjB,2BAAW,CAAA;IACX,mCAAmB,CAAA;IACnB,6BAAa,CAAA;AACf,CAAC,EATW,YAAY,4BAAZ,YAAY,QASvB"}
@@ -1,6 +1,7 @@
1
1
  import { ServerResponse } from 'http';
2
- import { AppRequest, ErrorCB, HTTP_METHODS, InterceptorCB, MiddlewareCB } from './common';
2
+ import { ErrorCB, HTTP_METHODS, InterceptorCB, MiddlewareCB } from './common';
3
3
  import { CORSConfig } from './cors';
4
+ import { IRequest } from './request';
4
5
  import { SanitizerConfig } from './sanitize';
5
6
  export type ControllerClass = {
6
7
  new (...args: any[]): any;
@@ -12,7 +13,7 @@ export type ControllerMethods = Array<{
12
13
  middlewares?: MiddlewareCB[];
13
14
  }>;
14
15
  export type ControllerType = {
15
- handleRequest?(request: AppRequest, response: ServerResponse): Promise<any>;
16
+ handleRequest?(request: IRequest, response: ServerResponse): Promise<any>;
16
17
  ws?: WsControllerHandlers;
17
18
  sse?: SeeControllerHandlers;
18
19
  new (...args: any[]): any;
@@ -1,3 +1,6 @@
1
+ import { ServerResponse } from 'http';
2
+ import { LambdaResponse } from './lambda';
3
+ import { IRequest } from './request';
1
4
  export declare enum ErrorCode {
2
5
  BAD_REQUEST = "BAD_REQUEST",
3
6
  UNAUTHORIZED = "UNAUTHORIZED",
@@ -67,3 +70,4 @@ export interface ErrorHandlerConfig {
67
70
  logStack?: boolean;
68
71
  customHandlers?: Record<ErrorCode, (error: AppError) => any>;
69
72
  }
73
+ export type ErorrHandler = (error: Error, req: IRequest, response: LambdaResponse | ServerResponse) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/types/error.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAaX;AAbD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,0CAA6B,CAAA;IAC7B,oCAAuB,CAAA;IACvB,oCAAuB,CAAA;IACvB,oDAAuC,CAAA;IACvC,wDAA2C,CAAA;IAC3C,8CAAiC,CAAA;IACjC,wDAA2C,CAAA;IAC3C,8CAAiC,CAAA;IACjC,gDAAmC,CAAA;IACnC,4CAA+B,CAAA;IAC/B,oDAAuC,CAAA;AACzC,CAAC,EAbW,SAAS,yBAAT,SAAS,QAapB"}
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/types/error.ts"],"names":[],"mappings":";;;AAIA,IAAY,SAaX;AAbD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,0CAA6B,CAAA;IAC7B,oCAAuB,CAAA;IACvB,oCAAuB,CAAA;IACvB,oDAAuC,CAAA;IACvC,wDAA2C,CAAA;IAC3C,8CAAiC,CAAA;IACjC,wDAA2C,CAAA;IAC3C,8CAAiC,CAAA;IACjC,gDAAmC,CAAA;IACnC,4CAA+B,CAAA;IAC/B,oDAAuC,CAAA;AACzC,CAAC,EAbW,SAAS,yBAAT,SAAS,QAapB"}
@@ -1,6 +1,6 @@
1
- import { ServerResponse } from 'http';
1
+ import { IRequest, IResponse } from './index.js';
2
2
  import { PubSub } from 'type-graphql';
3
- import { AppRequest, InterceptorCB, MiddlewareCB } from './common';
3
+ import { InterceptorCB, MiddlewareCB } from './common';
4
4
  import { ControllerClass, ControllerType } from './controller';
5
5
  import { CORSConfig } from './cors';
6
6
  import { AppError } from './error';
@@ -32,7 +32,7 @@ export interface ServerConfig {
32
32
  * Error handling callback
33
33
  * @type {ErrorCB}
34
34
  */
35
- errorHandler?: (error: AppError, req: AppRequest, response: LambdaResponse | ServerResponse) => any;
35
+ errorHandler?: (error: AppError, req: IRequest, response: IResponse) => any;
36
36
  /**
37
37
  * Array of controller types
38
38
  * @type {ControllerType[]}
@@ -55,10 +55,10 @@ export interface ServerConfig {
55
55
  statics?: StaticConfig[];
56
56
  /**
57
57
  * WebSocket enablement and lazy loading
58
- * @type {{ enabled: boolean; lazy?: boolean }}
58
+ * @type {{ path: string; lazy?: boolean }}
59
59
  */
60
60
  websocket?: {
61
- enabled: boolean;
61
+ path: string;
62
62
  lazy?: boolean;
63
63
  };
64
64
  /**
@@ -68,23 +68,18 @@ export interface ServerConfig {
68
68
  sse?: {
69
69
  enabled: boolean;
70
70
  };
71
- /**
72
- * Path for WebSocket connections
73
- * @type {string}
74
- */
75
- websocketPath?: string;
76
71
  /**
77
72
  * GraphQL configuration including playground, pubSub, and resolvers
78
73
  * @type {{ playground?: boolean; pubSub?: PubSub; resolvers?: Function[] }}
79
74
  */
80
75
  graphql?: {
76
+ path: string;
81
77
  playground?: boolean;
82
78
  pubSub?: PubSub;
83
79
  resolvers?: Function[];
84
80
  };
85
81
  }
86
82
  import { Server } from 'http';
87
- import { LambdaResponse } from './lambda';
88
83
  export interface IHttpServer {
89
84
  readonly app: Server;
90
85
  plugins: HttpPlugin[];
@@ -6,6 +6,8 @@ export * from './http';
6
6
  export * from './lambda';
7
7
  export * from './multipart';
8
8
  export * from './plugins';
9
+ export * from './request';
10
+ export * from './response';
9
11
  export * from './sanitize';
10
12
  export * from './sse';
11
13
  export * from './static';
@@ -22,6 +22,8 @@ __exportStar(require("./http"), exports);
22
22
  __exportStar(require("./lambda"), exports);
23
23
  __exportStar(require("./multipart"), exports);
24
24
  __exportStar(require("./plugins"), exports);
25
+ __exportStar(require("./request"), exports);
26
+ __exportStar(require("./response"), exports);
25
27
  __exportStar(require("./sanitize"), exports);
26
28
  __exportStar(require("./sse"), exports);
27
29
  __exportStar(require("./static"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,+CAA6B;AAC7B,yCAAuB;AACvB,0CAAwB;AACxB,yCAAuB;AACvB,2CAAyB;AACzB,8CAA4B;AAC5B,4CAA0B;AAC1B,6CAA2B;AAC3B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,+CAA6B;AAC7B,yCAAuB;AACvB,0CAAwB;AACxB,yCAAuB;AACvB,2CAAyB;AACzB,8CAA4B;AAC5B,4CAA0B;AAC1B,4CAA0B;AAC1B,6CAA2B;AAC3B,6CAA2B;AAC3B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B"}
@@ -1,8 +1,9 @@
1
1
  import { APIGatewayProxyEvent, APIGatewayProxyEventV2, Context, Handler } from 'aws-lambda';
2
- import { CookieOptions, HTTP_METHODS } from './common';
2
+ import { HTTP_METHODS } from './common';
3
3
  import { ControllerClass } from './controller';
4
4
  import { MultipartFile } from './multipart';
5
5
  import { LambdaPlugin } from './plugins';
6
+ import { CookieOptions } from './response';
6
7
  export interface LambdaFunctionUrlEvent {
7
8
  version: string;
8
9
  routeKey: string;
@@ -1,12 +1,13 @@
1
+ import { IRequest } from './index.js';
1
2
  import { Context } from 'aws-lambda';
2
3
  import { IncomingMessage, Server, ServerResponse } from 'http';
3
- import { AppRequest, MiddlewareCB } from './common';
4
+ import { MiddlewareCB } from './common';
4
5
  import { IHttpServer } from './http';
5
6
  import { ILambdaAdapter, LambdaEvent, LambdaRequest, LambdaResponse } from './lambda';
6
7
  export interface HttpPluginHooks {
7
8
  beforeRequest?: (req: IncomingMessage) => void | Promise<void>;
8
- beforeRoute?: (req: AppRequest, response: ServerResponse) => void | Promise<void>;
9
- afterResponse?: (req: AppRequest, res: ServerResponse) => void | Promise<void>;
9
+ beforeRoute?: (req: IRequest, response: ServerResponse) => void | Promise<void>;
10
+ afterResponse?: (req: IRequest, res: ServerResponse) => void | Promise<void>;
10
11
  }
11
12
  export interface HttpPlugin {
12
13
  name: string;
@@ -0,0 +1,65 @@
1
+ import { APIGatewayProxyEvent, Context } from 'aws-lambda';
2
+ import { IncomingHttpHeaders } from 'http';
3
+ import { LambdaEvent } from './lambda';
4
+ export type RequestSource = 'http' | 'lambda' | 'unknown';
5
+ export interface RequestOptions {
6
+ method: string;
7
+ requestUrl: URL;
8
+ url: string;
9
+ path: string;
10
+ headers: Record<string, string | string[]>;
11
+ query: Record<string, string | string[]>;
12
+ body: any;
13
+ params: Record<string, string>;
14
+ cookies: Record<string, string>;
15
+ sourceIp?: string;
16
+ userAgent?: string;
17
+ requestId: string;
18
+ stage?: string;
19
+ timestamp: Date;
20
+ raw?: any;
21
+ context?: any;
22
+ rawBody?: any;
23
+ event?: LambdaEvent;
24
+ isBase64Encoded?: boolean;
25
+ }
26
+ export interface IRequest {
27
+ method: string;
28
+ path: string;
29
+ url: string;
30
+ requestUrl: URL;
31
+ headers: Record<string, string | string[]>;
32
+ query: Record<string, string | string[]>;
33
+ body: any;
34
+ params: Record<string, string>;
35
+ cookies: Record<string, string>;
36
+ sourceIp: string;
37
+ userAgent: string;
38
+ requestId: string;
39
+ stage: string;
40
+ timestamp: Date;
41
+ source: RequestSource;
42
+ raw: any;
43
+ context: any;
44
+ rawBody: any;
45
+ isBase64Encoded: any;
46
+ startTime: number;
47
+ getHeader(name: string): string | string[] | undefined;
48
+ getCookie(name: string): string | undefined;
49
+ getQuery(name: string): string | string[] | undefined;
50
+ getParam(name: string): string | undefined;
51
+ isHttp(): boolean;
52
+ isLambda(): boolean;
53
+ getLambdaEvent(): APIGatewayProxyEvent | undefined;
54
+ getLambdaContext(): Context | undefined;
55
+ getHttpRequest(): IncomingHttpHeaders | undefined;
56
+ setState(key: string, value: any): void;
57
+ getState<T = any>(key: string): T | undefined;
58
+ getAllState(): Map<string, any>;
59
+ isSecure(): boolean;
60
+ getClientIp(): string;
61
+ getHost(): string;
62
+ getFullUrl(): string;
63
+ clone(overrides?: Partial<RequestOptions>): IRequest;
64
+ toJSON(): Record<string, any>;
65
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/types/request.ts"],"names":[],"mappings":""}
@@ -0,0 +1,49 @@
1
+ export type ResponseSource = 'http' | 'lambda' | 'unknown';
2
+ export interface CookieOptions {
3
+ maxAge?: number;
4
+ expires?: Date;
5
+ path?: string;
6
+ domain?: string;
7
+ secure?: boolean;
8
+ httpOnly?: boolean;
9
+ sameSite?: 'strict' | 'lax' | 'none';
10
+ priority?: 'low' | 'medium' | 'high';
11
+ partitioned?: boolean;
12
+ }
13
+ export interface ResponseOptions {
14
+ statusCode?: number;
15
+ headers?: Record<string, string | string[]>;
16
+ body?: any;
17
+ cookies?: string[];
18
+ isBase64Encoded?: boolean;
19
+ encoding?: BufferEncoding;
20
+ }
21
+ export interface IResponse {
22
+ headers: Record<string, string | string[]>;
23
+ data: any;
24
+ cookies: string[];
25
+ isBase64Encoded: boolean;
26
+ source: ResponseSource;
27
+ raw: any;
28
+ headersSent: boolean;
29
+ ok: boolean;
30
+ meta: {
31
+ requestUrl: URL;
32
+ method: string;
33
+ };
34
+ status: number;
35
+ getStatus(): number;
36
+ setHeader(name: string, value: string | string[]): this;
37
+ getHeader(name: string): string | string[] | undefined;
38
+ hasHeader(name: string): boolean;
39
+ removeHeader(name: string): this;
40
+ setHeaders(headers: Record<string, string | string[]>): this;
41
+ setCookie(name: string, value: string, options?: CookieOptions): this;
42
+ clearCookie(name: string, options?: CookieOptions): this;
43
+ getCookies(): string[];
44
+ redirect(url: string, statusCode?: number): this;
45
+ end(data: unknown): this;
46
+ error(data: unknown): this;
47
+ reset(): this;
48
+ toJSON(): Record<string, any>;
49
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/types/response.ts"],"names":[],"mappings":""}
@@ -1,6 +1,5 @@
1
- import { AppRequest, ControllerInstance, ControllerMethods, CORSConfig, InterceptorCB, MiddlewareCB, SanitizerConfig } from '../types/index.js';
2
- import { ServerResponse } from 'http';
3
- export declare const executeControllerMethod: (controller: ControllerInstance, propertyName: string, request: AppRequest, response: ServerResponse) => Promise<any>;
1
+ import { ControllerInstance, ControllerMethods, CORSConfig, InterceptorCB, IRequest, IResponse, MiddlewareCB, SanitizerConfig } from '../types/index.js';
2
+ export declare const executeControllerMethod: (controller: ControllerInstance, propertyName: string, request: IRequest, response: IResponse) => Promise<any>;
4
3
  export declare const getControllerMethods: (controller: ControllerInstance) => ControllerMethods;
5
4
  export declare const getAllMethods: (obj: any) => string[];
6
5
  export declare const findRouteInController: (instance: any, path: string, route: string, method: string) => {
@@ -16,10 +15,10 @@ export declare const getResponse: (data: {
16
15
  controllerInstance: ControllerInstance;
17
16
  name: string;
18
17
  interceptors: InterceptorCB[];
19
- request: AppRequest;
20
- response: ServerResponse;
18
+ request: IRequest;
19
+ response: IResponse;
21
20
  }) => Promise<any>;
22
- export declare const applyMiddlewaresVsSanitizers: (request: AppRequest, response: ServerResponse, functions: {
21
+ export declare const applyMiddlewaresVsSanitizers: (request: IRequest, response: IResponse, functions: {
23
22
  sanitizers: SanitizerConfig[][];
24
23
  middlewares: MiddlewareCB[][];
25
24
  }) => Promise<void>;