tspace-spear 1.0.0 → 1.0.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 (40) hide show
  1. package/License +1 -1
  2. package/README.md +336 -47
  3. package/build/lib/core/decorators/context.js +10 -9
  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 +53 -24
  23. package/build/lib/core/server/index.js +165 -211
  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 +413 -0
  27. package/build/lib/core/server/parser-factory.js.map +1 -0
  28. package/build/lib/core/server/router.d.ts +2 -2
  29. package/build/lib/core/server/router.js +1 -0
  30. package/build/lib/core/server/router.js.map +1 -0
  31. package/build/lib/{types → core/types}/index.d.ts +79 -7
  32. package/build/lib/{types → core/types}/index.js +1 -0
  33. package/build/lib/core/types/index.js.map +1 -0
  34. package/build/lib/index.d.ts +4 -13
  35. package/build/lib/index.js +7 -23
  36. package/build/lib/index.js.map +1 -0
  37. package/build/tests/benchmark.test.d.ts +1 -0
  38. package/build/tests/benchmark.test.js +135 -0
  39. package/build/tests/benchmark.test.js.map +1 -0
  40. package/package.json +22 -13
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,7 @@
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. It utilizes the native HTTP server.
8
7
 
9
8
  ## Install
10
9
 
@@ -16,28 +15,92 @@ npm install tspace-spear --save
16
15
  ```
17
16
  ## Basic Usage
18
17
  - [StartServer](#start-server)
18
+ - [CRUD](#crud)
19
19
  - [Middleware](#middleware)
20
20
  - [Controller](#controller)
21
21
  - [Router](#router)
22
- - [Handlers](#handlers)
22
+ - [Swagger](#swagger)
23
+ - [Others](#others)
23
24
 
24
25
  ## StartServer
25
26
  ```js
26
- import { Application } from "tspace-spear";
27
+ import Spear from "tspace-spear";
27
28
 
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
- })()
29
+ new Spear()
30
+ .get('/' , () => 'Hello world!')
31
+ .get('/json' , () => {
32
+ return {
33
+ message : 'Hello world!'
34
+ }
35
+ })
36
+ .listen(3000 , ({ server, port }) =>
37
+ console.log(`server listening on : http://localhost:${port}`)
38
+ )
39
+
40
+ ```
41
+
42
+ ### CRUD
43
+ ```js
44
+ import Spear from "tspace-spear";
45
+
46
+ const spears = [
47
+ {
48
+ id : 1,
49
+ damage : 100
50
+ },
51
+ {
52
+ id : 2,
53
+ damage : 75
54
+ },
55
+ {
56
+ id : 3,
57
+ damage : 50
58
+ }
59
+ ]
60
+
61
+ new Spear()
62
+ .useBodyParser()
63
+ .get('/' , () => spears)
64
+ .get('/:id' , ({ params }) => spears.find(spear => spear.id === Number(params.id ?? 0)))
65
+ .post('/' , ({ body }) => {
66
+ // please validation the your body
67
+ const damage = Number(body.damage ?? (Math.random() * 100).toFixed(0))
68
+
69
+ const id = spears.reduce((max, spear) => spear.id > max ? spear.id : max, 0) + 1
70
+
71
+ spears.push({ id , damage })
72
+
73
+ return spears.find(spear => spear.id === id)
74
+ })
75
+ .patch('/:id' , ({ params , body , res }) => {
76
+
77
+ const damage = Number(body.damage ?? (Math.random() * 100).toFixed(0))
78
+
79
+ const id = Number(params.id)
80
+
81
+ const spear = spears.find(spear => spear.id === id)
82
+
83
+ if (spear == null) return res.status(404).json({ message : 'Spear not found'})
84
+
85
+ spear.damage = damage;
86
+
87
+ return spears.find(spear => spear.id === id)
88
+ })
89
+ .delete('/:id', ({ params , res }) => {
90
+
91
+ const id = Number(params.id)
38
92
 
39
- // localhost:3000
93
+ const spear = spears.find(spear => spear.id === id)
40
94
 
95
+ if (spear == null) return res.status(404).json({ message : 'Spear not found'})
96
+
97
+ spears.splice(spears.findIndex(spear => spear.id === Number(params.id ?? 0)), 1)
98
+
99
+ return res.status(204).json()
100
+ })
101
+ .listen(3000 , ({ server, port }) =>
102
+ console.log(`server listening on : http://localhost:${port}`)
103
+ )
41
104
  ```
42
105
 
43
106
  ## Middleware
@@ -48,14 +111,14 @@ export default (ctx : TContext, next: TNextFunction) =>{
48
111
  return next();
49
112
  }
50
113
 
51
- import { Application , Router, TContext, TNextFunction } from "tspace-spear";
114
+ import Spear { Router, TContext, TNextFunction } from "tspace-spear";
52
115
  import CatMiddleware from './cat-middleware.ts'
53
116
 
54
117
  (async () => {
55
118
  const port = Number(process.env.PORT ?? 3000)
56
- const app = new Application({
119
+ const app = new Spear({
57
120
  middlewares: [ CatMiddleware ]
58
- // if you want to import a middleware with a directory can you follow the example
121
+ // if you want to import middlewares with a directory can you follow the example
59
122
  // middlewares : {
60
123
  // folder : `${__dirname}/middlewares`,
61
124
  // name : /middleware\.(ts|js)$/i
@@ -74,7 +137,7 @@ import CatMiddleware from './cat-middleware.ts'
74
137
  });
75
138
  })
76
139
 
77
- app.listen(port , () => console.log(`Server is now listening port: ${port}`))
140
+ app.listen(port , () => console.log(`Server is now listening http://localhost:${port}`))
78
141
 
