New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

elysia

Package Overview
Dependencies
Maintainers
1
Versions
494
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.2.14 to 1.2.15

94

dist/cjs/adapter/bun/index.js

@@ -151,2 +151,20 @@ "use strict";

let _id;
const errorHandlers = [
...Array.isArray(options.error) ? options.error : [options.error],
...(app.event.error ?? []).map(
(x) => typeof x === "function" ? x : x.fn
)
];
const handleErrors = !errorHandlers.length ? () => {
} : async (ws, error) => {
for (const handleError of errorHandlers) {
let response2 = handleError(
Object.assign(context, { error })
);
if (response2 instanceof Promise)
response2 = await response2;
await handleResponse(ws, response2);
if (response2) break;
}
};
if (server?.upgrade(context.request, {

@@ -168,8 +186,12 @@ headers: (0, import_utils.isNotEmpty)(set.headers) ? set.headers : void 0,

open(ws) {
handleResponse(
ws,
options.open?.(
new import_ws.ElysiaWS(ws, context)
)
);
try {
handleResponse(
ws,
options.open?.(
new import_ws.ElysiaWS(ws, context)
)
);
} catch (error) {
handleErrors(ws, error);
}
},

@@ -186,31 +208,43 @@ message: async (ws, _message) => {

);
handleResponse(
ws,
options.message?.(
new import_ws.ElysiaWS(
ws,
context,
try {
handleResponse(
ws,
options.message?.(
new import_ws.ElysiaWS(
ws,
context,
message
),
message
),
message
)
);
)
);
} catch (error) {
handleErrors(ws, error);
}
},
drain(ws) {
handleResponse(
ws,
options.drain?.(
new import_ws.ElysiaWS(ws, context)
)
);
try {
handleResponse(
ws,
options.drain?.(
new import_ws.ElysiaWS(ws, context)
)
);
} catch (error) {
handleErrors(ws, error);
}
},
close(ws, code, reason) {
handleResponse(
ws,
options.close?.(
new import_ws.ElysiaWS(ws, context),
code,
reason
)
);
try {
handleResponse(
ws,
options.close?.(
new import_ws.ElysiaWS(ws, context),
code,
reason
)
);
} catch (error) {
handleErrors(ws, error);
}
}

@@ -217,0 +251,0 @@ }

@@ -9,3 +9,4 @@ import type { AnyElysia } from '.';

export declare const hasProperty: (expectedProperty: string, _schema: TAnySchema | TypeCheck<any>) => any;
export declare const hasTransform: (schema: TAnySchema) => any;
export declare const hasRef: (schema: TAnySchema) => boolean;
export declare const hasTransform: (schema: TAnySchema) => boolean;
export declare const isAsyncName: (v: Function | HookContainer) => boolean;

@@ -12,0 +13,0 @@ export declare const isAsync: (v: Function | HookContainer) => boolean;

@@ -26,2 +26,3 @@ "use strict";

hasProperty: () => hasProperty,
hasRef: () => hasRef,
hasTransform: () => hasTransform,

@@ -230,4 +231,55 @@ hasType: () => hasType,

const TransformSymbol = Symbol.for("TypeBox.Transform");
const hasRef = (schema) => {
if (!schema) return false;
if (schema.type === "object" && schema.properties) {
const properties = schema.properties;
for (const key of Object.keys(properties)) {
const property = properties[key];
if (property.type === "object") {
if (hasRef(property)) return true;
} else {
if (property.anyOf) {
for (let i = 0; i < property.anyOf.length; i++)
if (hasRef(property.anyOf[i])) return true;
}
if (property.oneOf) {
for (let i = 0; i < property.oneOf.length; i++)
if (hasRef(property.oneOf[i])) return true;
}
if (property.allOf) {
for (let i = 0; i < property.allOf.length; i++)
if (hasRef(property.allOf[i])) return true;
}
}
if (property[import_typebox.Kind] === "Ref" && "$ref" in property) return true;
if (property.type === "array" && property.items) {
const item = property.items;
if (item.type === "object") {
if (hasRef(item)) return true;
} else {
if (item.anyOf) {
for (let i = 0; i < item.anyOf.length; i++)
if (hasRef(item.anyOf[i])) return true;
}
if (item.oneOf) {
for (let i = 0; i < item.oneOf.length; i++)
if (hasRef(item.oneOf[i])) return true;
}
if (item.allOf) {
for (let i = 0; i < item.allOf.length; i++)
if (hasRef(item.allOf[i])) return true;
}
}
if (item[import_typebox.Kind] === "Ref" && "$ref" in item) return true;
}
}
return false;
}
if (schema.type === "array" && schema.items) return hasRef(schema.items);
return schema[import_typebox.Kind] === "Ref" && "$ref" in schema;
};
const hasTransform = (schema) => {
if (!schema) return;
if (!schema) return false;
if (schema.$ref && schema.$defs && schema.$ref in schema.$defs)
return hasTransform(schema.$defs[schema.$ref]);
if (schema.type === "object" && schema.properties) {

@@ -239,11 +291,42 @@ const properties = schema.properties;

if (hasTransform(property)) return true;
} else if (property.anyOf) {
for (let i = 0; i < property.anyOf.length; i++)
if (hasTransform(property.anyOf[i])) return true;
} else {
if (property.anyOf) {
for (let i = 0; i < property.anyOf.length; i++)
if (hasTransform(property.anyOf[i])) return true;
}
if (property.allOf) {
for (let i = 0; i < property.allOf.length; i++)
if (hasTransform(property.allOf[i])) return true;
}
if (property.oneOf) {
for (let i = 0; i < property.oneOf.length; i++)
if (hasTransform(property.oneOf[i])) return true;
}
}
const hasTransformSymbol = TransformSymbol in property;
if (hasTransformSymbol) return true;
if (TransformSymbol in property) return true;
if (property.type === "array" && property.items) {
const item = property.items;
if (item.type === "object") {
if (hasTransform(item)) return true;
} else {
if (item.anyOf) {
for (let i = 0; i < item.anyOf.length; i++)
if (hasTransform(item.anyOf[i])) return true;
}
if (item.oneOf) {
for (let i = 0; i < item.oneOf.length; i++)
if (hasTransform(item.oneOf[i])) return true;
}
if (item.allOf) {
for (let i = 0; i < item.allOf.length; i++)
if (hasTransform(item.allOf[i])) return true;
}
}
if (TransformSymbol in item) return true;
}
}
return false;
}
if (schema.type === "array" && schema.items)
return hasTransform(schema.items);
return TransformSymbol in schema || schema.properties && TransformSymbol in schema.properties;

