tspace-spear 1.0.0 → 1.0.2

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 (43) hide show
  1. package/License +1 -1
  2. package/README.md +364 -47
  3. package/build/lib/core/decorators/context.js +11 -10
  4. package/build/lib/core/decorators/context.js.map +1 -0
  5. package/build/lib/core/decorators/controller.js +1 -0
  6. package/build/lib/core/decorators/controller.js.map +1 -0
  7. package/build/lib/core/decorators/headers.js +1 -0
  8. package/build/lib/core/decorators/headers.js.map +1 -0
  9. package/build/lib/core/decorators/index.d.ts +1 -0
  10. package/build/lib/core/decorators/index.js +2 -0
  11. package/build/lib/core/decorators/index.js.map +1 -0
  12. package/build/lib/core/decorators/methods.js +1 -0
  13. package/build/lib/core/decorators/methods.js.map +1 -0
  14. package/build/lib/core/decorators/middleware.d.ts +1 -1
  15. package/build/lib/core/decorators/middleware.js +1 -0
  16. package/build/lib/core/decorators/middleware.js.map +1 -0
  17. package/build/lib/core/decorators/statusCode.js +1 -0
  18. package/build/lib/core/decorators/statusCode.js.map +1 -0
  19. package/build/lib/core/decorators/swagger.d.ts +2 -0
  20. package/build/lib/core/decorators/swagger.js +15 -0
  21. package/build/lib/core/decorators/swagger.js.map +1 -0
  22. package/build/lib/core/server/index.d.ts +90 -44
  23. package/build/lib/core/server/index.js +314 -286
  24. package/build/lib/core/server/index.js.map +1 -0
  25. package/build/lib/core/server/parser-factory.d.ts +26 -0
  26. package/build/lib/core/server/parser-factory.js +428 -0
  27. package/build/lib/core/server/parser-factory.js.map +1 -0
  28. package/build/lib/core/server/q.bak.d.ts +0 -0
  29. package/build/lib/core/server/q.bak.js +965 -0
  30. package/build/lib/core/server/q.bak.js.map +1 -0
  31. package/build/lib/core/server/router.d.ts +63 -2
  32. package/build/lib/core/server/router.js +63 -1
  33. package/build/lib/core/server/router.js.map +1 -0
  34. package/build/lib/{types → core/types}/index.d.ts +85 -9
  35. package/build/lib/{types → core/types}/index.js +1 -0
  36. package/build/lib/core/types/index.js.map +1 -0
  37. package/build/lib/index.d.ts +4 -13
  38. package/build/lib/index.js +7 -23
  39. package/build/lib/index.js.map +1 -0
  40. package/build/tests/benchmark.test.d.ts +1 -0
  41. package/build/tests/benchmark.test.js +135 -0
  42. package/build/tests/benchmark.test.js.map +1 -0
  43. package/package.json +30 -19
