tspace-spear 1.2.3 → 1.2.5

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 (48) hide show
  1. package/README.md +268 -19
  2. package/dist/lib/core/const/index.d.ts +153 -0
  3. package/dist/lib/core/const/index.js +105 -0
  4. package/dist/lib/core/const/index.js.map +1 -0
  5. package/dist/lib/core/decorators/context.d.ts +16 -9
  6. package/dist/lib/core/decorators/context.js +85 -59
  7. package/dist/lib/core/decorators/context.js.map +1 -1
  8. package/dist/lib/core/decorators/headers.d.ts +2 -2
  9. package/dist/lib/core/decorators/headers.js +1 -1
  10. package/dist/lib/core/decorators/headers.js.map +1 -1
  11. package/dist/lib/core/decorators/methods.d.ts +7 -7
  12. package/dist/lib/core/decorators/methods.js.map +1 -1
  13. package/dist/lib/core/decorators/middleware.d.ts +3 -3
  14. package/dist/lib/core/decorators/middleware.js +2 -2
  15. package/dist/lib/core/decorators/middleware.js.map +1 -1
  16. package/dist/lib/core/decorators/statusCode.d.ts +1 -1
  17. package/dist/lib/core/decorators/statusCode.js.map +1 -1
  18. package/dist/lib/core/decorators/swagger.d.ts +1 -1
  19. package/dist/lib/core/decorators/swagger.js.map +1 -1
  20. package/dist/lib/core/server/fast-router.d.ts +133 -0
  21. package/dist/lib/core/server/fast-router.js +277 -0
  22. package/dist/lib/core/server/fast-router.js.map +1 -0
  23. package/dist/lib/core/server/index.d.ts +34 -37
  24. package/dist/lib/core/server/index.js +192 -501
  25. package/dist/lib/core/server/index.js.map +1 -1
  26. package/dist/lib/core/server/net/index.d.ts +20 -0
  27. package/dist/lib/core/server/net/index.js +393 -0
  28. package/dist/lib/core/server/net/index.js.map +1 -0
  29. package/dist/lib/core/server/parser-factory.d.ts +10 -11
  30. package/dist/lib/core/server/parser-factory.js +259 -437
  31. package/dist/lib/core/server/parser-factory.js.map +1 -1
  32. package/dist/lib/core/server/response.d.ts +6 -0
  33. package/dist/lib/core/server/response.js +168 -0
  34. package/dist/lib/core/server/response.js.map +1 -0
  35. package/dist/lib/core/server/router.d.ts +2 -12
  36. package/dist/lib/core/server/router.js +2 -13
  37. package/dist/lib/core/server/router.js.map +1 -1
  38. package/dist/lib/core/server/uWS/index.d.ts +30 -0
  39. package/dist/lib/core/server/uWS/index.js +357 -0
  40. package/dist/lib/core/server/uWS/index.js.map +1 -0
  41. package/dist/lib/core/types/index.d.ts +144 -43
  42. package/dist/lib/core/utils/index.d.ts +12 -0
  43. package/dist/lib/core/utils/index.js +137 -0
  44. package/dist/lib/core/utils/index.js.map +1 -0
  45. package/dist/lib/index.d.ts +3 -3
  46. package/dist/lib/index.js +3 -2
  47. package/dist/lib/index.js.map +1 -1
  48. package/package.json +19 -14
@@ -1,3 +1,10 @@
1
+ import { type T } from '../types';
2
+ export declare function createDtoDecorator(validator: (ctx: T.Context) => void | Promise<void>, onError?: (ctx: T.Context, error: any) => any): MethodDecorator;
3
+ export declare function createContextDecorator(hook: (ctx: T.Context, next: T.NextFunction, meta: {
4
+ target: any;
5
+ key: string | symbol;
6
+ descriptor: PropertyDescriptor;
7
+ }) => any | Promise<any>): MethodDecorator;
1
8
  /**
2
9
  * Extract specific fields from `ctx.body`.
3
10
  *
@@ -16,7 +23,7 @@
16
23
  * @param {...string} bodyParms - Body field names to extract.
17
24
  * @returns {MethodDecorator}
18
25
  */