@@ -403,8 +486,8 @@ };

let value = _value;
const isArray = value.type === "array" || !!value.anyOf?.some(
(v) => v.type === "string" && v.format === "ArrayString"
);
if (value && TypeBoxSymbol.optional in value && value.type === "array" && value.items)
value = value.items;
const { type, anyOf } = value;
const isArray = type === "array" || anyOf?.some(
(v) => v.type === "string" && v.format === "ArrayString"
);
destructured.push({

@@ -427,3 +510,3 @@ key,

} else {
fnLiteral += `if(c.qi!==-1){let url = '&' + decodeURIComponent(c.url.slice(c.qi + 1))
fnLiteral += `if(c.qi!==-1){let url = '&' + c.url.slice(c.qi + 1)
`;

@@ -453,9 +536,9 @@ let index = 0;

else temp=decodeURIComponent(url.slice(start, memory).replace(/\\+/g,' '))
const charCode = temp.charCodeAt(0)
if(charCode !== 91 && charCode !== 123)
const charCode=temp.charCodeAt(0)
if(charCode!==91&&charCode !== 123)
temp='"'+temp+'"'
a${index} += temp
if(memory === -1)break
a${index}+=temp
if(memory===-1)break
memory=url.indexOf('&${key}=',memory)
if(memory === -1)break}try{if(a${index}.charCodeAt(0) === 91)a${index} = JSON.parse(a${index})
if(memory===-1)break}try{if(a${index}.charCodeAt(0)===91)a${index} = JSON.parse(a${index})
else

@@ -493,4 +576,6 @@ a${index}=JSON.parse('['+a${index}+']')}catch{}

let value
if(deepMemory===-1)value=decodeURIComponent(url.slice(start).replace(/\\+/g,' '))
else value=decodeURIComponent(url.slice(start, deepMemory).replace(/\\+/g,' '))
if(deepMemory===-1)value=url.slice(start).replace(/\\+/g,' ')
else value=url.slice(start, deepMemory).replace(/\\+/g,' ')
value=decodeURIComponent(value)
if(value===null){if(deepMemory===-1){break}else{continue}}
const vStart=value.charCodeAt(0)

@@ -1487,2 +1572,3 @@ const vEnd=value.charCodeAt(value.length - 1)

hasProperty,
hasRef,
hasTransform,

@@ -1489,0 +1575,0 @@ hasType,

@@ -1297,4 +1297,11 @@ "use strict";

this.promisedModules.add(
promise.then((value) => {
if (value) return this._use(value);
promise.then((v) => {
if (!v) return;
const t3 = this._use(v);
if (t3 instanceof Promise)
return t3.then((v2) => {
if (v2) v2.compile();
else v.compile();
});
return v.compile();
})

@@ -1301,0 +1308,0 @@ );

@@ -73,2 +73,3 @@ "use strict";

var import_error = require("./error");
var import_compose = require("./compose");
const hasHeaderShorthand = "toJSON" in new Headers();

@@ -449,6 +450,11 @@ const replaceUrlPath = (url, pathname) => {

if (!s) return void 0;
let schema = typeof s === "string" ? s.endsWith("[]") ? import_type_system.t.Array(import_type_system.t.Ref(models[s.substring(0, s.length - 2)])) : (
// @ts-expect-error
modules.Import(s) ?? models[s]
) : s;
let schema;
if (typeof s !== "string") schema = s;
else {
const isArray = s.endsWith("[]");
const key = isArray ? s.substring(0, s.length - 2) : s;
schema = modules.Import(key) ?? models[key];
if (!(0, import_compose.hasRef)(schema)) schema = models[key];
if (isArray) schema = import_type_system.t.Array(schema);
}
if (!schema) return void 0;

@@ -568,3 +574,11 @@ if (coerce || additionalCoerce) {

if (!s) return;
const maybeSchemaOrRecord = typeof s === "string" ? s.endsWith("[]") ? import_type_system.t.Array(import_type_system.t.Ref(models[s.substring(0, s.length - 2)])) : modules.Import(s) ?? models[s] : s;
let maybeSchemaOrRecord;
if (typeof s !== "string") maybeSchemaOrRecord = s;
else {
const isArray = s.endsWith("[]");
const key = isArray ? s.substring(0, s.length - 2) : s;
maybeSchemaOrRecord = modules.Import(key) ?? models[key];
if (isArray)
maybeSchemaOrRecord = import_type_system.t.Array(maybeSchemaOrRecord);
}
if (!maybeSchemaOrRecord) return;

@@ -571,0 +585,0 @@ const compile = (schema, references) => {

@@ -9,3 +9,4 @@ import type { AnyElysia } from '.';

export declare const hasProperty: (expectedProperty: string, _schema: TAnySchema | TypeCheck<any>) => any;
export declare const hasTransform: (schema: TAnySchema) => any;
export declare const hasRef: (schema: TAnySchema) => boolean;
export declare const hasTransform: (schema: TAnySchema) => boolean;
export declare const isAsyncName: (v: Function | HookContainer) => boolean;

@@ -12,0 +13,0 @@ export declare const isAsync: (v: Function | HookContainer) => boolean;

{
"name": "elysia",
"description": "Ergonomic Framework for Human",
"version": "1.2.14",
"version": "1.2.15",
"author": {

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

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 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 too big to display

Sorry, the diff of this file is not supported yet

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