package/License CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2023 Thanathip Srisawatpattana
1
+ Copyright (c) 2024 Thanathip Srisawatpattana
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
  [![NPM version](https://img.shields.io/npm/v/tspace-spear.svg)](https://www.npmjs.com)
4
4
  [![NPM downloads](https://img.shields.io/npm/dm/tspace-spear.svg)](https://www.npmjs.com)
5
5
 
6
- tspace-spear is an api framework for node.js fast and highly focused on providing the best developer experience.
7
- the tspace-spear using native http server
6
+ tspace-spear is a lightweight API framework for Node.js that is fast and highly focused on providing the best developer experience.
7
+ It utilizes the native HTTP server.
8
8
 
9
9
  ## Install
10
10
 
@@ -16,27 +16,113 @@ npm install tspace-spear --save
16
16
  ```
17
17
  ## Basic Usage
18
18
  - [StartServer](#start-server)
19
+ - [CRUD](#crud)
20
+ - [Cluster](#cluster)
19
21
  - [Middleware](#middleware)
20
22
  - [Controller](#controller)
21
23
  - [Router](#router)
22
- - [Handlers](#handlers)
24
+ - [Swagger](#swagger)
25
+ - [Others](#others)
23
26
 
24
27
  ## StartServer
25
28
  ```js
26
- import { Application } from "tspace-spear";
29
+ import Spear from "tspace-spear";
27
30
 
28
- (async () => {
29
- await new Application()
30
- .get('/' , () => 'Hello world!')
31
- .get('/json' , () => {
32
- return {
33
- message : 'Hello world!'
34
- }
35
- })
36
- .listen(3000 , () => console.log('server listening on port : 3000'))
37
- })()
31
+ new Spear()
32
+ .get('/' , () => 'Hello world!')
33
+ .get('/json' , () => {
34
+ return {
35
+ message : 'Hello world!'
36
+ }
37
+ })
38
+ .listen(3000 , ({ server, port }) =>
39
+ console.log(`server listening on : http://localhost:${port}`)
40
+ )
41
+
42
+ ```
43
+
44
+ ### CRUD
45
+ ```js
46
+ import Spear from "tspace-spear";
47
+
48
+ const spears = [
49
+ {
50
+ id : 1,
51
+ damage : 100
52
+ },
53
+ {
54
+ id : 2,
55
+ damage : 75
56
+ },
57
+ {
58
+ id : 3,
59
+ damage : 50
60
+ }
61
+ ]
62
+
63
+ new Spear()
64
+ .useBodyParser()
65
+ .get('/' , () => spears)
66
+ .get('/:id' , ({ params }) => spears.find(spear => spear.id === Number(params.id ?? 0)))
67
+ .post('/' , ({ body }) => {
68
+ // please validation the your body
69
+ const damage = Number(body.damage ?? (Math.random() * 100).toFixed(0))
70
+
71
+ const id = spears.reduce((max, spear) => spear.id > max ? spear.id : max, 0) + 1
72
+
73
+ spears.push({ id , damage })
74
+
75
+ return spears.find(spear => spear.id === id)
76
+ })
77
+ .patch('/:id' , ({ params , body , res }) => {
78
+
79
+ const damage = Number(body.damage ?? (Math.random() * 100).toFixed(0))
80
+
81
+ const id = Number(params.id)
38
82
 
39
- // localhost:3000
83
+ const spear = spears.find(spear => spear.id === id)
84
+
85
+ if (spear == null) return res.status(404).json({ message : 'Spear not found'})
86
+
87
+ spear.damage = damage;
88
+
89
+ return spears.find(spear => spear.id === id)
90
+ })
91
+ .delete('/:id', ({ params , res }) => {
92
+
93
+ const id = Number(params.id)
94
+
95
+ const spear = spears.find(spear => spear.id === id)
96
+
97
+ if (spear == null) return res.status(404).json({ message : 'Spear not found'})
98
+
99
+ spears.splice(spears.findIndex(spear => spear.id === Number(params.id ?? 0)), 1)
100
+
101
+ return res.status(204).json()
102
+ })
103
+ .listen(3000 , ({ server, port }) =>
104
+ console.log(`server listening on : http://localhost:${port}`)
105
+ )
106
+ ```
107
+
108
+ ## Cluster
109
+ ```js
110
+ import Spear from "tspace-spear";
111
+ new Spear({
112
+ cluster : {
113
+ use : true,
114
+ maxWorkers : 3
115
+ }
116
+ })
117
+ .get('/' , () => 'Hello world!')
118
+ .get('/json' , () => {
119
+ return {
120
+ message : 'Hello world!'
121
+ }
122
+ })
123
+ .listen(3000 , ({ server, port }) =>
124
+ console.log(`server listening on : http://localhost:${port}`)
125
+ )
40
126
 
41
127
  ```
42
128
 
@@ -48,14 +134,14 @@ export default (ctx : TContext, next: TNextFunction) =>{
48
134
  return next();
49
135
  }
50
136
 
51
- import { Application , Router, TContext, TNextFunction } from "tspace-spear";
137
+ import Spear { Router, TContext, TNextFunction } from "tspace-spear";
52
138
  import CatMiddleware from './cat-middleware.ts'
53
139
 
54
140
  (async () => {
55
141
  const port = Number(process.env.PORT ?? 3000)
56
- const app = new Application({
142
+ const app = new Spear({
57
143
  middlewares: [ CatMiddleware ]
58
- // if you want to import a middleware with a directory can you follow the example
144
+ // if you want to import middlewares with a directory can you follow the example
59
145
  // middlewares : {
60
146
  // folder : `${__dirname}/middlewares`,
61
147
  // name : /middleware\.(ts|js)$/i
@@ -74,7 +160,7 @@ import CatMiddleware from './cat-middleware.ts'
74
160
  });
75
161
  })
76
162
 
77
- app.listen(port , () => console.log(`Server is now listening port: ${port}`))
163
+ app.listen(port , () => console.log(`Server is now listening http://localhost:${port}`))
78
164
 
79
165
  // localhost:3000
80
166
 
@@ -97,15 +183,17 @@ import {
97
183
  Params,
98
184
  Cookies,
99
185
  Files,
100
- StatusCode
186
+ StatusCode,
187
+ TCookies,
188
+ TParams,
189
+ TRequest,
190
+ TResponse ,
191
+ TQuery,
192
+ TFiles,
193
+ TContext,
194
+ TNextFunction
101
195
  } from 'tspace-spear';
102
196
 
103
- import type {
104
- TCookies, TParams,
105
- TRequest, TResponse ,
106
- TQuery, TFiles,
107
- TContext, TNextFunction
108
- } from 'tspace-spear';
109
197
  import CatMiddleware from './cat-middleware.ts'
110
198
 
111
199
  // file cat-controller.ts
@@ -115,10 +203,9 @@ class CatController {
115
203
  @Middleware(CatMiddleware)
116
204
  @Query('test','id')
117
205
  @Cookies('name')
118
- public async index({ query , cookies , req } : {
206
+ public async index({ query , cookies } : {
119
207
  query : TQuery<{ id : string }>
120
208
  cookies : TCookies<{ name : string}>
121
- req : TRequest
122
209
  }) {
123
210
 
124
211
  return {
@@ -130,7 +217,7 @@ class CatController {
130
217
  @Get('/:id')
131
218
  @Middleware(CatMiddleware)
132
219
  @Params('id')
133
- public async show({ params} : TContext) {
220
+ public async show({ params } : TContext) {
134
221
  return {
135
222
  params
136
223
  }
@@ -169,29 +256,34 @@ class CatController {
169
256
  }
170
257
  }
171
258
 
172
- import { Application , Router, TContext, TNextFunction } from "tspace-spear";
259
+ import Spear , { Router, TContext, TNextFunction } from "tspace-spear";
260
+
173
261
  import CatController from './cat-controller.ts'
174
262
 
175
263
  (async () => {
176
264
 
177
- const app = new Application({
265
+ const app = new Spear({
178
266
  controllers: [ CatController ]
179
- // if you want to import a controller with a directory can you follow the example
267
+ // if you want to import controllers with a directory can you follow the example
180
268
  // controllers : {
181
269
  // folder : `${__dirname}/controllers`,
182
270
  // name : /controller\.(ts|js)$/i
183
271
  // }
184
272
  })
185
273
 
274
+ app.useBodyParser()
275
+ app.useCookiesParser()
276
+ app.useFileUpload()
277
+
186
278
  app.get('/' , ( { res } : TContext) => {
187
279
  return res.json({
188
280
  message : 'hello world!'
189
281
  });
190
282
  })
191
283
 
192
- let port = 3000
284
+ const port = 3000
193
285
 
194
- app.listen(port , () => console.log(`Server is now listening port: ${port}`))
286
+ app.listen(port , () => console.log(`Server is now listening http://localhost:${port}`))
195
287
 
196
288
  // localhost:3000/cats
197
289
  // localhost:3000/cats/41
@@ -202,9 +294,9 @@ import CatController from './cat-controller.ts'
202
294
  ## Router
203
295
 
204
296
  ```js
205
- import { Application , Router, TContext, TNextFunction } from "tspace-spear";
297
+ import Spear , { Router, TContext, TNextFunction } from "tspace-spear";
206
298
 
207
- const app = new Application()
299
+ const app = new Spear()
208
300
 
209
301
  const router = new Router()
210
302
 
@@ -236,19 +328,232 @@ app.get('/' , ({ res } : TContext) => {
236
328
 
237
329
  let port = 3000
238
330
 
239
- app.listen(port , () => console.log(`Server is now listening port: ${port}`))
331
+ app.listen(port , () => console.log(`Server is now listening http://localhost:${port}`))
240
332
 
241
333
  // localhost:3000/my/cats
242
334
  // localhost:3000/cats
243
335
 
244
336
  ```
245
337
 
246
- ## Handlers
338
+ ## Swagger
339
+ ```js
340
+
341
+ // file cat-controller.ts
342
+ import {
343
+ TContext,
344
+ Controller,
345
+ Get ,
346
+ Post,
347
+ Put,
348
+ Patch,
349
+ Delete,
350
+ Swagger
351
+ } from 'tspace-spear';
352
+
353
+ @Controller('/cats')
354
+ class CatController {
355
+ @Get('/')
356
+ @Swagger({
357
+ query : {
358
+ id : {
359
+ type : 'integer'
360
+ },
361
+ name : {
362
+ type : 'string'
363
+ }
364
+ }
365
+ })
366
+ public async index({ query } : TContext) {
367
+
368
+ return {
369
+ query
370
+ }
371
+ }
372
+
373
+ @Get('/:id')
374
+ @Swagger({
375
+ description : '- message',
376
+ query : {
377
+ id : {
378
+ type : 'integer'
379
+ }
380
+ },
381
+ responses : [
382
+ { status : 200 , description : "OK" , example : { id : 'catz' }},
383
+ { status : 400 , description : "Bad request" , example : { id : 'catz' }}
384
+ ]
385
+ })
386
+ public async show({ params } : TContext) {
387
+ return {
388
+ params
389
+ }
390
+ }
391
+
392
+ @Post('/')
393
+ @Swagger({
394
+ bearerToken : true,
395
+ body : {
396
+ description : 'The description !',
397
+ required : true,
398
+ properties : {
399
+ id : {
400
+ type : 'integer',
401
+ example : 1
402
+ },
403
+ name : {
404
+ type : 'string',
405
+ example : "xxxxx"
406
+ }
407
+ }
408
+ }
409
+ })
410
+ public async store({ body } : TContext) {
411
+ return {
412
+ body
413
+ }
414
+ }
415
+
416
+ @Put('/:uuid')
417
+ @Swagger({
418
+ bearerToken : true,
419
+ body : {
420
+ description : 'The description !',
421
+ required : true,
422
+ properties : {
423
+ id : {
424
+ type : 'integer',
425
+ example : 1
426
+ },
427
+ name : {
428
+ type : 'string',
429
+ example : "xxxxx"
430
+ }
431
+ }
432
+ }
433
+ })
434
+ public async updated({ body } : TContext) {
435
+ return {
436
+ body
437
+ }
438
+ }
439
+
440
+ @Patch('/:uuid')
441
+ @Swagger({
442
+ bearerToken : true,
443
+ body : {
444
+ description : 'The description !',
445
+ required : true,
446
+ properties : {
447
+ id : {
448
+ type : 'integer',
449
+ example : 1
450
+ },
451
+ name : {
452
+ type : 'string',
453
+ example : "xxxxx"
454
+ }
455
+ }
456
+ }
457
+ })
458
+ public async update({ body } : TContext) {
459
+ return {
460
+ body
461
+ }
462
+ }
463
+
464
+ @Delete('/:uuid')
465
+ @Swagger({
466
+ bearerToken : true
467
+ })
468
+ public async delete({ params } : TContext) {
469
+ return {
470
+ params
471
+ }
472
+ }
473
+
474
+ @Post('/upload')
475
+ @Swagger({
476
+ bearerToken : true,
477
+ files : {
478
+ required : true,
479
+ properties : {
480
+ file : {
481
+ type : 'array',
482
+ items: {
483
+ type:"file",
484
+ format:"binary"
485
+ }
486
+ },
487
+ name : {
488
+ type : 'string'
489
+ }
490
+ }
491
+ }
492
+ })
493
+ public async upload({ body , files } : TContext) {
494
+ return {
495
+ body,
496
+ files
497
+ }
498
+ }
499
+ }
500
+
501
+ (async () => {
502
+
503
+ await new Spear({
504
+ controllers: [ CatController ]
505
+ })
506
+ .get('/' , ({ res } : TContext) => {
507
+ return res.json({
508
+ message : 'hello world!'
509
+ });
510
+ })
511
+ // .useSwagger() // by default path is "/api/docs"
512
+ .useSwagger({
513
+ path : "/docs",
514
+ servers : [
515
+ { url : "http://localhost:3000" , description : "development"},
516
+ { url : "http://localhost:8000" , description : "production"}
517
+ ],
518
+ info : {
519
+ "title" : "Welcome to the the documentation",
520
+ "description" : "This is the documentation"
521
+ }
522
+ })
523
+ .listen(3000 , () => console.log(`Server is now listening http://localhost:3000`))
524
+
525
+ // localhost:3000/docs
526
+ })()
527
+ ```
528
+
529
+ ## Others
530
+
247
531
  ```js
248
532
 
249
- const app = new Application({
533
+ const app = new Spear({
250
534
  logger : true, // logging
251
- globalPrefix : '/api' // prefix all routes in Router and Controller only!
535
+ globalPrefix : '/api' // prefix all routes
536
+ })
537
+ // or use this for logging
538
+ app.useLogger({
539
+ methods : ['GET','POST'],
540
+ exceptPath : ['/']
541
+ })
542
+
543
+ app.enableCors({
544
+ origins: [
545
+ /^http:\/\/localhost:\d+$/
546
+ ],
547
+ credentials: true
548
+ })
549
+
550
+ app.useFileUpload({
551
+ limit : 1000 * 1000, // limit for file upload 1_000_000 bytes
552
+ tempFileDir : 'tmp', // folder temporary directory
553
+ removeTempFile : {
554
+ remove : true, // remove temporary files
555
+ ms : 1000 * 60 // remove temporary after 60 seconds
556
+ }
252
557
  })
253
558
 
254
559
  app.get('/' , ({ res } : TContext) => {
@@ -257,6 +562,18 @@ app.get('/' , ({ res } : TContext) => {
257
562
  });
258
563
  })
259
564
 
565
+ app.get('/bad-request' , ({ res } : TContext) => {
566
+ return res.status(400).json({
567
+ message : 'hello but bad request'
568
+ });
569
+ })
570
+
571
+ app.get('/not-found' , ({ res } : TContext) => {
572
+ return res.status(404).json({
573
+ message : 'hello but not found the world!'
574
+ });
575
+ })
576
+
260
577
  app.get('/errors', () => {
261
578
  throw new Error('testing Error handler')
262
579
  })
@@ -271,7 +588,7 @@ app.formatResponse((results : unknown , statusCode : number) => {
271
588
  return {
272
589
  success : statusCode < 400,
273
590
  ...results,
274
- code : statusCode
591
+ statusCode
275
592
  }
276
593
  })
277
594
 
@@ -286,18 +603,18 @@ app.errorHandler((err : Error , { res } : TContext) => {
286
603
  return res
287
604
  .status(500)
288
605
  .json({
289
- success : false,
290
- message : err?.message,
291
- code : 500
606
+ success : false,
607
+ message : err?.message,
608
+ statusCode : 500
292
609
  });
293
610
  })
294
611
 
295
- let port = 3000
612
+ const port = 3000
296
613
 
297
- app.listen(port , () => console.log(`Server is now listening port: ${port}`))
614
+ app.listen(port , () => console.log(`Server is now listening http://localhost:${port}`))
298
615
 
299
616
  // localhost:3000/*********** // not found
300
617
  // localhost:3000/errors // errors
301
618
  // localhost:3000 // format response
302
619
 
303
- ```
620
+ ```
@@ -14,11 +14,11 @@ const Body = (...bodyParms) => {
14
14
  return function (target, key, descriptor) {
15
15
  const originalMethod = descriptor.value;
16
16
  descriptor.value = function (ctx, next) {
17
- var _a;
18
17
  return __awaiter(this, void 0, void 0, function* () {
18
+ var _a;
19
19
  const q = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.body) !== null && _a !== void 0 ? _a : {};
20
20
  const body = bodyParms.reduce((acc, key) => (q[key] != null ? Object.assign(Object.assign({}, acc), { [key]: q[key] }) : acc), {});
21
- ctx.body = Object.keys(body).length ? body : null;
21
+ ctx.body = Object.keys(body).length ? body : {};
22
22
  return yield originalMethod.call(this, ctx, next);
23
23
  });
24
24
  };
@@ -30,11 +30,11 @@ const Files = (...filesParms) => {
30
30
  return function (target, key, descriptor) {
31
31
  const originalMethod = descriptor.value;
32
32
  descriptor.value = function (ctx, next) {
33
- var _a;
34
33
  return __awaiter(this, void 0, void 0, function* () {
34
+ var _a;
35
35
  const q = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.files) !== null && _a !== void 0 ? _a : {};
36
36
  const files = filesParms.reduce((acc, key) => (q[key] != null ? Object.assign(Object.assign({}, acc), { [key]: q[key] }) : acc), {});
37
- ctx.files = Object.keys(files).length ? files : null;
37
+ ctx.files = Object.keys(files).length ? files : {};
38
38
  return yield originalMethod.call(this, ctx, next);
39
39
  });
40
40
  };
@@ -46,11 +46,11 @@ const Params = (...paramsData) => {
46
46
  return function (target, key, descriptor) {
47
47
  const originalMethod = descriptor.value;
48
48
  descriptor.value = function (ctx, next) {
49
- var _a;
50
49
  return __awaiter(this, void 0, void 0, function* () {
50
+ var _a;
51
51
  const q = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.params) !== null && _a !== void 0 ? _a : {};
52
52
  const params = paramsData.reduce((acc, key) => (q[key] != null ? Object.assign(Object.assign({}, acc), { [key]: q[key] }) : acc), {});
53
- ctx.params = Object.keys(params).length ? params : null;
53
+ ctx.params = Object.keys(params).length ? params : {};
54
54
  return yield originalMethod.call(this, ctx, next);
55
55
  });
56
56
  };
@@ -62,11 +62,11 @@ const Query = (...queryParms) => {
62
62
  return function (target, key, descriptor) {
63
63
  const originalMethod = descriptor.value;
64
64
  descriptor.value = function (ctx, next) {
65
- var _a;
66
65
  return __awaiter(this, void 0, void 0, function* () {
66
+ var _a;
67
67
  const q = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.query) !== null && _a !== void 0 ? _a : {};
68
68
  const query = queryParms.reduce((acc, key) => (q[key] != null ? Object.assign(Object.assign({}, acc), { [key]: q[key] }) : acc), {});
69
- ctx.query = Object.keys(query).length ? query : null;
69
+ ctx.query = Object.keys(query).length ? query : {};
70
70
  return yield originalMethod.call(this, ctx, next);
71
71
  });
72
72
  };
@@ -78,11 +78,11 @@ const Cookies = (...cookiesParms) => {
78
78
  return function (target, key, descriptor) {
79
79
  const originalMethod = descriptor.value;
80
80
  descriptor.value = function (ctx, next) {
81
- var _a;
82
81
  return __awaiter(this, void 0, void 0, function* () {
82
+ var _a;
83
83
  const q = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.cookies) !== null && _a !== void 0 ? _a : {};
84
84
  const cookies = cookiesParms.reduce((acc, key) => (q[key] != null ? Object.assign(Object.assign({}, acc), { [key]: q[key] }) : acc), {});
85
- ctx.cookies = Object.keys(cookies).length ? cookies : null;
85
+ ctx.cookies = Object.keys(cookies).length ? cookies : {};
86
86
  return yield originalMethod.call(this, ctx, next);
87
87
  });
88
88
  };
@@ -90,3 +90,4 @@ const Cookies = (...cookiesParms) => {
90
90
  };
91
91
  };
92
92
  exports.Cookies = Cookies;
93
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/context.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEO,MAAM,IAAI,GAAG,C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Ac,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,UAAe,GAAc,EAAG,IAAmB;;;gBAClE,MAAM,CAAC,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,mCAAI,EAAE,CAAA;gBAC5B,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,iCAAM,GAAG,KAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,IAAG,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAA;gBACzG,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAA;gBAExD,OAAO,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAG,IAAI,CAAC,CAAC;YACvD,CAAC;SAAA,CAAC;QAEF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC,CAAA;AAdY,QAAA,OAAO,WAcnB"}
@@ -7,3 +7,4 @@ const Controller = (path) => {
7
7
  };
8
8
  };
9
9
  exports.Controller = Controller;
10
+ //# sourceMappingURL=controller.js.map
@@ -0,0 +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,CAAC,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC,CAAC;AACJ,CAAC,CAAA;AAJY,QAAA,UAAU,cAItB"}
@@ -23,3 +23,4 @@ const WriteHeader = (statusCode, contentType) => {
23
23
  };
24
24
  };
25
25
  exports.WriteHeader = WriteHeader;
26
+ //# sourceMappingURL=headers.js.map
@@ -0,0 +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,UAAe,GAAc,EAAG,IAAmB;;gBAClE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAE,UAAU,EAAG,WAAW,CAAE,CAAC,CAAA;gBAClD,OAAO,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAG,IAAI,CAAC,CAAC;YACvD,CAAC;SAAA,CAAC;QAEF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC,CAAA;AAXa,QAAA,WAAW,eAWxB"}
@@ -6,3 +6,4 @@ export * from './controller';
6
6
  export * from './headers';
7
7
  export * from './statusCode';
8
8
  export * from './context';
9
+ export * from './swagger';
@@ -22,3 +22,5 @@ __exportStar(require("./controller"), exports);
22
22
  __exportStar(require("./headers"), exports);
23
23
  __exportStar(require("./statusCode"), exports);
24
24
  __exportStar(require("./context"), exports);
25
+ __exportStar(require("./swagger"), exports);
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4BAAyB;AAEzB,4CAAyB;AACzB,4CAAyB;AACzB,+CAA4B;AAC5B,+CAA4B;AAC5B,4CAAyB;AACzB,+CAA4B;AAC5B,4CAAyB;AACzB,4CAAyB"}
@@ -22,3 +22,4 @@ exports.Post = methodDecorator('post');
22
22
  exports.Put = methodDecorator('put');
23
23
  exports.Patch = methodDecorator('patch');
24
24
  exports.Delete = methodDecorator('delete');
25
+ //# sourceMappingURL=methods.js.map
@@ -0,0 +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,EAAmB,EAAE;QAC7C,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;YAC7B,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;YAEtC,MAAM,OAAO,GAAc,OAAO,CAAC,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC;gBACnE,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,2 +1,2 @@
1
- import { TRequestFunction } from '../../types';
1
+ import { TRequestFunction } from '../types';
2
2
  export declare const Middleware: (middleware: TRequestFunction) => (target: any, key: string, descriptor: PropertyDescriptor) => void;