Socket
Socket
Sign inDemoInstall

elysia

Package Overview
Dependencies
Maintainers
1
Versions
400
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elysia - npm Package Compare versions

Comparing version 1.1.12 to 1.1.13

8

dist/cjs/context.d.ts

@@ -15,3 +15,3 @@ import type { Server } from 'bun';

resolve: {};
}, Path extends string = ''> = Prettify<{
}, Path extends string | undefined = undefined> = Prettify<{
body: Route['body'];

@@ -64,6 +64,6 @@ query: undefined extends Route['query'] ? Record<string, string | undefined> : Route['query'];

resolve: {};
}, Path extends string = ''> = Prettify<{
}, Path extends string | undefined = undefined> = Prettify<{
body: Route['body'];
query: undefined extends Route['query'] ? Record<string, string | undefined> : Route['query'];
params: undefined extends Route['params'] ? Path extends `${string}/${':' | '*'}${string}` ? ResolvePath<Path> : never : Route['params'];
params: undefined extends Route['params'] ? undefined extends Path ? Record<string, string> : Path extends `${string}/${':' | '*'}${string}` ? ResolvePath<Path> : never : Route['params'];
headers: undefined extends Route['headers'] ? Record<string, string | undefined> : Route['headers'];

@@ -115,3 +115,3 @@ cookie: undefined extends Route['cookie'] ? Record<string, Cookie<string | undefined>> : Record<string, Cookie<string | undefined>> & Prettify<WithoutNullableKeys<{

store: Singleton['store'];
response?: Route['response'];
response?: undefined extends Route['response'] ? unknown : Route['response'][keyof Route['response']];
} & ({} extends Route['response'] ? {

@@ -118,0 +118,0 @@ error: typeof error;

@@ -831,3 +831,3 @@ "use strict";

get cookie() {
if (!(this.name in this.jar)) return this.initial;
if (!(this.name in this.jar)) this.jar[this.name] = this.initial;
return this.jar[this.name];

@@ -843,4 +843,3 @@ }

set value(value) {
if (!(this.name in this.jar)) this.jar[this.name] = this.initial;
this.jar[this.name].value = value;
this.cookie.value = value;
}

@@ -852,2 +851,3 @@ get expires() {

this.cookie.expires = expires;
console.log(this.cookie);
}

@@ -854,0 +854,0 @@ get maxAge() {

import type { Context } from './context';
import { LocalHook } from './types';
import type { LocalHook } from './types';
export declare const isNotEmpty: (obj?: Object) => boolean;

@@ -4,0 +4,0 @@ export declare const parseSetCookies: (headers: Headers, setCookie: string[]) => Headers;

@@ -809,3 +809,3 @@ "use strict";

get cookie() {
if (!(this.name in this.jar)) return this.initial;
if (!(this.name in this.jar)) this.jar[this.name] = this.initial;
return this.jar[this.name];

@@ -821,4 +821,3 @@ }

set value(value) {
if (!(this.name in this.jar)) this.jar[this.name] = this.initial;
this.jar[this.name].value = value;
this.cookie.value = value;
}

@@ -830,2 +829,3 @@ get expires() {

this.cookie.expires = expires;
console.log(this.cookie);
}

@@ -1325,7 +1325,3 @@ get maxAge() {

if (response instanceof Response)
return new Response(response.body, {
headers: {
"Content-Type": "application/json"
}
});
return response;
if (response instanceof Promise)

@@ -1611,7 +1607,3 @@ return response.then((x) => mapResponse(x, set));

if (response instanceof Response)
return new Response(response.body, {
headers: {
"Content-Type": "application/json"
}
});
return response;
if (response instanceof Promise)

@@ -1711,7 +1703,3 @@ return response.then((x) => mapEarlyResponse(x, set));

if (response instanceof Response)
return new Response(response.body, {
headers: {
"Content-Type": "application/json"
}
});
return response;
if (response instanceof Promise)

@@ -1718,0 +1706,0 @@ return response.then(

@@ -40,3 +40,3 @@ import { ArrayOptions, DateOptions, Kind, NumberOptions, TArray, TDate, TUnsafe } from '@sinclair/typebox';

export type TEnumValue = number | string | null;
export interface TUnionEnum<T extends NonEmptyArray<TEnumValue> = [TEnumValue]> extends TSchema {
export interface TUnionEnum<T extends NonEmptyArray<TEnumValue> | Readonly<NonEmptyArray<TEnumValue>> = [TEnumValue]> extends TSchema {
type?: 'number' | 'string' | 'null';

@@ -61,3 +61,3 @@ [Kind]: 'UnionEnum';

readonly Cookie: <T extends TProperties>(properties: T, { domain, expires, httpOnly, maxAge, path, priority, sameSite, secure, secrets, sign, ...options }?: ElysiaTypeOptions.CookieValidatorOption<T>) => TObject<T>;
readonly UnionEnum: <const T extends NonEmptyArray<TEnumValue>>(values: T, options?: SchemaOptions) => TUnionEnum<T>;
readonly UnionEnum: <const T extends NonEmptyArray<TEnumValue> | Readonly<NonEmptyArray<TEnumValue>>>(values: T, options?: SchemaOptions) => TUnionEnum<T>;
};

@@ -64,0 +64,0 @@ export type TCookie = (typeof ElysiaType)['Cookie'];

@@ -128,2 +128,3 @@ import type { Elysia } from '.';

* @default true
* @since 1.1.11
*/

@@ -227,3 +228,3 @@ nativeStaticResponse?: boolean;

}
export interface UnwrapGroupGuardRoute<in out Schema extends InputSchema<any>, in out Definitions extends Record<string, unknown> = {}, Path extends string = ''> {
export interface UnwrapGroupGuardRoute<in out Schema extends InputSchema<any>, in out Definitions extends Record<string, unknown> = {}, Path extends string | undefined = undefined> {
body: UnwrapBodySchema<Schema['body'], Definitions>;

@@ -282,3 +283,3 @@ headers: UnwrapSchema<Schema['headers'], Definitions> extends infer A extends Record<string, unknown> ? A : undefined;

resolve: {};
}, Path extends string = ''> = (context: Context<Route, Singleton, Path>) => MaybePromise<{} extends Route['response'] ? unknown : Route['response'][keyof Route['response']]>;
}, Path extends string | undefined = undefined> = (context: Context<Route, Singleton, Path>) => MaybePromise<{} extends Route['response'] ? unknown : Route['response'][keyof Route['response']]>;
export type Replace<Original, Target, With> = IsAny<Target> extends true ? Original : Original extends Record<string, unknown> ? {

@@ -296,3 +297,3 @@ [K in keyof Original]: Original[K] extends Target ? With : Original[K];

resolve: {};
}, Path extends string = '', MacroContext = {}> = ((context: MacroContext extends Record<string | number | symbol, unknown> ? Prettify<MacroContext & Context<Route, Singleton, Path>> : Context<Route, Singleton, Path>) => Response | MaybePromise<{} extends Route['response'] ? unknown : (Route['response'] extends {
}, Path extends string | undefined = undefined, MacroContext = {}> = ((context: MacroContext extends Record<string | number | symbol, unknown> ? Prettify<MacroContext & Context<Route, Singleton, Path>> : Context<Route, Singleton, Path>) => Response | MaybePromise<{} extends Route['response'] ? unknown : (Route['response'] extends {
200: any;

@@ -317,3 +318,3 @@ } ? Route['response'] : string | number | boolean | Object) | Route['response'][keyof Route['response']] | {

resolve: {};
}, Path extends string = ''> = Handler<Route, Singleton, Path> extends (context: infer Context) => infer Returned ? (context: Context) => Returned | MaybePromise<void> : never;
}, Path extends string | undefined = undefined> = Handler<Route, Singleton, Path> extends (context: infer Context) => infer Returned ? (context: Context) => Returned | MaybePromise<void> : never;
export type AfterHandler<in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = {

@@ -324,4 +325,4 @@ decorator: {};

resolve: {};
}, Path extends string = ''> = Handler<Route, Singleton, Path> extends (context: infer Context) => infer Returned ? (context: Prettify<{
response: Route['response'];
}, Path extends string | undefined = undefined> = Handler<Route, Singleton, Path> extends (context: infer Context) => infer Returned ? (context: Prettify<{
response: Route['response'][keyof Route['response']];
} & Context>) => Returned | MaybePromise<void> : never;

@@ -333,3 +334,3 @@ export type MapResponse<in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = {

resolve: {};
}, Path extends string = ''> = Handler<Omit<Route, 'response'> & {
}, Path extends string | undefined = undefined> = Handler<Omit<Route, 'response'> & {
response: MaybePromise<Response | undefined | unknown>;

@@ -352,6 +353,6 @@ }, Singleton & {

resolve: {};
}, BasePath extends string = ''> = {
}, Path extends string | undefined = undefined> = {
(context: Prettify<Context<Route, Omit<Singleton, 'resolve'> & {
resolve: {};
}, BasePath>>): MaybePromise<void>;
}, Path>>): MaybePromise<void>;
};

@@ -363,3 +364,3 @@ export type BodyHandler<in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = {

resolve: {};
}, Path extends string = ''> = (context: Prettify<{
}, Path extends string | undefined = undefined> = (context: Prettify<{
contentType: string;

@@ -366,0 +367,0 @@ } & Context<Route, Singleton, Path>>,

@@ -23,3 +23,3 @@ import type { ServerWebSocket, WebSocketHandler } from 'bun';

set id(newID: string);
get publish(): (topic: string, data?: Route["response"], compress?: boolean) => this;
get publish(): (topic: string, data?: {} extends Route["response"] ? unknown : Route["response"] extends Record<200, unknown> ? Route["response"][200] : unknown, compress?: boolean) => this;
get send(): (data: {} extends Route["response"] ? unknown : Route["response"] extends Record<200, unknown> ? Route["response"][200] : unknown) => this;

@@ -26,0 +26,0 @@ get subscribe(): (room: string) => this;

@@ -15,3 +15,3 @@ import type { Server } from 'bun';

resolve: {};
}, Path extends string = ''> = Prettify<{
}, Path extends string | undefined = undefined> = Prettify<{
body: Route['body'];

@@ -64,6 +64,6 @@ query: undefined extends Route['query'] ? Record<string, string | undefined> : Route['query'];

resolve: {};
}, Path extends string = ''> = Prettify<{
}, Path extends string | undefined = undefined> = Prettify<{
body: Route['body'];
query: undefined extends Route['query'] ? Record<string, string | undefined> : Route['query'];
params: undefined extends Route['params'] ? Path extends `${string}/${':' | '*'}${string}` ? ResolvePath<Path> : never : Route['params'];
params: undefined extends Route['params'] ? undefined extends Path ? Record<string, string> : Path extends `${string}/${':' | '*'}${string}` ? ResolvePath<Path> : never : Route['params'];
headers: undefined extends Route['headers'] ? Record<string, string | undefined> : Route['headers'];

@@ -115,3 +115,3 @@ cookie: undefined extends Route['cookie'] ? Record<string, Cookie<string | undefined>> : Record<string, Cookie<string | undefined>> & Prettify<WithoutNullableKeys<{

store: Singleton['store'];
response?: Route['response'];
response?: undefined extends Route['response'] ? unknown : Route['response'][keyof Route['response']];
} & ({} extends Route['response'] ? {

@@ -118,0 +118,0 @@ error: typeof error;

import type { Context } from './context';
import { LocalHook } from './types';
import type { LocalHook } from './types';
export declare const isNotEmpty: (obj?: Object) => boolean;

@@ -4,0 +4,0 @@ export declare const parseSetCookies: (headers: Headers, setCookie: string[]) => Headers;

@@ -40,3 +40,3 @@ import { ArrayOptions, DateOptions, Kind, NumberOptions, TArray, TDate, TUnsafe } from '@sinclair/typebox';

export type TEnumValue = number | string | null;
export interface TUnionEnum<T extends NonEmptyArray<TEnumValue> = [TEnumValue]> extends TSchema {
export interface TUnionEnum<T extends NonEmptyArray<TEnumValue> | Readonly<NonEmptyArray<TEnumValue>> = [TEnumValue]> extends TSchema {
type?: 'number' | 'string' | 'null';

@@ -61,3 +61,3 @@ [Kind]: 'UnionEnum';

readonly Cookie: <T extends TProperties>(properties: T, { domain, expires, httpOnly, maxAge, path, priority, sameSite, secure, secrets, sign, ...options }?: ElysiaTypeOptions.CookieValidatorOption<T>) => TObject<T>;
readonly UnionEnum: <const T extends NonEmptyArray<TEnumValue>>(values: T, options?: SchemaOptions) => TUnionEnum<T>;
readonly UnionEnum: <const T extends NonEmptyArray<TEnumValue> | Readonly<NonEmptyArray<TEnumValue>>>(values: T, options?: SchemaOptions) => TUnionEnum<T>;
};

@@ -64,0 +64,0 @@ export type TCookie = (typeof ElysiaType)['Cookie'];

@@ -128,2 +128,3 @@ import type { Elysia } from '.';

* @default true
* @since 1.1.11
*/

@@ -227,3 +228,3 @@ nativeStaticResponse?: boolean;

}
export interface UnwrapGroupGuardRoute<in out Schema extends InputSchema<any>, in out Definitions extends Record<string, unknown> = {}, Path extends string = ''> {
export interface UnwrapGroupGuardRoute<in out Schema extends InputSchema<any>, in out Definitions extends Record<string, unknown> = {}, Path extends string | undefined = undefined> {
body: UnwrapBodySchema<Schema['body'], Definitions>;

@@ -282,3 +283,3 @@ headers: UnwrapSchema<Schema['headers'], Definitions> extends infer A extends Record<string, unknown> ? A : undefined;

resolve: {};
}, Path extends string = ''> = (context: Context<Route, Singleton, Path>) => MaybePromise<{} extends Route['response'] ? unknown : Route['response'][keyof Route['response']]>;
}, Path extends string | undefined = undefined> = (context: Context<Route, Singleton, Path>) => MaybePromise<{} extends Route['response'] ? unknown : Route['response'][keyof Route['response']]>;
export type Replace<Original, Target, With> = IsAny<Target> extends true ? Original : Original extends Record<string, unknown> ? {

@@ -296,3 +297,3 @@ [K in keyof Original]: Original[K] extends Target ? With : Original[K];

resolve: {};
}, Path extends string = '', MacroContext = {}> = ((context: MacroContext extends Record<string | number | symbol, unknown> ? Prettify<MacroContext & Context<Route, Singleton, Path>> : Context<Route, Singleton, Path>) => Response | MaybePromise<{} extends Route['response'] ? unknown : (Route['response'] extends {
}, Path extends string | undefined = undefined, MacroContext = {}> = ((context: MacroContext extends Record<string | number | symbol, unknown> ? Prettify<MacroContext & Context<Route, Singleton, Path>> : Context<Route, Singleton, Path>) => Response | MaybePromise<{} extends Route['response'] ? unknown : (Route['response'] extends {
200: any;

@@ -317,3 +318,3 @@ } ? Route['response'] : string | number | boolean | Object) | Route['response'][keyof Route['response']] | {

resolve: {};
}, Path extends string = ''> = Handler<Route, Singleton, Path> extends (context: infer Context) => infer Returned ? (context: Context) => Returned | MaybePromise<void> : never;
}, Path extends string | undefined = undefined> = Handler<Route, Singleton, Path> extends (context: infer Context) => infer Returned ? (context: Context) => Returned | MaybePromise<void> : never;
export type AfterHandler<in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = {

@@ -324,4 +325,4 @@ decorator: {};

resolve: {};
}, Path extends string = ''> = Handler<Route, Singleton, Path> extends (context: infer Context) => infer Returned ? (context: Prettify<{
response: Route['response'];
}, Path extends string | undefined = undefined> = Handler<Route, Singleton, Path> extends (context: infer Context) => infer Returned ? (context: Prettify<{
response: Route['response'][keyof Route['response']];
} & Context>) => Returned | MaybePromise<void> : never;

@@ -333,3 +334,3 @@ export type MapResponse<in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = {

resolve: {};
}, Path extends string = ''> = Handler<Omit<Route, 'response'> & {
}, Path extends string | undefined = undefined> = Handler<Omit<Route, 'response'> & {
response: MaybePromise<Response | undefined | unknown>;

@@ -352,6 +353,6 @@ }, Singleton & {

resolve: {};
}, BasePath extends string = ''> = {
}, Path extends string | undefined = undefined> = {
(context: Prettify<Context<Route, Omit<Singleton, 'resolve'> & {
resolve: {};
}, BasePath>>): MaybePromise<void>;
}, Path>>): MaybePromise<void>;
};

@@ -363,3 +364,3 @@ export type BodyHandler<in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = {

resolve: {};
}, Path extends string = ''> = (context: Prettify<{
}, Path extends string | undefined = undefined> = (context: Prettify<{
contentType: string;

@@ -366,0 +367,0 @@ } & Context<Route, Singleton, Path>>,

@@ -23,3 +23,3 @@ import type { ServerWebSocket, WebSocketHandler } from 'bun';

set id(newID: string);
get publish(): (topic: string, data?: Route["response"], compress?: boolean) => this;
get publish(): (topic: string, data?: {} extends Route["response"] ? unknown : Route["response"] extends Record<200, unknown> ? Route["response"][200] : unknown, compress?: boolean) => this;
get send(): (data: {} extends Route["response"] ? unknown : Route["response"] extends Record<200, unknown> ? Route["response"][200] : unknown) => this;

@@ -26,0 +26,0 @@ get subscribe(): (room: string) => this;

{
"name": "elysia",
"description": "Ergonomic Framework for Human",
"version": "1.1.12",
"version": "1.1.13",
"author": {

@@ -6,0 +6,0 @@ "name": "saltyAom",

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 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc