elysia 2.0.0-exp.31 → 2.0.0-exp.33
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/base.js +1 -20
- package/dist/base.mjs +1 -20
- package/dist/error.d.ts +32 -10
- package/dist/error.js +9 -4
- package/dist/error.mjs +10 -5
- package/dist/type/bridge-live.d.ts +2 -2
- package/dist/type/bridge-live.js +1 -0
- package/dist/type/bridge-live.mjs +2 -2
- package/dist/type/bridge.d.ts +4 -2
- package/dist/type/bridge.js +8 -0
- package/dist/type/bridge.mjs +3 -1
- package/dist/type/compat.js +1 -0
- package/dist/type/compat.mjs +2 -1
- package/dist/type/types.d.ts +1 -1
- package/dist/type/validator/index.d.ts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/base.js
CHANGED
|
@@ -4,7 +4,6 @@ const require_universal_constants = require('./universal/constants.js');
|
|
|
4
4
|
const require_constants = require('./constants.js');
|
|
5
5
|
const require_utils = require('./utils.js');
|
|
6
6
|
const require_type_bridge = require('./type/bridge.js');
|
|
7
|
-
const require_error = require('./error.js');
|
|
8
7
|
const require_compile_aot = require('./compile/aot.js');
|
|
9
8
|
const require_compile_handler_index = require('./compile/handler/index.js');
|
|
10
9
|
const require_ws_route = require('./ws/route.js');
|
|
@@ -1082,21 +1081,6 @@ var Elysia = class Elysia {
|
|
|
1082
1081
|
this.#initMap();
|
|
1083
1082
|
const methods = this["~map"];
|
|
1084
1083
|
const length = this.#history.length;
|
|
1085
|
-
let hasDuplicate = false;
|
|
1086
|
-
const seen = /* @__PURE__ */ new Map();
|
|
1087
|
-
for (let i = 0; i < length; i++) {
|
|
1088
|
-
const route = this.#history[i];
|
|
1089
|
-
const m = route[0] === "WS" ? "WS" : require_utils.mapMethodBack(route[0]);
|
|
1090
|
-
const key = m + " " + route[1];
|
|
1091
|
-
if (this.#routeMayHaveModelRef(route)) this.#assertRouteModelRefs(route, m);
|
|
1092
|
-
if (seen.has(key)) {
|
|
1093
|
-
hasDuplicate = true;
|
|
1094
|
-
if (!require_error.isProduction()) {
|
|
1095
|
-
if (this.#history[seen.get(key)][2] !== route[2]) console.warn(`[Elysia] Duplicate route ${key} at`, (/* @__PURE__ */ new Error()).stack);
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
seen.set(key, i);
|
|
1099
|
-
}
|
|
1100
1084
|
let explicitHead;
|
|
1101
1085
|
if (enableAutoHead) {
|
|
1102
1086
|
for (let i = 0; i < length; i++) if (require_utils.mapMethodBack(this.#history[i][0]) === "HEAD") (explicitHead ??= /* @__PURE__ */ new Set()).add(this.#history[i][1]);
|
|
@@ -1123,10 +1107,7 @@ var Elysia = class Elysia {
|
|
|
1123
1107
|
const route = this.#history[i];
|
|
1124
1108
|
const method = require_utils.mapMethodBack(route[0]);
|
|
1125
1109
|
const path = route[1];
|
|
1126
|
-
if (
|
|
1127
|
-
const key = (route[0] === "WS" ? "WS" : method) + " " + path;
|
|
1128
|
-
if (seen.get(key) !== i) continue;
|
|
1129
|
-
}
|
|
1110
|
+
if (this.#routeMayHaveModelRef(route)) this.#assertRouteModelRefs(route, method);
|
|
1130
1111
|
if (route[0] === "WS") {
|
|
1131
1112
|
const ws = require_ws_route.buildWSRoute(route, this);
|
|
1132
1113
|
const handler = ws[0];
|
package/dist/base.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import { isBun } from "./universal/constants.mjs";
|
|
|
2
2
|
import { MethodMap, isDynamicRegex, needEncodeRegex } from "./constants.mjs";
|
|
3
3
|
import { clonePlainDecorators, clonePlainDeep, coalesceStandaloneSchemas, createErrorEventHandler, eventProperties, fnOrigin, fnv1a, getLoosePath, guardNonPlainLeaves, hookToGuard, invalidateMacroEpoch, isEmpty, isNotEmpty, isRecordNumber, joinPath, macroOrigin, mapMethodBack, mergeDeep, mergeResponse, nullObject, pushField, schemaProperties, serializeMacroSeed } from "./utils.mjs";
|
|
4
4
|
import { Ref } from "./type/bridge.mjs";
|
|
5
|
-
import { isProduction } from "./error.mjs";
|
|
6
5
|
import { Capture } from "./compile/aot.mjs";
|
|
7
6
|
import { compileHandler, composeRouteHook, localMacroRoot, resolveLocalHook } from "./compile/handler/index.mjs";
|
|
8
7
|
import { buildWSRoute } from "./ws/route.mjs";
|
|
@@ -1079,21 +1078,6 @@ var Elysia = class Elysia {
|
|
|
1079
1078
|
this.#initMap();
|
|
1080
1079
|
const methods = this["~map"];
|
|
1081
1080
|
const length = this.#history.length;
|
|
1082
|
-
let hasDuplicate = false;
|
|
1083
|
-
const seen = /* @__PURE__ */ new Map();
|
|
1084
|
-
for (let i = 0; i < length; i++) {
|
|
1085
|
-
const route = this.#history[i];
|
|
1086
|
-
const m = route[0] === "WS" ? "WS" : mapMethodBack(route[0]);
|
|
1087
|
-
const key = m + " " + route[1];
|
|
1088
|
-
if (this.#routeMayHaveModelRef(route)) this.#assertRouteModelRefs(route, m);
|
|
1089
|
-
if (seen.has(key)) {
|
|
1090
|
-
hasDuplicate = true;
|
|
1091
|
-
if (!isProduction()) {
|
|
1092
|
-
if (this.#history[seen.get(key)][2] !== route[2]) console.warn(`[Elysia] Duplicate route ${key} at`, (/* @__PURE__ */ new Error()).stack);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
seen.set(key, i);
|
|
1096
|
-
}
|
|
1097
1081
|
let explicitHead;
|
|
1098
1082
|
if (enableAutoHead) {
|
|
1099
1083
|
for (let i = 0; i < length; i++) if (mapMethodBack(this.#history[i][0]) === "HEAD") (explicitHead ??= /* @__PURE__ */ new Set()).add(this.#history[i][1]);
|
|
@@ -1120,10 +1104,7 @@ var Elysia = class Elysia {
|
|
|
1120
1104
|
const route = this.#history[i];
|
|
1121
1105
|
const method = mapMethodBack(route[0]);
|
|
1122
1106
|
const path = route[1];
|
|
1123
|
-
if (
|
|
1124
|
-
const key = (route[0] === "WS" ? "WS" : method) + " " + path;
|
|
1125
|
-
if (seen.get(key) !== i) continue;
|
|
1126
|
-
}
|
|
1107
|
+
if (this.#routeMayHaveModelRef(route)) this.#assertRouteModelRefs(route, method);
|
|
1127
1108
|
if (route[0] === "WS") {
|
|
1128
1109
|
const ws = buildWSRoute(route, this);
|
|
1129
1110
|
const handler = ws[0];
|
package/dist/error.d.ts
CHANGED
|
@@ -79,8 +79,8 @@ declare class ValidationError extends ElysiaError {
|
|
|
79
79
|
on?: undefined;
|
|
80
80
|
property?: undefined;
|
|
81
81
|
detail?: undefined;
|
|
82
|
-
expected?: undefined;
|
|
83
82
|
found?: undefined;
|
|
83
|
+
expected?: undefined;
|
|
84
84
|
errors?: undefined;
|
|
85
85
|
} | {
|
|
86
86
|
type: string;
|
|
@@ -89,8 +89,8 @@ declare class ValidationError extends ElysiaError {
|
|
|
89
89
|
on: string | undefined;
|
|
90
90
|
property: string;
|
|
91
91
|
detail?: undefined;
|
|
92
|
-
expected?: undefined;
|
|
93
92
|
found?: undefined;
|
|
93
|
+
expected?: undefined;
|
|
94
94
|
errors?: undefined;
|
|
95
95
|
} | {
|
|
96
96
|
type: string;
|
|
@@ -99,8 +99,8 @@ declare class ValidationError extends ElysiaError {
|
|
|
99
99
|
detail: any;
|
|
100
100
|
on: string | undefined;
|
|
101
101
|
property: string;
|
|
102
|
-
expected: unknown;
|
|
103
102
|
found: unknown;
|
|
103
|
+
expected: unknown;
|
|
104
104
|
errors: any[];
|
|
105
105
|
};
|
|
106
106
|
toResponse(headers?: Record<string, any>): Response;
|
|
@@ -192,6 +192,13 @@ type NumericStatus<Code extends number | keyof StatusMap> = Code extends keyof S
|
|
|
192
192
|
type ProblemStatus<P> = P extends {
|
|
193
193
|
status: infer S extends number | keyof StatusMap;
|
|
194
194
|
} ? NumericStatus<S> : 500;
|
|
195
|
+
type ProblemResponseBody<Status extends number, P> = {
|
|
196
|
+
type: string;
|
|
197
|
+
title: string;
|
|
198
|
+
status: Status;
|
|
199
|
+
detail?: string;
|
|
200
|
+
instance?: string;
|
|
201
|
+
} & Omit<P, keyof Problem>;
|
|
195
202
|
declare function problemBody(p: Problem): Record<string, unknown> & {
|
|
196
203
|
status: number;
|
|
197
204
|
};
|
|
@@ -199,13 +206,28 @@ declare function problemResponse(p: Problem, headers?: Record<string, any>): Res
|
|
|
199
206
|
declare function internalServerErrorBody(error: any): Record<string, unknown>;
|
|
200
207
|
declare function internalServerErrorBodyString(error: any): string;
|
|
201
208
|
declare function internalServerErrorResponse(error: any): Response;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
+
/**
|
|
210
|
+
* RFC 9457 Problem Details function
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```ts
|
|
214
|
+
* problem(400, { detail: 'Something went wrong' })
|
|
215
|
+
* ````
|
|
216
|
+
*
|
|
217
|
+
* @see https://www.rfc-editor.org/info/rfc9457
|
|
218
|
+
*/
|
|
219
|
+
declare function problem<const Code extends number | keyof StatusMap, const P extends Record<string, unknown> = {}>(status: Code, detail?: P & Omit<Problem<Code>, 'status'>): ElysiaStatus<NumericStatus<Code>, ProblemResponseBody<NumericStatus<Code>, P>>;
|
|
220
|
+
/**
|
|
221
|
+
* RFC 9457 Problem Details function
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```ts
|
|
225
|
+
* problem({ status: 400, detail: 'Something went wrong' })
|
|
226
|
+
* ````
|
|
227
|
+
*
|
|
228
|
+
* @see https://www.rfc-editor.org/info/rfc9457
|
|
229
|
+
*/
|
|
230
|
+
declare function problem<const P extends Problem>(detail: P): ElysiaStatus<ProblemStatus<P>, ProblemResponseBody<ProblemStatus<P>, P>>;
|
|
209
231
|
type CheckExcessProps<T, U> = 0 extends 1 & T ? T : U extends U ? Exclude<keyof T, keyof U> extends never ? T : { [K in keyof U]: U[K] } & { [K in Exclude<keyof T, keyof U>]: never } : never;
|
|
210
232
|
type SelectiveStatus<in out Res> = <const Code extends keyof Res | StatusMapBack[Extract<keyof StatusMapBack, keyof Res>], T extends (Code extends keyof Res ? Res[Code] : Code extends keyof StatusMap ? Res[StatusMap[Code]] : never)>(code: Code, response: CheckExcessProps<T, Code extends keyof Res ? Res[Code] : Code extends keyof StatusMap ? Res[StatusMap[Code]] : never>) => ElysiaStatus<Code, T>;
|
|
211
233
|
//#endregion
|
package/dist/error.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_constants = require('./constants.js');
|
|
3
|
-
const require_utils = require('./utils.js');
|
|
4
3
|
const require_type_bridge = require('./type/bridge.js');
|
|
5
4
|
const require_type_constants = require('./type/constants.js');
|
|
6
5
|
const require_adapter_skip_clone = require('./adapter/skip-clone.js');
|
|
@@ -319,7 +318,7 @@ var ValidationError = class extends ElysiaError {
|
|
|
319
318
|
let expected;
|
|
320
319
|
const schemaForExpected = first?.schema ?? this.schema;
|
|
321
320
|
if (schemaForExpected) try {
|
|
322
|
-
expected = require_type_bridge.
|
|
321
|
+
expected = require_type_bridge.Create(schemaForExpected);
|
|
323
322
|
} catch {}
|
|
324
323
|
return {
|
|
325
324
|
type: "validation",
|
|
@@ -328,8 +327,8 @@ var ValidationError = class extends ElysiaError {
|
|
|
328
327
|
detail,
|
|
329
328
|
on: this.type,
|
|
330
329
|
property,
|
|
331
|
-
expected,
|
|
332
330
|
found: scopeFound(this.value, first),
|
|
331
|
+
expected,
|
|
333
332
|
errors
|
|
334
333
|
};
|
|
335
334
|
}
|
|
@@ -447,7 +446,13 @@ function internalServerErrorResponse(error) {
|
|
|
447
446
|
require_adapter_skip_clone.skipClone.add(response);
|
|
448
447
|
return response;
|
|
449
448
|
}
|
|
450
|
-
|
|
449
|
+
function problem(statusOrDetail, detail) {
|
|
450
|
+
const body = typeof statusOrDetail === "object" ? statusOrDetail : {
|
|
451
|
+
...detail,
|
|
452
|
+
status: statusOrDetail
|
|
453
|
+
};
|
|
454
|
+
return new ElysiaStatus(body.status ?? 500, problemBody(body), { "content-type": PROBLEM_JSON });
|
|
455
|
+
}
|
|
451
456
|
|
|
452
457
|
//#endregion
|
|
453
458
|
exports.ElysiaError = ElysiaError;
|
package/dist/error.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { StatusMap, StatusMapBack } from "./constants.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { Default } from "./type/bridge.mjs";
|
|
2
|
+
import { Create } from "./type/bridge.mjs";
|
|
4
3
|
import { primitiveElysiaTypes } from "./type/constants.mjs";
|
|
5
4
|
import { skipClone } from "./adapter/skip-clone.mjs";
|
|
6
5
|
import { env } from "./universal/env.mjs";
|
|
@@ -318,7 +317,7 @@ var ValidationError = class extends ElysiaError {
|
|
|
318
317
|
let expected;
|
|
319
318
|
const schemaForExpected = first?.schema ?? this.schema;
|
|
320
319
|
if (schemaForExpected) try {
|
|
321
|
-
expected =
|
|
320
|
+
expected = Create(schemaForExpected);
|
|
322
321
|
} catch {}
|
|
323
322
|
return {
|
|
324
323
|
type: "validation",
|
|
@@ -327,8 +326,8 @@ var ValidationError = class extends ElysiaError {
|
|
|
327
326
|
detail,
|
|
328
327
|
on: this.type,
|
|
329
328
|
property,
|
|
330
|
-
expected,
|
|
331
329
|
found: scopeFound(this.value, first),
|
|
330
|
+
expected,
|
|
332
331
|
errors
|
|
333
332
|
};
|
|
334
333
|
}
|
|
@@ -446,7 +445,13 @@ function internalServerErrorResponse(error) {
|
|
|
446
445
|
skipClone.add(response);
|
|
447
446
|
return response;
|
|
448
447
|
}
|
|
449
|
-
|
|
448
|
+
function problem(statusOrDetail, detail) {
|
|
449
|
+
const body = typeof statusOrDetail === "object" ? statusOrDetail : {
|
|
450
|
+
...detail,
|
|
451
|
+
status: statusOrDetail
|
|
452
|
+
};
|
|
453
|
+
return new ElysiaStatus(body.status ?? 500, problemBody(body), { "content-type": PROBLEM_JSON });
|
|
454
|
+
}
|
|
450
455
|
|
|
451
456
|
//#endregion
|
|
452
457
|
export { ElysiaError, ElysiaStatus, InternalServerError, NotFound, PROBLEM_JSON, ParseError, ValidationError, internalServerErrorBody, internalServerErrorBodyString, internalServerErrorResponse, isProduction, problem, problemBody, problemResponse, status, validationDetail };
|
|
@@ -6,9 +6,9 @@ import { TypeBoxValidatorCache } from "./validator/validator-cache.js";
|
|
|
6
6
|
import { TypeBoxValidator } from "./validator/index.js";
|
|
7
7
|
import { Ref } from "typebox/type";
|
|
8
8
|
import { Compile } from "typebox/compile";
|
|
9
|
-
import { Clone, Decode, Default, HasCodec } from "typebox/value";
|
|
9
|
+
import { Clone, Create, Decode, Default, HasCodec } from "typebox/value";
|
|
10
10
|
|
|
11
11
|
//#region src/type/bridge-live.d.ts
|
|
12
12
|
declare function useTypebox(_mod?: Parameters<typeof useTypebox$1>[0]): void;
|
|
13
13
|
//#endregion
|
|
14
|
-
export { Clone, Compile, Decode, Default, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, useTypebox };
|
|
14
|
+
export { Clone, Compile, Create, Decode, Default, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, useTypebox };
|
package/dist/type/bridge-live.js
CHANGED
|
@@ -17,6 +17,7 @@ function useTypebox(_mod) {}
|
|
|
17
17
|
//#endregion
|
|
18
18
|
exports.Clone = typebox_value.Clone;
|
|
19
19
|
exports.Compile = typebox_compile.Compile;
|
|
20
|
+
exports.Create = typebox_value.Create;
|
|
20
21
|
exports.Decode = typebox_value.Decode;
|
|
21
22
|
exports.Default = typebox_value.Default;
|
|
22
23
|
exports.HasCodec = typebox_value.HasCodec;
|
|
@@ -5,7 +5,7 @@ import { TypeBoxValidator } from "./validator/index.mjs";
|
|
|
5
5
|
import { Intersect } from "./elysia/intersect.mjs";
|
|
6
6
|
import { Ref } from "typebox/type";
|
|
7
7
|
import { Compile } from "typebox/compile";
|
|
8
|
-
import { Clone, Decode, Default, HasCodec } from "typebox/value";
|
|
8
|
+
import { Clone, Create, Decode, Default, HasCodec } from "typebox/value";
|
|
9
9
|
import { Settings } from "typebox/system";
|
|
10
10
|
|
|
11
11
|
//#region src/type/bridge-live.ts
|
|
@@ -13,4 +13,4 @@ Settings.Set({ unionPrioritySort: false });
|
|
|
13
13
|
function useTypebox(_mod) {}
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
16
|
-
export { Clone, Compile, Decode, Default, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, useTypebox };
|
|
16
|
+
export { Clone, Compile, Create, Decode, Default, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, useTypebox };
|
package/dist/type/bridge.d.ts
CHANGED
|
@@ -5,11 +5,12 @@ import { TypeBoxValidatorCache as TypeBoxValidatorCache$1 } from "./validator/va
|
|
|
5
5
|
import { TypeBoxValidator as TypeBoxValidator$1 } from "./validator/index.js";
|
|
6
6
|
import { Ref as Ref$1, TAny, TSchema } from "typebox/type";
|
|
7
7
|
import { Compile as Compile$1 } from "typebox/compile";
|
|
8
|
-
import { Clone as Clone$1, Decode as Decode$1, Default as Default$1, HasCodec as HasCodec$1 } from "typebox/value";
|
|
8
|
+
import { Clone as Clone$1, Create as Create$1, Decode as Decode$1, Default as Default$1, HasCodec as HasCodec$1 } from "typebox/value";
|
|
9
9
|
|
|
10
10
|
//#region src/type/bridge.d.ts
|
|
11
11
|
interface TypeboxModule {
|
|
12
12
|
Compile: typeof Compile$1;
|
|
13
|
+
Create: typeof Create$1;
|
|
13
14
|
Decode: typeof Decode$1;
|
|
14
15
|
applyCoercions: typeof applyCoercions$1;
|
|
15
16
|
TypeBoxValidator: TypeBoxValidator$1;
|
|
@@ -27,6 +28,7 @@ interface TypeboxModule {
|
|
|
27
28
|
Clone: typeof Clone$1;
|
|
28
29
|
}
|
|
29
30
|
declare let Compile: typeof Compile$1;
|
|
31
|
+
declare let Create: typeof Create$1;
|
|
30
32
|
declare let Decode: typeof Decode$1;
|
|
31
33
|
declare let applyCoercions: typeof applyCoercions$1;
|
|
32
34
|
declare let TypeBoxValidator: TypeBoxValidator$1;
|
|
@@ -46,4 +48,4 @@ declare let Ref: typeof Ref$1;
|
|
|
46
48
|
declare let Clone: typeof Clone$1;
|
|
47
49
|
declare function useTypebox(mod: TypeboxModule): void;
|
|
48
50
|
//#endregion
|
|
49
|
-
export { Clone, Compile, Decode, Default, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, useTypebox };
|
|
51
|
+
export { Clone, Compile, Create, Decode, Default, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, useTypebox };
|
package/dist/type/bridge.js
CHANGED
|
@@ -20,6 +20,7 @@ function stubClass(name) {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
let Compile = stub("Compile");
|
|
23
|
+
let Create = stub("Create");
|
|
23
24
|
let Decode = stub("Decode");
|
|
24
25
|
let applyCoercions = stub("applyCoercions");
|
|
25
26
|
let TypeBoxValidator = stubClass("TypeBoxValidator");
|
|
@@ -38,6 +39,7 @@ let Clone = stub("Clone");
|
|
|
38
39
|
function useTypebox(mod) {
|
|
39
40
|
live = mod;
|
|
40
41
|
Compile = mod.Compile;
|
|
42
|
+
Create = mod.Create;
|
|
41
43
|
Decode = mod.Decode;
|
|
42
44
|
applyCoercions = mod.applyCoercions;
|
|
43
45
|
TypeBoxValidator = mod.TypeBoxValidator;
|
|
@@ -68,6 +70,12 @@ Object.defineProperty(exports, 'Compile', {
|
|
|
68
70
|
return Compile;
|
|
69
71
|
}
|
|
70
72
|
});
|
|
73
|
+
Object.defineProperty(exports, 'Create', {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return Create;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
71
79
|
Object.defineProperty(exports, 'Decode', {
|
|
72
80
|
enumerable: true,
|
|
73
81
|
get: function () {
|
package/dist/type/bridge.mjs
CHANGED
|
@@ -18,6 +18,7 @@ function stubClass(name) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
let Compile = stub("Compile");
|
|
21
|
+
let Create = stub("Create");
|
|
21
22
|
let Decode = stub("Decode");
|
|
22
23
|
let applyCoercions = stub("applyCoercions");
|
|
23
24
|
let TypeBoxValidator = stubClass("TypeBoxValidator");
|
|
@@ -36,6 +37,7 @@ let Clone = stub("Clone");
|
|
|
36
37
|
function useTypebox(mod) {
|
|
37
38
|
live = mod;
|
|
38
39
|
Compile = mod.Compile;
|
|
40
|
+
Create = mod.Create;
|
|
39
41
|
Decode = mod.Decode;
|
|
40
42
|
applyCoercions = mod.applyCoercions;
|
|
41
43
|
TypeBoxValidator = mod.TypeBoxValidator;
|
|
@@ -54,4 +56,4 @@ function useTypebox(mod) {
|
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
//#endregion
|
|
57
|
-
export { Clone, Compile, Decode, Default, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, useTypebox };
|
|
59
|
+
export { Clone, Compile, Create, Decode, Default, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, useTypebox };
|
package/dist/type/compat.js
CHANGED
|
@@ -19,6 +19,7 @@ function setupTypebox() {
|
|
|
19
19
|
typebox_system.Settings.Set({ unionPrioritySort: false });
|
|
20
20
|
require_type_bridge.useTypebox({
|
|
21
21
|
Compile: typebox_compile.Compile,
|
|
22
|
+
Create: typebox_value.Create,
|
|
22
23
|
Decode: typebox_value.Decode,
|
|
23
24
|
applyCoercions: require_type_coerce.applyCoercions,
|
|
24
25
|
TypeBoxValidator: require_type_validator_index.TypeBoxValidator,
|
package/dist/type/compat.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { TypeBoxValidator } from "./validator/index.mjs";
|
|
|
6
6
|
import { Intersect as Intersect$1 } from "./elysia/intersect.mjs";
|
|
7
7
|
import { Ref } from "typebox/type";
|
|
8
8
|
import { Compile } from "typebox/compile";
|
|
9
|
-
import { Clone, Decode as Decode$1, Default, HasCodec } from "typebox/value";
|
|
9
|
+
import { Clone, Create, Decode as Decode$1, Default, HasCodec } from "typebox/value";
|
|
10
10
|
import { Settings } from "typebox/system";
|
|
11
11
|
|
|
12
12
|
//#region src/type/compat.ts
|
|
@@ -17,6 +17,7 @@ function setupTypebox() {
|
|
|
17
17
|
Settings.Set({ unionPrioritySort: false });
|
|
18
18
|
useTypebox({
|
|
19
19
|
Compile,
|
|
20
|
+
Create,
|
|
20
21
|
Decode: Decode$1,
|
|
21
22
|
applyCoercions,
|
|
22
23
|
TypeBoxValidator,
|
package/dist/type/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ELYSIA_TYPES } from "./constants.js";
|
|
2
2
|
import { CookieOptions } from "../cookie/types.js";
|
|
3
3
|
import { MaybeArray } from "../types.js";
|
|
4
|
+
import { Validator } from "typebox/schema";
|
|
4
5
|
import { TObjectOptions, TSchemaOptions } from "typebox";
|
|
5
6
|
import { TLocalizedValidationError } from "typebox/error";
|
|
6
|
-
import { Validator } from "typebox/schema";
|
|
7
7
|
|
|
8
8
|
//#region src/type/types.d.ts
|
|
9
9
|
type FileUnit = number | `${number}${'k' | 'm'}`;
|
|
@@ -2,8 +2,8 @@ import { Validator as Validator$1, ValidatorOptions } from "../../validator/inde
|
|
|
2
2
|
import { TypeBoxValidatorCache } from "./validator-cache.js";
|
|
3
3
|
import { MaybePromise } from "../../types.js";
|
|
4
4
|
import { Static, StaticDecode, StaticEncode, TAny, TSchema } from "typebox/type";
|
|
5
|
-
import { TLocalizedValidationError } from "typebox/error";
|
|
6
5
|
import { Validator } from "typebox/schema";
|
|
6
|
+
import { TLocalizedValidationError } from "typebox/error";
|
|
7
7
|
|
|
8
8
|
//#region src/type/validator/index.d.ts
|
|
9
9
|
declare function shallowMergeObjects(members: any[]): TSchema | null;
|
package/dist/types.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ import { Context, ErrorContext, LifecycleContext, PreContext } from "./context.j
|
|
|
10
10
|
import { WebSocketHandler } from "./ws/types.js";
|
|
11
11
|
import { AnyElysia, Elysia } from "./base.js";
|
|
12
12
|
import { ElysiaAdapter } from "./adapter/index.js";
|
|
13
|
-
import { Static, StaticDecode, StaticEncode, TIntersect, TObject, TSchema } from "typebox";
|
|
14
13
|
import { Instruction } from "exact-mirror";
|
|
14
|
+
import { Static, StaticDecode, StaticEncode, TIntersect, TObject, TSchema } from "typebox";
|
|
15
15
|
import { OpenAPIV3 } from "openapi-types";
|
|
16
16
|
|
|
17
17
|
//#region src/types.d.ts
|