tspace-spear 1.2.1-beta.1 → 1.2.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.
package/README.md CHANGED
@@ -111,6 +111,8 @@ const app = new Spear()
111
111
 
112
112
  ### Response
113
113
  ```js
114
+ import { Spear } from "tspace-spear";
115
+
114
116
  const app = new Spear()
115
117
  .get('/' , () => {
116
118
  return {
@@ -119,14 +121,29 @@ const app = new Spear()
119
121
  })
120
122
  .response((results, statusCode) => {
121
123
 
122
- if(typeof results === 'string') return results
123
-
124
- /// ...
125
- return {
126
- success : statusCode < 400,
127
- ...results,
128
- statusCode
129
- }
124
+ if (typeof results === 'string') return results
125
+
126
+ if (Array.isArray(results)) {
127
+ return {
128
+ success: statusCode < 400,
129
+ data: results,
130
+ statusCode
131
+ }
132
+ }
133
+
134
+ if (typeof results === 'object' && results !== null) {
135
+ return {
136
+ success: statusCode < 400,
137
+ ...results,
138
+ statusCode
139
+ }
140
+ }
141
+
142
+ return {
143
+ success: statusCode < 400,
144
+ data: results,
145
+ statusCode
146
+ }
130
147
  })
131
148
  .listen(3000 , () => console.log(`Server is now listening http://localhost:3000`))
132
149
  // http://localhost:3000 => { success: true , message : 'Hello World' , statusCode: 200 }
@@ -135,15 +152,28 @@ const app = new Spear()
135
152
 
136
153
  ### Catch
