Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

elysia

Package Overview
Dependencies
Maintainers
0
Versions
477
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.2 to 1.2.3

4

dist/cjs/adapter/bun/index.js

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

for (let i = 0; i < app.event.start.length; i++)
app.event.start[i].fn(this);
app.event.start[i].fn(app);
if (callback) callback(app.server);

@@ -94,3 +94,3 @@ process.on("beforeExit", () => {

for (let i = 0; i < app.event.stop.length; i++)
app.event.stop[i].fn(this);
app.event.stop[i].fn(app);
}

@@ -97,0 +97,0 @@ });

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

for (const key of Object.keys(app.singleton.decorator))
decoratorsLiteral += `,${key}: app.singleton.decorator.${key}`;
decoratorsLiteral += `,${key}: decorator['${key}']`;
const standardHostname = app.config.handler?.standardHostname ?? true;

@@ -83,0 +83,0 @@ const hasTrace = app.event.trace.length > 0;

@@ -309,4 +309,2 @@ "use strict";

fnLiteral += "Object.defineProperty(c,'server',{get:function(){return getServer()}})\n";
if (inference.body) fnLiteral += `let isParsing=false
`;
validator.createBody?.();

@@ -320,2 +318,4 @@ validator.createQuery?.();

const hasBody = method !== "$INTERNALWS" && method !== "GET" && method !== "HEAD" && (inference.body || !!validator.body || hooks.parse.length);
if (hasBody) fnLiteral += `let isParsing=false
`;
const defaultHeaders = app.setHeaders;

@@ -513,2 +513,3 @@ const hasDefaultHeaders = defaultHeaders && !!Object.keys(defaultHeaders).length;

if (adapter.parser.declare) fnLiteral += adapter.parser.declare;
fnLiteral += "\nisParsing=true";
const parser = typeof hooks.parse === "string" ? hooks.parse : Array.isArray(hooks.parse) && hooks.parse.length === 1 ? typeof hooks.parse[0] === "string" ? hooks.parse[0] : typeof hooks.parse[0].fn === "string" ? hooks.parse[0].fn : void 0 : void 0;

@@ -971,3 +972,4 @@ if (parser && parser in defaultParsers) {

fnLiteral += `mr=${isAsyncName(mapResponse) ? "await" : ""} onMapResponse[${i}](c)
if(mr!==undefined)r=c.response=mr`;
if(mr!==undefined)r=c.response=mr
`;
endUnit();

@@ -1206,2 +1208,3 @@ }

handler: typeof handler === "function" ? handler.toString() : handler,
instruction: init,
hooks: {

@@ -1277,2 +1280,3 @@ ...debugHooks,

const store=app.singleton.store
const decorator=app.singleton.decorator
const staticRouter=app.router.static.http

@@ -1279,0 +1283,0 @@ const ht=app.router.history

@@ -30,2 +30,7 @@ "use strict";

var import_value = require("@sinclair/typebox/value");
const injectDefaultValues = (typeChecker, obj) => {
for (const [key, keySchema] of Object.entries(typeChecker.schema.properties)) {
obj[key] ??= keySchema.default;
}
};
const createDynamicHandler = (app) => {

@@ -160,2 +165,11 @@ const { mapResponse, mapEarlyResponse } = app["~adapter"].handler;

);
const headerValidator = validator?.createHeaders?.();
if (headerValidator)
injectDefaultValues(headerValidator, context.headers);
const paramsValidator = validator?.createParams?.();
if (paramsValidator)
injectDefaultValues(paramsValidator, context.params);
const queryValidator = validator?.createQuery?.();
if (queryValidator)
injectDefaultValues(queryValidator, context.query);
for (let i = 0; i < hooks.transform.length; i++) {

@@ -171,6 +185,6 @@ const hook = hooks.transform[i];

if (validator) {
if (validator.createHeaders?.()) {
const _header = {};
for (const key in request.headers)
_header[key] = request.headers.get(key);
if (headerValidator) {
const _header = structuredClone(context.headers);
for (const [key, value] of request.headers)
_header[key] = value;
if (validator.headers.Check(_header) === false)

@@ -184,3 +198,3 @@ throw new import_error.ValidationError(

context.headers = validator.headers.Decode(context.headers);
if (validator.createParams?.()?.Check(context.params) === false) {
if (paramsValidator?.Check(context.params) === false) {
throw new import_error.ValidationError(

@@ -193,3 +207,3 @@ "params",

context.params = validator.params.Decode(context.params);
if (validator.createQuery?.()?.Check(context.query) === false)
if (queryValidator?.Check(context.query) === false)
throw new import_error.ValidationError(

@@ -196,0 +210,0 @@ "query",

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

const error2 = isProduction ? void 0 : "Errors" in validator ? validator.Errors(value).First() : import_value.Value.Errors(validator, value).First();
const customError = error2?.schema.error !== void 0 ? typeof error2.schema.error === "function" ? error2.schema.error({
const customError = error2.schema.message || error2?.schema.error !== void 0 ? typeof error2.schema.error === "function" ? error2.schema.error({
type,

@@ -135,0 +135,0 @@ validator,

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

@@ -18,2 +20,10 @@ 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);

@@ -28,3 +38,2 @@ var file_exports = {};

module.exports = __toCommonJS(file_exports);
var import_fs2 = require("./fs");
var import_utils = require("./utils");

@@ -114,2 +123,4 @@ const mime = {

const file = (path) => new ElysiaFile(path);
let createReadStream;
let stat;
class ElysiaFile {

@@ -120,4 +131,19 @@ constructor(path) {

else {
this.value = (0, import_fs2.createReadStream)(path);
this.stats = (0, import_fs2.statSync)(path);
if (typeof window !== "undefined") {
console.warn("Browser environment does not support file");
} else {
if (!createReadStream || !stat) {
this.value = import("fs").then((fs) => {
createReadStream = fs.createReadStream;
return fs.createReadStream(path);
});
this.stats = import("fs/promises").then((fs) => {
stat = fs.stat;
return fs.stat(path);
});
} else {
this.value = createReadStream(path);
this.stats = stat(path);
}
}
}

@@ -133,3 +159,3 @@ }

if (import_utils.isBun) return this.value.size;
return this.stats?.size ?? 0;
return this.stats?.then((x) => x.size) ?? 0;
}

@@ -136,0 +162,0 @@ }

@@ -1,2 +0,3 @@

import { type Stats } from 'fs';
import { type stat as Stat } from 'fs/promises';
import type { MaybePromise } from '../types';
export declare const mime: {

@@ -83,7 +84,7 @@ readonly aac: "audio/aac";

path: string;
readonly value: unknown;
readonly stats: Stats | undefined;
readonly value: MaybePromise<unknown>;
readonly stats: ReturnType<typeof Stat> | undefined;
constructor(path: string);
get type(): any;
get length(): number;
get length(): number | Promise<number | bigint>;
}
{
"name": "elysia",
"description": "Ergonomic Framework for Human",
"version": "1.2.2",
"version": "1.2.3",
"author": {

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

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

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