79
142
  // localhost:3000
80
143
 
@@ -97,15 +160,17 @@ import {
97
160
  Params,
98
161
  Cookies,
99
162
  Files,
100
- StatusCode
163
+ StatusCode,
164
+ TCookies,
165
+ TParams,
166
+ TRequest,
167
+ TResponse ,
168
+ TQuery,
169
+ TFiles,
170
+ TContext,
171
+ TNextFunction
101
172
  } from 'tspace-spear';
102
173
 
103
- import type {
104
- TCookies, TParams,
105
- TRequest, TResponse ,
106
- TQuery, TFiles,
107
- TContext, TNextFunction
108
- } from 'tspace-spear';
109
174
  import CatMiddleware from './cat-middleware.ts'
110
175
 
111
176
  // file cat-controller.ts
@@ -115,10 +180,9 @@ class CatController {
115
180
  @Middleware(CatMiddleware)
116
181
  @Query('test','id')
117
182
  @Cookies('name')
118
- public async index({ query , cookies , req } : {
183
+ public async index({ query , cookies } : {
119
184
  query : TQuery<{ id : string }>
120
185
  cookies : TCookies<{ name : string}>
121
- req : TRequest
122
186
  }) {
123
187
 
124
188
  return {
@@ -130,7 +194,7 @@ class CatController {
130
194
  @Get('/:id')
131
195
  @Middleware(CatMiddleware)
132
196
  @Params('id')
133
- public async show({ params} : TContext) {
197
+ public async show({ params } : TContext) {
134
198
  return {
135
199
  params
136
200
  }
@@ -169,29 +233,34 @@ class CatController {
169
233
  }
170
234
  }
171
235
 
172
- import { Application , Router, TContext, TNextFunction } from "tspace-spear";
236
+ import Spear , { Router, TContext, TNextFunction } from "tspace-spear";
237
+
173
238
  import CatController from './cat-controller.ts'
174
239
 
175
240
  (async () => {
176
241
 
177
- const app = new Application({
242
+ const app = new Spear({
178
243
  controllers: [ CatController ]
179
- // if you want to import a controller with a directory can you follow the example
244
+ // if you want to import controllers with a directory can you follow the example
180
245
  // controllers : {
181
246
  // folder : `${__dirname}/controllers`,
182
247
  // name : /controller\.(ts|js)$/i
183
248
  // }
184
249
  })
185
250
 
251
+ app.useBodyParser()
252
+ app.useCookiesParser()
253
+ app.useFileUpload()
254
+
186
255
  app.get('/' , ( { res } : TContext) => {
187
256
  return res.json({
188
257
  message : 'hello world!'
189
258
  });
190
259
  })
191
260
 
192
- let port = 3000
261
+ const port = 3000
193
262
 
194
- app.listen(port , () => console.log(`Server is now listening port: ${port}`))
263
+ app.listen(port , () => console.log(`Server is now listening http://localhost:${port}`))
195
264
 
196
265
  // localhost:3000/cats
197
266
  // localhost:3000/cats/41
@@ -202,9 +271,9 @@ import CatController from './cat-controller.ts'
202
271
  ## Router
203
272
 
204
273
  ```js
205
- import { Application , Router, TContext, TNextFunction } from "tspace-spear";
274
+ import Spear , { Router, TContext, TNextFunction } from "tspace-spear";
206
275
 
207
- const app = new Application()
276
+ const app = new Spear()
208
277
 
209
278
  const router = new Router()
210
279
 
@@ -236,19 +305,227 @@ app.get('/' , ({ res } : TContext) => {
236
305
 
237
306
  let port = 3000
238
307
 
239
- app.listen(port , () => console.log(`Server is now listening port: ${port}`))
308
+ app.listen(port , () => console.log(`Server is now listening http://localhost:${port}`))
240
309
 
241
310
  // localhost:3000/my/cats
242
311
  // localhost:3000/cats
243
312
 
244
313
  ```
245
314
 
246
- ## Handlers
315
+ ## Swagger
316
+ ```js
317
+
318
+ // file cat-controller.ts
319
+ import {
320
+ TContext,
321
+ Controller,
322
+ Get ,
323
+ Post,
324
+ Put,
325
+ Patch,
326
+ Delete,
327
+ Swagger
328
+ } from 'tspace-spear';
329
+
330
+ @Controller('/cats')
331
+ class CatController {
332
+ @Get('/')
333
+ @Swagger({
334
+ query : {
335
+ id : {
336
+ type : 'integer'
337
+ },
338
+ name : {
339
+ type : 'string'
340
+ }
341
+ }
342
+ })
343
+ public async index({ query } : TContext) {
344
+
345
+ return {
346
+ query
347
+ }
348
+ }
349
+
350
+ @Get('/:id')
351
+ @Swagger({
352
+ description : '- message',
353
+ query : {
354
+ id : {
355
+ type : 'integer'
356
+ }
357
+ },
358
+ responses : [
359
+ { status : 200 , description : "OK" , example : { id : 'catz' }},
360
+ { status : 400 , description : "Bad request" , example : { id : 'catz' }}
361
+ ]
362
+ })
363
+ public async show({ params } : TContext) {
364
+ return {
365
+ params
366
+ }
367
+ }
368
+
369
+ @Post('/')
370
+ @Swagger({
371
+ bearerToken : true,
372
+ body : {
373
+ description : 'The description !',
374
+ required : true,
375
+ properties : {
376
+ id : {
377
+ type : 'integer',
378
+ example : 1
379
+ },
380
+ name : {
381
+ type : 'string',
382
+ example : "xxxxx"
383
+ }
384
+ }
385
+ }
386
+ })
387
+ public async store({ body } : TContext) {
388
+ return {
389
+ body
390
+ }
391
+ }
392
+
393
+ @Put('/:uuid')
394
+ @Swagger({
395
+ bearerToken : true,
396
+ body : {
397
+ description : 'The description !',
398
+ required : true,
399
+ properties : {
400
+ id : {
401
+ type : 'integer',
402
+ example : 1
403
+ },
404
+ name : {
405
+ type : 'string',
406
+ example : "xxxxx"
407
+ }
408
+ }
409
+ }
410
+ })
411
+ public async updated({ body } : TContext) {
412
+ return {
413
+ body
414
+ }
415
+ }
416
+
417
+ @Patch('/:uuid')
418
+ @Swagger({
419
+ bearerToken : true,
420
+ body : {
421
+ description : 'The description !',
422
+ required : true,
423
+ properties : {
424
+ id : {
425
+ type : 'integer',
426
+ example : 1
427
+ },
428
+ name : {
429
+ type : 'string',
430
+ example : "xxxxx"
431
+ }
432
+ }
433
+ }
434
+ })
435
+ public async update({ body } : TContext) {
436
+ return {
437
+ body
438
+ }
439
+ }
440
+
441
+ @Delete('/:uuid')
442
+ @Swagger({
443
+ bearerToken : true
444
+ })
445
+ public async delete({ params } : TContext) {
446
+ return {
447
+ params
448
+ }
449
+ }
450
+
451
+ @Post('/upload')
452
+ @Swagger({
453
+ bearerToken : true,
454
+ files : {
455
+ required : true,
456
+ properties : {
457
+ file : {
458
+ type : 'array',
459
+ items: {
460
+ type:"file",
461
+ format:"binary"
462
+ }
463
+ },
464
+ name : {
465
+ type : 'string'
466
+ }
467
+ }
468
+ }
469
+ })
470
+ public async upload({ body , files } : TContext) {
471
+ return {
472
+ body,
473
+ files
474
+ }
475
+ }
476
+ }
477
+
478
+ (async () => {
479
+
480
+ await new Spear({
481
+ controllers: [ CatController ]
482
+ })
483
+ .get('/' , ({ res } : TContext) => {
484
+ return res.json({
485
+ message : 'hello world!'
486
+ });
487
+ })
488
+ // .useSwagger() // by default path is "/api/docs"
489
+ .useSwagger({
490
+ path : "/docs",
491
+ servers : [
492
+ { url : "http://localhost:3000" , description : "development"},
493
+ { url : "http://localhost:8000" , description : "production"}
494
+ ],
495
+ info : {
496
+ "title" : "Welcome to the the documentation",
497
+ "description" : "This is the documentation"
498
+ }
499
+ })
500
+ .listen(3000 , () => console.log(`Server is now listening http://localhost:3000`))
501
+
502
+ // localhost:3000/docs
503
+ })()
504
+ ```
505
+
506
+ ## Others
507
+
247
508
  ```js
248
509
 
249
- const app = new Application({
510
+ const app = new Spear({
250
511
  logger : true, // logging
251
- globalPrefix : '/api' // prefix all routes in Router and Controller only!
512
+ globalPrefix : '/api' // prefix all routes
513
+ })
514
+
515
+ app.enableCors({
516
+ origins: [
517
+ /^http:\/\/localhost:\d+$/
518
+ ],
519
+ credentials: true
520
+ })
521
+
522
+ app.useFileUpload({
523
+ limit : 1000 * 1000, // limit for file upload 1_000_000 bytes
524
+ tempFileDir : 'tmp', // folder temporary directory
525
+ removeTempFile : {
526
+ remove : true, // remove temporary files
527
+ ms : 1000 * 60 // remove temporary after 60 seconds
528
+ }
252
529
  })
253
530
 
254
531
  app.get('/' , ({ res } : TContext) => {
@@ -257,6 +534,18 @@ app.get('/' , ({ res } : TContext) => {
257
534
  });
258
535
  })
259
536
 
537
+ app.get('/bad-request' , ({ res } : TContext) => {
538
+ return res.status(400).json({
539
+ message : 'hello but bad request'
540
+ });
541
+ })
542
+
543
+ app.get('/not-found' , ({ res } : TContext) => {
544
+ return res.status(404).json({
545
+ message : 'hello but not found the world!'
546
+ });
547
+ })
548
+
260
549
  app.get('/errors', () => {
261
550
  throw new Error('testing Error handler')
262
551
  })
@@ -271,7 +560,7 @@ app.formatResponse((results : unknown , statusCode : number) => {
271
560
  return {
272
561
  success : statusCode < 400,
273
562
  ...results,
274
- code : statusCode
563
+ statusCode
275
564
  }
276
565
  })
277
566
 
@@ -286,18 +575,18 @@ app.errorHandler((err : Error , { res } : TContext) => {
286
575
  return res
287
576
  .status(500)
288
577
  .json({
289
- success : false,
290
- message : err?.message,
291
- code : 500
578
+ success : false,
579
+ message : err?.message,
580
+ statusCode : 500
292
581
  });
293
582
  })
294
583
 
295
- let port = 3000
584
+ const port = 3000
296
585
 
297
- app.listen(port , () => console.log(`Server is now listening port: ${port}`))
586
+ app.listen(port , () => console.log(`Server is now listening http://localhost:${port}`))
298
587
 
299
588
  // localhost:3000/*********** // not found
300
589
  // localhost:3000/errors // errors
301
590
  // localhost:3000 // format response
302
591
 
303
- ```
592
+ ```
@@ -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,8 +78,8 @@ 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
85
  ctx.cookies = Object.keys(cookies).length ? cookies : null;
@@ -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,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,UAAe,GAAc,EAAG,IAAmB;;;gBAClE,MAAM,CAAC,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,mCAAI,EAAE,CAAA;gBACzB,MAAM,IAAI,GAAG,SAAS,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;g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C,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA;gBAE1D,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;
@@ -21,3 +21,4 @@ const Middleware = (middleware) => {
21
21
  };
22
22
  };
23
23
  exports.Middleware = Middleware;
24
+ //# sourceMappingURL=middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/middleware.ts"],"names":[],"mappings":";;;AAEO,MAAM,UAAU,GAAG,CAAC,UAA6B,EAAE,EAAE;IAE1D,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,UAA8B,EAAE,EAAE;QAClE,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QACxC,UAAU,CAAC,KAAK,GAAG,UAAS,GAAc,EAAG,IAAoB;YAC/D,IAAI,CAAC;gBAEH,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,CAAC;wBACf,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;oBAClB,CAAC;oBACD,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAG,IAAI,CAAC,CAAC;gBAC/C,CAAC,CAAC,CAAA;YAEJ,CAAC;YAAC,OAAO,KAAW,EAAE,CAAC;gBAErB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAA;YACpB,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAA;AAtBY,QAAA,UAAU,cAsBtB"}
@@ -24,3 +24,4 @@ const StatusCode = (statusCode) => {
24
24
  };
25
25
  };
26
26
  exports.StatusCode = StatusCode;
27
+ //# sourceMappingURL=statusCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statusCode.js","sourceRoot":"","sources":["../../../../src/lib/core/decorators/statusCode.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEO,MAAO,UAAU,GAAG,CAAC,UAAmB,EAAE,EAAE;IAC/C,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,UAA8B,EAAE,EAAE;QAChE,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,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,UAAe,GAAc,EAAG,IAAmB;;gBAClE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,EAAG,EAAE,cAAc,EAAE,kBAAkB,EAAC,CAAC,CAAA;gBACrE,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;AAba,QAAA,UAAU,cAavB"}
@@ -0,0 +1,2 @@
1
+ import { TSwagger } from "../types";
2
+ export declare const Swagger: (data: TSwagger) => (target: any, propertyKey: any) => void;