137
154
  ```js
155
+ import { Spear } from "tspace-spear";
156
+ import { z } from "zod";
138
157
  const app = new Spear()
139
158
  .get('/' , () => {
140
159
  throw new Error('Catching failed')
141
160
  })
142
- .catch((err : Error , { res } : T.Context) => {
161
+ .catch((err, { res } : T.Context) => {
162
+
163
+ if(err instanceof z.ZodError) {
164
+ return res
165
+ .status(422)
166
+ .json({
167
+ success : false,
168
+ message: "Validation failed",
169
+ issues : err?.issues,
170
+ statusCode : 422
171
+ });
172
+ }
143
173
 
144
174
  return res
145
- .status(500)
146
- .json({
175
+ .status(500)
176
+ .json({
147
177
  success : false,
148
178
  message : err?.message,
149
179
  statusCode : 500
@@ -1,6 +1,24 @@
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
+ /**
5
+ * Extract specific fields from `ctx.body`.
6
+ *
7
+ * This decorator filters the request body and keeps only the
8
+ * specified keys. The filtered result replaces `ctx.body`
9
+ * before the controller method is executed.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * @Body('email', 'password')
14
+ * async login(ctx: T.Context) {
15
+ * // ctx.body = { email: "...", password: "..." }
16
+ * }
17
+ * ```
18
+ *
19
+ * @param {...string} bodyParms - Body field names to extract.
20
+ * @returns {MethodDecorator}
21
+ */
4
22
  const Body = (...bodyParms) => {
5
23
  return function (target, key, descriptor) {
6
24
  const originalMethod = descriptor.value;
@@ -14,6 +32,23 @@ const Body = (...bodyParms) => {
14
32
  };
15
33
  };
16
34
  exports.Body = Body;
35
+ /**
36
+ * Extract specific uploaded files from `ctx.files`.
37
+ *
38
+ * Filters uploaded files and keeps only the specified
39
+ * file field names before executing the controller method.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * \@Files('avatar', 'resume')
44
+ * async upload(ctx: T.Context) {
45
+ * // ctx.files = { avatar: File, resume: File }
46
+ * }
47
+ * ```
48
+ *
49
+ * @param {...string} filesParms - File field names to extract.
50
+ * @returns {MethodDecorator}
51
+ */
17
52
  const Files = (...filesParms) => {
18
53
  return function (target, key, descriptor) {
19
54
  const originalMethod = descriptor.value;
@@ -27,6 +62,23 @@ const Files = (...filesParms) => {
27
62
  };
28
63
  };
29
64
  exports.Files = Files;
65
+ /**
66
+ * Extract specific route parameters from `ctx.params`.
67
+ *
68
+ * Filters route parameters and keeps only the specified
69
+ * parameter names.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * \@Params('id')
74
+ * async getUser(ctx: T.Context) {
75
+ * // ctx.params = { id: "123" }
76
+ * }
77
+ * ```
78
+ *
79
+ * @param {...string} paramsData - Route parameter names to extract.
80
+ * @returns {MethodDecorator}
81
+ */
30
82
  const Params = (...paramsData) => {
31
83
  return function (target, key, descriptor) {
32
84
  const originalMethod = descriptor.value;
@@ -40,6 +92,23 @@ const Params = (...paramsData) => {
40
92
  };
41
93
  };
42
94
  exports.Params = Params;
95
+ /**
96
+ * Extract specific query parameters from `ctx.query`.
97
+ *
98
+ * Filters query parameters and keeps only the specified
99
+ * query keys.
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * \@Query('page', 'limit')
104
+ * async listUsers(ctx: T.Context) {
105
+ * // ctx.query = { page: "1", limit: "10" }
106
+ * }
107
+ * ```
108
+ *
109
+ * @param {...string} queryParms - Query parameter names to extract.
110
+ * @returns {MethodDecorator}
111
+ */
43
112
  const Query = (...queryParms) => {
44
113
  return function (target, key, descriptor) {
45
114
  const originalMethod = descriptor.value;
@@ -53,6 +122,23 @@ const Query = (...queryParms) => {
53
122
  };
54
123
  };
55
124
  exports.Query = Query;
125
+ /**
126
+ * Extract specific cookies from `ctx.cookies`.
127
+ *
128
+ * Filters cookies and keeps only the specified cookie keys
129
+ * before executing the controller method.
130
+ *
131
+ * @example
132
+ * ```ts
133
+ * \@Cookies('token')
134
+ * async profile(ctx: T.Context) {
135
+ * // ctx.cookies = { token: "..." }
136
+ * }
137
+ * ```
138
+ *
139
+ * @param {...string} cookiesParms - Cookie names to extract.
140
+ * @returns {MethodDecorator}
141
+ */
56
142
  const Cookies = (...cookiesParms) => {
57
143
  return function (target, key, descriptor) {
58
144
  const originalMethod = descriptor.value;
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/context.ts"],"names":[],"mappings":";;;AAEO,MAAM,IAAI,GAAG,CAAC,GAAG,SAAoB,EAAE,EAAE;IAC5C,OAAO,UAAS,MAAW,EAAE,GAAW,EAAE,UAA8B;QACpE,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,KAAK,WAAU,GAAe,EAA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C;YAEzD,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;AAlBW,QAAA,OAAO,WAkBlB"}
@@ -1,6 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Controller = void 0;
4
+ /**
5
+ * Declares a class as a controller and assigns a base route path.
6
+ *
7
+ * The provided path will be used as the **base URL prefix**
8
+ * for all routes defined inside the controller. The path must
9
+ * start with `/`.
10
+ *
11
+ * This decorator stores the controller path using
12
+ * `Reflect.defineMetadata` under the key `"controllers"`.
13
+ * The framework can later read this metadata to register
14
+ * routes automatically.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * \@Controller('/users')
19
+ * class UserController {
20
+ *
21
+ * async list(ctx: T.Context) {
22
+ * return [{ id: 1, name: "John" }];
23
+ * }
24
+ *
25
+ * }
26
+ * ```
27
+ *
28
+ * If a route handler defines `/profile`, the final route becomes:
29
+ *
30
+ * ```
31
+ * /users/profile
32
+ * ```
33
+ *
34
+ * @param {`/${string}`} path - Base route path for the controller.
35
+ * @returns {ClassDecorator}
36
+ */
4
37
  const Controller = (path) => {
5
38
  return (target) => {
6
39
  return Reflect.defineMetadata("controllers", path, target);
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/controller.ts"],"names":[],"mappings":";;;AAAO,MAAM,UAAU,GAAG,CAAC,IAAkB,EAAkB,EAAE;IAC/D,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,OAAO,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC,CAAA;AAJY,QAAA,UAAU,cAItB"}
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/controller.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACI,MAAM,UAAU,GAAG,CAAC,IAAkB,EAAkB,EAAE;IAC/D,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,OAAO,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC,CAAA;AAJY,QAAA,UAAU,cAItB"}
@@ -1,6 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WriteHeader = void 0;
4
+ /**
5
+ * Sets the HTTP response headers and status code before the controller method executes.
6
+ *
7
+ * This decorator calls `res.writeHead()` on the underlying Node.js response object,
8
+ * allowing you to define the response **status code** and **headers** in advance.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * class UserController {
13
+ *
14
+ * \@WriteHeader(200, { "Content-Type": "application/json" })
15
+ * async profile(ctx: T.Context) {
16
+ * return { id: 1, name: "John" };
17
+ * }
18
+ *
19
+ * }
20
+ * ```
21
+ *
22
+ * Example response:
23
+ *
24
+ * ```
25
+ * HTTP/1.1 200 OK
26
+ * Content-Type: application/json
27
+ * ```
28
+ *
29
+ * @param {number} statusCode - HTTP status code to send with the response.
30
+ * @param {OutgoingHttpHeaders} contentType - Response headers to set.
31
+ * @returns {Function}
32
+ */
4
33
  const WriteHeader = (statusCode, contentType) => {
5
34
  return (target, key, descriptor) => {
6
35
  const originalMethod = descriptor.value;
@@ -1 +1 @@
1
- {"version":3,"file":"headers.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/headers.ts"],"names":[],"mappings":";;;AAGO,MAAO,WAAW,GAAG,CAAC,UAAmB,EAAG,WAAiC,EAAE,EAAE;IACpF,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,UAA8B,EAAE,EAAE;QAChE,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,KAAK,WAAU,GAAe,EAAG,IAAoB;YACpE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAE,UAAU,EAAG,WAAW,CAAE,CAAC,CAAA;YAClD,OAAO,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAG,IAAI,CAAC,CAAC;QACvD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC,CAAA;AAXa,QAAA,WAAW,eAWxB"}
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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = void 0;
3
+ exports.Options = exports.Head = exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = void 0;
4
4
  const methodDecorator = (method) => {
5
5
  return (path) => {
6
6
  return (target, propertyKey) => {
@@ -17,9 +17,86 @@ const methodDecorator = (method) => {
17
17
  };
18
18
  };
19
19
  };
20
+ /**
21
+ * Maps a controller method to an HTTP GET route.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * \@Get('/users')
26
+ * async list(ctx: T.Context) {
27
+ * return [{ id: 1, name: "John" }];
28
+ * }
29
+ * ```
30
+ */
20
31
  exports.Get = methodDecorator('get');
32
+ /**
33
+ * Maps a controller method to an HTTP POST route.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * \@Post('/users')
38
+ * async create(ctx: T.Context) {
39
+ * return { success: true };
40
+ * }
41
+ * ```
42
+ */
21
43
  exports.Post = methodDecorator('post');
44
+ /**
45
+ * Maps a controller method to an HTTP PUT route.
46
+ *
47
+ * Used for replacing a resource.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * \@Put('/users/:id')
52
+ * async update(ctx: T.Context) {}
53
+ * ```
54
+ */
22
55
  exports.Put = methodDecorator('put');
56
+ /**
57
+ * Maps a controller method to an HTTP PATCH route.
58
+ *
59
+ * Used for partially updating a resource.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * \@Patch('/users/:id')
64
+ * async patch(ctx: T.Context) {}
65
+ * ```
66
+ */
23
67
  exports.Patch = methodDecorator('patch');
68
+ /**
69
+ * Maps a controller method to an HTTP DELETE route.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * \@Delete('/users/:id')
74
+ * async remove(ctx: T.Context) {}
75
+ * ```
76
+ */
24
77
  exports.Delete = methodDecorator('delete');
78
+ /**
79
+ * Maps a controller method to an HTTP HEAD route.
80
+ *
81
+ * HEAD responses contain only headers and no response body.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * \@Head('/health')
86
+ * async health(ctx: T.Context) {}
87
+ * ```
88
+ */
89
+ exports.Head = methodDecorator('head');
90
+ /**
91
+ * Maps a controller method to an HTTP OPTIONS route.
92
+ *
93
+ * Typically used for CORS preflight requests.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * \@Options('/users')
98
+ * async options(ctx: T.Context) {}
99
+ * ```
100
+ */
101
+ exports.Options = methodDecorator('options');
25
102
  //# sourceMappingURL=methods.js.map
@@ -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;AAEY,QAAA,GAAG,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;AAC7B,QAAA,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;AAC/B,QAAA,GAAG,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;AAC7B,QAAA,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;AACjC,QAAA,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC"}
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;;;;;;;;;;GAUG;AACU,QAAA,KAAK,GAAG,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"}
@@ -1,6 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Middleware = void 0;
4
+ /**
5
+ * Attaches a middleware function to a controller method.
6
+ *
7
+ * The middleware will be executed **before the route handler**.
8
+ * If the middleware calls `next(err)`, the error will be forwarded
9
+ * to the framework's error handler. Otherwise, the original
10
+ * controller method will be executed.
11
+ *
12
+ * This decorator also stores middleware metadata using `Reflect.defineMetadata`
13
+ * so the framework can discover and execute it during the request lifecycle.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * class UserController {
18
+ *
19
+ * \@Middleware(authMiddleware)
20
+ * async profile(ctx: T.Context) {
21
+ * return { user: ctx.user };
22
+ * }
23
+ *
24
+ * }
25
+ * ```
26
+ *
27
+ * Example middleware:
28
+ *
29
+ * ```ts
30
+ * const authMiddleware: T.RequestFunction = (ctx, next) => {
31
+ * if (!ctx.user) {
32
+ * return next(new Error("Unauthorized"));
33
+ * }
34
+ * next();
35
+ * };
36
+ * ```
37
+ *
38
+ * @param {T.RequestFunction} middleware - Middleware function to execute before the route handler.
39
+ * @returns {MethodDecorator}
40
+ */
4
41
  const Middleware = (middleware) => {
5
42
  return (target, key, descriptor) => {
6
43
  const originalMethod = descriptor.value;
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/middleware.ts"],"names":[],"mappings":";;;AAEO,MAAM,UAAU,GAAG,CAAC,UAA8B,EAAY,EAAE;IAErE,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,UAA8B,EAAE,EAAE;QAClE,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QACxC,UAAU,CAAC,KAAK,GAAG,UAAS,GAAe,EAAG,IAAqB;YACjE,IAAI;gBAEF,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,UAAU,EAAG,MAAM,CAAC,CAAA;gBAE1D,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC,GAAU,EAAE,EAAE;oBACpC,IAAG,GAAG,IAAI,IAAI,EAAE;wBACd,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;qBACjB;oBACD,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAG,IAAI,CAAC,CAAC;gBAC/C,CAAC,CAAC,CAAA;aAEH;YAAC,OAAO,KAAW,EAAE;gBAEpB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAA;aACnB;QACH,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAA;AAtBY,QAAA,UAAU,cAsBtB"}
1
+ {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/middleware.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACI,MAAM,UAAU,GAAG,CAAC,UAA6B,EAAY,EAAE;IAEpE,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,UAA8B,EAAE,EAAE;QAClE,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,UAAU,GAAc,EAAE,IAAoB;YAC/D,IAAI;gBAEF,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;gBAE1D,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC,GAAS,EAAE,EAAE;oBACnC,IAAI,GAAG,IAAI,IAAI,EAAE;wBACf,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;qBAClB;oBAED,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;gBAC9C,CAAC,CAAC,CAAC;aAEJ;YAAC,OAAO,KAAU,EAAE;gBACnB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;QACH,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,UAAU,cAuBrB"}
@@ -1,6 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StatusCode = void 0;
4
+ /**
5
+ * Sets the HTTP response status code before executing the controller method.
6
+ *
7
+ * The provided status code will be automatically clamped between **100** and **599**
8
+ * to ensure a valid HTTP status range. It also sets the default
9
+ * `Content-Type` header to `application/json`.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * class UserController {
14
+ * \@StatusCode(201)
15
+ * async create(ctx: T.Context) {
16
+ * return { success: true };
17
+ * }
18
+ * }
19
+ * ```
20
+ *
21
+ * In this example the response will be sent with:
22
+ * - Status: **201 Created**
23
+ * - Header: `Content-Type: application/json`
24
+ *
25
+ * @param {T.StatusCode} statusCode - HTTP status code to send with the response.
26
+ * @returns {MethodDecorator}
27
+ */
4
28
  const StatusCode = (statusCode) => {
5
29
  return (target, key, descriptor) => {
6
30
  const originalMethod = descriptor.value;
@@ -1 +1 @@
1
- {"version":3,"file":"statusCode.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/statusCode.ts"],"names":[],"mappings":";;;AAEO,MAAO,UAAU,GAAG,CAAC,UAAmB,EAAY,EAAE;IACzD,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,WAAU,GAAe,EAAG,IAAoB;YACpE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAG,EAAE,cAAc,EAAE,kBAAkB,EAAC,CAAC,CAAA;YAC/D,OAAO,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAG,IAAI,CAAC,CAAC;QACvD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC,CAAA;AAba,QAAA,UAAU,cAavB"}
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,6 +1,40 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Swagger = void 0;
4
+ /**
5
+ * Attaches Swagger/OpenAPI specification metadata to a controller method.
6
+ *
7
+ * This decorator stores route documentation using `Reflect.defineMetadata`
8
+ * so the framework can later collect it and generate **Swagger / OpenAPI**
9
+ * documentation automatically.
10
+ *
11
+ * The metadata is stored on the controller constructor under the key `"swaggers"`.
12
+ * Each decorated method contributes a Swagger specification object.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * class UserController {
17
+ *
18
+ * \@Swagger({
19
+ * summary: "Get user profile",
20
+ * description: "Returns the authenticated user's profile",
21
+ * tags: ["Users"],
22
+ * responses: {
23
+ * 200: {
24
+ * description: "Successful response"
25
+ * }
26
+ * }
27
+ * })
28
+ * async profile(ctx: T.Context) {
29
+ * return { id: 1, name: "John" };
30
+ * }
31
+ *
32
+ * }
33
+ * ```
34
+ *
35
+ * @param {T.Swagger.Spec} data - Swagger/OpenAPI specification for the route.
36
+ * @returns {MethodDecorator}
37
+ */
4
38
  const Swagger = (data) => {
5
39
  return (target, propertyKey) => {
6
40
  const controller = target.constructor;
@@ -9,7 +43,7 @@ const Swagger = (data) => {
9
43
  : [];
10
44
  swaggers.push({
11
45
  handler: propertyKey,
12
- ...data
46
+ ...data,
13
47
  });
14
48
  Reflect.defineMetadata("swaggers", swaggers, controller);
15
49
  };
@@ -1 +1 @@
1
- {"version":3,"file":"swagger.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/swagger.ts"],"names":[],"mappings":";;;AAEO,MAAM,OAAO,GAAG,CAAC,IAAqB,EAAE,EAAE;IAC7C,OAAO,CAAC,MAAW,EAAE,WAAgB,EAAE,EAAE;QACrC,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;QAEtC,MAAM,QAAQ,GAAU,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC;YACnE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC;YAC7C,CAAC,CAAC,EAAE,CAAC;QAEL,QAAQ,CAAC,IAAI,CAAC;YACV,OAAO,EAAE,WAAW;YACpB,GAAG,IAAI;SACV,CAAC,CAAC;QAEH,OAAO,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC,CAAA;AACL,CAAC,CAAA;AAfU,QAAA,OAAO,WAejB"}
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,OAA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