File tree Expand file tree Collapse file tree 8 files changed +50
-37
lines changed Expand file tree Collapse file tree 8 files changed +50
-37
lines changed Original file line number Diff line number Diff line change
1
+ # 1.3.13 - 18 Aug 2025
2
+ Bug fix:
3
+ - important performance degration, exact mirror normalize doesn't apply correctly
4
+ - normalize optional property with special character
5
+
6
+ Change:
7
+ - update ` exact-mirror ` to ` 0.1.6 `
8
+
1
9
# 1.3.12 - 19 Aug 2025
2
10
Bug fix:
3
- - [ #1348 ] ( https://github.com/elysiajs/elysia/issues/1348 ) onAfterResponse runs twice if NotFoundError thrown and onError provided
11
+ - [ #1348 ] ( https://github.com/elysiajs/elysia/issues/1348 ) onAfterResponse runs twice if NotFoundError thrown and onError provided
4
12
5
13
# 1.3.11 - 18 Aug 2025
6
14
Bug fix:
7
- - [ #1346 ] ( https://github.com/elysiajs/elysia/issues/1346 ) cannot declare 'mep' twice
15
+ - [ #1346 ] ( https://github.com/elysiajs/elysia/issues/1346 ) cannot declare 'mep' twice
8
16
9
17
# 1.3.10 - 18 Aug 2025
10
18
Bug fix:
Original file line number Diff line number Diff line change 5
5
"name" : " elysia" ,
6
6
"dependencies" : {
7
7
"cookie" : " ^1.0.2" ,
8
- "exact-mirror" : " ^0.1.5 " ,
8
+ "exact-mirror" : " ^0.1.6 " ,
9
9
"fast-decode-uri-component" : " ^1.0.1" ,
10
10
},
11
11
"devDependencies" : {
31
31
},
32
32
"peerDependencies" : {
33
33
"@sinclair/typebox" : " >= 0.34.0" ,
34
- "exact-mirror" : " ^0.1.3 " ,
34
+ "exact-mirror" : " >= 0.0.9 " ,
35
35
"file-type" : " >= 20.0.0" ,
36
36
"openapi-types" : " >= 12.0.0" ,
37
37
"typescript" : " >= 5.0.0" ,
363
363
364
364
"eventsource-parser" : [
" [email protected] " ,
" " , {},
" sha512-VARTJ9CYeuQYb0pZEPbzi740OWFgpHe7AYJ2WFZVnUDUQp5Dk2yJUgF36YsZ81cOyxT0QxmXD2EQpapAouzWVA==" ],
365
365
366
- "exact-mirror" : [
" [email protected] .5 " ,
" " , {
"peerDependencies" : {
"@sinclair/typebox" :
" ^0.34.15" },
"optionalPeers" : [
" @sinclair/typebox" ] },
" sha512-NKLenPSYjWPoj2+IL3+NSXDTfddZMBAclnLPPZCEtWcSZYOVlKwedNpCCVQkdyIo6UYAMTiLd4wgtuQMPs4C/A ==" ],
366
+ "exact-mirror" : [
" [email protected] .6 " ,
" " , {
"peerDependencies" : {
"@sinclair/typebox" :
" ^0.34.15" },
"optionalPeers" : [
" @sinclair/typebox" ] },
" sha512-EXGDixoDotCGrXCce63zmGHDA+3Id6PPkIwshBHuB10dwVc4YV4gfaYLuysHOxyURmwyt4UL186ann0oYa2CFQ ==" ],
367
367
368
368
"expect-type" : [
" [email protected] " ,
" " , {},
" sha512-/kP8CAwxzLVEeFrMm4kMmy4CCDlpipyA7MYLVrdJIkV0fYF0UaigQHRsxHiuY/GEea+bh4KSv3TIlgr+2UL6bw==" ],
369
369
Original file line number Diff line number Diff line change 1
1
import { Elysia , t } from '../src'
2
2
import { req } from '../test/utils'
3
3
4
- let isAfterResponseCalled = false
5
-
6
- const app = new Elysia ( { precompile : true } )
7
- . onAfterResponse ( ( ) => {
8
- isAfterResponseCalled = true
4
+ const app = new Elysia ( ) . get ( '/' , ( { headers } ) => typeof headers [ 'is-admin' ] , {
5
+ headers : t . Object ( {
6
+ 'is-admin' : t . Union ( [
7
+ t . Boolean ( ) ,
8
+ t . String ( {
9
+ format : 'boolean'
10
+ } )
11
+ ] )
9
12
} )
10
- . onError ( ( ) => {
11
- return new Response ( 'a' , {
12
- status : 401 ,
13
+ } )
14
+
15
+ const value = await app
16
+ . handle (
17
+ req ( '/' , {
13
18
headers : {
14
- awd : 'b '
19
+ 'is-admin' : 'true '
15
20
}
16
21
} )
17
- } )
18
- . compile ( )
19
-
20
- // console.log(app.handleError.toString())
21
-
22
- await app . handle ( req ( '/' ) )
23
- // wait for next tick
24
- await Bun . sleep ( 1 )
25
-
26
- console . log ( isAfterResponseCalled )
22
+ )
23
+ . then ( ( x ) => x . text ( ) )
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " elysia" ,
3
3
"description" : " Ergonomic Framework for Human" ,
4
- "version" : " 1.3.12 " ,
4
+ "version" : " 1.3.13 " ,
5
5
"author" : {
6
6
"name" : " saltyAom" ,
7
7
"url" : " https://github.com/SaltyAom" ,
184
184
},
185
185
"dependencies" : {
186
186
"cookie" : " ^1.0.2" ,
187
- "exact-mirror" : " ^0.1.5 " ,
187
+ "exact-mirror" : " ^0.1.6 " ,
188
188
"fast-decode-uri-component" : " ^1.0.1"
189
189
},
190
190
"devDependencies" : {
Original file line number Diff line number Diff line change @@ -1564,6 +1564,7 @@ export const composeHandler = ({
1564
1564
defaultConfig : app . config . cookie ,
1565
1565
dynamic : ! ! app . config . aot ,
1566
1566
config : validator . cookie ?. config ?? { } ,
1567
+ normalize : app . config . normalize ,
1567
1568
// @ts -expect-error
1568
1569
models : app . definitions . type
1569
1570
} ) !
Original file line number Diff line number Diff line change @@ -605,6 +605,7 @@ export default class Elysia<
605
605
modules,
606
606
validator : cloned . cookie ,
607
607
defaultConfig : this . config . cookie ,
608
+ normalize,
608
609
config : cloned . cookie ?. config ?? { } ,
609
610
dynamic,
610
611
models,
@@ -699,6 +700,7 @@ export default class Elysia<
699
700
modules,
700
701
dynamic,
701
702
models,
703
+ normalize,
702
704
additionalProperties : ! normalize ,
703
705
coerce : true ,
704
706
additionalCoerce :
@@ -719,6 +721,7 @@ export default class Elysia<
719
721
modules,
720
722
dynamic,
721
723
models,
724
+ normalize,
722
725
coerce : true ,
723
726
additionalCoerce :
724
727
stringToStructureCoercions ( ) ,
@@ -738,6 +741,7 @@ export default class Elysia<
738
741
modules,
739
742
dynamic,
740
743
models,
744
+ normalize,
741
745
coerce : true ,
742
746
additionalCoerce :
743
747
stringToStructureCoercions ( ) ,
Original file line number Diff line number Diff line change @@ -974,11 +974,13 @@ export const getSchemaValidator = <T extends TSchema | string | undefined>(
974
974
console . warn (
975
975
'Failed to create exactMirror. Please report the following code to https://github.com/elysiajs/elysia/issues'
976
976
)
977
- console . warn ( schema )
977
+ console . dir ( schema , {
978
+ depth : null
979
+ } )
978
980
979
981
compiled . Clean = createCleaner ( schema )
980
982
}
981
- } else compiled . Clean = createCleaner ( schema )
983
+ } else if ( normalize === 'typebox' ) compiled . Clean = createCleaner ( schema )
982
984
983
985
compiled . parse = ( v ) => {
984
986
try {
@@ -1277,6 +1279,7 @@ export const getCookieValidator = ({
1277
1279
defaultConfig = { } ,
1278
1280
config,
1279
1281
dynamic,
1282
+ normalize = false ,
1280
1283
models,
1281
1284
validators,
1282
1285
sanitize
@@ -1286,6 +1289,7 @@ export const getCookieValidator = ({
1286
1289
defaultConfig : CookieOptions | undefined
1287
1290
config : CookieOptions
1288
1291
dynamic : boolean
1292
+ normalize : ElysiaConfig < '' > [ 'normalize' ] | undefined
1289
1293
models : Record < string , TSchema > | undefined
1290
1294
validators ?: InputSchema [ 'cookie' ] [ ]
1291
1295
sanitize ?: ( ) => ExactMirrorInstruction [ 'sanitize' ]
@@ -1294,6 +1298,7 @@ export const getCookieValidator = ({
1294
1298
modules,
1295
1299
dynamic,
1296
1300
models,
1301
+ normalize,
1297
1302
additionalProperties : true ,
1298
1303
coerce : true ,
1299
1304
additionalCoerce : stringToStructureCoercions ( ) ,
Original file line number Diff line number Diff line change @@ -232,15 +232,13 @@ describe('Header Validator', () => {
232
232
'/' ,
233
233
( { headers } ) => headers ?. name ?? 'sucrose' ,
234
234
{
235
- headers : t . Optional (
236
- t . Object (
237
- {
238
- name : t . String ( )
239
- } ,
240
- {
241
- additionalProperties : true
242
- }
243
- )
235
+ headers : t . Object (
236
+ {
237
+ name : t . Optional ( t . String ( ) )
238
+ } ,
239
+ {
240
+ additionalProperties : true
241
+ }
244
242
)
245
243
}
246
244
)
You can’t perform that action at this time.
0 commit comments