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

elysia

Package Overview
Dependencies
Maintainers
1
Versions
429
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.11 to 1.1.12

bunfig.toml

18

dist/cjs/cookies.js

@@ -439,2 +439,5 @@ "use strict";

});
import_typebox.TypeRegistry.Set("UnionEnum", (schema, value) => {
return (typeof value === "number" || typeof value === "string" || value === null) && schema.enum.includes(value);
});
var ElysiaType = {

@@ -641,2 +644,16 @@ Numeric: (property) => {

return v;
},
// based on https://github.com/elysiajs/elysia/issues/512#issuecomment-1980134955
UnionEnum: (values, options = {}) => {
const type = values.every((value) => typeof value === "string") ? { type: "string" } : values.every((value) => typeof value === "number") ? { type: "number" } : values.every((value) => value === null) ? { type: "null" } : {};
if (values.some((x) => typeof x === "object" && x !== null))
throw new Error("This type does not support objects or arrays");
return {
// why it need default??
default: values[0],
...options,
[import_typebox.Kind]: "UnionEnum",
...type,
enum: values
};
}

@@ -672,2 +689,3 @@ };

t.Date = ElysiaType.Date;
t.UnionEnum = ElysiaType.UnionEnum;

@@ -674,0 +692,0 @@ // src/handler.ts

@@ -290,2 +290,5 @@ "use strict";

});
import_typebox.TypeRegistry.Set("UnionEnum", (schema, value) => {
return (typeof value === "number" || typeof value === "string" || value === null) && schema.enum.includes(value);
});
var ElysiaType = {

@@ -492,2 +495,16 @@ Numeric: (property) => {

return v;
},
// based on https://github.com/elysiajs/elysia/issues/512#issuecomment-1980134955
UnionEnum: (values, options = {}) => {
const type = values.every((value) => typeof value === "string") ? { type: "string" } : values.every((value) => typeof value === "number") ? { type: "number" } : values.every((value) => value === null) ? { type: "null" } : {};
if (values.some((x) => typeof x === "object" && x !== null))
throw new Error("This type does not support objects or arrays");
return {
// why it need default??
default: values[0],
...options,
[import_typebox.Kind]: "UnionEnum",
...type,
enum: values
};
}

@@ -523,2 +540,3 @@ };

t.Date = ElysiaType.Date;
t.UnionEnum = ElysiaType.UnionEnum;

@@ -525,0 +543,0 @@ // src/handler.ts

@@ -436,2 +436,5 @@ "use strict";

});
import_typebox.TypeRegistry.Set("UnionEnum", (schema, value) => {
return (typeof value === "number" || typeof value === "string" || value === null) && schema.enum.includes(value);
});
var ElysiaType = {

@@ -638,2 +641,16 @@ Numeric: (property) => {

return v;
},
// based on https://github.com/elysiajs/elysia/issues/512#issuecomment-1980134955
UnionEnum: (values, options = {}) => {
const type = values.every((value) => typeof value === "string") ? { type: "string" } : values.every((value) => typeof value === "number") ? { type: "number" } : values.every((value) => value === null) ? { type: "null" } : {};
if (values.some((x) => typeof x === "object" && x !== null))
throw new Error("This type does not support objects or arrays");
return {
// why it need default??
default: values[0],
...options,
[import_typebox.Kind]: "UnionEnum",
...type,
enum: values
};
}

@@ -669,2 +686,3 @@ };

t.Date = ElysiaType.Date;
t.UnionEnum = ElysiaType.UnionEnum;

@@ -671,0 +689,0 @@ // src/utils.ts

@@ -428,2 +428,5 @@ "use strict";

});
import_typebox.TypeRegistry.Set("UnionEnum", (schema, value) => {
return (typeof value === "number" || typeof value === "string" || value === null) && schema.enum.includes(value);
});
var ElysiaType = {

@@ -630,2 +633,16 @@ Numeric: (property) => {

return v;
},
// based on https://github.com/elysiajs/elysia/issues/512#issuecomment-1980134955
UnionEnum: (values, options = {}) => {
const type = values.every((value) => typeof value === "string") ? { type: "string" } : values.every((value) => typeof value === "number") ? { type: "number" } : values.every((value) => value === null) ? { type: "null" } : {};
if (values.some((x) => typeof x === "object" && x !== null))
throw new Error("This type does not support objects or arrays");
return {
// why it need default??
default: values[0],
...options,
[import_typebox.Kind]: "UnionEnum",
...type,
enum: values
};
}

@@ -661,2 +678,3 @@ };