19
- export declare const Body: (...bodyParms: string[]) => Function;
26
+ export declare const Body: (...keys: string[]) => MethodDecorator;
20
27
  /**
21
28
  * Extract specific uploaded files from `ctx.files`.
22
29
  *
@@ -31,10 +38,10 @@ export declare const Body: (...bodyParms: string[]) => Function;
31
38
  * }
32
39
  * ```
33
40
  *
34
- * @param {...string} filesParms - File field names to extract.
41
+ * @param {...string} keys - File field names to extract.
35
42
  * @returns {MethodDecorator}
36
43
  */
37
- export declare const Files: (...filesParms: string[]) => Function;
44
+ export declare const Files: (...keys: string[]) => MethodDecorator;
38
45
  /**
39
46
  * Extract specific route parameters from `ctx.params`.
40
47
  *
@@ -49,10 +56,10 @@ export declare const Files: (...filesParms: string[]) => Function;
49
56
  * }
50
57
  * ```
51
58
  *
52
- * @param {...string} paramsData - Route parameter names to extract.
59
+ * @param {...string} keys - Route parameter names to extract.
53
60
  * @returns {MethodDecorator}
54
61
  */
55
- export declare const Params: (...paramsData: string[]) => Function;
62
+ export declare const Params: (...keys: string[]) => MethodDecorator;
56
63
  /**
57
64
  * Extract specific query parameters from `ctx.query`.
58
65
  *
@@ -67,10 +74,10 @@ export declare const Params: (...paramsData: string[]) => Function;
67
74
  * }
68
75
  * ```
69
76
  *
70
- * @param {...string} queryParms - Query parameter names to extract.
77
+ * @param {...string} keys - Query parameter names to extract.
71
78
  * @returns {MethodDecorator}
72
79
  */
73
- export declare const Query: (...queryParms: string[]) => Function;
80
+ export declare const Query: (...keys: string[]) => MethodDecorator;
74
81
  /**
75
82
  * Extract specific cookies from `ctx.cookies`.
76
83
  *
@@ -85,7 +92,7 @@ export declare const Query: (...queryParms: string[]) => Function;
85
92
  * }
86
93
  * ```
87
94
  *
88
- * @param {...string} cookiesParms - Cookie names to extract.
95
+ * @param {...string} keys - Cookie names to extract.
89
96
  * @returns {MethodDecorator}
90
97
  */
91
- export declare const Cookies: (...cookiesParms: string[]) => Function;
98
+ export declare const Cookies: (...keys: string[]) => MethodDecorator;
@@ -1,6 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Cookies = exports.Query = exports.Params = exports.Files = exports.Body = void 0;
4
+ exports.createDtoDecorator = createDtoDecorator;
5
+ exports.createContextDecorator = createContextDecorator;
6
+ function createDtoDecorator(validator, onError) {
7
+ return (_target, _key, descriptor) => {
8
+ const original = descriptor.value;
9
+ descriptor.value = async function (ctx, next) {
10
+ try {
11
+ await validator(ctx);
12
+ return await original.call(this, ctx, next);
13
+ }
14
+ catch (err) {
15
+ if (onError) {
16
+ return onError(ctx, err);
17
+ }
18
+ let message = err?.message ?? "Bad Request";
19
+ let issues = err.issues ?? [];
20
+ let status = 400;
21
+ if (err.name === "ZodError") {
22
+ const zodIssues = err.issues
23
+ .map((i) => ({
24
+ path: i.path.join("."),
25
+ message: i.message,
26
+ }));
27
+ message = "Validation failed";
28
+ issues = zodIssues;
29
+ status = 422;
30
+ }
31
+ return ctx.res.status(status).json({
32
+ message,
33
+ issues,
34
+ });
35
+ }
36
+ };
37
+ return descriptor;
38
+ };
39
+ }
40
+ function createContextDecorator(hook) {
41
+ return (target, key, descriptor) => {
42
+ const original = descriptor.value;
43
+ descriptor.value = async function (ctx, next) {
44
+ return await hook(ctx, async () => {
45
+ return await original.call(this, ctx, next);
46
+ }, {
47
+ target,
48
+ key,
49
+ descriptor,
50
+ });
51
+ };
52
+ return descriptor;
53
+ };
54
+ }
4
55
  /**
5
56
  * Extract specific fields from `ctx.body`.
6
57
  *
@@ -19,17 +70,12 @@ exports.Cookies = exports.Query = exports.Params = exports.Files = exports.Body
19
70
  * @param {...string} bodyParms - Body field names to extract.
20
71
  * @returns {MethodDecorator}
21
72
  */
