vovk 3.0.0-draft.55 → 3.0.0-draft.56

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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > vovk@3.0.0-draft.55 build
3
+ > vovk@3.0.0-draft.56 build
4
4
  > tsc
5
5
 
6
6
  \
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > vovk@3.0.0-draft.53 tsc
3
+ > vovk@3.0.0-draft.55 tsc
4
4
  > tsc --noEmit
5
5
 
6
6
  \
@@ -1,4 +1,4 @@
1
1
  import type { VovkHandlerSchema, KnownAny, VovkController, VovkRequest } from './types';
2
2
  type Next = () => Promise<unknown>;
3
- export declare function createDecorator<ARGS extends unknown[], REQUEST = VovkRequest>(handler: null | ((this: VovkController, req: REQUEST, next: Next, ...args: ARGS) => unknown), initHandler?: (this: VovkController, ...args: ARGS) => Omit<VovkHandlerSchema, 'path' | 'httpMethod'> | ((handlerSchema: VovkHandlerSchema | null) => Omit<VovkHandlerSchema, 'path' | 'httpMethod'>) | null | undefined): (...args: ARGS) => (target: KnownAny, propertyKey: string) => void;
3
+ export declare function createDecorator<ARGS extends unknown[], REQUEST = VovkRequest>(handler: null | ((this: VovkController, req: REQUEST, next: Next, ...args: ARGS) => unknown), initHandler?: (this: VovkController, ...args: ARGS) => Omit<VovkHandlerSchema, 'path' | 'httpMethod'> | ((handlerSchema: VovkHandlerSchema | null) => Omit<Partial<VovkHandlerSchema>, 'path' | 'httpMethod'>) | null | undefined): (...args: ARGS) => (target: KnownAny, propertyKey: string) => void;
4
4
  export {};
@@ -31,11 +31,10 @@ function createVovkApp() {
31
31
  controller._handlers = {
32
32
  ...controller._handlers,
33
33
  [propertyKey]: {
34
- path,
35
- httpMethod,
36
34
  validation: {},
37
- custom: {},
38
35
  ...(controller._handlers ?? {})[propertyKey],
36
+ path,
37
+ httpMethod,
39
38
  },
40
39
  };
41
40
  const originalMethod = controller[propertyKey];
package/dist/types.d.ts CHANGED
@@ -10,7 +10,7 @@ export type VovkHandlerSchema = {
10
10
  query?: KnownAny;
11
11
  body?: KnownAny;
12
12
  };
13
- custom: Record<string, KnownAny>;
13
+ custom?: Record<string, KnownAny>;
14
14
  };
15
15
  export type VovkControllerSchema = {
16
16
  controllerName: string;
@@ -20,10 +20,7 @@ function getSchema(options) {
20
20
  handlers: {
21
21
  ...(exposeValidation
22
22
  ? controller._handlers
23
- : Object.fromEntries(Object.entries(controller._handlers ?? {}).map(([key, value]) => [
24
- key,
25
- { ...value, validation: {} },
26
- ]))),
23
+ : Object.fromEntries(Object.entries(controller._handlers ?? {}).map(([key, value]) => [key, { ...value, validation: {} }]))),
27
24
  },
28
25
  };
29
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "3.0.0-draft.55",
3
+ "version": "3.0.0-draft.56",
4
4
  "main": "dist/index.js",
5
5
  "description": "RESTful RPC for Next.js - Transforms Next.js into a powerful REST API platform with RPC capabilities.",
6
6
  "repository": {
@@ -9,7 +9,7 @@ export function createDecorator<ARGS extends unknown[], REQUEST = VovkRequest>(
9
9
  ...args: ARGS
10
10
  ) =>
11
11
  | Omit<VovkHandlerSchema, 'path' | 'httpMethod'>
12
- | ((handlerSchema: VovkHandlerSchema | null) => Omit<VovkHandlerSchema, 'path' | 'httpMethod'>)
12
+ | ((handlerSchema: VovkHandlerSchema | null) => Omit<Partial<VovkHandlerSchema>, 'path' | 'httpMethod'>)
13
13
  | null
14
14
  | undefined
15
15
  ) {
@@ -48,11 +48,10 @@ export function createVovkApp() {
48
48
  controller._handlers = {
49
49
  ...controller._handlers,
50
50
  [propertyKey]: {
51
- path,
52
- httpMethod,
53
51
  validation: {},
54
- custom: {},
55
52
  ...((controller._handlers ?? {})[propertyKey] as Partial<VovkHandlerSchema>),
53
+ path,
54
+ httpMethod,
56
55
  },
57
56
  };
58
57
 
package/src/types.ts CHANGED
@@ -10,7 +10,7 @@ export type VovkHandlerSchema = {
10
10
  path: string;
11
11
  httpMethod: HttpMethod;
12
12
  validation: { query?: KnownAny; body?: KnownAny };
13
- custom: Record<string, KnownAny>;
13
+ custom?: Record<string, KnownAny>;
14
14
  };
15
15
 
16
16
  export type VovkControllerSchema = {