Comparing version 1.1.0-exp.3 to 1.1.0-exp.4
@@ -0,5 +1,6 @@ | ||
import type { Server } from 'bun'; | ||
import type { Cookie, ElysiaCookie } from './cookies'; | ||
import type { StatusMap, InvertedStatusMap, redirect as Redirect } from './utils'; | ||
import type { Cookie, ElysiaCookie } from './cookies'; | ||
import { error, type ELYSIA_RESPONSE } from './error'; | ||
import type { RouteSchema, Prettify, GetPathParameter, SingletonBase } from './types'; | ||
import type { RouteSchema, Prettify, GetPathParameter, SingletonBase, HTTPHeaders } from './types'; | ||
type InvertedStatusMapKey = keyof InvertedStatusMap; | ||
@@ -9,5 +10,2 @@ type WithoutNullableKeys<Type> = { | ||
}; | ||
type SetCookie = { | ||
'Set-Cookie'?: string | string[]; | ||
}; | ||
export type ErrorContext<in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = { | ||
@@ -26,5 +24,6 @@ decorator: {}; | ||
}>>; | ||
server: Server | null; | ||
redirect: Redirect; | ||
set: { | ||
headers: Record<string, string> & SetCookie; | ||
headers: HTTPHeaders; | ||
status?: number | keyof StatusMap; | ||
@@ -42,2 +41,3 @@ redirect?: string; | ||
store: Singleton['store']; | ||
response: Route['response']; | ||
} & Singleton['decorator'] & Singleton['derive'] & Singleton['resolve']>; | ||
@@ -57,5 +57,6 @@ export type Context<in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = { | ||
}>>; | ||
server: Server | null; | ||
redirect: Redirect; | ||
set: { | ||
headers: Record<string, string> & SetCookie; | ||
headers: HTTPHeaders; | ||
status?: number | keyof StatusMap; | ||
@@ -73,2 +74,3 @@ redirect?: string; | ||
store: Singleton['store']; | ||
response?: Route['response']; | ||
} & (Route['response'] extends { | ||
@@ -96,6 +98,5 @@ 200: unknown; | ||
redirect: Redirect; | ||
server: Server | null; | ||
set: { | ||
headers: { | ||
[header: string]: string; | ||
} & SetCookie; | ||
headers: HTTPHeaders; | ||
status?: number; | ||
@@ -102,0 +103,0 @@ redirect?: string; |
@@ -133,4 +133,4 @@ import type { Context } from './context'; | ||
set httpOnly(httpOnly: boolean | undefined); | ||
get sameSite(): boolean | "none" | "lax" | "strict" | undefined; | ||
set sameSite(sameSite: boolean | "none" | "lax" | "strict" | undefined); | ||
get sameSite(): boolean | "lax" | "strict" | "none" | undefined; | ||
set sameSite(sameSite: boolean | "lax" | "strict" | "none" | undefined); | ||
get priority(): "low" | "medium" | "high" | undefined; | ||
@@ -137,0 +137,0 @@ set priority(priority: "low" | "medium" | "high" | undefined); |
@@ -12,2 +12,4 @@ import type { Elysia } from '.'; | ||
export declare const createDynamicHandler: (app: Elysia<any, any, any, any, any, any, any, any>) => (request: Request) => Promise<Response>; | ||
export declare const createDynamicErrorHandler: (app: Elysia<any, any, any, any, any, any, any, any>) => (context: Context, error: ElysiaErrors) => Promise<import("undici-types").Response>; | ||
export declare const createDynamicErrorHandler: (app: Elysia<any, any, any, any, any, any, any, any>) => (context: Context & { | ||
response: unknown; | ||
}, error: ElysiaErrors) => Promise<import("undici-types").Response>; |
@@ -10,4 +10,6 @@ import { DateOptions, NumberOptions, TDate, TUnsafe } from '@sinclair/typebox'; | ||
type FileUnit = number | `${number}${'k' | 'm'}`; | ||
type StrictFileType = 'image' | 'image/*' | 'image/jpeg' | 'image/png' | 'image/gif' | 'image/tiff' | 'image/x-icon' | 'image/svg' | 'image/webp' | 'image/avif' | 'audio' | 'audio/*' | 'audio/aac' | 'audio/mpeg' | 'audio/x-ms-wma' | 'audio/vnd.rn-realaudio' | 'audio/x-wav' | 'video' | 'video/*' | 'video/mpeg' | 'video/mp4' | 'video/quicktime' | 'video/x-ms-wmv' | 'video/x-msvideo' | 'video/x-flv' | 'video/webm' | 'text' | 'text/*' | 'text/css' | 'text/csv' | 'text/html' | 'text/javascript' | 'text/plain' | 'text/xml' | 'application' | 'application/*' | 'application/graphql' | 'application/graphql-response+json' | 'application/ogg' | 'application/pdf' | 'application/xhtml' | 'application/xhtml+html' | 'application/xml-dtd' | 'application/html' | 'application/json' | 'application/ld+json' | 'application/xml' | 'application/zip' | 'font' | 'font/*' | 'font/woff2' | 'font/woff' | 'font/ttf' | 'font/otf'; | ||
type FileType = (string & {}) | StrictFileType; | ||
interface File extends SchemaOptions { | ||
type?: MaybeArray<(string & {}) | 'image' | 'image/jpeg' | 'image/png' | 'image/gif' | 'image/tiff' | 'image/x-icon' | 'image/svg' | 'image/webp' | 'image/avif' | 'audio' | 'audio/mpeg' | 'audio/x-ms-wma' | 'audio/vnd.rn-realaudio' | 'audio/x-wav' | 'video' | 'video/mpeg' | 'video/mp4' | 'video/quicktime' | 'video/x-ms-wmv' | 'video/x-msvideo' | 'video/x-flv' | 'video/webm' | 'text' | 'text/css' | 'text/csv' | 'text/html' | 'text/javascript' | 'text/plain' | 'text/xml' | 'application' | 'application/ogg' | 'application/pdf' | 'application/xhtml' | 'application/html' | 'application/json' | 'application/ld+json' | 'application/xml' | 'application/zip' | 'font' | 'font/woff2' | 'font/woff' | 'font/ttf' | 'font/otf'>; | ||
type?: MaybeArray<FileType>; | ||
minSize?: FileUnit; | ||
@@ -14,0 +16,0 @@ maxSize?: FileUnit; |
@@ -234,3 +234,3 @@ import type { Elysia } from '.'; | ||
scope?: LifeCycleType; | ||
subType?: 'derive' | 'resolve' | (string & {}); | ||
subType?: 'derive' | 'resolve' | 'mapDerive' | 'mapResolve' | (string & {}); | ||
fn: T; | ||
@@ -247,3 +247,3 @@ }; | ||
mapResponse: HookContainer<MapResponse<any, any>>[]; | ||
afterResponse: HookContainer<VoidHandler<any, any>>[]; | ||
afterResponse: HookContainer<AfterResponseHandler<any, any>>[]; | ||
trace: HookContainer<TraceHandler<any, any>>[]; | ||
@@ -278,6 +278,7 @@ error: HookContainer<ErrorHandler<any, any, any>>[]; | ||
}, Path extends string = ''> = (context: Context<Route, Singleton, Path>) => Route['response'] extends SuccessfulResponse ? Response | MaybePromise<Route['response'][keyof Route['response']]> : Response | MaybePromise<Route['response']>; | ||
export type Replace<Original, Target, With> = Original extends Record<string, unknown> ? { | ||
export type Replace<Original, Target, With> = IsAny<Target> extends true ? Original : Original extends Record<string, unknown> ? { | ||
[K in keyof Original]: Original[K] extends Target ? With : Original[K]; | ||
} : Original extends Target ? With : Original; | ||
export type CoExist<Original, Target, With> = Original extends Record<string, unknown> ? { | ||
type IsAny<T> = 0 extends 1 & T ? true : false; | ||
export type CoExist<Original, Target, With> = IsAny<Target> extends true ? Original : Original extends Record<string, unknown> ? { | ||
[K in keyof Original]: Original[K] extends Target ? Original[K] | With : Original[K]; | ||
@@ -367,2 +368,10 @@ } : Original extends Target ? Original | With : Original; | ||
}> = (context: PreContext<Singleton>) => MaybePromise<Route['response'] | void>; | ||
export type AfterResponseHandler<in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = { | ||
decorator: {}; | ||
store: {}; | ||
derive: {}; | ||
resolve: {}; | ||
}> = (context: Prettify<Context<Route, Singleton> & { | ||
response: Route['response']; | ||
}>) => MaybePromise<void>; | ||
export type GracefulHandler<in Instance extends Elysia<any, any, any, any, any, any, any, any>> = (data: Instance) => any; | ||
@@ -561,12 +570,12 @@ export type ErrorHandler<in out T extends Record<string, Error> = {}, in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = { | ||
}, fn: MaybeArray<ErrorHandler<Errors, TypedRoute, Singleton>>): unknown; | ||
mapResponse(fn: MaybeArray<VoidHandler<TypedRoute, Singleton>>): unknown; | ||
mapResponse(fn: MaybeArray<MapResponse<TypedRoute, Singleton>>): unknown; | ||
mapResponse(options: { | ||
insert?: 'before' | 'after'; | ||
stack?: 'global' | 'local'; | ||
}, fn: MaybeArray<VoidHandler<TypedRoute, Singleton>>): unknown; | ||
onAfterResponse(fn: MaybeArray<MapResponse<TypedRoute, Singleton>>): unknown; | ||
}, fn: MaybeArray<MapResponse<TypedRoute, Singleton>>): unknown; | ||
onAfterResponse(fn: MaybeArray<AfterResponseHandler<TypedRoute, Singleton>>): unknown; | ||
onAfterResponse(options: { | ||
insert?: 'before' | 'after'; | ||
stack?: 'global' | 'local'; | ||
}, fn: MaybeArray<MapResponse<TypedRoute, Singleton>>): unknown; | ||
}, fn: MaybeArray<AfterResponseHandler<TypedRoute, Singleton>>): unknown; | ||
events: { | ||
@@ -627,3 +636,3 @@ global: Prettify<LifeCycleStore & RouteSchema>; | ||
export type LifeCycleType = 'global' | 'local' | 'scoped'; | ||
export type ExcludeElysiaResponse<T> = Exclude<Awaited<T>, { | ||
export type ExcludeElysiaResponse<T> = Exclude<undefined extends Awaited<T> ? Partial<Awaited<T>> : Awaited<T>, { | ||
[ELYSIA_RESPONSE]: any; | ||
@@ -660,2 +669,95 @@ }>; | ||
export type ContextAppendType = 'append' | 'override'; | ||
export type HTTPHeaders = Record<string, string> & { | ||
'www-authenticate'?: string; | ||
authorization?: string; | ||
'proxy-aauthenticate'?: string; | ||
'proxy-authorization'?: string; | ||
age?: string; | ||
'cache-ctonrol'?: string; | ||
'clear-site-data'?: string; | ||
expires?: string; | ||
'no-vary-search'?: string; | ||
pragma?: string; | ||
'last-modified'?: string; | ||
etag?: string; | ||
'if-match'?: string; | ||
'if-none-match'?: string; | ||
'if-modified-since'?: string; | ||
'if-unmodified-since'?: string; | ||
vary?: string; | ||
connection?: string; | ||
'keep-alive'?: string; | ||
accept?: string; | ||
'accept-encoding'?: string; | ||
'accept-language'?: string; | ||
expect?: string; | ||
'max-forwards'?: string; | ||
cookie?: string; | ||
'set-cookie'?: string | string[]; | ||
'access-control-allow-origin'?: string; | ||
'access-control-allow-credentials'?: string; | ||
'access-control-allow-headers'?: string; | ||
'access-control-allow-methods'?: string; | ||
'access-control-expose-headers'?: string; | ||
'access-control-max-age'?: string; | ||
'access-control-request-headers'?: string; | ||
'access-control-request-method'?: string; | ||
origin?: string; | ||
'timing-allow-origin'?: string; | ||
'content-disposition'?: string; | ||
'content-length'?: string; | ||
'content-type'?: string; | ||
'content-encoding'?: string; | ||
'content-language'?: string; | ||
'content-location'?: string; | ||
forwarded?: string; | ||
via?: string; | ||
location?: string; | ||
refresh?: string; | ||
allow?: string; | ||
server?: 'Elysia' | (string & {}); | ||
'accept-ranges'?: string; | ||
range?: string; | ||
'if-range'?: string; | ||
'content-range'?: string; | ||
'content-security-policy'?: string; | ||
'content-security-policy-report-only'?: string; | ||
'cross-origin-embedder-policy'?: string; | ||
'cross-origin-opener-policy'?: string; | ||
'cross-origin-resource-policy'?: string; | ||
'expect-ct'?: string; | ||
'permission-policy'?: string; | ||
'strict-transport-security'?: string; | ||
'upgrade-insecure-requests'?: string; | ||
'x-content-type-options'?: string; | ||
'x-frame-options'?: string; | ||
'x-xss-protection'?: string; | ||
'last-event-id'?: string; | ||
'ping-from'?: string; | ||
'ping-to'?: string; | ||
'report-to'?: string; | ||
te?: string; | ||
trailer?: string; | ||
'transfer-encoding'?: string; | ||
'alt-svg'?: string; | ||
'alt-used'?: string; | ||
date?: string; | ||
dnt?: string; | ||
'early-data'?: string; | ||
'large-allocation'?: string; | ||
link?: string; | ||
'retry-after'?: string; | ||
'service-worker-allowed'?: string; | ||
'source-map'?: string; | ||
upgrade?: string; | ||
'x-dns-prefetch-control'?: string; | ||
'x-forwarded-for'?: string; | ||
'x-forwarded-host'?: string; | ||
'x-forwarded-proto'?: string; | ||
'x-powered-by'?: 'Elysia' | (string & {}); | ||
'x-request-id'?: string; | ||
'x-requested-with'?: string; | ||
'x-robots-tag'?: string; | ||
'x-ua-compatible'?: string; | ||
}; | ||
export {}; |
@@ -122,3 +122,3 @@ import type { BunFile } from 'bun'; | ||
} | MaybeArray<HookContainer>, fn?: MaybeArray<HookContainer>) => void; | ||
export declare const isNumericString: (message: string) => boolean; | ||
export declare const isNumericString: (message: string | number) => boolean; | ||
export declare class PromiseGroup implements PromiseLike<void> { | ||
@@ -125,0 +125,0 @@ onError: (error: any) => void; |
@@ -6,3 +6,3 @@ import type { ServerWebSocket, WebSocketHandler } from 'bun'; | ||
import type { Context } from '../context'; | ||
import type { SingletonBase, Handler, VoidHandler, ErrorHandler, InputSchema, RouteSchema, Isolate, GetPathParameter, MaybeArray, BaseMacro } from '../types'; | ||
import type { SingletonBase, Handler, ErrorHandler, InputSchema, RouteSchema, Isolate, GetPathParameter, MaybeArray, BaseMacro, TransformHandler } from '../types'; | ||
export declare namespace WS { | ||
@@ -15,4 +15,4 @@ type Config = Omit<WebSocketHandler, 'open' | 'message' | 'close' | 'drain'>; | ||
}>, TypedRoute, Singleton> extends infer WS ? { | ||
transform?: MaybeArray<VoidHandler<TypedRoute, Singleton>>; | ||
transformMessage?: MaybeArray<VoidHandler<TypedRoute, Singleton>>; | ||
transform?: MaybeArray<TransformHandler<TypedRoute, Singleton>>; | ||
transformMessage?: MaybeArray<TransformHandler<TypedRoute, Singleton>>; | ||
beforeHandle?: MaybeArray<Handler<TypedRoute, Singleton>>; | ||
@@ -19,0 +19,0 @@ /** |
@@ -0,5 +1,6 @@ | ||
import type { Server } from 'bun'; | ||
import type { Cookie, ElysiaCookie } from './cookies'; | ||
import type { StatusMap, InvertedStatusMap, redirect as Redirect } from './utils'; | ||
import type { Cookie, ElysiaCookie } from './cookies'; | ||
import { error, type ELYSIA_RESPONSE } from './error'; | ||
import type { RouteSchema, Prettify, GetPathParameter, SingletonBase } from './types'; | ||
import type { RouteSchema, Prettify, GetPathParameter, SingletonBase, HTTPHeaders } from './types'; | ||
type InvertedStatusMapKey = keyof InvertedStatusMap; | ||
@@ -9,5 +10,2 @@ type WithoutNullableKeys<Type> = { | ||
}; | ||
type SetCookie = { | ||
'Set-Cookie'?: string | string[]; | ||
}; | ||
export type ErrorContext<in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = { | ||
@@ -26,5 +24,6 @@ decorator: {}; | ||
}>>; | ||
server: Server | null; | ||
redirect: Redirect; | ||
set: { | ||
headers: Record<string, string> & SetCookie; | ||
headers: HTTPHeaders; | ||
status?: number | keyof StatusMap; | ||
@@ -42,2 +41,3 @@ redirect?: string; | ||
store: Singleton['store']; | ||
response: Route['response']; | ||
} & Singleton['decorator'] & Singleton['derive'] & Singleton['resolve']>; | ||
@@ -57,5 +57,6 @@ export type Context<in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = { | ||
}>>; | ||
server: Server | null; | ||
redirect: Redirect; | ||
set: { | ||
headers: Record<string, string> & SetCookie; | ||
headers: HTTPHeaders; | ||
status?: number | keyof StatusMap; | ||
@@ -73,2 +74,3 @@ redirect?: string; | ||
store: Singleton['store']; | ||
response?: Route['response']; | ||
} & (Route['response'] extends { | ||
@@ -96,6 +98,5 @@ 200: unknown; | ||
redirect: Redirect; | ||
server: Server | null; | ||
set: { | ||
headers: { | ||
[header: string]: string; | ||
} & SetCookie; | ||
headers: HTTPHeaders; | ||
status?: number; | ||
@@ -102,0 +103,0 @@ redirect?: string; |
@@ -133,4 +133,4 @@ import type { Context } from './context'; | ||
set httpOnly(httpOnly: boolean | undefined); | ||
get sameSite(): boolean | "none" | "lax" | "strict" | undefined; | ||
set sameSite(sameSite: boolean | "none" | "lax" | "strict" | undefined); | ||
get sameSite(): boolean | "lax" | "strict" | "none" | undefined; | ||
set sameSite(sameSite: boolean | "lax" | "strict" | "none" | undefined); | ||
get priority(): "low" | "medium" | "high" | undefined; | ||
@@ -137,0 +137,0 @@ set priority(priority: "low" | "medium" | "high" | undefined); |
@@ -12,2 +12,4 @@ import type { Elysia } from '.'; | ||
export declare const createDynamicHandler: (app: Elysia<any, any, any, any, any, any, any, any>) => (request: Request) => Promise<Response>; | ||
export declare const createDynamicErrorHandler: (app: Elysia<any, any, any, any, any, any, any, any>) => (context: Context, error: ElysiaErrors) => Promise<import("undici-types").Response>; | ||
export declare const createDynamicErrorHandler: (app: Elysia<any, any, any, any, any, any, any, any>) => (context: Context & { | ||
response: unknown; | ||
}, error: ElysiaErrors) => Promise<import("undici-types").Response>; |
@@ -10,4 +10,6 @@ import { DateOptions, NumberOptions, TDate, TUnsafe } from '@sinclair/typebox'; | ||
type FileUnit = number | `${number}${'k' | 'm'}`; | ||
type StrictFileType = 'image' | 'image/*' | 'image/jpeg' | 'image/png' | 'image/gif' | 'image/tiff' | 'image/x-icon' | 'image/svg' | 'image/webp' | 'image/avif' | 'audio' | 'audio/*' | 'audio/aac' | 'audio/mpeg' | 'audio/x-ms-wma' | 'audio/vnd.rn-realaudio' | 'audio/x-wav' | 'video' | 'video/*' | 'video/mpeg' | 'video/mp4' | 'video/quicktime' | 'video/x-ms-wmv' | 'video/x-msvideo' | 'video/x-flv' | 'video/webm' | 'text' | 'text/*' | 'text/css' | 'text/csv' | 'text/html' | 'text/javascript' | 'text/plain' | 'text/xml' | 'application' | 'application/*' | 'application/graphql' | 'application/graphql-response+json' | 'application/ogg' | 'application/pdf' | 'application/xhtml' | 'application/xhtml+html' | 'application/xml-dtd' | 'application/html' | 'application/json' | 'application/ld+json' | 'application/xml' | 'application/zip' | 'font' | 'font/*' | 'font/woff2' | 'font/woff' | 'font/ttf' | 'font/otf'; | ||
type FileType = (string & {}) | StrictFileType; | ||
interface File extends SchemaOptions { | ||
type?: MaybeArray<(string & {}) | 'image' | 'image/jpeg' | 'image/png' | 'image/gif' | 'image/tiff' | 'image/x-icon' | 'image/svg' | 'image/webp' | 'image/avif' | 'audio' | 'audio/mpeg' | 'audio/x-ms-wma' | 'audio/vnd.rn-realaudio' | 'audio/x-wav' | 'video' | 'video/mpeg' | 'video/mp4' | 'video/quicktime' | 'video/x-ms-wmv' | 'video/x-msvideo' | 'video/x-flv' | 'video/webm' | 'text' | 'text/css' | 'text/csv' | 'text/html' | 'text/javascript' | 'text/plain' | 'text/xml' | 'application' | 'application/ogg' | 'application/pdf' | 'application/xhtml' | 'application/html' | 'application/json' | 'application/ld+json' | 'application/xml' | 'application/zip' | 'font' | 'font/woff2' | 'font/woff' | 'font/ttf' | 'font/otf'>; | ||
type?: MaybeArray<FileType>; | ||
minSize?: FileUnit; | ||
@@ -14,0 +16,0 @@ maxSize?: FileUnit; |
@@ -234,3 +234,3 @@ import type { Elysia } from '.'; | ||
scope?: LifeCycleType; | ||
subType?: 'derive' | 'resolve' | (string & {}); | ||
subType?: 'derive' | 'resolve' | 'mapDerive' | 'mapResolve' | (string & {}); | ||
fn: T; | ||
@@ -247,3 +247,3 @@ }; | ||
mapResponse: HookContainer<MapResponse<any, any>>[]; | ||
afterResponse: HookContainer<VoidHandler<any, any>>[]; | ||
afterResponse: HookContainer<AfterResponseHandler<any, any>>[]; | ||
trace: HookContainer<TraceHandler<any, any>>[]; | ||
@@ -278,6 +278,7 @@ error: HookContainer<ErrorHandler<any, any, any>>[]; | ||
}, Path extends string = ''> = (context: Context<Route, Singleton, Path>) => Route['response'] extends SuccessfulResponse ? Response | MaybePromise<Route['response'][keyof Route['response']]> : Response | MaybePromise<Route['response']>; | ||
export type Replace<Original, Target, With> = Original extends Record<string, unknown> ? { | ||
export type Replace<Original, Target, With> = IsAny<Target> extends true ? Original : Original extends Record<string, unknown> ? { | ||
[K in keyof Original]: Original[K] extends Target ? With : Original[K]; | ||
} : Original extends Target ? With : Original; | ||
export type CoExist<Original, Target, With> = Original extends Record<string, unknown> ? { | ||
type IsAny<T> = 0 extends 1 & T ? true : false; | ||
export type CoExist<Original, Target, With> = IsAny<Target> extends true ? Original : Original extends Record<string, unknown> ? { | ||
[K in keyof Original]: Original[K] extends Target ? Original[K] | With : Original[K]; | ||
@@ -367,2 +368,10 @@ } : Original extends Target ? Original | With : Original; | ||
}> = (context: PreContext<Singleton>) => MaybePromise<Route['response'] | void>; | ||
export type AfterResponseHandler<in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = { | ||
decorator: {}; | ||
store: {}; | ||
derive: {}; | ||
resolve: {}; | ||
}> = (context: Prettify<Context<Route, Singleton> & { | ||
response: Route['response']; | ||
}>) => MaybePromise<void>; | ||
export type GracefulHandler<in Instance extends Elysia<any, any, any, any, any, any, any, any>> = (data: Instance) => any; | ||
@@ -561,12 +570,12 @@ export type ErrorHandler<in out T extends Record<string, Error> = {}, in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = { | ||
}, fn: MaybeArray<ErrorHandler<Errors, TypedRoute, Singleton>>): unknown; | ||
mapResponse(fn: MaybeArray<VoidHandler<TypedRoute, Singleton>>): unknown; | ||
mapResponse(fn: MaybeArray<MapResponse<TypedRoute, Singleton>>): unknown; | ||
mapResponse(options: { | ||
insert?: 'before' | 'after'; | ||
stack?: 'global' | 'local'; | ||
}, fn: MaybeArray<VoidHandler<TypedRoute, Singleton>>): unknown; | ||
onAfterResponse(fn: MaybeArray<MapResponse<TypedRoute, Singleton>>): unknown; | ||
}, fn: MaybeArray<MapResponse<TypedRoute, Singleton>>): unknown; | ||
onAfterResponse(fn: MaybeArray<AfterResponseHandler<TypedRoute, Singleton>>): unknown; | ||
onAfterResponse(options: { | ||
insert?: 'before' | 'after'; | ||
stack?: 'global' | 'local'; | ||
}, fn: MaybeArray<MapResponse<TypedRoute, Singleton>>): unknown; | ||
}, fn: MaybeArray<AfterResponseHandler<TypedRoute, Singleton>>): unknown; | ||
events: { | ||
@@ -627,3 +636,3 @@ global: Prettify<LifeCycleStore & RouteSchema>; | ||
export type LifeCycleType = 'global' | 'local' | 'scoped'; | ||
export type ExcludeElysiaResponse<T> = Exclude<Awaited<T>, { | ||
export type ExcludeElysiaResponse<T> = Exclude<undefined extends Awaited<T> ? Partial<Awaited<T>> : Awaited<T>, { | ||
[ELYSIA_RESPONSE]: any; | ||
@@ -660,2 +669,95 @@ }>; | ||
export type ContextAppendType = 'append' | 'override'; | ||
export type HTTPHeaders = Record<string, string> & { | ||
'www-authenticate'?: string; | ||
authorization?: string; | ||
'proxy-aauthenticate'?: string; | ||
'proxy-authorization'?: string; | ||
age?: string; | ||
'cache-ctonrol'?: string; | ||
'clear-site-data'?: string; | ||
expires?: string; | ||
'no-vary-search'?: string; | ||
pragma?: string; | ||
'last-modified'?: string; | ||
etag?: string; | ||
'if-match'?: string; | ||
'if-none-match'?: string; | ||
'if-modified-since'?: string; | ||
'if-unmodified-since'?: string; | ||
vary?: string; | ||
connection?: string; | ||
'keep-alive'?: string; | ||
accept?: string; | ||
'accept-encoding'?: string; | ||
'accept-language'?: string; | ||
expect?: string; | ||
'max-forwards'?: string; | ||
cookie?: string; | ||
'set-cookie'?: string | string[]; | ||
'access-control-allow-origin'?: string; | ||
'access-control-allow-credentials'?: string; | ||
'access-control-allow-headers'?: string; | ||
'access-control-allow-methods'?: string; | ||
'access-control-expose-headers'?: string; | ||
'access-control-max-age'?: string; | ||
'access-control-request-headers'?: string; | ||
'access-control-request-method'?: string; | ||
origin?: string; | ||
'timing-allow-origin'?: string; | ||
'content-disposition'?: string; | ||
'content-length'?: string; | ||
'content-type'?: string; | ||
'content-encoding'?: string; | ||
'content-language'?: string; | ||
'content-location'?: string; | ||
forwarded?: string; | ||
via?: string; | ||
location?: string; | ||
refresh?: string; | ||
allow?: string; | ||
server?: 'Elysia' | (string & {}); | ||
'accept-ranges'?: string; | ||
range?: string; | ||
'if-range'?: string; | ||
'content-range'?: string; | ||
'content-security-policy'?: string; | ||
'content-security-policy-report-only'?: string; | ||
'cross-origin-embedder-policy'?: string; | ||
'cross-origin-opener-policy'?: string; | ||
'cross-origin-resource-policy'?: string; | ||
'expect-ct'?: string; | ||
'permission-policy'?: string; | ||
'strict-transport-security'?: string; | ||
'upgrade-insecure-requests'?: string; | ||
'x-content-type-options'?: string; | ||
'x-frame-options'?: string; | ||
'x-xss-protection'?: string; | ||
'last-event-id'?: string; | ||
'ping-from'?: string; | ||
'ping-to'?: string; | ||
'report-to'?: string; | ||
te?: string; | ||
trailer?: string; | ||
'transfer-encoding'?: string; | ||
'alt-svg'?: string; | ||
'alt-used'?: string; | ||
date?: string; | ||
dnt?: string; | ||
'early-data'?: string; | ||
'large-allocation'?: string; | ||
link?: string; | ||
'retry-after'?: string; | ||
'service-worker-allowed'?: string; | ||
'source-map'?: string; | ||
upgrade?: string; | ||
'x-dns-prefetch-control'?: string; | ||
'x-forwarded-for'?: string; | ||
'x-forwarded-host'?: string; | ||
'x-forwarded-proto'?: string; | ||
'x-powered-by'?: 'Elysia' | (string & {}); | ||
'x-request-id'?: string; | ||
'x-requested-with'?: string; | ||
'x-robots-tag'?: string; | ||
'x-ua-compatible'?: string; | ||
}; | ||
export {}; |
@@ -122,3 +122,3 @@ import type { BunFile } from 'bun'; | ||
} | MaybeArray<HookContainer>, fn?: MaybeArray<HookContainer>) => void; | ||
export declare const isNumericString: (message: string) => boolean; | ||
export declare const isNumericString: (message: string | number) => boolean; | ||
export declare class PromiseGroup implements PromiseLike<void> { | ||
@@ -125,0 +125,0 @@ onError: (error: any) => void; |
@@ -6,3 +6,3 @@ import type { ServerWebSocket, WebSocketHandler } from 'bun'; | ||
import type { Context } from '../context'; | ||
import type { SingletonBase, Handler, VoidHandler, ErrorHandler, InputSchema, RouteSchema, Isolate, GetPathParameter, MaybeArray, BaseMacro } from '../types'; | ||
import type { SingletonBase, Handler, ErrorHandler, InputSchema, RouteSchema, Isolate, GetPathParameter, MaybeArray, BaseMacro, TransformHandler } from '../types'; | ||
export declare namespace WS { | ||
@@ -15,4 +15,4 @@ type Config = Omit<WebSocketHandler, 'open' | 'message' | 'close' | 'drain'>; | ||
}>, TypedRoute, Singleton> extends infer WS ? { | ||
transform?: MaybeArray<VoidHandler<TypedRoute, Singleton>>; | ||
transformMessage?: MaybeArray<VoidHandler<TypedRoute, Singleton>>; | ||
transform?: MaybeArray<TransformHandler<TypedRoute, Singleton>>; | ||
transformMessage?: MaybeArray<TransformHandler<TypedRoute, Singleton>>; | ||
beforeHandle?: MaybeArray<Handler<TypedRoute, Singleton>>; | ||
@@ -19,0 +19,0 @@ /** |
{ | ||
"name": "elysia", | ||
"description": "Ergonomic Framework for Human", | ||
"version": "1.1.0-exp.3", | ||
"version": "1.1.0-exp.4", | ||
"author": { | ||
@@ -118,3 +118,3 @@ "name": "saltyAom", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.5.1-rc" | ||
"typescript": "^5.5.2" | ||
}, | ||
@@ -121,0 +121,0 @@ "peerDependencies": { |
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 too big to display
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 too big to display
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 too big to display
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 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 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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5301689
149799