22
- const Body = (...bodyParms) => {
23
- return function (target, key, descriptor) {
24
- const originalMethod = descriptor.value;
25
- descriptor.value = async function (ctx, next) {
26
- const q = ctx?.body ?? {};
27
- const body = bodyParms.reduce((acc, key) => (q[key] != null ? { ...acc, [key]: q[key] } : acc), {});
28
- ctx.body = Object.keys(body).length ? body : {};
29
- return await originalMethod.call(this, ctx, next);
30
- };
31
- return descriptor;
32
- };
73
+ const Body = (...keys) => {
74
+ return createContextDecorator(async (ctx, next) => {
75
+ const body = ctx.body;
76
+ ctx.body = keys.reduce((prev, curr) => (body[curr] != null ? { ...prev, [curr]: body[curr] } : prev), {});
77
+ return await next();
78
+ });
33
79
  };
34
80
  exports.Body = Body;
35
81
  /**
@@ -46,20 +92,15 @@ exports.Body = Body;
46
92
  * }
47
93
  * ```
48
94
  *
49
- * @param {...string} filesParms - File field names to extract.
95
+ * @param {...string} keys - File field names to extract.
50
96
  * @returns {MethodDecorator}
51
97
  */
52
- const Files = (...filesParms) => {
53
- return function (target, key, descriptor) {
54
- const originalMethod = descriptor.value;
55
- descriptor.value = async function (ctx, next) {
56
- const q = ctx?.files ?? {};
57
- const files = filesParms.reduce((acc, key) => (q[key] != null ? { ...acc, [key]: q[key] } : acc), {});
58
- ctx.files = Object.keys(files).length ? files : {};
59
- return await originalMethod.call(this, ctx, next);
60
- };
61
- return descriptor;
62
- };
98
+ const Files = (...keys) => {
99
+ return createContextDecorator(async (ctx, next) => {
100
+ const files = ctx.files;
101
+ ctx.files = keys.reduce((prev, curr) => (files[curr] != null ? { ...prev, [curr]: files[curr] } : prev), {});
102
+ return await next();
103
+ });
63
104
  };
64
105
  exports.Files = Files;
65
106
  /**
@@ -76,20 +117,15 @@ exports.Files = Files;
76
117
  * }
77
118
  * ```
78
119
  *
79
- * @param {...string} paramsData - Route parameter names to extract.
120
+ * @param {...string} keys - Route parameter names to extract.
80
121
  * @returns {MethodDecorator}
81
122
  */
82
- const Params = (...paramsData) => {
83
- return function (target, key, descriptor) {
84
- const originalMethod = descriptor.value;
85
- descriptor.value = async function (ctx, next) {
86
- const q = ctx?.params ?? {};
87
- const params = paramsData.reduce((acc, key) => (q[key] != null ? { ...acc, [key]: q[key] } : acc), {});
88
- ctx.params = Object.keys(params).length ? params : {};
89
- return await originalMethod.call(this, ctx, next);
90
- };
91
- return descriptor;
92
- };
123
+ const Params = (...keys) => {
124
+ return createContextDecorator(async (ctx, next) => {
125
+ const params = ctx.params;
126
+ ctx.params = keys.reduce((prev, curr) => (params[curr] != null ? { ...prev, [curr]: params[curr] } : prev), {});
127
+ return await next();
128
+ });
93
129
  };
94
130
  exports.Params = Params;
95
131
  /**
@@ -106,20 +142,15 @@ exports.Params = Params;
106
142
  * }
107
143
  * ```
108
144
  *
109
- * @param {...string} queryParms - Query parameter names to extract.
145
+ * @param {...string} keys - Query parameter names to extract.
110
146
  * @returns {MethodDecorator}
111
147
  */
112
- const Query = (...queryParms) => {
113
- return function (target, key, descriptor) {
114
- const originalMethod = descriptor.value;
115
- descriptor.value = async function (ctx, next) {
116
- const q = ctx?.query ?? {};
117
- const query = queryParms.reduce((acc, key) => (q[key] != null ? { ...acc, [key]: q[key] } : acc), {});
118
- ctx.query = Object.keys(query).length ? query : {};
119
- return await originalMethod.call(this, ctx, next);
120
- };
121
- return descriptor;
122
- };
148
+ const Query = (...keys) => {
149
+ return createContextDecorator(async (ctx, next) => {
150
+ const query = ctx.query;
151
+ ctx.query = keys.reduce((prev, curr) => (query[curr] != null ? { ...prev, [curr]: query[curr] } : prev), {});
152
+ return await next();
153
+ });
123
154
  };
124
155
  exports.Query = Query;
125
156
  /**
@@ -136,20 +167,15 @@ exports.Query = Query;
136
167
  * }
137
168
  * ```
138
169
  *
139
- * @param {...string} cookiesParms - Cookie names to extract.
170
+ * @param {...string} keys - Cookie names to extract.
140
171
  * @returns {MethodDecorator}
141
172
  */
142
- const Cookies = (...cookiesParms) => {
143
- return function (target, key, descriptor) {
144
- const originalMethod = descriptor.value;
145
- descriptor.value = async function (ctx, next) {
146
- const q = ctx?.cookies ?? {};
147
- const cookies = cookiesParms.reduce((acc, key) => (q[key] != null ? { ...acc, [key]: q[key] } : acc), {});
148
- ctx.cookies = Object.keys(cookies).length ? cookies : {};
149
- return await originalMethod.call(this, ctx, next);
150
- };
151
- return descriptor;
152
- };
173
+ const Cookies = (...keys) => {
174
+ return createContextDecorator(async (ctx, next) => {
175
+ const cookies = ctx.cookies;
176
+ ctx.cookies = keys.reduce((prev, curr) => (cookies[curr] != null ? { ...prev, [curr]: cookies[curr] } : prev), {});
177
+ return await next();
178
+ });
153
179
  };
154
180
  exports.Cookies = Cookies;
155
181
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/context.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;GAiBG;AACI,MAAM,IAAI,GAAG,CAAC,GAAG,SAAmB,EAAY,EAAE;IACrD,OAAO,U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,MAAM,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAXW,QAAA,KAAK,SAWhB;AAEF;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,OAAO,GAAG,CAAC,GAAG,IAAc,EAAmB,EAAE;IAC1D,OAAO,sBAAsB,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC9C,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAE5B,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CACrB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EACnF,EAAE,CACL,CAAC;QAEF,OAAO,MAAM,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAXW,QAAA,OAAO,WAWlB"}
@@ -26,6 +26,6 @@ import { OutgoingHttpHeaders } from 'http';
26
26
  *
27
27
  * @param {number} statusCode - HTTP status code to send with the response.
28
28
  * @param {OutgoingHttpHeaders} contentType - Response headers to set.
29
- * @returns {Function}
29
+ * @returns {MethodDecorator}
30
30
  */
31
- export declare const WriteHeader: (statusCode: number, contentType: OutgoingHttpHeaders) => Function;
31
+ export declare const WriteHeader: (statusCode: number, contentType: OutgoingHttpHeaders) => MethodDecorator;
@@ -28,7 +28,7 @@ exports.WriteHeader = void 0;
28
28
  *
29
29
  * @param {number} statusCode - HTTP status code to send with the response.
30
30
  * @param {OutgoingHttpHeaders} contentType - Response headers to set.
31
- * @returns {Function}
31
+ * @returns {MethodDecorator}
32
32
  */
33
33
  const WriteHeader = (statusCode, contentType) => {
34
34
  return (target, key, descriptor) => {
@@ -1 +1 @@
1
- {"version":3,"file":"headers.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/headers.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACI,MAAM,WAAW,GAAG,CAAC,UAAkB,EAAE,WAAgC,EAAY,EAAE;IAC5F,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,UAA8B,EAAE,EAAE;QAClE,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,KAAK,WAAW,GAAc,EAAE,IAAoB;YACrE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;YAChD,OAAO,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,WAAW,eAWtB"}
1
+ {"version":3,"file":"headers.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/headers.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACI,MAAM,WAAW,GAAG,CAAC,UAAkB,EAAE,WAAgC,EAAmB,EAAE;IACnG,OAAO,CAAC,MAAW,EAAE,GAAQ,EAAE,UAA8B,EAAE,EAAE;QAC/D,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,KAAK,WAAW,GAAc,EAAE,IAAoB;YACrE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;YAChD,OAAO,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,WAAW,eAWtB"}
@@ -9,7 +9,7 @@
9
9
  * }
10
10
  * ```
11
11
  */
12
- export declare const Get: (path: `/${string}`) => (target: any, propertyKey: any) => void;
12
+ export declare const Get: (path: `/${string}`) => MethodDecorator;
13
13
  /**
14
14
  * Maps a controller method to an HTTP POST route.
15
15
  *
@@ -21,7 +21,7 @@ export declare const Get: (path: `/${string}`) => (target: any, propertyKey: any
21
21
  * }
22
22
  * ```
23
23
  */
24
- export declare const Post: (path: `/${string}`) => (target: any, propertyKey: any) => void;
24
+ export declare const Post: (path: `/${string}`) => MethodDecorator;
25
25
  /**
26
26
  * Maps a controller method to an HTTP PUT route.
27
27
  *
@@ -33,7 +33,7 @@ export declare const Post: (path: `/${string}`) => (target: any, propertyKey: an
33
33
  * async update(ctx: T.Context) {}
34
34
  * ```
35
35
  */
36
- export declare const Put: (path: `/${string}`) => (target: any, propertyKey: any) => void;
36
+ export declare const Put: (path: `/${string}`) => MethodDecorator;
37
37
  /**
38
38
  * Maps a controller method to an HTTP PATCH route.
39
39
  *
@@ -45,7 +45,7 @@ export declare const Put: (path: `/${string}`) => (target: any, propertyKey: any
45
45
  * async patch(ctx: T.Context) {}
46
46
  * ```
47
47
  */
48
- export declare const Patch: (path: `/${string}`) => (target: any, propertyKey: any) => void;
48
+ export declare const Patch: (path: `/${string}`) => MethodDecorator;
49
49
  /**
50
50
  * Maps a controller method to an HTTP DELETE route.
51
51
  *
@@ -55,7 +55,7 @@ export declare const Patch: (path: `/${string}`) => (target: any, propertyKey: a
55
55
  * async remove(ctx: T.Context) {}
56
56
  * ```
57
57
  */
58
- export declare const Delete: (path: `/${string}`) => (target: any, propertyKey: any) => void;
58
+ export declare const Delete: (path: `/${string}`) => MethodDecorator;
59
59
  /**
60
60
  * Maps a controller method to an HTTP HEAD route.
61
61
  *
@@ -67,7 +67,7 @@ export declare const Delete: (path: `/${string}`) => (target: any, propertyKey:
67
67
  * async health(ctx: T.Context) {}
68
68
  * ```
69
69
  */
70
- export declare const Head: (path: `/${string}`) => (target: any, propertyKey: any) => void;
70
+ export declare const Head: (path: `/${string}`) => MethodDecorator;
71
71
  /**
72
72
  * Maps a controller method to an HTTP OPTIONS route.
73
73
  *
@@ -79,4 +79,4 @@ export declare const Head: (path: `/${string}`) => (target: any, propertyKey: an
79
79
  * async options(ctx: T.Context) {}
80
80
  * ```
81
81
  */
82
- export declare const Options: (path: `/${string}`) => (target: any, propertyKey: any) => void;
82
+ export declare const Options: (path: `/${string}`) => MethodDecorator;
@@ -1 +1 @@
1
- {"version":3,"file":"methods.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/methods.ts"],"names":[],"mappings":";;;AAEA,MAAM,eAAe,GAAG,CAAC,MAAgB,EAAE,EAAE;IAC3C,OAAO,CAAC,IAAkB,EAAE,EAAE;QAC5B,OAAO,CAAC,MAAU,EAAE,WAAe,EAAE,EAAE;YACrC,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;YAEtC,MAAM,OAAO,GAAe,OAAO,CAAC,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC;gBACpE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC;gBAC5C,CAAC,CAAC,EAAE,CAAC;YAEP,OAAO,CAAC,IAAI,CAAC;gBACX,MAAM;gBACN,IAAI;gBACJ,OAAO,EAAE,WAAW;aACrB,CAAC,CAAC;YAEH,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACzD,CAAC,CAAA;IACH,CAAC,CAAA;AACH,CAAC,CAAA;AAED;;;;;;;;;;GAUG;AACU,QAAA,GAAG,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;AAE1C;;;;;;;;;;GAUG;AACU,QAAA,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;AAE5C;;;;;;;;;;GAUG;AACU,QAAA,GAAG,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;AAE1C;;;;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AG,eAAe,CAAC,OAAO,CAAC,CAAC;AAE9C;;;;;;;;GAQG;AACU,QAAA,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;AAEhD;;;;;;;;;;GAUG;AACU,QAAA,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;AAE5C;;;;;;;;;;GAUG;AACU,QAAA,OAAO,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC"}
@@ -25,7 +25,7 @@ import { T } from '../types';
25
25
  * Example middleware:
26
26
  *
27
27
  * ```ts
28
- * const authMiddleware: T.RequestFunction = (ctx, next) => {
28
+ * const authMiddleware: T.ContextHandler = (ctx, next) => {
29
29
  * if (!ctx.user) {
30
30
  * return next(new Error("Unauthorized"));
31
31
  * }
@@ -33,7 +33,7 @@ import { T } from '../types';
33
33
  * };
34
34
  * ```
35
35
  *
36
- * @param {T.RequestFunction} middleware - Middleware function to execute before the route handler.
36
+ * @param {T.ContextHandler} middleware - Middleware function to execute before the route handler.
37
37
  * @returns {MethodDecorator}
38
38
  */
39
- export declare const Middleware: (middleware: T.RequestFunction) => Function;
39
+ export declare const Middleware: (middleware: T.ContextHandler) => MethodDecorator;
@@ -27,7 +27,7 @@ exports.Middleware = void 0;
27
27
  * Example middleware:
28
28
  *
29
29
  * ```ts
30
- * const authMiddleware: T.RequestFunction = (ctx, next) => {
30
+ * const authMiddleware: T.ContextHandler = (ctx, next) => {
31
31
  * if (!ctx.user) {
32
32
  * return next(new Error("Unauthorized"));
33
33
  * }
@@ -35,7 +35,7 @@ exports.Middleware = void 0;
35
35
  * };
36
36
  * ```
37
37
  *
38
- * @param {T.RequestFunction} middleware - Middleware function to execute before the route handler.
38
+ * @param {T.ContextHandler} middleware - Middleware function to execute before the route handler.
39
39
  * @returns {MethodDecorator}
40
40
  */
41
41
  const Middleware = (middleware) => {
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/middleware.ts"],"names":[],"mappings":";;;AA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EAAE,MAAM,CAAC,CAAC;gBAE1D,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC,GAAS,EAAE,EAAE;oBACnC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;wBAChB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;oBACnB,CAAC;oBAED,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;gBAC9C,CAAC,CAAC,CAAC;YAEL,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,UAAU,cAuBrB"}
@@ -23,4 +23,4 @@ import { type T } from '../types';
23
23
  * @param {T.StatusCode} statusCode - HTTP status code to send with the response.
24
24
  * @returns {MethodDecorator}
25
25
  */
26
- export declare const StatusCode: (statusCode: T.StatusCode) => Function;
26
+ export declare const StatusCode: (statusCode: T.StatusCode) => MethodDecorator;
@@ -1 +1 @@
1
- {"version":3,"file":"statusCode.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/statusCode.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACI,MAAM,UAAU,GAAG,CAAC,UAAwB,EAAY,EAAE;IAC7D,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,UAA8B,EAAE,EAAE;QAChE,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,MAAM,IAAI,GAAG,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC;QAE1E,UAAU,CAAC,KAAK,GAAG,KAAK,WAAW,GAAc,EAAE,IAAoB;YACnE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC;YAChE,OAAO,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC,CAAC;AAbW,QAAA,UAAU,cAarB"}
1
+ {"version":3,"file":"statusCode.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/statusCode.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACI,MAAM,UAAU,GAAG,CAAC,UAAwB,EAAmB,EAAE;IACpE,OAAO,CAAC,MAAW,EAAE,GAAQ,EAAE,UAA8B,EAAE,EAAE;QAC7D,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,MAAM,IAAI,GAAG,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC;QAE1E,UAAU,CAAC,KAAK,GAAG,KAAK,WAAW,GAAc,EAAE,IAAoB;YACnE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC;YAChE,OAAO,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC,CAAC;AAbW,QAAA,UAAU,cAarB"}
@@ -33,4 +33,4 @@ import { type T } from "../types";
33
33
  * @param {T.Swagger.Spec} data - Swagger/OpenAPI specification for the route.
34
34
  * @returns {MethodDecorator}
35
35
  */
36
- export declare const Swagger: (data: T.Swagger.Spec) => (target: any, propertyKey: any) => void;
36
+ export declare const Swagger: (data: T.Swagger.Spec) => MethodDecorator;
@@ -1 +1 @@
1
- {"version":3,"file":"swagger.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/swagger.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACI,MAAM,OAAO,GAAG,CAAC,IAAoB,EAAE,EAAE;IAC9C,OAAO,CAAC,MAAW,EAAE,WAAgB,EAAE,EAAE;QACvC,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;QAEtC,MAAM,QAAQ,GAAU,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC;YACjE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC;YAC7C,CAAC,CAAC,EAAE,CAAC;QAEP,QAAQ,CAAC,IAAI,CAAC;YACZ,OAAO,EAAE,WAAW;YACpB,GAAG,IAAI;SACR,CAAC,CAAC;QAEH,OAAO,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,OAAO,WAelB"}
1
+ {"version":3,"file":"swagger.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/swagger.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACI,MAAM,OAAO,GAAG,CAAC,IAAoB,EAAmB,EAAE;IAC/D,OAAO,CAAC,MAAW,EAAE,WAAgB,EAAE,EAAE;QACvC,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;QAEtC,MAAM,QAAQ,GAAU,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC;YACjE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC;YAC7C,CAAC,CAAC,EAAE,CAAC;QAEP,QAAQ,CAAC,IAAI,CAAC;YACZ,OAAO,EAAE,WAAW;YACpB,GAAG,IAAI;SACR,CAAC,CAAC;QAEH,OAAO,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,OAAO,WAelB"}
@@ -0,0 +1,133 @@
1
+ import { IncomingMessage, ServerResponse } from "http";
2
+ type Handler = (req: IncomingMessage, res: ServerResponse, params: Record<string, string>) => any;
3
+ export declare class FastRouter {
4
+ private trees;
5
+ private _routes;
6
+ constructor();
7
+ /**
8
+ * Get all registered routes in the router.
9
+ *
10
+ * Returns the internal route registry used for debugging,
11
+ * inspection, or serialization of the router tree.
12
+ *
13
+ * @returns Internal routes structure
14
+ */
15
+ get routes(): {
16
+ path: string;
17
+ method: string;
18
+ params: string[];
19
+ }[];
20
+ /**
21
+ * Register a GET route.
22
+ *
23
+ * Handles HTTP GET requests for the specified path.
24
+ *
25
+ * @param path Route path (e.g. "/users/:id")
26
+ * @param handler Function executed when route matches
27
+ * @returns Router instance for chaining
28
+ *
29
+ * @example
30
+ * router.get("/users", (req, res) => {});
31
+ */
32
+ get(path: string, handler: Handler): this;
33
+ /**
34
+ * Register a POST route.
35
+ *
36
+ * Used for creating resources or submitting data.
37
+ *
38
+ * @param path Route path
39
+ * @param handler Route handler function
40
+ * @returns Router instance for chaining
41
+ */
42
+ post(path: string, handler: Handler): this;
43
+ /**
44
+ * Register a PUT route.
45
+ *
46
+ * Typically used for full resource replacement.
47
+ *
48
+ * @param path Route path
49
+ * @param handler Route handler function
50
+ * @returns Router instance for chaining
51
+ */
52
+ put(path: string, handler: Handler): this;
53
+ /**
54
+ * Register a PATCH route.
55
+ *
56
+ * Used for partial updates to a resource.
57
+ *
58
+ * @param path Route path
59
+ * @param handler Route handler function
60
+ * @returns Router instance for chaining
61
+ */
62
+ patch(path: string, handler: Handler): this;
63
+ /**
64
+ * Register a DELETE route.
65
+ *
66
+ * Used for removing a resource.
67
+ *
68
+ * @param path Route path
69
+ * @param handler Route handler function
70
+ * @returns Router instance for chaining
71
+ */
72
+ delete(path: string, handler: Handler): this;
73
+ /**
74
+ * Register an OPTIONS route.
75
+ *
76
+ * Used for CORS preflight requests or capability discovery.
77
+ *
78
+ * @param path Route path
79
+ * @param handler Route handler function
80
+ * @returns Router instance for chaining
81
+ */
82
+ options(path: string, handler: Handler): this;
83
+ /**
84
+ * Register a HEAD route.
85
+ *
86
+ * Same as GET but returns headers only (no body).
87
+ *
88
+ * @param path Route path
89
+ * @param handler Route handler function
90
+ * @returns Router instance for chaining
91
+ */
92
+ head(path: string, handler: Handler): this;
93
+ /**
94
+ * Register a route for all HTTP methods.
95
+ *
96
+ * This registers the same handler for every supported HTTP method.
97
+ * Useful for middleware-like or catch-all behavior.
98
+ *
99
+ * @param path Route path
100
+ * @param handler Route handler function
101
+ * @returns Router instance for chaining
102
+ *
103
+ * @example
104
+ * router.all("/health", (req, res) => res.send("OK"));
105
+ */
106
+ all(path: string, handler: Handler): this;
107
+ /**
108
+ * Lookup a route handler based on the incoming request.
109
+ *
110
+ * This method is responsible for resolving the correct route
111
+ * from the registered router tree and executing the matched handler.
112
+ *
113
+ * It supports parameterized routes, static routes, and (optionally)
114
+ * wildcard matching depending on router implementation.
115
+ *
116
+ * @param req Incoming HTTP request object
117
+ * @param res Server response object used to send output
118
+ *
119
+ * @returns void
120
+ *
121
+ * @example
122
+ * router.lookup(req, res);
123
+ *
124
+ * @internal
125
+ * This is typically called by the HTTP server layer and should not
126
+ * be invoked directly in most application code.
127
+ */
128
+ lookup(req: IncomingMessage, res: ServerResponse): any;
129
+ private _createNode;
130
+ private _add;
131
+ private _extractParams;
132
+ }
133
+ export {};