elysia 2.0.0-exp.22 → 2.0.0-exp.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/types.d.ts +6 -0
- package/dist/adapter/utils.d.ts +1 -1
- package/dist/base.d.ts +9 -9
- package/dist/base.js +4 -8
- package/dist/base.mjs +4 -8
- package/dist/error.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/type/coerce.js +1 -5
- package/dist/type/coerce.mjs +1 -5
- package/dist/type/constants.d.ts +1 -1
- package/dist/type/validator/index.js +7 -2
- package/dist/type/validator/index.mjs +7 -2
- package/package.json +1 -1
package/dist/adapter/types.d.ts
CHANGED
|
@@ -23,6 +23,12 @@ interface ElysiaAdapterOptions {
|
|
|
23
23
|
* Whether this adapter is web standard
|
|
24
24
|
*/
|
|
25
25
|
isWebStandard: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether this adapter supports WebSocket.
|
|
28
|
+
*
|
|
29
|
+
* `.ws()` throws on non-Bun runtimes unless this is set.
|
|
30
|
+
*/
|
|
31
|
+
websocket?: boolean;
|
|
26
32
|
listen?(app: AnyElysia, options: string | number | Partial<Serve>, callback?: ListenCallback): void;
|
|
27
33
|
/**
|
|
28
34
|
* Stop server from serving
|
package/dist/adapter/utils.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare function responseToSetHeaders(response: Response, set?: Context['set']):
|
|
|
11
11
|
cookie?: Record<string, BaseCookie>;
|
|
12
12
|
} | {
|
|
13
13
|
headers: any;
|
|
14
|
-
status: number | "
|
|
14
|
+
status: number | "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required";
|
|
15
15
|
};
|
|
16
16
|
interface CreateHandlerParameter {
|
|
17
17
|
mapResponse(response: unknown, set: Context['set'], request?: Request): Response;
|
package/dist/base.d.ts
CHANGED
|
@@ -949,23 +949,17 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
949
949
|
head<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
|
|
950
950
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
951
951
|
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'head', Path, Schema, {}, Handle>;
|
|
952
|
-
all<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
|
|
953
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
954
|
-
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>)>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']>, fn: Handle): this;
|
|
955
|
-
all<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
|
|
956
|
-
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
957
|
-
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): this;
|
|
958
952
|
/**
|
|
959
953
|
* ### method
|
|
960
|
-
* Register
|
|
954
|
+
* Register handler for path with custom method
|
|
961
955
|
*
|
|
962
956
|
* ---
|
|
963
957
|
* @example
|
|
964
958
|
* ```typescript
|
|
965
|
-
* import { Elysia } from 'elysia'
|
|
959
|
+
* import { Elysia, t } from 'elysia'
|
|
966
960
|
*
|
|
967
961
|
* new Elysia()
|
|
968
|
-
* .method('
|
|
962
|
+
* .method('Elysia', '/', 'hi')
|
|
969
963
|
* ```
|
|
970
964
|
*/
|
|
971
965
|
method<const Method extends HTTPMethod, const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
|
|
@@ -974,6 +968,12 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
974
968
|
method<const Method extends HTTPMethod, const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
|
|
975
969
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
976
970
|
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(method: Method, path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Method, Path, Schema, {}, Handle>;
|
|
971
|
+
all<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
|
|
972
|
+
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
973
|
+
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>)>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']>, fn: Handle): this;
|
|
974
|
+
all<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
|
|
975
|
+
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
976
|
+
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): this;
|
|
977
977
|
/**
|
|
978
978
|
* ### ws
|
|
979
979
|
* Register a WebSocket route. Mirrors `.get`/`.post` ergonomics:
|
package/dist/base.js
CHANGED
|
@@ -762,14 +762,14 @@ var Elysia = class Elysia {
|
|
|
762
762
|
head(path, hookOrFn, fn) {
|
|
763
763
|
return fn === void 0 ? this.#add(require_constants.MethodMap.HEAD, path, hookOrFn) : this.#add(require_constants.MethodMap.HEAD, path, fn, hookOrFn);
|
|
764
764
|
}
|
|
765
|
+
method(method, path, hookOrFn, fn) {
|
|
766
|
+
return fn === void 0 ? this.#add(method, path, hookOrFn) : this.#add(method, path, fn, hookOrFn);
|
|
767
|
+
}
|
|
765
768
|
all(path, hookOrFn, fn) {
|
|
766
769
|
if (fn === void 0) this.#add("*", path, hookOrFn);
|
|
767
770
|
else this.#add("*", path, fn, hookOrFn);
|
|
768
771
|
return this;
|
|
769
772
|
}
|
|
770
|
-
method(method, path, hookOrFn, fn) {
|
|
771
|
-
return fn === void 0 ? this.#add(method, path, hookOrFn) : this.#add(method, path, fn, hookOrFn);
|
|
772
|
-
}
|
|
773
773
|
ws(path, optionsOrHandler, handler) {
|
|
774
774
|
this["~hasWS"] = true;
|
|
775
775
|
const adapter = this["~config"]?.adapter;
|
|
@@ -1029,11 +1029,7 @@ var Elysia = class Elysia {
|
|
|
1029
1029
|
return this.#handle ??= async (requestOrUrl, options) => this.fetch(typeof requestOrUrl === "string" ? new Request(requestOrUrl.startsWith("/") ? `http://e.ly${requestOrUrl}` : requestOrUrl, options) : requestOrUrl);
|
|
1030
1030
|
}
|
|
1031
1031
|
listen(options, callback) {
|
|
1032
|
-
|
|
1033
|
-
this["~config"] ??= require_utils.nullObject();
|
|
1034
|
-
this["~config"].adapter = require_adapter_bun_index.BunAdapter;
|
|
1035
|
-
}
|
|
1036
|
-
const listen = this["~config"]?.adapter?.listen;
|
|
1032
|
+
const listen = (this["~config"]?.adapter ?? (require_universal_constants.isBun ? require_adapter_bun_index.BunAdapter : void 0))?.listen;
|
|
1037
1033
|
if (!listen) throw new Error("No adapter provided for listen()");
|
|
1038
1034
|
if (!require_universal_env.env.ELYSIA_AOT_BUILD) listen(this, options, callback);
|
|
1039
1035
|
return this;
|
package/dist/base.mjs
CHANGED
|
@@ -759,14 +759,14 @@ var Elysia = class Elysia {
|
|
|
759
759
|
head(path, hookOrFn, fn) {
|
|
760
760
|
return fn === void 0 ? this.#add(MethodMap.HEAD, path, hookOrFn) : this.#add(MethodMap.HEAD, path, fn, hookOrFn);
|
|
761
761
|
}
|
|
762
|
+
method(method, path, hookOrFn, fn) {
|
|
763
|
+
return fn === void 0 ? this.#add(method, path, hookOrFn) : this.#add(method, path, fn, hookOrFn);
|
|
764
|
+
}
|
|
762
765
|
all(path, hookOrFn, fn) {
|
|
763
766
|
if (fn === void 0) this.#add("*", path, hookOrFn);
|
|
764
767
|
else this.#add("*", path, fn, hookOrFn);
|
|
765
768
|
return this;
|
|
766
769
|
}
|
|
767
|
-
method(method, path, hookOrFn, fn) {
|
|
768
|
-
return fn === void 0 ? this.#add(method, path, hookOrFn) : this.#add(method, path, fn, hookOrFn);
|
|
769
|
-
}
|
|
770
770
|
ws(path, optionsOrHandler, handler) {
|
|
771
771
|
this["~hasWS"] = true;
|
|
772
772
|
const adapter = this["~config"]?.adapter;
|
|
@@ -1026,11 +1026,7 @@ var Elysia = class Elysia {
|
|
|
1026
1026
|
return this.#handle ??= async (requestOrUrl, options) => this.fetch(typeof requestOrUrl === "string" ? new Request(requestOrUrl.startsWith("/") ? `http://e.ly${requestOrUrl}` : requestOrUrl, options) : requestOrUrl);
|
|
1027
1027
|
}
|
|
1028
1028
|
listen(options, callback) {
|
|
1029
|
-
|
|
1030
|
-
this["~config"] ??= nullObject();
|
|
1031
|
-
this["~config"].adapter = BunAdapter;
|
|
1032
|
-
}
|
|
1033
|
-
const listen = this["~config"]?.adapter?.listen;
|
|
1029
|
+
const listen = (this["~config"]?.adapter ?? (isBun ? BunAdapter : void 0))?.listen;
|
|
1034
1030
|
if (!listen) throw new Error("No adapter provided for listen()");
|
|
1035
1031
|
if (!env.ELYSIA_AOT_BUILD) listen(this, options, callback);
|
|
1036
1032
|
return this;
|
package/dist/error.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ declare class ElysiaStatus<const in out Code extends number | keyof StatusMap, T
|
|
|
85
85
|
constructor(code: Code, res: T);
|
|
86
86
|
get status(): number;
|
|
87
87
|
}
|
|
88
|
-
declare const status: <const Code extends number | keyof StatusMap, const T = (Code extends keyof StatusMapBack ? StatusMapBack[Code] : Code)>(code: Code, response?: T) => ElysiaStatus<Code, T, Code extends "
|
|
88
|
+
declare const status: <const Code extends number | keyof StatusMap, const T = (Code extends keyof StatusMapBack ? StatusMapBack[Code] : Code)>(code: Code, response?: T) => ElysiaStatus<Code, T, Code extends "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required" ? {
|
|
89
89
|
readonly Continue: 100;
|
|
90
90
|
readonly 'Switching Protocols': 101;
|
|
91
91
|
readonly Processing: 102;
|
package/dist/index.d.ts
CHANGED
|
@@ -17,5 +17,5 @@ import { Server } from "./universal/server.js";
|
|
|
17
17
|
import { HTTPHeaders, InputSchema, Macro, MacroToContext, MacroToProperty, RouteSchema, SSEPayload, UnwrapRoute, UnwrapSchema } from "./types.js";
|
|
18
18
|
import { form, prefix, redirect, sse } from "./utils.js";
|
|
19
19
|
import { Context, ErrorContext, createBaseContext, createContext } from "./context.js";
|
|
20
|
-
import { Elysia } from "./base.js";
|
|
21
|
-
export { type AnySchema, type BaseCookie, type BaseSchema, Compiled, type Context, type Cookie, type CookieOptions, Elysia, Elysia as default, ElysiaError, ElysiaFile, ElysiaStatus, type ErrorContext, type FileTypeDetector, type HTTPHeaders, type InputSchema, InternalServerError, InvalidCookieSignature, type Macro, type MacroToContext, type MacroToProperty, Capture as Manifest, MultiValidator, NotFound, ParseError, type RouteSchema, type SSEPayload, type SelectiveStatus, type Server, type StandardJSONSchemaV1Like, type StandardSchemaV1Like, StandardValidator, StatusMap, StatusMapBack, type TCookieField, type TCookieObject, type TFiles, TypeBoxValidator, TypeSystem, type UnwrapRoute, type UnwrapSchema, ValidationError, Validator, createBaseContext, createContext, env, file, fileType, form, prefix, redirect, setFileTypeDetector, setupTypebox, sse, status, t, validationDetail };
|
|
20
|
+
import { AnyElysia, Elysia } from "./base.js";
|
|
21
|
+
export { AnyElysia, type AnySchema, type BaseCookie, type BaseSchema, Compiled, type Context, type Cookie, type CookieOptions, Elysia, Elysia as default, ElysiaError, ElysiaFile, ElysiaStatus, type ErrorContext, type FileTypeDetector, type HTTPHeaders, type InputSchema, InternalServerError, InvalidCookieSignature, type Macro, type MacroToContext, type MacroToProperty, Capture as Manifest, MultiValidator, NotFound, ParseError, type RouteSchema, type SSEPayload, type SelectiveStatus, type Server, type StandardJSONSchemaV1Like, type StandardSchemaV1Like, StandardValidator, StatusMap, StatusMapBack, type TCookieField, type TCookieObject, type TFiles, TypeBoxValidator, TypeSystem, type UnwrapRoute, type UnwrapSchema, ValidationError, Validator, createBaseContext, createContext, env, file, fileType, form, prefix, redirect, setFileTypeDetector, setupTypebox, sse, status, t, validationDetail };
|
package/dist/type/coerce.js
CHANGED
|
@@ -249,16 +249,12 @@ function captureCoercePlan(original, coerced) {
|
|
|
249
249
|
const walk = (o, c) => {
|
|
250
250
|
if (o === c || !c || typeof c !== "object") return null;
|
|
251
251
|
const ely = c["~elyTyp"];
|
|
252
|
-
if (ely === require_type_constants.ELYSIA_TYPES.ObjectString && (!o || o["~elyTyp"] !== ely)) {
|
|
252
|
+
if ((ely === require_type_constants.ELYSIA_TYPES.ObjectString || ely === require_type_constants.ELYSIA_TYPES.ArrayString) && (!o || o["~elyTyp"] !== ely)) {
|
|
253
253
|
any = true;
|
|
254
254
|
const site = { os: ely };
|
|
255
255
|
if (o && "~optional" in o) site.o = o["~optional"];
|
|
256
256
|
return site;
|
|
257
257
|
}
|
|
258
|
-
if (ely === require_type_constants.ELYSIA_TYPES.ArrayString) {
|
|
259
|
-
bakeable = false;
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
258
|
if (ely && COERCE_LEAF_CTOR[ely] && (!o || o["~elyTyp"] !== ely)) {
|
|
263
259
|
any = true;
|
|
264
260
|
const leaf = { e: ely };
|
package/dist/type/coerce.mjs
CHANGED
|
@@ -248,16 +248,12 @@ function captureCoercePlan(original, coerced) {
|
|
|
248
248
|
const walk = (o, c) => {
|
|
249
249
|
if (o === c || !c || typeof c !== "object") return null;
|
|
250
250
|
const ely = c["~elyTyp"];
|
|
251
|
-
if (ely === ELYSIA_TYPES.ObjectString && (!o || o["~elyTyp"] !== ely)) {
|
|
251
|
+
if ((ely === ELYSIA_TYPES.ObjectString || ely === ELYSIA_TYPES.ArrayString) && (!o || o["~elyTyp"] !== ely)) {
|
|
252
252
|
any = true;
|
|
253
253
|
const site = { os: ely };
|
|
254
254
|
if (o && "~optional" in o) site.o = o["~optional"];
|
|
255
255
|
return site;
|
|
256
256
|
}
|
|
257
|
-
if (ely === ELYSIA_TYPES.ArrayString) {
|
|
258
|
-
bakeable = false;
|
|
259
|
-
return null;
|
|
260
|
-
}
|
|
261
257
|
if (ely && COERCE_LEAF_CTOR[ely] && (!o || o["~elyTyp"] !== ely)) {
|
|
262
258
|
any = true;
|
|
263
259
|
const leaf = { e: ely };
|
package/dist/type/constants.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare const ELYSIA_TYPES: {
|
|
|
17
17
|
readonly NoValidate: 15;
|
|
18
18
|
};
|
|
19
19
|
type ELYSIA_TYPES = typeof ELYSIA_TYPES;
|
|
20
|
-
declare const primitiveElysiaTypes: Set<
|
|
20
|
+
declare const primitiveElysiaTypes: Set<1 | 2 | 3 | 6 | 10 | 11 | 13 | 14>;
|
|
21
21
|
declare const noEnumerable: {
|
|
22
22
|
readonly enumerable: false;
|
|
23
23
|
};
|
|
@@ -148,8 +148,13 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
|
|
|
148
148
|
const originalElyTyp = schema?.["~elyTyp"];
|
|
149
149
|
const frozen = options?.aot && options.slot ? require_compile_aot.Compiled.getValidator(options.aot.method, options.aot.path, options.slot) : void 0;
|
|
150
150
|
let schemaHasRef = false;
|
|
151
|
-
if (name && options?.models)
|
|
152
|
-
|
|
151
|
+
if (name && options?.models) {
|
|
152
|
+
schema = moduleCache.getOrInsertComputed(options.models, () => (0, typebox_type.Module)(options.models))[name];
|
|
153
|
+
if (isIntersectable) {
|
|
154
|
+
const members = [schema, ...options.schemas];
|
|
155
|
+
schema = shallowMergeObjects(members) ?? (0, typebox_type.Evaluate)((0, typebox_type.Intersect)(members));
|
|
156
|
+
}
|
|
157
|
+
} else if (options?.models && typeof name !== "string") {
|
|
153
158
|
schemaHasRef = frozen ? frozen.r === 1 : schemaContainsRef(schema);
|
|
154
159
|
if (schemaHasRef) {
|
|
155
160
|
const id = `inline@${++inlineRefId}`;
|
|
@@ -145,8 +145,13 @@ var TypeBoxValidator = class extends Validator$1 {
|
|
|
145
145
|
const originalElyTyp = schema?.["~elyTyp"];
|
|
146
146
|
const frozen = options?.aot && options.slot ? Compiled.getValidator(options.aot.method, options.aot.path, options.slot) : void 0;
|
|
147
147
|
let schemaHasRef = false;
|
|
148
|
-
if (name && options?.models)
|
|
149
|
-
|
|
148
|
+
if (name && options?.models) {
|
|
149
|
+
schema = moduleCache.getOrInsertComputed(options.models, () => Module(options.models))[name];
|
|
150
|
+
if (isIntersectable) {
|
|
151
|
+
const members = [schema, ...options.schemas];
|
|
152
|
+
schema = shallowMergeObjects(members) ?? Evaluate(Intersect(members));
|
|
153
|
+
}
|
|
154
|
+
} else if (options?.models && typeof name !== "string") {
|
|
150
155
|
schemaHasRef = frozen ? frozen.r === 1 : schemaContainsRef(schema);
|
|
151
156
|
if (schemaHasRef) {
|
|
152
157
|
const id = `inline@${++inlineRefId}`;
|