elysia 2.0.0-exp.2 → 2.0.0-exp.21
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/_virtual/_rolldown/runtime.js +2 -0
- package/dist/adapter/bun/index.d.ts +2 -25
- package/dist/adapter/bun/index.js +18 -12
- package/dist/adapter/bun/index.mjs +19 -13
- package/dist/adapter/bun/router.js +1 -1
- package/dist/adapter/bun/router.mjs +1 -1
- package/dist/adapter/constants.d.ts +3 -26
- package/dist/adapter/index.d.ts +1 -26
- package/dist/adapter/index.js +1 -17
- package/dist/adapter/index.mjs +1 -17
- package/dist/adapter/types.d.ts +1 -0
- package/dist/adapter/utils.d.ts +3 -4
- package/dist/adapter/utils.js +83 -81
- package/dist/adapter/utils.mjs +82 -80
- package/dist/adapter/web-standard/handler.js +6 -3
- package/dist/adapter/web-standard/handler.mjs +6 -3
- package/dist/adapter/web-standard/index.d.ts +2 -26
- package/dist/adapter/web-standard/index.js +12 -1
- package/dist/adapter/web-standard/index.mjs +12 -1
- package/dist/base.d.ts +38 -68
- package/dist/base.js +133 -97
- package/dist/base.mjs +133 -97
- package/dist/compile/aot.d.ts +22 -1
- package/dist/compile/aot.js +22 -0
- package/dist/compile/aot.mjs +22 -0
- package/dist/compile/handler/index.d.ts +2 -2
- package/dist/compile/handler/index.js +85 -456
- package/dist/compile/handler/index.mjs +86 -457
- package/dist/compile/handler/jit.d.ts +35 -0
- package/dist/compile/handler/jit.js +445 -0
- package/dist/compile/handler/jit.mjs +443 -0
- package/dist/compile/handler/params.js +3 -2
- package/dist/compile/handler/params.mjs +4 -3
- package/dist/compile/handler/reconstruct.d.ts +13 -0
- package/dist/compile/handler/reconstruct.js +29 -0
- package/dist/compile/handler/reconstruct.mjs +28 -0
- package/dist/compile/handler/utils.d.ts +2 -1
- package/dist/compile/handler/utils.js +9 -3
- package/dist/compile/handler/utils.mjs +9 -4
- package/dist/compile/jit-probe.d.ts +19 -0
- package/dist/compile/jit-probe.js +38 -0
- package/dist/compile/jit-probe.mjs +36 -0
- package/dist/cookie/index.d.ts +4 -3
- package/dist/cookie/index.js +2 -1
- package/dist/cookie/index.mjs +2 -1
- package/dist/cookie/serialize.d.ts +6 -0
- package/dist/cookie/serialize.js +28 -0
- package/dist/cookie/serialize.mjs +27 -0
- package/dist/cookie/utils.d.ts +1 -2
- package/dist/cookie/utils.js +2 -23
- package/dist/cookie/utils.mjs +5 -25
- package/dist/handler/error.js +2 -2
- package/dist/handler/error.mjs +3 -3
- package/dist/handler/fetch.js +49 -42
- package/dist/handler/fetch.mjs +50 -43
- package/dist/index.d.ts +13 -8
- package/dist/index.js +11 -4
- package/dist/index.mjs +7 -6
- package/dist/parse-query.js +1 -1
- package/dist/parse-query.mjs +1 -1
- package/dist/plugin/bun.d.ts +10 -0
- package/dist/plugin/bun.js +18 -1
- package/dist/plugin/bun.mjs +19 -2
- package/dist/plugin/core.d.ts +61 -1
- package/dist/plugin/core.js +90 -10
- package/dist/plugin/core.mjs +90 -12
- package/dist/plugin/esbuild.d.ts +10 -0
- package/dist/plugin/esbuild.js +18 -1
- package/dist/plugin/esbuild.mjs +19 -2
- package/dist/plugin/source.d.ts +38 -1
- package/dist/plugin/source.js +104 -13
- package/dist/plugin/source.mjs +102 -14
- package/dist/plugin/vite.d.ts +7 -0
- package/dist/plugin/vite.js +22 -1
- package/dist/plugin/vite.mjs +23 -2
- package/dist/sucrose.js +23 -10
- package/dist/sucrose.mjs +23 -10
- package/dist/trace.d.ts +1 -1
- package/dist/trace.js +4 -6
- package/dist/trace.mjs +4 -6
- package/dist/type/bridge.d.ts +9 -8
- package/dist/type/coerce.d.ts +20 -2
- package/dist/type/coerce.js +110 -0
- package/dist/type/coerce.mjs +109 -2
- package/dist/type/compat.js +4 -3
- package/dist/type/compat.mjs +2 -1
- package/dist/type/constants.d.ts +1 -1
- package/dist/type/elysia/boolean-string.js +1 -1
- package/dist/type/elysia/boolean-string.mjs +1 -1
- package/dist/type/elysia/file-type.js +1 -1
- package/dist/type/elysia/file-type.mjs +1 -1
- package/dist/type/elysia/integer-string.js +1 -1
- package/dist/type/elysia/integer-string.mjs +1 -1
- package/dist/type/exports.js +29 -2059
- package/dist/type/exports.mjs +7 -295
- package/dist/type/index.d.ts +6 -2
- package/dist/type/index.js +4 -0
- package/dist/type/index.mjs +3 -1
- package/dist/type/types.d.ts +1 -1
- package/dist/type/utils.js +4 -4
- package/dist/type/utils.mjs +4 -4
- package/dist/type/validator/custom-error.d.ts +10 -0
- package/dist/type/validator/custom-error.js +113 -0
- package/dist/type/validator/custom-error.mjs +110 -0
- package/dist/type/validator/default-precompute.d.ts +22 -0
- package/dist/type/validator/default-precompute.js +476 -0
- package/dist/type/validator/default-precompute.mjs +465 -0
- package/dist/type/validator/frozen-check.d.ts +11 -0
- package/dist/type/validator/frozen-check.js +19 -0
- package/dist/type/validator/frozen-check.mjs +18 -0
- package/dist/type/{validator.d.ts → validator/index.d.ts} +7 -20
- package/dist/type/validator/index.js +572 -0
- package/dist/type/validator/index.mjs +567 -0
- package/dist/type/validator/string-codec-aot.d.ts +9 -0
- package/dist/type/validator/string-codec-aot.js +106 -0
- package/dist/type/validator/string-codec-aot.mjs +102 -0
- package/dist/type/validator/validator-cache.d.ts +21 -0
- package/dist/type/validator/validator-cache.js +163 -0
- package/dist/type/validator/validator-cache.mjs +161 -0
- package/dist/types.d.ts +22 -14
- package/dist/universal/file.d.ts +1 -1
- package/dist/universal/file.js +35 -29
- package/dist/universal/file.mjs +35 -29
- package/dist/utils.d.ts +12 -1
- package/dist/utils.js +89 -45
- package/dist/utils.mjs +88 -46
- package/dist/validator/index.d.ts +1 -1
- package/dist/validator/index.js +15 -2
- package/dist/validator/index.mjs +15 -2
- package/dist/validator/route.d.ts +0 -1
- package/dist/ws/route.js +47 -24
- package/dist/ws/route.mjs +48 -25
- package/package.json +10 -4
- package/dist/type/validator.js +0 -1033
- package/dist/type/validator.mjs +0 -1029
package/dist/type/exports.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
1
|
+
import { __exportAll, __reExport } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
2
|
import { ArrayType } from "./elysia/array.mjs";
|
|
3
3
|
import { StringType } from "./elysia/string.mjs";
|
|
4
4
|
import { Union } from "./elysia/union.mjs";
|
|
@@ -27,330 +27,42 @@ import { NumericEnum } from "./elysia/numeric-enum.mjs";
|
|
|
27
27
|
import { Optional } from "./elysia/optional.mjs";
|
|
28
28
|
import { Uint8ArrayType } from "./elysia/uint8-array.mjs";
|
|
29
29
|
import { UnionEnum } from "./elysia/union-enum.mjs";
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
export * from "typebox/type"
|
|
31
32
|
|
|
32
33
|
//#region src/type/exports.ts
|
|
33
34
|
var exports_exports = /* @__PURE__ */ __exportAll({
|
|
34
35
|
Accelerate: () => Accelerate,
|
|
35
|
-
AddImmutable: () => AddImmutable,
|
|
36
|
-
AddImmutableDeferred: () => AddImmutableDeferred,
|
|
37
|
-
AddOptional: () => AddOptional,
|
|
38
|
-
AddOptionalDeferred: () => AddOptionalDeferred,
|
|
39
|
-
AddReadonly: () => AddReadonly,
|
|
40
|
-
AddReadonlyDeferred: () => AddReadonlyDeferred,
|
|
41
|
-
Any: () => Any,
|
|
42
36
|
Array: () => ArrayType,
|
|
43
37
|
ArrayBuffer: () => ArrayBufferType,
|
|
44
|
-
ArrayOptions: () => ArrayOptions,
|
|
45
38
|
ArrayString: () => ArrayString,
|
|
46
|
-
AsyncIterator: () => AsyncIterator,
|
|
47
|
-
AsyncIteratorOptions: () => AsyncIteratorOptions,
|
|
48
|
-
Awaited: () => Awaited,
|
|
49
|
-
AwaitedAction: () => AwaitedAction,
|
|
50
|
-
AwaitedDeferred: () => AwaitedDeferred,
|
|
51
|
-
AwaitedInstantiate: () => AwaitedInstantiate,
|
|
52
|
-
Base: () => Base,
|
|
53
|
-
BigInt: () => BigInt,
|
|
54
|
-
BigIntPattern: () => BigIntPattern,
|
|
55
39
|
Boolean: () => BooleanType,
|
|
56
40
|
BooleanString: () => BooleanString,
|
|
57
|
-
Broaden: () => Broaden,
|
|
58
|
-
Call: () => Call,
|
|
59
|
-
CallConstruct: () => CallConstruct,
|
|
60
|
-
Capitalize: () => Capitalize,
|
|
61
|
-
CapitalizeAction: () => CapitalizeAction,
|
|
62
|
-
CapitalizeDeferred: () => CapitalizeDeferred,
|
|
63
|
-
CapitalizeInstantiate: () => CapitalizeInstantiate,
|
|
64
|
-
Codec: () => Codec,
|
|
65
|
-
CollapseToObject: () => CollapseToObject,
|
|
66
|
-
Compare: () => Compare,
|
|
67
|
-
Composite: () => Composite,
|
|
68
|
-
Conditional: () => Conditional,
|
|
69
|
-
ConditionalAction: () => ConditionalAction,
|
|
70
|
-
ConditionalDeferred: () => ConditionalDeferred,
|
|
71
|
-
ConditionalInstantiate: () => ConditionalInstantiate,
|
|
72
|
-
Constructor: () => Constructor,
|
|
73
|
-
ConstructorOptions: () => ConstructorOptions,
|
|
74
|
-
ConstructorParameters: () => ConstructorParameters,
|
|
75
|
-
ConstructorParametersAction: () => ConstructorParametersAction,
|
|
76
|
-
ConstructorParametersDeferred: () => ConstructorParametersDeferred,
|
|
77
|
-
ConstructorParametersInstantiate: () => ConstructorParametersInstantiate,
|
|
78
|
-
ConvertToIntegerKey: () => ConvertToIntegerKey,
|
|
79
41
|
Cookie: () => Cookie,
|
|
80
|
-
Cyclic: () => Cyclic,
|
|
81
|
-
CyclicCandidates: () => CyclicCandidates,
|
|
82
|
-
CyclicCheck: () => CyclicCheck,
|
|
83
|
-
CyclicDependencies: () => CyclicDependencies,
|
|
84
|
-
CyclicExtends: () => CyclicExtends,
|
|
85
|
-
CyclicOptions: () => CyclicOptions,
|
|
86
|
-
CyclicTarget: () => CyclicTarget,
|
|
87
42
|
Date: () => DateType,
|
|
88
|
-
Decode: () => Decode,
|
|
89
|
-
DecodeBuilder: () => DecodeBuilder,
|
|
90
|
-
Deferred: () => Deferred,
|
|
91
|
-
Dependent: () => Dependent,
|
|
92
|
-
DependentOptions: () => DependentOptions,
|
|
93
|
-
Distribute: () => Distribute,
|
|
94
|
-
Encode: () => Encode,
|
|
95
|
-
EncodeBuilder: () => EncodeBuilder,
|
|
96
|
-
Enum: () => Enum,
|
|
97
|
-
Evaluate: () => Evaluate,
|
|
98
|
-
EvaluateAction: () => EvaluateAction,
|
|
99
|
-
EvaluateDeferred: () => EvaluateDeferred,
|
|
100
|
-
EvaluateDependent: () => EvaluateDependent,
|
|
101
|
-
EvaluateEnum: () => EvaluateEnum,
|
|
102
|
-
EvaluateInstantiate: () => EvaluateInstantiate,
|
|
103
|
-
EvaluateIntersect: () => EvaluateIntersect,
|
|
104
|
-
EvaluateTemplateLiteral: () => EvaluateTemplateLiteral,
|
|
105
|
-
EvaluateType: () => EvaluateType,
|
|
106
|
-
EvaluateUnion: () => EvaluateUnion,
|
|
107
|
-
EvaluateUnionFast: () => EvaluateUnionFast,
|
|
108
|
-
Exclude: () => Exclude,
|
|
109
|
-
ExcludeAction: () => ExcludeAction,
|
|
110
|
-
ExcludeDeferred: () => ExcludeDeferred,
|
|
111
|
-
ExcludeInstantiate: () => ExcludeInstantiate,
|
|
112
|
-
Extends: () => Extends,
|
|
113
|
-
ExtendsResult: () => ExtendsResult,
|
|
114
|
-
Extract: () => Extract,
|
|
115
|
-
ExtractAction: () => ExtractAction,
|
|
116
|
-
ExtractDeferred: () => ExtractDeferred,
|
|
117
|
-
ExtractInstantiate: () => ExtractInstantiate,
|
|
118
43
|
File: () => File,
|
|
119
44
|
Files: () => Files,
|
|
120
|
-
Flatten: () => Flatten,
|
|
121
45
|
Form: () => Form,
|
|
122
|
-
Function: () => Function,
|
|
123
|
-
FunctionOptions: () => FunctionOptions,
|
|
124
|
-
Generic: () => Generic,
|
|
125
|
-
Identifier: () => Identifier,
|
|
126
|
-
Immutable: () => Immutable,
|
|
127
|
-
Index: () => Index,
|
|
128
|
-
IndexAction: () => IndexAction,
|
|
129
|
-
IndexDeferred: () => IndexDeferred,
|
|
130
|
-
IndexInstantiate: () => IndexInstantiate,
|
|
131
|
-
Infer: () => Infer,
|
|
132
|
-
InstanceType: () => InstanceType,
|
|
133
|
-
InstanceTypeAction: () => InstanceTypeAction,
|
|
134
|
-
InstanceTypeDeferred: () => InstanceTypeDeferred,
|
|
135
|
-
InstanceTypeInstantiate: () => InstanceTypeInstantiate,
|
|
136
|
-
Instantiate: () => Instantiate,
|
|
137
|
-
InstantiateCyclic: () => InstantiateCyclic,
|
|
138
46
|
Integer: () => Integer,
|
|
139
|
-
IntegerKey: () => IntegerKey,
|
|
140
|
-
IntegerPattern: () => IntegerPattern,
|
|
141
47
|
IntegerString: () => IntegerString,
|
|
142
|
-
Interface: () => Interface,
|
|
143
|
-
InterfaceAction: () => InterfaceAction,
|
|
144
|
-
InterfaceDeferred: () => InterfaceDeferred,
|
|
145
|
-
InterfaceInstantiate: () => InterfaceInstantiate,
|
|
146
48
|
Intersect: () => Intersect,
|
|
147
|
-
IntersectOptions: () => IntersectOptions,
|
|
148
|
-
InvalidLiteralValue: () => InvalidLiteralValue,
|
|
149
|
-
IsAny: () => IsAny,
|
|
150
|
-
IsArray: () => IsArray,
|
|
151
|
-
IsAsyncIterator: () => IsAsyncIterator,
|
|
152
|
-
IsBase: () => IsBase,
|
|
153
|
-
IsBigInt: () => IsBigInt,
|
|
154
|
-
IsBoolean: () => IsBoolean,
|
|
155
|
-
IsCall: () => IsCall,
|
|
156
|
-
IsCodec: () => IsCodec,
|
|
157
|
-
IsConstructor: () => IsConstructor,
|
|
158
|
-
IsCyclic: () => IsCyclic,
|
|
159
|
-
IsDeferred: () => IsDeferred,
|
|
160
|
-
IsDependent: () => IsDependent,
|
|
161
|
-
IsEnum: () => IsEnum,
|
|
162
|
-
IsFunction: () => IsFunction,
|
|
163
|
-
IsGeneric: () => IsGeneric,
|
|
164
|
-
IsIdentifier: () => IsIdentifier,
|
|
165
|
-
IsImmutable: () => IsImmutable,
|
|
166
|
-
IsInfer: () => IsInfer,
|
|
167
|
-
IsInteger: () => IsInteger,
|
|
168
|
-
IsInterfaceDeferred: () => IsInterfaceDeferred,
|
|
169
|
-
IsIntersect: () => IsIntersect,
|
|
170
|
-
IsIterator: () => IsIterator,
|
|
171
|
-
IsKind: () => IsKind,
|
|
172
|
-
IsLiteral: () => IsLiteral,
|
|
173
|
-
IsLiteralBigInt: () => IsLiteralBigInt,
|
|
174
|
-
IsLiteralBoolean: () => IsLiteralBoolean,
|
|
175
|
-
IsLiteralNumber: () => IsLiteralNumber,
|
|
176
|
-
IsLiteralString: () => IsLiteralString,
|
|
177
|
-
IsLiteralValue: () => IsLiteralValue,
|
|
178
|
-
IsNever: () => IsNever,
|
|
179
|
-
IsNull: () => IsNull,
|
|
180
|
-
IsNumber: () => IsNumber,
|
|
181
|
-
IsObject: () => IsObject,
|
|
182
|
-
IsOptional: () => IsOptional,
|
|
183
|
-
IsParameter: () => IsParameter,
|
|
184
|
-
IsPromise: () => IsPromise,
|
|
185
|
-
IsReadonly: () => IsReadonly,
|
|
186
|
-
IsRecord: () => IsRecord,
|
|
187
|
-
IsRef: () => IsRef,
|
|
188
|
-
IsRefine: () => IsRefine,
|
|
189
|
-
IsRefinement: () => IsRefinement,
|
|
190
|
-
IsRest: () => IsRest,
|
|
191
|
-
IsSchema: () => IsSchema,
|
|
192
|
-
IsString: () => IsString,
|
|
193
|
-
IsSymbol: () => IsSymbol,
|
|
194
|
-
IsTemplateLiteral: () => IsTemplateLiteral,
|
|
195
|
-
IsTemplateLiteralDeferred: () => IsTemplateLiteralDeferred,
|
|
196
|
-
IsTemplateLiteralFinite: () => IsTemplateLiteralFinite,
|
|
197
|
-
IsTemplateLiteralPattern: () => IsTemplateLiteralPattern,
|
|
198
|
-
IsThis: () => IsThis,
|
|
199
|
-
IsTuple: () => IsTuple,
|
|
200
|
-
IsTypeScriptEnumLike: () => IsTypeScriptEnumLike,
|
|
201
|
-
IsUndefined: () => IsUndefined,
|
|
202
|
-
IsUnion: () => IsUnion,
|
|
203
|
-
IsUnknown: () => IsUnknown,
|
|
204
|
-
IsUnsafe: () => IsUnsafe,
|
|
205
|
-
IsVoid: () => IsVoid,
|
|
206
|
-
Iterator: () => Iterator,
|
|
207
|
-
IteratorOptions: () => IteratorOptions,
|
|
208
|
-
KeyOf: () => KeyOf,
|
|
209
|
-
KeyOfAction: () => KeyOfAction,
|
|
210
|
-
KeyOfDeferred: () => KeyOfDeferred,
|
|
211
|
-
KeyOfInstantiate: () => KeyOfInstantiate,
|
|
212
|
-
KeysToIndexer: () => KeysToIndexer,
|
|
213
|
-
Literal: () => Literal,
|
|
214
|
-
LiteralTypeName: () => LiteralTypeName,
|
|
215
|
-
Lowercase: () => Lowercase,
|
|
216
|
-
LowercaseAction: () => LowercaseAction,
|
|
217
|
-
LowercaseDeferred: () => LowercaseDeferred,
|
|
218
|
-
LowercaseInstantiate: () => LowercaseInstantiate,
|
|
219
|
-
Mapped: () => Mapped,
|
|
220
|
-
MappedAction: () => MappedAction,
|
|
221
|
-
MappedDeferred: () => MappedDeferred,
|
|
222
|
-
MappedInstantiate: () => MappedInstantiate,
|
|
223
49
|
MaybeEmpty: () => MaybeEmpty,
|
|
224
|
-
Module: () => Module,
|
|
225
|
-
ModuleDeferred: () => ModuleDeferred,
|
|
226
|
-
ModuleInstantiate: () => ModuleInstantiate,
|
|
227
|
-
Narrow: () => Narrow,
|
|
228
|
-
Never: () => Never,
|
|
229
|
-
NeverPattern: () => NeverPattern,
|
|
230
50
|
NoValidate: () => NoValidate,
|
|
231
|
-
NonNullable: () => NonNullable,
|
|
232
|
-
NonNullableAction: () => NonNullableAction,
|
|
233
|
-
NonNullableDeferred: () => NonNullableDeferred,
|
|
234
|
-
NonNullableInstantiate: () => NonNullableInstantiate,
|
|
235
|
-
Null: () => Null,
|
|
236
51
|
Nullable: () => Nullable,
|
|
237
52
|
Number: () => NumberType,
|
|
238
|
-
NumberKey: () => NumberKey,
|
|
239
|
-
NumberPattern: () => NumberPattern,
|
|
240
53
|
Numeric: () => Numeric,
|
|
241
54
|
NumericEnum: () => NumericEnum,
|
|
242
55
|
Object: () => ObjectType,
|
|
243
|
-
ObjectOptions: () => ObjectOptions,
|
|
244
56
|
ObjectString: () => ObjectString,
|
|
245
|
-
Omit: () => Omit,
|
|
246
|
-
OmitAction: () => OmitAction,
|
|
247
|
-
OmitDeferred: () => OmitDeferred,
|
|
248
|
-
OmitInstantiate: () => OmitInstantiate,
|
|
249
57
|
Optional: () => Optional,
|
|
250
|
-
Options: () => Options,
|
|
251
|
-
Parameter: () => Parameter,
|
|
252
|
-
Parameters: () => Parameters,
|
|
253
|
-
ParametersAction: () => ParametersAction,
|
|
254
|
-
ParametersDeferred: () => ParametersDeferred,
|
|
255
|
-
ParametersInstantiate: () => ParametersInstantiate,
|
|
256
|
-
ParsePatternIntoTypes: () => ParsePatternIntoTypes,
|
|
257
|
-
ParseTemplateIntoTypes: () => ParseTemplateIntoTypes,
|
|
258
|
-
Partial: () => Partial,
|
|
259
|
-
PartialAction: () => PartialAction,
|
|
260
|
-
PartialDeferred: () => PartialDeferred,
|
|
261
|
-
PartialInstantiate: () => PartialInstantiate,
|
|
262
|
-
Pick: () => Pick,
|
|
263
|
-
PickAction: () => PickAction,
|
|
264
|
-
PickDeferred: () => PickDeferred,
|
|
265
|
-
PickInstantiate: () => PickInstantiate,
|
|
266
|
-
Priority: () => Priority,
|
|
267
|
-
Promise: () => Promise$1,
|
|
268
|
-
PromiseOptions: () => PromiseOptions,
|
|
269
|
-
PropertyKeys: () => PropertyKeys,
|
|
270
|
-
PropertyValues: () => PropertyValues,
|
|
271
|
-
Readonly: () => Readonly,
|
|
272
|
-
ReadonlyObject: () => ReadonlyObject,
|
|
273
|
-
ReadonlyObjectAction: () => ReadonlyObjectAction,
|
|
274
|
-
ReadonlyObjectDeferred: () => ReadonlyObjectDeferred,
|
|
275
|
-
ReadonlyObjectInstantiate: () => ReadonlyObjectInstantiate,
|
|
276
|
-
ReadonlyType: () => ReadonlyType,
|
|
277
|
-
Record: () => Record,
|
|
278
|
-
RecordAction: () => RecordAction,
|
|
279
|
-
RecordDeferred: () => RecordDeferred,
|
|
280
|
-
RecordFromPattern: () => RecordFromPattern,
|
|
281
|
-
RecordInstantiate: () => RecordInstantiate,
|
|
282
|
-
RecordKey: () => RecordKey,
|
|
283
|
-
RecordOptions: () => RecordOptions,
|
|
284
|
-
RecordPattern: () => RecordPattern,
|
|
285
|
-
RecordPatternToType: () => RecordPatternToType,
|
|
286
|
-
RecordValue: () => RecordValue,
|
|
287
|
-
Ref: () => Ref,
|
|
288
|
-
RefInstantiate: () => RefInstantiate,
|
|
289
|
-
Refine: () => Refine,
|
|
290
|
-
RefineAdd: () => RefineAdd,
|
|
291
|
-
RemoveImmutable: () => RemoveImmutable,
|
|
292
|
-
RemoveImmutableDeferred: () => RemoveImmutableDeferred,
|
|
293
|
-
RemoveOptional: () => RemoveOptional,
|
|
294
|
-
RemoveOptionalDeferred: () => RemoveOptionalDeferred,
|
|
295
|
-
RemoveReadonly: () => RemoveReadonly,
|
|
296
|
-
RemoveReadonlyDeferred: () => RemoveReadonlyDeferred,
|
|
297
|
-
Required: () => Required,
|
|
298
|
-
RequiredAction: () => RequiredAction,
|
|
299
|
-
RequiredArray: () => RequiredArray,
|
|
300
|
-
RequiredDeferred: () => RequiredDeferred,
|
|
301
|
-
RequiredInstantiate: () => RequiredInstantiate,
|
|
302
|
-
Rest: () => Rest,
|
|
303
|
-
ResultDisjoint: () => ResultDisjoint,
|
|
304
|
-
ResultEqual: () => ResultEqual,
|
|
305
|
-
ResultLeftInside: () => ResultLeftInside,
|
|
306
|
-
ResultRightInside: () => ResultRightInside,
|
|
307
|
-
ReturnType: () => ReturnType,
|
|
308
|
-
ReturnTypeAction: () => ReturnTypeAction,
|
|
309
|
-
ReturnTypeDeferred: () => ReturnTypeDeferred,
|
|
310
|
-
ReturnTypeInstantiate: () => ReturnTypeInstantiate,
|
|
311
|
-
Script: () => Script,
|
|
312
58
|
String: () => StringType,
|
|
313
|
-
StringKey: () => StringKey,
|
|
314
|
-
StringPattern: () => StringPattern,
|
|
315
|
-
Symbol: () => Symbol,
|
|
316
|
-
TemplateLiteral: () => TemplateLiteral,
|
|
317
|
-
TemplateLiteralCreate: () => TemplateLiteralCreate,
|
|
318
|
-
TemplateLiteralDecode: () => TemplateLiteralDecode,
|
|
319
|
-
TemplateLiteralDecodeUnsafe: () => TemplateLiteralDecodeUnsafe,
|
|
320
|
-
TemplateLiteralDeferred: () => TemplateLiteralDeferred,
|
|
321
|
-
TemplateLiteralEncode: () => TemplateLiteralEncode,
|
|
322
|
-
TemplateLiteralFromString: () => TemplateLiteralFromString,
|
|
323
|
-
TemplateLiteralFromTypes: () => TemplateLiteralFromTypes,
|
|
324
|
-
This: () => This,
|
|
325
|
-
Tuple: () => Tuple,
|
|
326
|
-
TupleOptions: () => TupleOptions,
|
|
327
|
-
TypeScriptEnumToEnumValues: () => TypeScriptEnumToEnumValues,
|
|
328
59
|
Uint8Array: () => Uint8ArrayType,
|
|
329
|
-
Uncapitalize: () => Uncapitalize,
|
|
330
|
-
UncapitalizeAction: () => UncapitalizeAction,
|
|
331
|
-
UncapitalizeDeferred: () => UncapitalizeDeferred,
|
|
332
|
-
UncapitalizeInstantiate: () => UncapitalizeInstantiate,
|
|
333
|
-
Undefined: () => Undefined,
|
|
334
60
|
Union: () => Union,
|
|
335
|
-
UnionEnum: () => UnionEnum
|
|
336
|
-
UnionOptions: () => UnionOptions,
|
|
337
|
-
Unknown: () => Unknown,
|
|
338
|
-
Unsafe: () => Unsafe,
|
|
339
|
-
Uppercase: () => Uppercase,
|
|
340
|
-
UppercaseAction: () => UppercaseAction,
|
|
341
|
-
UppercaseDeferred: () => UppercaseDeferred,
|
|
342
|
-
UppercaseInstantiate: () => UppercaseInstantiate,
|
|
343
|
-
Void: () => Void,
|
|
344
|
-
With: () => With,
|
|
345
|
-
WithAction: () => WithAction,
|
|
346
|
-
WithDeferred: () => WithDeferred,
|
|
347
|
-
WithInstantiate: () => WithInstantiate,
|
|
348
|
-
_Array_: () => _Array_,
|
|
349
|
-
_Function_: () => _Function_,
|
|
350
|
-
_Object_: () => _Object_,
|
|
351
|
-
_Promise_: () => _Promise_
|
|
61
|
+
UnionEnum: () => UnionEnum
|
|
352
62
|
});
|
|
63
|
+
import * as import_typebox_type from "typebox/type";
|
|
64
|
+
__reExport(exports_exports, import_typebox_type);
|
|
353
65
|
setupTypebox();
|
|
354
66
|
|
|
355
67
|
//#endregion
|
|
356
|
-
export { Accelerate,
|
|
68
|
+
export { Accelerate, ArrayType as Array, ArrayBufferType as ArrayBuffer, ArrayString, BooleanType as Boolean, BooleanString, Cookie, DateType as Date, File, Files, Form, Integer, IntegerString, Intersect, MaybeEmpty, NoValidate, Nullable, NumberType as Number, Numeric, NumericEnum, ObjectType as Object, ObjectString, Optional, StringType as String, Uint8ArrayType as Uint8Array, Union, UnionEnum, exports_exports };
|
package/dist/type/index.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { AnySchema, BaseSchema, StandardJSONSchemaV1Like, StandardSchemaV1Like, TypeBoxSchema } from "./types.js";
|
|
2
2
|
import { FileTypeDetector, fileType, setFileTypeDetector } from "./elysia/file-type.js";
|
|
3
3
|
import { exports_d_exports } from "./exports.js";
|
|
4
|
+
import { setupTypebox } from "./compat.js";
|
|
5
|
+
import { TypeBoxValidator } from "./validator/index.js";
|
|
6
|
+
import * as TypeBoxType from "typebox/type";
|
|
4
7
|
import { System as TypeSystem } from "typebox/system";
|
|
5
8
|
|
|
6
9
|
//#region src/type/index.d.ts
|
|
7
|
-
|
|
10
|
+
type TypeBuilder = Omit<typeof TypeBoxType, keyof typeof exports_d_exports> & typeof exports_d_exports;
|
|
11
|
+
declare const t: TypeBuilder;
|
|
8
12
|
//#endregion
|
|
9
|
-
export { type AnySchema, type BaseSchema, type FileTypeDetector, type StandardJSONSchemaV1Like, type StandardSchemaV1Like, type TypeBoxSchema, TypeSystem, fileType, setFileTypeDetector, t };
|
|
13
|
+
export { type AnySchema, type BaseSchema, type FileTypeDetector, type StandardJSONSchemaV1Like, type StandardSchemaV1Like, type TypeBoxSchema, TypeBoxValidator, TypeSystem, fileType, setFileTypeDetector, setupTypebox, t };
|
package/dist/type/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
3
3
|
const require_type_elysia_file_type = require('./elysia/file-type.js');
|
|
4
|
+
const require_type_validator_index = require('./validator/index.js');
|
|
5
|
+
const require_type_compat = require('./compat.js');
|
|
4
6
|
const require_type_exports = require('./exports.js');
|
|
5
7
|
let typebox_system = require("typebox/system");
|
|
6
8
|
|
|
@@ -8,6 +10,7 @@ let typebox_system = require("typebox/system");
|
|
|
8
10
|
const t = require_type_exports.exports_exports;
|
|
9
11
|
|
|
10
12
|
//#endregion
|
|
13
|
+
exports.TypeBoxValidator = require_type_validator_index.TypeBoxValidator;
|
|
11
14
|
Object.defineProperty(exports, 'TypeSystem', {
|
|
12
15
|
enumerable: true,
|
|
13
16
|
get: function () {
|
|
@@ -16,4 +19,5 @@ Object.defineProperty(exports, 'TypeSystem', {
|
|
|
16
19
|
});
|
|
17
20
|
exports.fileType = require_type_elysia_file_type.fileType;
|
|
18
21
|
exports.setFileTypeDetector = require_type_elysia_file_type.setFileTypeDetector;
|
|
22
|
+
exports.setupTypebox = require_type_compat.setupTypebox;
|
|
19
23
|
exports.t = t;
|
package/dist/type/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { fileType, setFileTypeDetector } from "./elysia/file-type.mjs";
|
|
2
|
+
import { TypeBoxValidator } from "./validator/index.mjs";
|
|
3
|
+
import { setupTypebox } from "./compat.mjs";
|
|
2
4
|
import { exports_exports } from "./exports.mjs";
|
|
3
5
|
import { System as TypeSystem } from "typebox/system";
|
|
4
6
|
|
|
@@ -6,4 +8,4 @@ import { System as TypeSystem } from "typebox/system";
|
|
|
6
8
|
const t = exports_exports;
|
|
7
9
|
|
|
8
10
|
//#endregion
|
|
9
|
-
export { TypeSystem, fileType, setFileTypeDetector, t };
|
|
11
|
+
export { TypeBoxValidator, TypeSystem, fileType, setFileTypeDetector, setupTypebox, t };
|
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";
|
|
5
4
|
import { TObjectOptions, TSchemaOptions } from "typebox";
|
|
6
5
|
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'}`;
|
package/dist/type/utils.js
CHANGED
|
@@ -27,11 +27,11 @@ function _hasTypes(types, schema) {
|
|
|
27
27
|
return _hasTypes(types, schema.items);
|
|
28
28
|
}
|
|
29
29
|
if (schema.properties) {
|
|
30
|
-
for (const
|
|
30
|
+
for (const k in schema.properties) if (Object.hasOwn(schema.properties, k) && _hasTypes(types, schema.properties[k])) return true;
|
|
31
31
|
}
|
|
32
32
|
if (typeof schema.additionalProperties === "object" && _hasTypes(types, schema.additionalProperties)) return true;
|
|
33
33
|
if (schema.patternProperties) {
|
|
34
|
-
for (const
|
|
34
|
+
for (const k in schema.patternProperties) if (Object.hasOwn(schema.patternProperties, k) && _hasTypes(types, schema.patternProperties[k])) return true;
|
|
35
35
|
}
|
|
36
36
|
return false;
|
|
37
37
|
}
|
|
@@ -45,11 +45,11 @@ function hasProperty(key, schema) {
|
|
|
45
45
|
if (schema.not && hasProperty(key, schema.not)) return true;
|
|
46
46
|
if (schema.items) return Array.isArray(schema.items) ? schema.items.some((s) => hasProperty(key, s)) : hasProperty(key, schema.items);
|
|
47
47
|
if (schema.properties) {
|
|
48
|
-
for (const
|
|
48
|
+
for (const k in schema.properties) if (Object.hasOwn(schema.properties, k) && hasProperty(key, schema.properties[k])) return true;
|
|
49
49
|
}
|
|
50
50
|
if (typeof schema.additionalProperties === "object" && hasProperty(key, schema.additionalProperties)) return true;
|
|
51
51
|
if (schema.patternProperties) {
|
|
52
|
-
for (const
|
|
52
|
+
for (const k in schema.patternProperties) if (Object.hasOwn(schema.patternProperties, k) && hasProperty(key, schema.patternProperties[k])) return true;
|
|
53
53
|
}
|
|
54
54
|
return false;
|
|
55
55
|
}
|
package/dist/type/utils.mjs
CHANGED
|
@@ -26,11 +26,11 @@ function _hasTypes(types, schema) {
|
|
|
26
26
|
return _hasTypes(types, schema.items);
|
|
27
27
|
}
|
|
28
28
|
if (schema.properties) {
|
|
29
|
-
for (const
|
|
29
|
+
for (const k in schema.properties) if (Object.hasOwn(schema.properties, k) && _hasTypes(types, schema.properties[k])) return true;
|
|
30
30
|
}
|
|
31
31
|
if (typeof schema.additionalProperties === "object" && _hasTypes(types, schema.additionalProperties)) return true;
|
|
32
32
|
if (schema.patternProperties) {
|
|
33
|
-
for (const
|
|
33
|
+
for (const k in schema.patternProperties) if (Object.hasOwn(schema.patternProperties, k) && _hasTypes(types, schema.patternProperties[k])) return true;
|
|
34
34
|
}
|
|
35
35
|
return false;
|
|
36
36
|
}
|
|
@@ -44,11 +44,11 @@ function hasProperty(key, schema) {
|
|
|
44
44
|
if (schema.not && hasProperty(key, schema.not)) return true;
|
|
45
45
|
if (schema.items) return Array.isArray(schema.items) ? schema.items.some((s) => hasProperty(key, s)) : hasProperty(key, schema.items);
|
|
46
46
|
if (schema.properties) {
|
|
47
|
-
for (const
|
|
47
|
+
for (const k in schema.properties) if (Object.hasOwn(schema.properties, k) && hasProperty(key, schema.properties[k])) return true;
|
|
48
48
|
}
|
|
49
49
|
if (typeof schema.additionalProperties === "object" && hasProperty(key, schema.additionalProperties)) return true;
|
|
50
50
|
if (schema.patternProperties) {
|
|
51
|
-
for (const
|
|
51
|
+
for (const k in schema.patternProperties) if (Object.hasOwn(schema.patternProperties, k) && hasProperty(key, schema.patternProperties[k])) return true;
|
|
52
52
|
}
|
|
53
53
|
return false;
|
|
54
54
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CapturedValidator, FrozenValidator } from "../../compile/aot.js";
|
|
2
|
+
|
|
3
|
+
//#region src/type/validator/custom-error.d.ts
|
|
4
|
+
declare function buildFindCustomError(schema: unknown, frozen?: FrozenValidator): ((value: unknown) => {
|
|
5
|
+
instancePath: string;
|
|
6
|
+
error: unknown;
|
|
7
|
+
} | undefined) | undefined;
|
|
8
|
+
declare function captureCustomErrors(schema: unknown): CapturedValidator['customErrors'] | undefined;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { buildFindCustomError, captureCustomErrors };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
|
|
3
|
+
const require_compile_aot = require('../../compile/aot.js');
|
|
4
|
+
const require_type_validator_frozen_check = require('./frozen-check.js');
|
|
5
|
+
let typebox_schema = require("typebox/schema");
|
|
6
|
+
|
|
7
|
+
//#region src/type/validator/custom-error.ts
|
|
8
|
+
function collectCustomErrorNodes(schema, path, out, union) {
|
|
9
|
+
if (!schema || typeof schema !== "object") return out;
|
|
10
|
+
if (schema.error !== void 0) out.push({
|
|
11
|
+
path,
|
|
12
|
+
node: schema,
|
|
13
|
+
union
|
|
14
|
+
});
|
|
15
|
+
if (schema.properties) for (const k in schema.properties) collectCustomErrorNodes(schema.properties[k], path + "/" + k, out, union);
|
|
16
|
+
const items = schema.items;
|
|
17
|
+
if (Array.isArray(items)) for (let i = 0; i < items.length; i++) collectCustomErrorNodes(items[i], path + "/" + i, out, union);
|
|
18
|
+
else if (items && items.error !== void 0) out.push({
|
|
19
|
+
path,
|
|
20
|
+
node: items,
|
|
21
|
+
each: true,
|
|
22
|
+
union
|
|
23
|
+
});
|
|
24
|
+
const branches = schema.anyOf ?? schema.oneOf;
|
|
25
|
+
if (Array.isArray(branches)) {
|
|
26
|
+
const gate = {
|
|
27
|
+
node: schema,
|
|
28
|
+
path
|
|
29
|
+
};
|
|
30
|
+
for (const branch of branches) collectCustomErrorNodes(branch, path, out, gate);
|
|
31
|
+
}
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
function subValueAt(value, path) {
|
|
35
|
+
if (!path) return value;
|
|
36
|
+
let cur = value;
|
|
37
|
+
for (const part of path.split("/")) {
|
|
38
|
+
if (!part) continue;
|
|
39
|
+
if (cur === null || typeof cur !== "object") return;
|
|
40
|
+
cur = cur[part];
|
|
41
|
+
}
|
|
42
|
+
return cur;
|
|
43
|
+
}
|
|
44
|
+
function buildFindCustomError(schema, frozen) {
|
|
45
|
+
const nodes = collectCustomErrorNodes(schema, "", []);
|
|
46
|
+
if (!nodes.length) return;
|
|
47
|
+
const frozenByPath = frozen?.ce ? new Map(frozen.ce.map((e) => [e.p, e])) : void 0;
|
|
48
|
+
const checks = [];
|
|
49
|
+
for (const { path, node, each, union } of nodes) {
|
|
50
|
+
let check;
|
|
51
|
+
const fe = union ? void 0 : frozenByPath?.get(path);
|
|
52
|
+
if (fe) try {
|
|
53
|
+
check = fe.c(fe.e ? require_compile_aot.collectExternals(node) : require_compile_aot.EMPTY_EXTERNALS);
|
|
54
|
+
} catch {}
|
|
55
|
+
else try {
|
|
56
|
+
const c = (0, typebox_schema.Compile)(node);
|
|
57
|
+
check = (v) => c.Check(v);
|
|
58
|
+
} catch {}
|
|
59
|
+
if (check && each) {
|
|
60
|
+
const elementCheck = check;
|
|
61
|
+
check = (v) => !Array.isArray(v) || v.every((x) => elementCheck(x));
|
|
62
|
+
}
|
|
63
|
+
if (!check) continue;
|
|
64
|
+
let gate;
|
|
65
|
+
if (union) {
|
|
66
|
+
let unionCheck;
|
|
67
|
+
try {
|
|
68
|
+
const uc = (0, typebox_schema.Compile)(union.node);
|
|
69
|
+
unionCheck = (v) => uc.Check(v);
|
|
70
|
+
} catch {}
|
|
71
|
+
if (!unionCheck) continue;
|
|
72
|
+
const unionPath = union.path;
|
|
73
|
+
gate = (root) => unionCheck(subValueAt(root, unionPath));
|
|
74
|
+
}
|
|
75
|
+
checks.push({
|
|
76
|
+
path,
|
|
77
|
+
check,
|
|
78
|
+
gate,
|
|
79
|
+
error: node.error
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (!checks.length) return;
|
|
83
|
+
checks.sort((a, b) => b.path.length - a.path.length);
|
|
84
|
+
return (value) => {
|
|
85
|
+
for (const c of checks) {
|
|
86
|
+
if (c.gate && c.gate(value)) continue;
|
|
87
|
+
if (!c.check(subValueAt(value, c.path))) return {
|
|
88
|
+
instancePath: c.path,
|
|
89
|
+
error: c.error
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function captureCustomErrors(schema) {
|
|
95
|
+
const ceNodes = collectCustomErrorNodes(schema, "", []);
|
|
96
|
+
if (!ceNodes.length) return;
|
|
97
|
+
const entries = [];
|
|
98
|
+
for (const { path, node, union } of ceNodes) {
|
|
99
|
+
if (union) continue;
|
|
100
|
+
try {
|
|
101
|
+
const cf = require_type_validator_frozen_check.buildFrozenCheck((0, typebox_schema.Build)(node), node);
|
|
102
|
+
if (cf) entries.push({
|
|
103
|
+
path,
|
|
104
|
+
...cf
|
|
105
|
+
});
|
|
106
|
+
} catch {}
|
|
107
|
+
}
|
|
108
|
+
return entries.length ? entries : void 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
exports.buildFindCustomError = buildFindCustomError;
|
|
113
|
+
exports.captureCustomErrors = captureCustomErrors;
|