tspace-spear 1.2.3 → 1.2.5-beta.1

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 (63) hide show
  1. package/README.md +268 -19
  2. package/dist/lib/core/client/index.d.ts +23 -0
  3. package/dist/lib/core/client/index.js +45 -0
  4. package/dist/lib/core/client/index.js.map +1 -0
  5. package/dist/lib/core/compiler/generator.d.ts +18 -0
  6. package/dist/lib/core/compiler/generator.js +142 -0
  7. package/dist/lib/core/compiler/generator.js.map +1 -0
  8. package/dist/lib/core/compiler/index.d.ts +14 -0
  9. package/dist/lib/core/compiler/index.js +11 -0
  10. package/dist/lib/core/compiler/index.js.map +1 -0
  11. package/dist/lib/core/compiler/pre-routes.d.ts +3 -0
  12. package/dist/lib/core/compiler/pre-routes.js +5 -0
  13. package/dist/lib/core/compiler/pre-routes.js.map +1 -0
  14. package/dist/lib/core/compiler/types.d.ts +12 -0
  15. package/dist/lib/core/compiler/types.js +3 -0
  16. package/dist/lib/core/compiler/types.js.map +1 -0
  17. package/dist/lib/core/const/index.d.ts +153 -0
  18. package/dist/lib/core/const/index.js +105 -0
  19. package/dist/lib/core/const/index.js.map +1 -0
  20. package/dist/lib/core/decorators/context.d.ts +16 -9
  21. package/dist/lib/core/decorators/context.js +85 -59
  22. package/dist/lib/core/decorators/context.js.map +1 -1
  23. package/dist/lib/core/decorators/headers.d.ts +2 -2
  24. package/dist/lib/core/decorators/headers.js +1 -1
  25. package/dist/lib/core/decorators/headers.js.map +1 -1
  26. package/dist/lib/core/decorators/methods.d.ts +7 -7
  27. package/dist/lib/core/decorators/methods.js.map +1 -1
  28. package/dist/lib/core/decorators/middleware.d.ts +3 -3
  29. package/dist/lib/core/decorators/middleware.js +2 -2
  30. package/dist/lib/core/decorators/middleware.js.map +1 -1
  31. package/dist/lib/core/decorators/statusCode.d.ts +1 -1
  32. package/dist/lib/core/decorators/statusCode.js.map +1 -1
  33. package/dist/lib/core/decorators/swagger.d.ts +1 -1
  34. package/dist/lib/core/decorators/swagger.js.map +1 -1
  35. package/dist/lib/core/server/fast-router.d.ts +133 -0
  36. package/dist/lib/core/server/fast-router.js +277 -0
  37. package/dist/lib/core/server/fast-router.js.map +1 -0
  38. package/dist/lib/core/server/index.d.ts +39 -37
  39. package/dist/lib/core/server/index.js +201 -501
  40. package/dist/lib/core/server/index.js.map +1 -1
  41. package/dist/lib/core/server/net/index.d.ts +20 -0
  42. package/dist/lib/core/server/net/index.js +393 -0
  43. package/dist/lib/core/server/net/index.js.map +1 -0
  44. package/dist/lib/core/server/parser-factory.d.ts +10 -11
  45. package/dist/lib/core/server/parser-factory.js +259 -437
  46. package/dist/lib/core/server/parser-factory.js.map +1 -1
  47. package/dist/lib/core/server/response.d.ts +6 -0
  48. package/dist/lib/core/server/response.js +168 -0
  49. package/dist/lib/core/server/response.js.map +1 -0
  50. package/dist/lib/core/server/router.d.ts +2 -12
  51. package/dist/lib/core/server/router.js +2 -13
  52. package/dist/lib/core/server/router.js.map +1 -1
  53. package/dist/lib/core/server/uWS/index.d.ts +30 -0
  54. package/dist/lib/core/server/uWS/index.js +357 -0
  55. package/dist/lib/core/server/uWS/index.js.map +1 -0
  56. package/dist/lib/core/types/index.d.ts +150 -48
  57. package/dist/lib/core/utils/index.d.ts +12 -0
  58. package/dist/lib/core/utils/index.js +137 -0
  59. package/dist/lib/core/utils/index.js.map +1 -0
  60. package/dist/lib/index.d.ts +4 -3
  61. package/dist/lib/index.js +4 -2
  62. package/dist/lib/index.js.map +1 -1
  63. package/package.json +20 -14
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Compiler = void 0;
4
+ const generator_1 = require("./generator");
5
+ class Compiler {
6
+ async generateRoutes(options) {
7
+ return await (0, generator_1.generateRoutes)({ controllers: options });
8
+ }
9
+ }
10
+ exports.Compiler = Compiler;
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/core/compiler/index.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,MAAa,QAAQ;IACV,KAAK,CAAC,cAAc,CAAE,OAG5B;QACG,OAAO,MAAM,IAAA,0BAAc,EAAC,EAAE,WAAW,EAAG,OAAO,EAAE,CAAC,CAAC;IAC3D,CAAC;CACJ;AAPD,4BAOC"}
@@ -0,0 +1,3 @@
1
+ export interface AppRoutes {
2
+ }
3
+ export type AppRoute = keyof AppRoutes;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // AUTO GENERATED FILE
3
+ // DO NOT EDIT
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=pre-routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pre-routes.js","sourceRoot":"","sources":["../../../../src/lib/core/compiler/pre-routes.ts"],"names":[],"mappings":";AACA,sBAAsB;AACtB,cAAc"}
@@ -0,0 +1,12 @@
1
+ import type { AppRoutes } from "./pre-routes";
2
+ export type RoutesWithMethod<TMethod extends string> = {
3
+ [K in keyof AppRoutes]: TMethod extends keyof AppRoutes[K] ? K : never;
4
+ }[keyof AppRoutes];
5
+ export type ExtractFrom<TPath extends keyof AppRoutes, TMethod extends keyof AppRoutes[TPath], Key extends string> = AppRoutes[TPath][TMethod] extends Record<Key, infer R> ? R : never;
6
+ export type RequestBody<TPath extends keyof AppRoutes, TMethod extends keyof AppRoutes[TPath]> = ExtractFrom<TPath, TMethod, "body">;
7
+ export type RequestQuery<TPath extends keyof AppRoutes, TMethod extends keyof AppRoutes[TPath]> = ExtractFrom<TPath, TMethod, "query">;
8
+ export type RequestParams<TPath extends keyof AppRoutes, TMethod extends keyof AppRoutes[TPath]> = ExtractFrom<TPath, TMethod, "params">;
9
+ export type RequestFiles<TPath extends keyof AppRoutes, TMethod extends keyof AppRoutes[TPath]> = ExtractFrom<TPath, TMethod, "files">;
10
+ export type ResponseType<TPath extends keyof AppRoutes, TMethod extends keyof AppRoutes[TPath]> = AppRoutes[TPath][TMethod] extends {
11
+ response: infer R;
12
+ } ? Awaited<R> : never;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/lib/core/compiler/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,153 @@
1
+ export declare const HTTP_STATUS_MESSAGES: {
2
+ readonly 100: "Continue";
3
+ readonly 101: "Switching Protocols";
4
+ readonly 102: "Processing";
5
+ readonly 200: "OK";
6
+ readonly 201: "Created";
7
+ readonly 202: "Accepted";
8
+ readonly 203: "Non-Authoritative Information";
9
+ readonly 204: "No Content";
10
+ readonly 205: "Reset Content";
11
+ readonly 206: "Partial Content";
12
+ readonly 207: "Multi-Status";
13
+ readonly 208: "Already Reported";
14
+ readonly 226: "IM Used";
15
+ readonly 300: "Multiple Choices";
16
+ readonly 301: "Moved Permanently";
17
+ readonly 302: "Found";
18
+ readonly 303: "See Other";
19
+ readonly 304: "Not Modified";
20
+ readonly 305: "Use Proxy";
21
+ readonly 306: "(Unused)";
22
+ readonly 307: "Temporary Redirect";
23
+ readonly 308: "Permanent Redirect";
24
+ readonly 400: "Bad Request";
25
+ readonly 401: "Unauthorized";
26
+ readonly 402: "Payment Required";
27
+ readonly 403: "Forbidden";
28
+ readonly 404: "Not Found";
29
+ readonly 405: "Method Not Allowed";
30
+ readonly 406: "Not Acceptable";
31
+ readonly 407: "Proxy Authentication Required";
32
+ readonly 408: "Request Timeout";
33
+ readonly 409: "Conflict";
34
+ readonly 410: "Gone";
35
+ readonly 411: "Length Required";
36
+ readonly 412: "Precondition Failed";
37
+ readonly 413: "Payload Too Large";
38
+ readonly 414: "URI Too Long";
39
+ readonly 415: "Unsupported Media Type";
40
+ readonly 416: "Range Not Satisfiable";
41
+ readonly 417: "Expectation Failed";
42
+ readonly 418: "I'm a teapot";
43
+ readonly 421: "Misdirected Request";
44
+ readonly 422: "Unprocessable Entity";
45
+ readonly 423: "Locked";
46
+ readonly 424: "Failed Dependency";
47
+ readonly 425: "Too Early";
48
+ readonly 426: "Upgrade Required";
49
+ readonly 428: "Precondition Required";
50
+ readonly 429: "Too Many Requests";
51
+ readonly 431: "Request Header Fields Too Large";
52
+ readonly 451: "Unavailable For Legal Reasons";
53
+ readonly 500: "Internal Server Error";
54
+ readonly 501: "Not Implemented";
55
+ readonly 502: "Bad Gateway";
56
+ readonly 503: "Service Unavailable";
57
+ readonly 504: "Gateway Timeout";
58
+ readonly 505: "HTTP Version Not Supported";
59
+ readonly 506: "Variant Also Negotiates";
60
+ readonly 507: "Insufficient Storage";
61
+ readonly 508: "Loop Detected";
62
+ readonly 510: "Not Extended";
63
+ readonly 511: "Network Authentication Required";
64
+ };
65
+ export declare const HEADER_CONTENT_TYPES: {
66
+ readonly text: {
67
+ readonly 'Content-Type': "text/plain";
68
+ };
69
+ readonly html: {
70
+ readonly 'Content-Type': "text/html";
71
+ };
72
+ readonly css: {
73
+ readonly 'Content-Type': "text/css";
74
+ };
75
+ readonly js: {
76
+ readonly 'Content-Type': "application/javascript";
77
+ };
78
+ readonly json: {
79
+ readonly 'Content-Type': "application/json";
80
+ };
81
+ readonly form: {
82
+ readonly 'Content-Type': "application/x-www-form-urlencoded";
83
+ };
84
+ readonly multipart: {
85
+ readonly 'Content-Type': "multipart/form-data";
86
+ };
87
+ readonly png: {
88
+ readonly 'Content-Type': "image/png";
89
+ };
90
+ readonly jpg: {
91
+ readonly 'Content-Type': "image/jpeg";
92
+ };
93
+ readonly jpeg: {
94
+ readonly 'Content-Type': "image/jpeg";
95
+ };
96
+ readonly gif: {
97
+ readonly 'Content-Type': "image/gif";
98
+ };
99
+ readonly webp: {
100
+ readonly 'Content-Type': "image/webp";
101
+ };
102
+ readonly svg: {
103
+ readonly 'Content-Type': "image/svg+xml";
104
+ };
105
+ readonly ico: {
106
+ readonly 'Content-Type': "image/x-icon";
107
+ };
108
+ readonly pdf: {
109
+ readonly 'Content-Type': "application/pdf";
110
+ };
111
+ readonly zip: {
112
+ readonly 'Content-Type': "application/zip";
113
+ };
114
+ readonly gzip: {
115
+ readonly 'Content-Type': "application/gzip";
116
+ };
117
+ readonly mp4: {
118
+ readonly 'Content-Type': "video/mp4";
119
+ };
120
+ readonly webm: {
121
+ readonly 'Content-Type': "video/webm";
122
+ };
123
+ readonly ogg: {
124
+ readonly 'Content-Type': "video/ogg";
125
+ };
126
+ readonly mp3: {
127
+ readonly 'Content-Type': "audio/mpeg";
128
+ };
129
+ readonly wav: {
130
+ readonly 'Content-Type': "audio/wav";
131
+ };
132
+ readonly aac: {
133
+ readonly 'Content-Type': "audio/aac";
134
+ };
135
+ readonly oga: {
136
+ readonly 'Content-Type': "audio/ogg";
137
+ };
138
+ readonly woff: {
139
+ readonly 'Content-Type': "font/woff";
140
+ };
141
+ readonly woff2: {
142
+ readonly 'Content-Type': "font/woff2";
143
+ };
144
+ readonly ttf: {
145
+ readonly 'Content-Type': "font/ttf";
146
+ };
147
+ readonly otf: {
148
+ readonly 'Content-Type': "font/otf";
149
+ };
150
+ readonly octet: {
151
+ readonly 'Content-Type': "application/octet-stream";
152
+ };
153
+ };
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HEADER_CONTENT_TYPES = exports.HTTP_STATUS_MESSAGES = void 0;
4
+ exports.HTTP_STATUS_MESSAGES = {
5
+ 100: 'Continue',
6
+ 101: 'Switching Protocols',
7
+ 102: 'Processing',
8
+ 200: 'OK',
9
+ 201: 'Created',
10
+ 202: 'Accepted',
11
+ 203: 'Non-Authoritative Information',
12
+ 204: 'No Content',
13
+ 205: 'Reset Content',
14
+ 206: 'Partial Content',
15
+ 207: 'Multi-Status',
16
+ 208: 'Already Reported',
17
+ 226: 'IM Used',
18
+ 300: 'Multiple Choices',
19
+ 301: 'Moved Permanently',
20
+ 302: 'Found',
21
+ 303: 'See Other',
22
+ 304: 'Not Modified',
23
+ 305: 'Use Proxy',
24
+ 306: '(Unused)',
25
+ 307: 'Temporary Redirect',
26
+ 308: 'Permanent Redirect',
27
+ 400: 'Bad Request',
28
+ 401: 'Unauthorized',
29
+ 402: 'Payment Required',
30
+ 403: 'Forbidden',
31
+ 404: 'Not Found',
32
+ 405: 'Method Not Allowed',
33
+ 406: 'Not Acceptable',
34
+ 407: 'Proxy Authentication Required',
35
+ 408: 'Request Timeout',
36
+ 409: 'Conflict',
37
+ 410: 'Gone',
38
+ 411: 'Length Required',
39
+ 412: 'Precondition Failed',
40
+ 413: 'Payload Too Large',
41
+ 414: 'URI Too Long',
42
+ 415: 'Unsupported Media Type',
43
+ 416: 'Range Not Satisfiable',
44
+ 417: 'Expectation Failed',
45
+ 418: 'I\'m a teapot',
46
+ 421: 'Misdirected Request',
47
+ 422: 'Unprocessable Entity',
48
+ 423: 'Locked',
49
+ 424: 'Failed Dependency',
50
+ 425: 'Too Early',
51
+ 426: 'Upgrade Required',
52
+ 428: 'Precondition Required',
53
+ 429: 'Too Many Requests',
54
+ 431: 'Request Header Fields Too Large',
55
+ 451: 'Unavailable For Legal Reasons',
56
+ 500: 'Internal Server Error',
57
+ 501: 'Not Implemented',
58
+ 502: 'Bad Gateway',
59
+ 503: 'Service Unavailable',
60
+ 504: 'Gateway Timeout',
61
+ 505: 'HTTP Version Not Supported',
62
+ 506: 'Variant Also Negotiates',
63
+ 507: 'Insufficient Storage',
64
+ 508: 'Loop Detected',
65
+ 510: 'Not Extended',
66
+ 511: 'Network Authentication Required'
67
+ };
68
+ exports.HEADER_CONTENT_TYPES = {
69
+ text: { 'Content-Type': 'text/plain' },
70
+ html: { 'Content-Type': 'text/html' },
71
+ css: { 'Content-Type': 'text/css' },
72
+ js: { 'Content-Type': 'application/javascript' },
73
+ json: { 'Content-Type': 'application/json' },
74
+ form: { 'Content-Type': 'application/x-www-form-urlencoded' },
75
+ multipart: { 'Content-Type': 'multipart/form-data' },
76
+ // images
77
+ png: { 'Content-Type': 'image/png' },
78
+ jpg: { 'Content-Type': 'image/jpeg' },
79
+ jpeg: { 'Content-Type': 'image/jpeg' },
80
+ gif: { 'Content-Type': 'image/gif' },
81
+ webp: { 'Content-Type': 'image/webp' },
82
+ svg: { 'Content-Type': 'image/svg+xml' },
83
+ ico: { 'Content-Type': 'image/x-icon' },
84
+ // documents
85
+ pdf: { 'Content-Type': 'application/pdf' },
86
+ zip: { 'Content-Type': 'application/zip' },
87
+ gzip: { 'Content-Type': 'application/gzip' },
88
+ // video
89
+ mp4: { 'Content-Type': 'video/mp4' },
90
+ webm: { 'Content-Type': 'video/webm' },
91
+ ogg: { 'Content-Type': 'video/ogg' },
92
+ // audio
93
+ mp3: { 'Content-Type': 'audio/mpeg' },
94
+ wav: { 'Content-Type': 'audio/wav' },
95
+ aac: { 'Content-Type': 'audio/aac' },
96
+ oga: { 'Content-Type': 'audio/ogg' },
97
+ // fonts
98
+ woff: { 'Content-Type': 'font/woff' },
99
+ woff2: { 'Content-Type': 'font/woff2' },
100
+ ttf: { 'Content-Type': 'font/ttf' },
101
+ otf: { 'Content-Type': 'font/otf' },
102
+ // binary
103
+ octet: { 'Content-Type': 'application/octet-stream' }
104
+ };
105
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/core/const/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG;IAChC,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,+BAA+B;IACpC,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,cAAc;IACnB,GAAG,EAAE,kBAAkB;IACvB,GAAG,EAAE,SAAS;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AE,WAAW,EAAE;IACpC,GAAG,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE;IAEpC,QAAQ;IACR,IAAI,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE;IACrC,KAAK,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE;IACvC,GAAG,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE;IACnC,GAAG,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE;IAEnC,SAAS;IACT,KAAK,EAAE,EAAE,cAAc,EAAE,0BAA0B,EAAE;CAC7C,CAAA"}
@@ -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,UAAU,MAAW,EAAE,GAAW,EAAE,UAA8B;QACrE,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC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;;;;;;;;;;;;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"}