quantum-flow 1.1.1 → 1.1.4

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
@@ -9,9 +9,6 @@ To install dependencies and build the project, run:
9
9
  ```bash
10
10
  yarn install
11
11
  # or npm install
12
-
13
- yarn build
14
- # or npm run build
15
12
  ```
16
13
 
17
14
  # Usage
@@ -31,7 +28,56 @@ You can use controllers and server functionality by importing controllers and cr
31
28
  Use the `@Controller` decorator to define controllers with options such as prefix, sub-controllers, middlewares, and interceptors.
32
29
 
33
30
  ```typescript
34
- import { Controller } from 'quantum-flow/core';
31
+ import {
32
+ Body,
33
+ Catch,
34
+ Controller,
35
+ Headers,
36
+ InjectWS,
37
+ IWebSocketService,
38
+ Params,
39
+ PUT,
40
+ Query,
41
+ Request,
42
+ Response,
43
+ Status,
44
+ USE
45
+ } from 'quantum-flow/core';
46
+ import {IsString} from 'class-validator'
47
+
48
+ class UserDto {
49
+ constructor() {}
50
+ @IsString()
51
+ name: string;
52
+ }
53
+
54
+ @Controller({
55
+ prefix: 'user',
56
+ controllers: [UserMetadata, ...],
57
+ interceptor: (data, req, res) => {
58
+ return { data, intercepted: true };
59
+ },
60
+ })
61
+ @Catch((err) => ({ status: 500, err }))
62
+ export class User {
63
+ @Status(201)
64
+ @PUT(':id')
65
+ async createUser(
66
+ @Body(UserDto) body: UserDto,
67
+ @Query() query: any,
68
+ @Headers() headers: any,
69
+ @Params() params: any,
70
+ @Request() req: any,
71
+ @Response() resp: any,
72
+ @InjectWS() ws: IWebSocketService,
73
+ ) {
74
+ }
75
+
76
+ @USE()
77
+ async any(@Response() resp: any) {
78
+ ...
79
+ }
80
+ }
35
81
 
36
82
  @Controller(api, [...middlewares])
37
83
  @Controller({
@@ -26,7 +26,6 @@ function Endpoint(method, pathPattern, middlewares) {
26
26
  console.warn('❌ originalMethod is undefined!');
27
27
  return descriptor;
28
28
  }
29
- console.log(pathPattern);
30
29
  if (method && pathPattern) {
31
30
  Reflect.defineMetadata(_constants_1.ENDPOINT, [method, pathPattern], target, propertyKey);
32
31
  Reflect.defineMetadata('middlewares', middlewares || [], target, propertyKey);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quantum-flow",
3
- "version": "1.1.1",
3
+ "version": "1.1.4",
4
4
  "description": "Decorator-based API framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",