Comparing version 1.2.9 to 1.2.10
"use strict"; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
@@ -20,10 +18,2 @@ var __export = (target, all) => { | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
@@ -47,3 +37,3 @@ var compose_exports = {}; | ||
var import_fast_querystring = require("./fast-querystring"); | ||
var import_fast_decode_uri_component = __toESM(require("fast-decode-uri-component")); | ||
var import_deuri = require("./deuri"); | ||
var import_utils = require("./utils"); | ||
@@ -457,4 +447,4 @@ var import_error = require("./error"); | ||
let temp | ||
if(memory===-1)temp=decodeURIComponent(url.slice(start).replace(/\\+|%20/g,' ')) | ||
else temp=decodeURIComponent(url.slice(start, memory).replace(/\\+|%20/g,' ')) | ||
if(memory===-1)temp=decodeURIComponent(url.slice(start).replace(/\\+/g,' ')) | ||
else temp=decodeURIComponent(url.slice(start, memory).replace(/\\+/g,' ')) | ||
const charCode = temp.charCodeAt(0) | ||
@@ -474,4 +464,4 @@ if(charCode !== 91 && charCode !== 123) | ||
if(a${index}===undefined)a${index}=[] | ||
if(memory===-1){a${index}.push(decodeURIComponent(url.slice(start)).replace(/\\+|%20/g,' ')) | ||
break}else a${index}.push(decodeURIComponent(url.slice(start, memory)).replace(/\\+|%20/g,' ')) | ||
if(memory===-1){a${index}.push(decodeURIComponent(url.slice(start)).replace(/\\+/g,' ')) | ||
break}else a${index}.push(decodeURIComponent(url.slice(start, memory)).replace(/\\+/g,' ')) | ||
memory=url.indexOf('&${key}=',memory) | ||
@@ -483,8 +473,8 @@ if(memory===-1) break | ||
memory=url.indexOf('&',start) | ||
if(memory===-1)a${index}=decodeURIComponent(url.slice(start).replace(/\\+|%20/g,' '))else a${index}=decodeURIComponent(url.slice(start,memory).replace(/\\+|%20/g,' '))if(a${index}!==undefined)try{a${index}=JSON.parse(a${index})}catch{}}`; | ||
if(memory===-1)a${index}=decodeURIComponent(url.slice(start).replace(/\\+/g,' '))else a${index}=decodeURIComponent(url.slice(start,memory).replace(/\\+/g,' '))if(a${index}!==undefined)try{a${index}=JSON.parse(a${index})}catch{}}`; | ||
else { | ||
fnLiteral += init2 + `if(memory!==-1){const start=memory+${key.length + 2} | ||
memory=url.indexOf('&',start) | ||
if(memory===-1)a${index}=decodeURIComponent(url.slice(start).replace(/\\+|%20/g,' ')) | ||
else{a${index}=decodeURIComponent(url.slice(start,memory).replace(/\\+|%20/g,' '))`; | ||
if(memory===-1)a${index}=decodeURIComponent(url.slice(start).replace(/\\+/g,' ')) | ||
else{a${index}=decodeURIComponent(url.slice(start,memory).replace(/\\+/g,' '))`; | ||
if (anyOf) | ||
@@ -499,4 +489,4 @@ fnLiteral += ` | ||
let value | ||
if(deepMemory===-1)value=decodeURIComponent(url.slice(start).replace(/\\+|%20/g,' ')) | ||
else value=decodeURIComponent(url.slice(start, deepMemory).replace(/\\+|%20/g,' ')) | ||
if(deepMemory===-1)value=decodeURIComponent(url.slice(start).replace(/\\+/g,' ')) | ||
else value=decodeURIComponent(url.slice(start, deepMemory).replace(/\\+/g,' ')) | ||
const vStart=value.charCodeAt(0) | ||
@@ -1210,3 +1200,3 @@ const vEnd=value.charCodeAt(value.length - 1) | ||
signCookie: import_utils.signCookie, | ||
decodeURIComponent: import_fast_decode_uri_component.default, | ||
decodeURIComponent: import_deuri.decode, | ||
ElysiaCustomStatusResponse: import_error2.ElysiaCustomStatusResponse, | ||
@@ -1213,0 +1203,0 @@ ELYSIA_TRACE: import_trace.ELYSIA_TRACE, |
"use strict"; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
@@ -20,10 +18,2 @@ var __export = (target, all) => { | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
@@ -39,3 +29,3 @@ var cookies_exports = {}; | ||
var import_cookie = require("cookie"); | ||
var import_fast_decode_uri_component = __toESM(require("fast-decode-uri-component")); | ||
var import_deuri = require("./deuri"); | ||
var import_utils = require("./utils"); | ||
@@ -188,3 +178,4 @@ var import_error = require("./error"); | ||
for (const [name, v] of Object.entries(cookies)) { | ||
let value = (0, import_fast_decode_uri_component.default)(v); | ||
if (v === void 0) continue; | ||
let value = (0, import_deuri.decode)(v); | ||
if (sign === true || sign?.includes(name)) { | ||
@@ -191,0 +182,0 @@ if (!secrets) |
"use strict"; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
@@ -20,10 +18,2 @@ var __export = (target, all) => { | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
@@ -36,3 +26,3 @@ var fast_querystring_exports = {}; | ||
module.exports = __toCommonJS(fast_querystring_exports); | ||
var import_fast_decode_uri_component = __toESM(require("fast-decode-uri-component")); | ||
var import_deuri = require("./deuri"); | ||
const plusRegex = /\+/g; | ||
@@ -56,3 +46,3 @@ function parseQueryFromURL(input) { | ||
if (flags & 1) key = key.replace(plusRegex, " "); | ||
if (flags & 2) key = (0, import_fast_decode_uri_component.default)(key) || key; | ||
if (flags & 2) key = (0, import_deuri.decode)(key) || key; | ||
if (!result[key]) { | ||
@@ -64,3 +54,3 @@ if (hasBothKeyValuePair) { | ||
if (flags & 8) | ||
value = (0, import_fast_decode_uri_component.default)(value) || value; | ||
value = (0, import_deuri.decode)(value) || value; | ||
} | ||
@@ -98,3 +88,3 @@ result[key] = value; | ||
if (flags & 1) key = key.replace(plusRegex, " "); | ||
if (flags & 2) key = (0, import_fast_decode_uri_component.default)(key) || key; | ||
if (flags & 2) key = (0, import_deuri.decode)(key) || key; | ||
if (!result[key]) { | ||
@@ -105,3 +95,3 @@ if (hasBothKeyValuePair) { | ||
value = value.replace(plusRegex, " "); | ||
if (flags & 8) value = (0, import_fast_decode_uri_component.default)(value) || value; | ||
if (flags & 8) value = (0, import_deuri.decode)(value) || value; | ||
} | ||
@@ -138,3 +128,3 @@ result[key] = value; | ||
if (keyHasPlus) key = key.replace(plusRegex, " "); | ||
if (shouldDecodeKey) key = (0, import_fast_decode_uri_component.default)(key) || key; | ||
if (shouldDecodeKey) key = (0, import_deuri.decode)(key) || key; | ||
if (hasBothKeyValuePair) { | ||
@@ -144,3 +134,3 @@ value = input.slice(equalityIndex + 1, i); | ||
if (shouldDecodeValue) | ||
value = (0, import_fast_decode_uri_component.default)(value) || value; | ||
value = (0, import_deuri.decode)(value) || value; | ||
} | ||
@@ -147,0 +137,0 @@ const currentValue = result[key]; |
@@ -1422,2 +1422,9 @@ "use strict"; | ||
} else if (typeof macro === "object") { | ||
for (const name of Object.keys(macro)) | ||
if (typeof macro[name] === "object") { | ||
const actualValue = { ...macro[name] }; | ||
macro[name] = (v) => { | ||
if (v === true) return actualValue; | ||
}; | ||
} | ||
const hook = { | ||
@@ -1424,0 +1431,0 @@ checksum: (0, import_utils2.checksum)( |
@@ -55,7 +55,7 @@ import { ArrayOptions, DateOptions, Kind, NumberOptions, TArray, TDate, TUnsafe, TInteger, IntegerOptions } from '@sinclair/typebox'; | ||
readonly Files: (options?: ElysiaTypeOptions.Files) => import("@sinclair/typebox").TTransform<TUnsafe<File[]>, File[]>; | ||
readonly Nullable: <T extends TSchema>(schema: T) => import("@sinclair/typebox").TUnion<[T, import("@sinclair/typebox").TNull]>; | ||
readonly Nullable: <T extends TSchema>(schema: T, options?: SchemaOptions) => import("@sinclair/typebox").TUnion<[T, import("@sinclair/typebox").TNull]>; | ||
/** | ||
* Allow Optional, Nullable and Undefined | ||
*/ | ||
readonly MaybeEmpty: <T extends TSchema>(schema: T) => import("@sinclair/typebox").TUnion<[T, import("@sinclair/typebox").TNull, import("@sinclair/typebox").TUndefined]>; | ||
readonly MaybeEmpty: <T extends TSchema>(schema: T, options?: SchemaOptions) => import("@sinclair/typebox").TUnion<[T, import("@sinclair/typebox").TNull, import("@sinclair/typebox").TUndefined]>; | ||
readonly Cookie: <T extends TProperties>(properties: T, { domain, expires, httpOnly, maxAge, path, priority, sameSite, secure, secrets, sign, ...options }?: ElysiaTypeOptions.CookieValidatorOption<T>) => TObject<T>; | ||
@@ -62,0 +62,0 @@ readonly UnionEnum: <const T extends NonEmptyArray<TEnumValue> | Readonly<NonEmptyArray<TEnumValue>>>(values: T, options?: SchemaOptions) => TUnionEnum<T>; |
@@ -352,7 +352,7 @@ "use strict"; | ||
}).Encode((value) => value), | ||
Nullable: (schema) => t.Union([schema, t.Null()]), | ||
Nullable: (schema, options) => t.Union([schema, t.Null()], options), | ||
/** | ||
* Allow Optional, Nullable and Undefined | ||
*/ | ||
MaybeEmpty: (schema) => t.Union([schema, t.Null(), t.Undefined()]), | ||
MaybeEmpty: (schema, options) => t.Union([schema, t.Null(), t.Undefined()], options), | ||
Cookie: (properties, { | ||
@@ -359,0 +359,0 @@ domain, |
@@ -298,6 +298,9 @@ import type { Elysia, AnyElysia } from '.'; | ||
export type MacroContextBlacklistKey = 'type' | 'detail' | 'parse' | 'transform' | 'resolve' | 'beforeHandle' | 'afterHandle' | 'mapResponse' | 'afterResponse' | 'error' | 'tags' | keyof RouteSchema; | ||
type ReturnTypeIfPossible<T> = T extends (...args: any) => any ? ReturnType<T> : T; | ||
export type MacroToContext<MacroFn extends BaseMacroFn = {}, SelectedMacro extends MetadataBase['macro'] = {}> = {} extends SelectedMacro ? {} : { | ||
[key in keyof SelectedMacro as MacroFn[key] extends (...v: any[]) => { | ||
resolve: MaybeArray<(...v: any) => MaybePromise<Record<keyof any, unknown> | void | ElysiaCustomStatusResponse<any, any, any>>>; | ||
} ? key : never]: ResolveResolutions<Awaited<ReturnType<MacroFn[key]>['resolve']>>; | ||
} ? key : MacroFn[key] extends { | ||
resolve: MaybeArray<(...v: any) => MaybePromise<Record<keyof any, unknown> | void | ElysiaCustomStatusResponse<any, any, any>>>; | ||
} ? true extends SelectedMacro[key] ? key : never : never]: ResolveResolutions<Awaited<ReturnTypeIfPossible<MacroFn[key]>['resolve']>>; | ||
} extends infer A extends Record<RecordKey, unknown> ? IsNever<A[keyof A]> extends false ? Exclude<Awaited<A[keyof A]>, ElysiaCustomStatusResponse<any, any, any> | void> : {} : {}; | ||
@@ -596,3 +599,3 @@ export type InlineHandler<Route extends RouteSchema = {}, Singleton extends SingletonBase = { | ||
resolve: {}; | ||
}, in out Errors extends Record<string, Error> = {}> = Record<keyof any, (...a: any) => { | ||
}, in out Errors extends Record<string, Error> = {}> = Record<keyof any, { | ||
parse?: MaybeArray<BodyHandler<TypedRoute, Singleton>>; | ||
@@ -606,5 +609,14 @@ transform?: MaybeArray<VoidHandler<TypedRoute, Singleton>>; | ||
resolve?: MaybeArray<ResolveHandler<TypedRoute, Singleton>>; | ||
} | void>; | ||
} | ((...a: any) => { | ||
parse?: MaybeArray<BodyHandler<TypedRoute, Singleton>>; | ||
transform?: MaybeArray<VoidHandler<TypedRoute, Singleton>>; | ||
beforeHandle?: MaybeArray<OptionalHandler<TypedRoute, Singleton>>; | ||
afterHandle?: MaybeArray<AfterHandler<TypedRoute, Singleton>>; | ||
error?: MaybeArray<ErrorHandler<Errors, TypedRoute, Singleton>>; | ||
mapResponse?: MaybeArray<MapResponse<TypedRoute, Singleton>>; | ||
afterResponse?: MaybeArray<AfterResponseHandler<TypedRoute, Singleton>>; | ||
resolve?: MaybeArray<ResolveHandler<TypedRoute, Singleton>>; | ||
} | void)>; | ||
export type MacroToProperty<in out T extends BaseMacroFn | HookMacroFn<any, any, any>> = Prettify<{ | ||
[K in keyof T]: T[K] extends Function ? T[K] extends (a: infer Params) => any ? Params | undefined : T[K] : T[K]; | ||
[K in keyof T]: T[K] extends Function ? T[K] extends (a: infer Params) => any ? Params : boolean : boolean; | ||
}>; | ||
@@ -611,0 +623,0 @@ interface MacroOptions { |
@@ -919,4 +919,4 @@ "use strict"; | ||
} | ||
delete property[key]; | ||
} | ||
delete property[key]; | ||
} | ||
@@ -923,0 +923,0 @@ }; |
@@ -55,7 +55,7 @@ import { ArrayOptions, DateOptions, Kind, NumberOptions, TArray, TDate, TUnsafe, TInteger, IntegerOptions } from '@sinclair/typebox'; | ||
readonly Files: (options?: ElysiaTypeOptions.Files) => import("@sinclair/typebox").TTransform<TUnsafe<File[]>, File[]>; | ||
readonly Nullable: <T extends TSchema>(schema: T) => import("@sinclair/typebox").TUnion<[T, import("@sinclair/typebox").TNull]>; | ||
readonly Nullable: <T extends TSchema>(schema: T, options?: SchemaOptions) => import("@sinclair/typebox").TUnion<[T, import("@sinclair/typebox").TNull]>; | ||
/** | ||
* Allow Optional, Nullable and Undefined | ||
*/ | ||
readonly MaybeEmpty: <T extends TSchema>(schema: T) => import("@sinclair/typebox").TUnion<[T, import("@sinclair/typebox").TNull, import("@sinclair/typebox").TUndefined]>; | ||
readonly MaybeEmpty: <T extends TSchema>(schema: T, options?: SchemaOptions) => import("@sinclair/typebox").TUnion<[T, import("@sinclair/typebox").TNull, import("@sinclair/typebox").TUndefined]>; | ||
readonly Cookie: <T extends TProperties>(properties: T, { domain, expires, httpOnly, maxAge, path, priority, sameSite, secure, secrets, sign, ...options }?: ElysiaTypeOptions.CookieValidatorOption<T>) => TObject<T>; | ||
@@ -62,0 +62,0 @@ readonly UnionEnum: <const T extends NonEmptyArray<TEnumValue> | Readonly<NonEmptyArray<TEnumValue>>>(values: T, options?: SchemaOptions) => TUnionEnum<T>; |
@@ -298,6 +298,9 @@ import type { Elysia, AnyElysia } from '.'; | ||
export type MacroContextBlacklistKey = 'type' | 'detail' | 'parse' | 'transform' | 'resolve' | 'beforeHandle' | 'afterHandle' | 'mapResponse' | 'afterResponse' | 'error' | 'tags' | keyof RouteSchema; | ||
type ReturnTypeIfPossible<T> = T extends (...args: any) => any ? ReturnType<T> : T; | ||
export type MacroToContext<MacroFn extends BaseMacroFn = {}, SelectedMacro extends MetadataBase['macro'] = {}> = {} extends SelectedMacro ? {} : { | ||
[key in keyof SelectedMacro as MacroFn[key] extends (...v: any[]) => { | ||
resolve: MaybeArray<(...v: any) => MaybePromise<Record<keyof any, unknown> | void | ElysiaCustomStatusResponse<any, any, any>>>; | ||
} ? key : never]: ResolveResolutions<Awaited<ReturnType<MacroFn[key]>['resolve']>>; | ||
} ? key : MacroFn[key] extends { | ||
resolve: MaybeArray<(...v: any) => MaybePromise<Record<keyof any, unknown> | void | ElysiaCustomStatusResponse<any, any, any>>>; | ||
} ? true extends SelectedMacro[key] ? key : never : never]: ResolveResolutions<Awaited<ReturnTypeIfPossible<MacroFn[key]>['resolve']>>; | ||
} extends infer A extends Record<RecordKey, unknown> ? IsNever<A[keyof A]> extends false ? Exclude<Awaited<A[keyof A]>, ElysiaCustomStatusResponse<any, any, any> | void> : {} : {}; | ||
@@ -596,3 +599,3 @@ export type InlineHandler<Route extends RouteSchema = {}, Singleton extends SingletonBase = { | ||
resolve: {}; | ||
}, in out Errors extends Record<string, Error> = {}> = Record<keyof any, (...a: any) => { | ||
}, in out Errors extends Record<string, Error> = {}> = Record<keyof any, { | ||
parse?: MaybeArray<BodyHandler<TypedRoute, Singleton>>; | ||
@@ -606,5 +609,14 @@ transform?: MaybeArray<VoidHandler<TypedRoute, Singleton>>; | ||
resolve?: MaybeArray<ResolveHandler<TypedRoute, Singleton>>; | ||
} | void>; | ||
} | ((...a: any) => { | ||
parse?: MaybeArray<BodyHandler<TypedRoute, Singleton>>; | ||
transform?: MaybeArray<VoidHandler<TypedRoute, Singleton>>; | ||
beforeHandle?: MaybeArray<OptionalHandler<TypedRoute, Singleton>>; | ||
afterHandle?: MaybeArray<AfterHandler<TypedRoute, Singleton>>; | ||
error?: MaybeArray<ErrorHandler<Errors, TypedRoute, Singleton>>; | ||
mapResponse?: MaybeArray<MapResponse<TypedRoute, Singleton>>; | ||
afterResponse?: MaybeArray<AfterResponseHandler<TypedRoute, Singleton>>; | ||
resolve?: MaybeArray<ResolveHandler<TypedRoute, Singleton>>; | ||
} | void)>; | ||
export type MacroToProperty<in out T extends BaseMacroFn | HookMacroFn<any, any, any>> = Prettify<{ | ||
[K in keyof T]: T[K] extends Function ? T[K] extends (a: infer Params) => any ? Params | undefined : T[K] : T[K]; | ||
[K in keyof T]: T[K] extends Function ? T[K] extends (a: infer Params) => any ? Params : boolean : boolean; | ||
}>; | ||
@@ -611,0 +623,0 @@ interface MacroOptions { |
{ | ||
"name": "elysia", | ||
"description": "Ergonomic Framework for Human", | ||
"version": "1.2.9", | ||
"version": "1.2.10", | ||
"author": { | ||
@@ -86,2 +86,7 @@ "name": "saltyAom", | ||
}, | ||
"./deuri": { | ||
"types": "./dist/deuri.d.ts", | ||
"import": "./dist/deuri.mjs", | ||
"require": "./dist/cjs/deuri.js" | ||
}, | ||
"./adapter": { | ||
@@ -159,3 +164,2 @@ "types": "./dist/adapter/index.d.ts", | ||
"cookie": "^1.0.2", | ||
"fast-decode-uri-component": "^1.0.1", | ||
"memoirist": "^0.2.0", | ||
@@ -162,0 +166,0 @@ "openapi-types": "^12.1.3" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1822093
7
118
29632
19
26
- Removedfast-decode-uri-component@^1.0.1
- Removedfast-decode-uri-component@1.0.1(transitive)