t.Date = ElysiaType.Date;
t.UnionEnum = ElysiaType.UnionEnum;

@@ -663,0 +681,0 @@ // src/handler.ts

14

dist/cjs/type-system.d.ts

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

import { ArrayOptions, DateOptions, NumberOptions, TDate, TUnsafe } from '@sinclair/typebox';
import { ArrayOptions, DateOptions, Kind, NumberOptions, TArray, TDate, TUnsafe } from '@sinclair/typebox';
import { type SchemaOptions, type TSchema, TProperties, ObjectOptions, TObject, TNumber, TBoolean } from '@sinclair/typebox';

@@ -38,2 +38,10 @@ import { type ValueError, type TypeCheck } from '@sinclair/typebox/compiler';

type ElysiaFile = (options?: Partial<ElysiaTypeOptions.Files> | undefined) => TUnsafe<File>;
type NonEmptyArray<T> = [T, ...T[]];
export type TEnumValue = number | string | null;
export interface TUnionEnum<T extends NonEmptyArray<TEnumValue> = [TEnumValue]> extends TSchema {
type?: 'number' | 'string' | 'null';
[Kind]: 'UnionEnum';
static: T[number];
enum: T;
}
export declare const ElysiaType: {

@@ -44,3 +52,3 @@ readonly Numeric: (property?: NumberOptions) => TNumber;

readonly ObjectString: <T extends TProperties>(properties: T, options?: ObjectOptions) => TObject<T>;
readonly ArrayString: <T extends TSchema>(children?: T, options?: ArrayOptions) => TObject<T>;
readonly ArrayString: <T extends TSchema>(children?: T, options?: ArrayOptions) => TArray<T>;
readonly File: ElysiaFile;

@@ -54,2 +62,3 @@ readonly Files: (options?: ElysiaTypeOptions.Files) => import("@sinclair/typebox").TTransform<TUnsafe<File[]>, File[]>;

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

@@ -68,2 +77,3 @@ export type TCookie = (typeof ElysiaType)['Cookie'];

Cookie: typeof ElysiaType.Cookie;
UnionEnum: typeof ElysiaType.UnionEnum;
}

@@ -70,0 +80,0 @@ interface SchemaOptions {

@@ -541,2 +541,5 @@ "use strict";

});
import_typebox2.TypeRegistry.Set("UnionEnum", (schema, value) => {
return (typeof value === "number" || typeof value === "string" || value === null) && schema.enum.includes(value);
});
var ElysiaType = {

@@ -743,2 +746,16 @@ Numeric: (property) => {

return v;
},
// based on https://github.com/elysiajs/elysia/issues/512#issuecomment-1980134955
UnionEnum: (values, options = {}) => {
const type = values.every((value) => typeof value === "string") ? { type: "string" } : values.every((value) => typeof value === "number") ? { type: "number" } : values.every((value) => value === null) ? { type: "null" } : {};
if (values.some((x) => typeof x === "object" && x !== null))
throw new Error("This type does not support objects or arrays");
return {
// why it need default??
default: values[0],
...options,
[import_typebox2.Kind]: "UnionEnum",
...type,
enum: values
};
}

@@ -774,2 +791,3 @@ };

t.Date = ElysiaType.Date;
t.UnionEnum = ElysiaType.UnionEnum;
// Annotate the CommonJS export names for ESM import in node:

