adorn-api 1.0.3 → 1.0.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/dist/core/binding/binder.d.ts +1 -1
- package/dist/core/binding/binder.js +1 -1
- package/dist/core/errors/validation-error.d.ts +1 -1
- package/dist/core/errors/validation-error.js +1 -1
- package/dist/core/reply/typed.d.ts +1 -1
- package/dist/core/reply/typed.js +1 -1
- package/dist/decorators/methods.d.ts +3 -3
- package/dist/decorators/methods.js +3 -3
- package/dist/integrations/metal-orm/schema/entity.d.ts +1 -1
- package/dist/integrations/metal-orm/schema/entity.js +1 -1
- package/package.json +1 -1
|
@@ -61,7 +61,7 @@ export type BindOptions = {
|
|
|
61
61
|
* ```typescript
|
|
62
62
|
* // For a POST route with body
|
|
63
63
|
* // @Post('/users')
|
|
64
|
-
* // async createUser(
|
|
64
|
+
* // async createUser(userData: CreateUserDto)
|
|
65
65
|
* const { args } = bindArgs(route, handler, requestContext);
|
|
66
66
|
* const result = await handler(...args); // Automatically passes parsed body
|
|
67
67
|
* ```
|
|
@@ -27,7 +27,7 @@ import { coerceObjectSmart, coerceValueSmart } from './coerce/arrays.js';
|
|
|
27
27
|
* ```typescript
|
|
28
28
|
* // For a POST route with body
|
|
29
29
|
* // @Post('/users')
|
|
30
|
-
* // async createUser(
|
|
30
|
+
* // async createUser(userData: CreateUserDto)
|
|
31
31
|
* const { args } = bindArgs(route, handler, requestContext);
|
|
32
32
|
* const result = await handler(...args); // Automatically passes parsed body
|
|
33
33
|
* ```
|
|
@@ -33,7 +33,7 @@ import type { ValidationIssue } from '../../contracts/validator.js';
|
|
|
33
33
|
* ```typescript
|
|
34
34
|
* // In a controller with validation
|
|
35
35
|
* @Post('/users')
|
|
36
|
-
* async createUser(
|
|
36
|
+
* async createUser(userData: CreateUserDto) {
|
|
37
37
|
* const validationResult = await validator.validate(userData);
|
|
38
38
|
*
|
|
39
39
|
* if (!validationResult.valid) {
|
|
@@ -32,7 +32,7 @@ import { HttpError } from './http-error.js';
|
|
|
32
32
|
* ```typescript
|
|
33
33
|
* // In a controller with validation
|
|
34
34
|
* @Post('/users')
|
|
35
|
-
* async createUser(
|
|
35
|
+
* async createUser(userData: CreateUserDto) {
|
|
36
36
|
* const validationResult = await validator.validate(userData);
|
|
37
37
|
*
|
|
38
38
|
* if (!validationResult.valid) {
|
|
@@ -90,7 +90,7 @@ type InitFor<R extends ResponsesSpec, S extends number> = Omit<ReplyInit, 'heade
|
|
|
90
90
|
*
|
|
91
91
|
* class UserController {
|
|
92
92
|
* @Post('/users')
|
|
93
|
-
* async createUser(
|
|
93
|
+
* async createUser(userData: CreateUserDto) {
|
|
94
94
|
* const createdUser = await userService.create(userData);
|
|
95
95
|
* return route.reply(201, createdUser); // Type-safe!
|
|
96
96
|
* }
|
package/dist/core/reply/typed.js
CHANGED
|
@@ -77,7 +77,7 @@ import { reply as baseReply, noContent as baseNoContent } from './reply.js';
|
|
|
77
77
|
*
|
|
78
78
|
* class UserController {
|
|
79
79
|
* @Post('/users')
|
|
80
|
-
* async createUser(
|
|
80
|
+
* async createUser(userData: CreateUserDto) {
|
|
81
81
|
* const createdUser = await userService.create(userData);
|
|
82
82
|
* return route.reply(201, createdUser); // Type-safe!
|
|
83
83
|
* }
|
|
@@ -55,7 +55,7 @@ export declare function Get<Path extends string, const O extends RouteOptions<Pa
|
|
|
55
55
|
* ```typescript
|
|
56
56
|
* class UserController {
|
|
57
57
|
* @Post('/users')
|
|
58
|
-
* async createUser(
|
|
58
|
+
* async createUser(userData: CreateUserDto) {
|
|
59
59
|
* return await userService.create(userData);
|
|
60
60
|
* }
|
|
61
61
|
*
|
|
@@ -82,7 +82,7 @@ export declare function Post<Path extends string, const O extends RouteOptions<P
|
|
|
82
82
|
* ```typescript
|
|
83
83
|
* class UserController {
|
|
84
84
|
* @Put('/users/:id')
|
|
85
|
-
* async updateUser(id: string,
|
|
85
|
+
* async updateUser(id: string, userData: UpdateUserDto) {
|
|
86
86
|
* return await userService.update(id, userData);
|
|
87
87
|
* }
|
|
88
88
|
* }
|
|
@@ -104,7 +104,7 @@ export declare function Put<Path extends string, const O extends RouteOptions<Pa
|
|
|
104
104
|
* ```typescript
|
|
105
105
|
* class UserController {
|
|
106
106
|
* @Patch('/users/:id')
|
|
107
|
-
* async partialUpdate(id: string,
|
|
107
|
+
* async partialUpdate(id: string, partialData: Partial<User>) {
|
|
108
108
|
* return await userService.patch(id, partialData);
|
|
109
109
|
* }
|
|
110
110
|
* }
|
|
@@ -72,7 +72,7 @@ export function Get(path, options) {
|
|
|
72
72
|
* ```typescript
|
|
73
73
|
* class UserController {
|
|
74
74
|
* @Post('/users')
|
|
75
|
-
* async createUser(
|
|
75
|
+
* async createUser(userData: CreateUserDto) {
|
|
76
76
|
* return await userService.create(userData);
|
|
77
77
|
* }
|
|
78
78
|
*
|
|
@@ -101,7 +101,7 @@ export function Post(path, options) {
|
|
|
101
101
|
* ```typescript
|
|
102
102
|
* class UserController {
|
|
103
103
|
* @Put('/users/:id')
|
|
104
|
-
* async updateUser(id: string,
|
|
104
|
+
* async updateUser(id: string, userData: UpdateUserDto) {
|
|
105
105
|
* return await userService.update(id, userData);
|
|
106
106
|
* }
|
|
107
107
|
* }
|
|
@@ -125,7 +125,7 @@ export function Put(path, options) {
|
|
|
125
125
|
* ```typescript
|
|
126
126
|
* class UserController {
|
|
127
127
|
* @Patch('/users/:id')
|
|
128
|
-
* async partialUpdate(id: string,
|
|
128
|
+
* async partialUpdate(id: string, partialData: Partial<User>) {
|
|
129
129
|
* return await userService.patch(id, partialData);
|
|
130
130
|
* }
|
|
131
131
|
* }
|
|
@@ -52,7 +52,7 @@ export type EntitySchemaOptions = {
|
|
|
52
52
|
* ```typescript
|
|
53
53
|
* // Using in a controller with validation
|
|
54
54
|
* @Post('/users')
|
|
55
|
-
* async createUser(
|
|
55
|
+
* async createUser(userData: unknown) {
|
|
56
56
|
* const userSchema = entity(User, {
|
|
57
57
|
* omit: ['id', 'createdAt', 'updatedAt']
|
|
58
58
|
* });
|
|
@@ -39,7 +39,7 @@ import { tableDefOf } from './tabledef.js';
|
|
|
39
39
|
* ```typescript
|
|
40
40
|
* // Using in a controller with validation
|
|
41
41
|
* @Post('/users')
|
|
42
|
-
* async createUser(
|
|
42
|
+
* async createUser(userData: unknown) {
|
|
43
43
|
* const userSchema = entity(User, {
|
|
44
44
|
* omit: ['id', 'createdAt', 'updatedAt']
|
|
45
45
|
* });
|