Skip to content

Commit 5bd3d7e

Browse files
committed
🔧 fix: day one patch
1 parent 0569610 commit 5bd3d7e

File tree

5 files changed

+43
-39
lines changed

5 files changed

+43
-39
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 1.4.4 - 13 Sep 2025
2+
Bug fix:
3+
- merge schema in GET method
4+
- remove accidental console.log
5+
16
# 1.4.3 - 13 Sep 2025
27
Bug fix:
38
- `mapValueError` should return all possible value both in dev environment and production environment

example/a.ts

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
1-
import { Elysia } from 'elysia'
1+
import { Elysia } from '../src'
2+
import z from 'zod'
3+
import * as v from 'valibot'
24

3-
const findUser = (authorization?: string) => {
4-
return {
5-
name: 'Jane Doe',
6-
role: 'admin' as const
7-
}
8-
}
9-
// ---cut---
10-
11-
const app = new Elysia()
12-
.macro({
13-
role: (role: 'user' | 'admin') => ({
14-
resolve({ status, headers: { authorization } }) {
15-
const user = findUser(authorization)
16-
17-
if(user.role !== role)
18-
return status(401)
19-
20-
return {
21-
user
22-
}
23-
}
5+
new Elysia()
6+
.guard({
7+
schema: 'standalone',
8+
body: z.object({
9+
id: z.coerce.number()
2410
})
2511
})
26-
.get('/token', ({ user }) => user, {
27-
// ^?
28-
role: 'admin'
12+
.get('/user/:id', ({ body }) => body, {
13+
body: v.object({
14+
name: v.literal('lilith')
15+
})
2916
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "elysia",
33
"description": "Ergonomic Framework for Human",
4-
"version": "1.4.3",
4+
"version": "1.4.4",
55
"author": {
66
"name": "saltyAom",
77
"url": "https://github.com/SaltyAom",

src/index.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5010,13 +5010,9 @@ export default class Elysia<
50105010
private _use(
50115011
plugin: AnyElysia | ((app: AnyElysia) => MaybePromise<AnyElysia>)
50125012
) {
5013-
console.log("1", plugin.toString())
5014-
50155013
if (typeof plugin === 'function') {
50165014
const instance = plugin(this as unknown as any) as unknown as any
50175015

5018-
console.log("2")
5019-
50205016
if (instance instanceof Promise) {
50215017
this.promisedModules.add(
50225018
instance
@@ -5644,20 +5640,20 @@ export default class Elysia<
56445640
MergeSchema<
56455641
Volatile['schema'],
56465642
MergeSchema<Ephemeral['schema'], Metadata['schema']>
5647-
> &
5648-
Metadata['standaloneSchema'] &
5649-
Ephemeral['standaloneSchema'] &
5650-
Volatile['standaloneSchema']
5651-
>,
5643+
>
5644+
> &
5645+
Metadata['standaloneSchema'] &
5646+
Ephemeral['standaloneSchema'] &
5647+
Volatile['standaloneSchema'],
5648+
const Decorator extends Singleton & {
5649+
derive: Ephemeral['derive'] & Volatile['derive']
5650+
resolve: Ephemeral['resolve'] & Volatile['resolve']
5651+
},
56525652
const MacroContext extends MacroToContext<
56535653
Metadata['macroFn'],
56545654
Omit<Input, NonResolvableMacroKey>,
56555655
Definitions['typebox']
56565656
>,
5657-
const Decorator extends Singleton & {
5658-
derive: Ephemeral['derive'] & Volatile['derive']
5659-
resolve: Ephemeral['resolve'] & Volatile['resolve']
5660-
},
56615657
const Handle extends InlineHandler<
56625658
NoInfer<Schema>,
56635659
Decorator,

test/types/lifecycle/soundness.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,3 +1881,19 @@ import { Prettify } from '../../../src/types'
18811881
}
18821882
)
18831883
}
1884+
1885+
// Get schema in GET
1886+
{
1887+
new Elysia()
1888+
.guard({
1889+
schema: 'standalone',
1890+
body: t.Object({
1891+
id: t.Number()
1892+
})
1893+
})
1894+
.get('/user/:id', ({ body }) => body, {
1895+
body: t.Object({
1896+
name: t.Literal('lilith')
1897+
})
1898+
})
1899+
}

0 commit comments

Comments
 (0)