@@ -776,0 +794,0 @@ 0 && (module.exports = {

@@ -463,2 +463,5 @@ "use strict";

});
import_typebox.TypeRegistry.Set("UnionEnum", (schema, value) => {
return (typeof value === "number" || typeof value === "string" || value === null) && schema.enum.includes(value);
});
var ElysiaType = {

@@ -665,2 +668,16 @@ Numeric: (property) => {

return v;
},
// based on https://github.com/elysiajs/elysia/issues/512#issuecomment-1980134955
UnionEnum: (values, options = {}) => {
const type = values.every((value) => typeof value === "string") ? { type: "string" } : values.every((value) => typeof value === "number") ? { type: "number" } : values.every((value) => value === null) ? { type: "null" } : {};
if (values.some((x) => typeof x === "object" && x !== null))
throw new Error("This type does not support objects or arrays");
return {
// why it need default??
default: values[0],
...options,
[import_typebox.Kind]: "UnionEnum",
...type,
enum: values
};
}

@@ -696,2 +713,3 @@ };

t.Date = ElysiaType.Date;
t.UnionEnum = ElysiaType.UnionEnum;

@@ -698,0 +716,0 @@ // src/handler.ts

@@ -284,2 +284,5 @@ "use strict";

});
import_typebox.TypeRegistry.Set("UnionEnum", (schema, value) => {
return (typeof value === "number" || typeof value === "string" || value === null) && schema.enum.includes(value);
});
var ElysiaType = {

@@ -486,2 +489,16 @@ Numeric: (property) => {

return v;
},
// based on https://github.com/elysiajs/elysia/issues/512#issuecomment-1980134955
UnionEnum: (values, options = {}) => {
const type = values.every((value) => typeof value === "string") ? { type: "string" } : values.every((value) => typeof value === "number") ? { type: "number" } : values.every((value) => value === null) ? { type: "null" } : {};
if (values.some((x) => typeof x === "object" && x !== null))
throw new Error("This type does not support objects or arrays");
return {
// why it need default??
default: values[0],
...options,
[import_typebox.Kind]: "UnionEnum",
...type,
enum: values
};
}

@@ -517,2 +534,3 @@ };

t.Date = ElysiaType.Date;
t.UnionEnum = ElysiaType.UnionEnum;

@@ -519,0 +537,0 @@ // src/handler.ts

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

import { ArrayOptions, DateOptions, NumberOptions, TDate, TUnsafe } from '@sinclair/typebox';
import { ArrayOptions, DateOptions, Kind, NumberOptions, TArray, TDate, TUnsafe } from '@sinclair/typebox';
import { type SchemaOptions, type TSchema, TProperties, ObjectOptions, TObject, TNumber, TBoolean } from '@sinclair/typebox';

@@ -38,2 +38,10 @@ import { type ValueError, type TypeCheck } from '@sinclair/typebox/compiler';

type ElysiaFile = (options?: Partial<ElysiaTypeOptions.Files> | undefined) => TUnsafe<File>;
type NonEmptyArray<T> = [T, ...T[]];
export type TEnumValue = number | string | null;
export interface TUnionEnum<T extends NonEmptyArray<TEnumValue> = [TEnumValue]> extends TSchema {
type?: 'number' | 'string' | 'null';
[Kind]: 'UnionEnum';
static: T[number];
enum: T;
}
export declare const ElysiaType: {

@@ -44,3 +52,3 @@ readonly Numeric: (property?: NumberOptions) => TNumber;

readonly ObjectString: <T extends TProperties>(properties: T, options?: ObjectOptions) => TObject<T>;
readonly ArrayString: <T extends TSchema>(children?: T, options?: ArrayOptions) => TObject<T>;
readonly ArrayString: <T extends TSchema>(children?: T, options?: ArrayOptions) => TArray<T>;
readonly File: ElysiaFile;

@@ -54,2 +62,3 @@ readonly Files: (options?: ElysiaTypeOptions.Files) => import("@sinclair/typebox").TTransform<TUnsafe<File[]>, File[]>;

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

@@ -68,2 +77,3 @@ export type TCookie = (typeof ElysiaType)['Cookie'];

Cookie: typeof ElysiaType.Cookie;
UnionEnum: typeof ElysiaType.UnionEnum;
}

@@ -70,0 +80,0 @@ interface SchemaOptions {

2

package.json
{
"name": "elysia",
"description": "Ergonomic Framework for Human",
"version": "1.1.11",
"version": "1.1.12",
"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 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