@wener/utils 1.1.25 → 1.1.27
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/README.md +4 -0
- package/dist/cjs/createFetchWith-qhRObsE4.js +2 -0
- package/dist/cjs/createFetchWith-qhRObsE4.js.map +1 -0
- package/dist/cjs/{getGlobalThis-304f74e0.js → getGlobalThis-GhffAgiG.js} +1 -1
- package/dist/cjs/{getGlobalThis-304f74e0.js.map → getGlobalThis-GhffAgiG.js.map} +1 -1
- package/dist/cjs/index.cjs +12 -12
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/schema/typebox/gen/index.cjs +118 -0
- package/dist/cjs/schema/typebox/gen/index.cjs.map +1 -0
- package/dist/cjs/schema/typebox/index.cjs +2 -0
- package/dist/cjs/schema/typebox/index.cjs.map +1 -0
- package/dist/cjs/server.cjs +1 -1
- package/dist/cjs/server.cjs.map +1 -1
- package/dist/cjs/servers/jsdom.cjs +1 -1
- package/dist/cjs/servers/jsdom.cjs.map +1 -1
- package/dist/cjs/servers/node-fetch.cjs +1 -1
- package/dist/cjs/servers/ws.cjs +1 -1
- package/dist/esm/createFetchWith-1q1S-Xro.js +2 -0
- package/dist/esm/createFetchWith-1q1S-Xro.js.map +1 -0
- package/dist/esm/{getGlobalThis-b7ad0cf9.js → getGlobalThis-A8F-nU7J.js} +1 -1
- package/dist/esm/{getGlobalThis-b7ad0cf9.js.map → getGlobalThis-A8F-nU7J.js.map} +1 -1
- package/dist/esm/index.js +9 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/schema/typebox/gen.js +118 -0
- package/dist/esm/schema/typebox/gen.js.map +1 -0
- package/dist/esm/schema/typebox.js +2 -0
- package/dist/esm/schema/typebox.js.map +1 -0
- package/dist/esm/server.js +1 -1
- package/dist/esm/server.js.map +1 -1
- package/dist/esm/servers/jsdom.js +1 -1
- package/dist/esm/servers/jsdom.js.map +1 -1
- package/dist/esm/servers/node-fetch.js +1 -1
- package/dist/esm/servers/ws.js +1 -1
- package/dist/system/createFetchWith-TjUle-dI.js +2 -0
- package/dist/system/createFetchWith-TjUle-dI.js.map +1 -0
- package/dist/system/{getGlobalThis-8951eb0e.js → getGlobalThis-X5ifUXDI.js} +1 -1
- package/dist/system/{getGlobalThis-8951eb0e.js.map → getGlobalThis-X5ifUXDI.js.map} +1 -1
- package/dist/system/index.js +12 -12
- package/dist/system/index.js.map +1 -1
- package/dist/system/schema/typebox/gen.js +118 -0
- package/dist/system/schema/typebox/gen.js.map +1 -0
- package/dist/system/schema/typebox.js +2 -0
- package/dist/system/schema/typebox.js.map +1 -0
- package/dist/system/server.js +1 -1
- package/dist/system/server.js.map +1 -1
- package/dist/system/servers/jsdom.js +1 -1
- package/dist/system/servers/jsdom.js.map +1 -1
- package/dist/system/servers/node-fetch.js +1 -1
- package/dist/system/servers/ws.js +1 -1
- package/lib/crypto/hashing.js +1 -1
- package/lib/crypto/hashing.js.map +1 -1
- package/lib/fetch/createFetchWith.js.map +1 -1
- package/lib/{servers/fetch → fetch}/createFetchWithRetry.js +1 -1
- package/lib/fetch/createFetchWithRetry.js.map +1 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/langs/deepFreeze.js +16 -0
- package/lib/langs/deepFreeze.js.map +1 -0
- package/lib/maths/clamp.js +21 -0
- package/lib/maths/clamp.js.map +1 -0
- package/lib/objects/get.js.map +1 -1
- package/lib/objects/set.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/common/encoder.js +74 -0
- package/lib/schema/typebox/gen/codegen/common/encoder.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/common/formatter.js +10 -0
- package/lib/schema/typebox/gen/codegen/common/formatter.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/common/jsdoc.js +68 -0
- package/lib/schema/typebox/gen/codegen/common/jsdoc.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/expression/compiler.js +325 -0
- package/lib/schema/typebox/gen/codegen/expression/compiler.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/expression/errors.js +237 -0
- package/lib/schema/typebox/gen/codegen/expression/errors.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/expression/evaluator.js +241 -0
- package/lib/schema/typebox/gen/codegen/expression/evaluator.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/expression/expression.js +200 -0
- package/lib/schema/typebox/gen/codegen/expression/expression.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/index.js +19 -0
- package/lib/schema/typebox/gen/codegen/index.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-arktype.js +263 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-arktype.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-expression.js +363 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-expression.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-grpc.js +245 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-grpc.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-io-ts.js +316 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-io-ts.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-javascript.js +20 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-javascript.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-json-schema.js +171 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-json-schema.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-typebox.js +10 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-typebox.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-typescript.js +198 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-typescript.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-valibot.js +252 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-valibot.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-value.js +19 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-value.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-yrel.js +247 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-yrel.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-yup.js +249 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-yup.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-zod.js +272 -0
- package/lib/schema/typebox/gen/codegen/model/model-to-zod.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/typescript/typescript-to-model.js +45 -0
- package/lib/schema/typebox/gen/codegen/typescript/typescript-to-model.js.map +1 -0
- package/lib/schema/typebox/gen/codegen/typescript/typescript-to-typebox.js +620 -0
- package/lib/schema/typebox/gen/codegen/typescript/typescript-to-typebox.js.map +1 -0
- package/lib/schema/typebox/gen/index.js +3 -0
- package/lib/schema/typebox/gen/index.js.map +1 -0
- package/lib/schema/typebox/index.js +3 -0
- package/lib/schema/typebox/index.js.map +1 -0
- package/lib/schema/typebox/typebox.js +34 -0
- package/lib/schema/typebox/typebox.js.map +1 -0
- package/lib/server.js +0 -1
- package/lib/server.js.map +1 -1
- package/lib/servers/fetch/createFetchWithProxyByUndici.js +15 -0
- package/lib/servers/fetch/createFetchWithProxyByUndici.js.map +1 -1
- package/package.json +21 -6
- package/src/crypto/hashing.ts +1 -1
- package/src/fetch/createFetchWith.ts +1 -1
- package/src/{servers/fetch → fetch}/createFetchWithRetry.ts +3 -3
- package/src/fetch/index.ts +1 -0
- package/src/index.ts +12 -4
- package/src/langs/deepFreeze.ts +19 -0
- package/src/langs/hashCode.ignored.ts +125 -0
- package/src/libs/README.md +2 -0
- package/src/logging/slog.ts +121 -0
- package/src/maths/clamp.test.ts +19 -0
- package/src/maths/clamp.ts +23 -1
- package/src/objects/get.ts +14 -14
- package/src/objects/set.ts +5 -5
- package/src/schema/typebox/gen/codegen/common/encoder.ts +99 -0
- package/src/schema/typebox/gen/codegen/common/formatter.ts +31 -0
- package/src/schema/typebox/gen/codegen/common/index.ts +29 -0
- package/src/schema/typebox/gen/codegen/common/jsdoc.ts +93 -0
- package/src/schema/typebox/gen/codegen/expression/compiler.ts +377 -0
- package/src/schema/typebox/gen/codegen/expression/errors.ts +302 -0
- package/src/schema/typebox/gen/codegen/expression/evaluator.ts +268 -0
- package/src/schema/typebox/gen/codegen/expression/expression.ts +538 -0
- package/src/schema/typebox/gen/codegen/expression/index.ts +32 -0
- package/src/schema/typebox/gen/codegen/index.ts +29 -0
- package/src/schema/typebox/gen/codegen/model/index.ts +40 -0
- package/src/schema/typebox/gen/codegen/model/model-to-arktype.ts +266 -0
- package/src/schema/typebox/gen/codegen/model/model-to-expression.ts +378 -0
- package/src/schema/typebox/gen/codegen/model/model-to-grpc.ts +244 -0
- package/src/schema/typebox/gen/codegen/model/model-to-io-ts.ts +294 -0
- package/src/schema/typebox/gen/codegen/model/model-to-javascript.ts +42 -0
- package/src/schema/typebox/gen/codegen/model/model-to-json-schema.ts +166 -0
- package/src/schema/typebox/gen/codegen/model/model-to-typebox.ts +32 -0
- package/src/schema/typebox/gen/codegen/model/model-to-typescript.ts +189 -0
- package/src/schema/typebox/gen/codegen/model/model-to-valibot.ts +236 -0
- package/src/schema/typebox/gen/codegen/model/model-to-value.ts +42 -0
- package/src/schema/typebox/gen/codegen/model/model-to-yrel.ts +232 -0
- package/src/schema/typebox/gen/codegen/model/model-to-yup.ts +226 -0
- package/src/schema/typebox/gen/codegen/model/model-to-zod.ts +251 -0
- package/src/schema/typebox/gen/codegen/model/model.ts +33 -0
- package/src/schema/typebox/gen/codegen/typescript/index.ts +28 -0
- package/src/schema/typebox/gen/codegen/typescript/typescript-to-model.ts +61 -0
- package/src/schema/typebox/gen/codegen/typescript/typescript-to-typebox.ts +647 -0
- package/src/schema/typebox/gen/gen.test.ts +12 -0
- package/src/schema/typebox/gen/index.ts +1 -0
- package/src/schema/typebox/index.ts +1 -0
- package/src/schema/typebox/typebox.ts +34 -0
- package/src/server.ts +0 -1
- package/src/servers/fetch/createFetchWithProxyByUndici.ts +16 -1
- package/src/typedoc.ts +2 -1
- package/src/types/index.d.ts +1 -0
- package/lib/servers/fetch/createFetchWithRetry.js.map +0 -1
- package/src/langs/hashCode.ts +0 -37
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
@sinclair/typebox-expression
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in
|
|
17
|
+
all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
THE SOFTWARE.
|
|
26
|
+
|
|
27
|
+
---------------------------------------------------------------------------*/
|
|
28
|
+
|
|
29
|
+
// -------------------------------------------------------------------------
|
|
30
|
+
// Expression: Error
|
|
31
|
+
// -------------------------------------------------------------------------
|
|
32
|
+
export interface ExpressionError {
|
|
33
|
+
expression: Expression;
|
|
34
|
+
path: string;
|
|
35
|
+
value: unknown;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// -------------------------------------------------------------------------
|
|
39
|
+
// Expression: Tree
|
|
40
|
+
// -------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
export type Equatable = string | number | boolean | null | undefined;
|
|
43
|
+
export type Compariable = number | bigint;
|
|
44
|
+
export type TypeOf = 'undefined' | 'symbol' | 'function' | 'string' | 'number' | 'boolean' | 'bigint' | 'object';
|
|
45
|
+
|
|
46
|
+
export interface ExpressionOptions {
|
|
47
|
+
$id?: string;
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
}
|
|
50
|
+
export interface AndExpression extends ExpressionOptions {
|
|
51
|
+
type: 'And';
|
|
52
|
+
expr: Expression[];
|
|
53
|
+
}
|
|
54
|
+
export interface CallExpression<
|
|
55
|
+
E extends Expression = Expression,
|
|
56
|
+
T extends string = string,
|
|
57
|
+
A extends unknown[] = unknown[],
|
|
58
|
+
> extends ExpressionOptions {
|
|
59
|
+
type: 'Call';
|
|
60
|
+
target: T;
|
|
61
|
+
parameters: [...A];
|
|
62
|
+
expr: E;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface ElementsDistinctExpression extends ExpressionOptions {
|
|
66
|
+
type: 'ElementsDistinct';
|
|
67
|
+
}
|
|
68
|
+
export interface ElementsExpression<E extends Expression = Expression> extends ExpressionOptions {
|
|
69
|
+
type: 'Elements';
|
|
70
|
+
expr: E;
|
|
71
|
+
}
|
|
72
|
+
export interface EqualsExpression<T extends Equatable = Equatable> extends ExpressionOptions {
|
|
73
|
+
type: 'Equals';
|
|
74
|
+
value: T;
|
|
75
|
+
}
|
|
76
|
+
export type FunctionExpressionCallback = (value: unknown) => boolean;
|
|
77
|
+
|
|
78
|
+
export interface FunctionExpression<F extends FunctionExpressionCallback = FunctionExpressionCallback>
|
|
79
|
+
extends ExpressionOptions {
|
|
80
|
+
type: 'Function';
|
|
81
|
+
callback: F;
|
|
82
|
+
}
|
|
83
|
+
export interface GreaterThanEqualExpression<T extends Compariable = Compariable> extends ExpressionOptions {
|
|
84
|
+
type: 'GreaterThanEqual';
|
|
85
|
+
value: T;
|
|
86
|
+
}
|
|
87
|
+
export interface GreaterThanExpression<T extends Compariable = Compariable> extends ExpressionOptions {
|
|
88
|
+
type: 'GreaterThan';
|
|
89
|
+
value: T;
|
|
90
|
+
}
|
|
91
|
+
export interface FalseExpression extends ExpressionOptions {
|
|
92
|
+
type: 'False';
|
|
93
|
+
}
|
|
94
|
+
export interface IfThenElseExpression extends ExpressionOptions {
|
|
95
|
+
type: 'IfThenElse';
|
|
96
|
+
if: Expression;
|
|
97
|
+
then: Expression;
|
|
98
|
+
else: Expression;
|
|
99
|
+
}
|
|
100
|
+
export interface InstanceOfExpression<T extends string = string> extends ExpressionOptions {
|
|
101
|
+
type: 'InstanceOf';
|
|
102
|
+
value: T;
|
|
103
|
+
}
|
|
104
|
+
export interface IndexExpression<E extends Expression = Expression, I extends number = number>
|
|
105
|
+
extends ExpressionOptions {
|
|
106
|
+
type: 'Index';
|
|
107
|
+
index: I;
|
|
108
|
+
expr: E;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface IsArrayExpression extends ExpressionOptions {
|
|
112
|
+
type: 'IsArray';
|
|
113
|
+
}
|
|
114
|
+
export interface IsBigIntExpression extends TypeOfExpression<'bigint'> {}
|
|
115
|
+
export interface IsBooleanExpression extends TypeOfExpression<'boolean'> {}
|
|
116
|
+
export interface IsFiniteExpression extends ExpressionOptions {
|
|
117
|
+
type: 'IsFinite';
|
|
118
|
+
}
|
|
119
|
+
export interface IsFunctionExpression extends TypeOfExpression<'function'> {}
|
|
120
|
+
export interface IsIntegerExpression extends ExpressionOptions {
|
|
121
|
+
type: 'IsInteger';
|
|
122
|
+
}
|
|
123
|
+
export interface IsNaNExpression extends ExpressionOptions {
|
|
124
|
+
type: 'IsNaN';
|
|
125
|
+
}
|
|
126
|
+
export interface IsNullExpression extends EqualsExpression<null> {}
|
|
127
|
+
export interface IsNumberExpression extends TypeOfExpression<'number'> {}
|
|
128
|
+
export interface IsSafeIntegerExpression extends ExpressionOptions {
|
|
129
|
+
type: 'IsSafeInteger';
|
|
130
|
+
}
|
|
131
|
+
export interface IsObjectExpression extends TypeOfExpression<'object'> {}
|
|
132
|
+
export interface IsStringExpression extends TypeOfExpression<'string'> {}
|
|
133
|
+
export interface IsSymbolExpression extends TypeOfExpression<'symbol'> {}
|
|
134
|
+
export interface IsUndefinedExpression extends ExpressionOptions {
|
|
135
|
+
type: 'IsUndefined';
|
|
136
|
+
}
|
|
137
|
+
export interface KeyInExpression<T extends string = string> extends ExpressionOptions {
|
|
138
|
+
type: 'KeyIn';
|
|
139
|
+
value: T;
|
|
140
|
+
}
|
|
141
|
+
export interface OrExpression extends ExpressionOptions {
|
|
142
|
+
type: 'Or';
|
|
143
|
+
expr: Expression[];
|
|
144
|
+
}
|
|
145
|
+
export interface NotExpression<E extends Expression = Expression> extends ExpressionOptions {
|
|
146
|
+
type: 'Not';
|
|
147
|
+
expr: E;
|
|
148
|
+
}
|
|
149
|
+
export interface LessThanEqualExpression<T extends Compariable = Compariable> extends ExpressionOptions {
|
|
150
|
+
type: 'LessThanEqual';
|
|
151
|
+
value: T;
|
|
152
|
+
}
|
|
153
|
+
export interface LessThanExpression<T extends Compariable = Compariable> extends ExpressionOptions {
|
|
154
|
+
type: 'LessThan';
|
|
155
|
+
value: T;
|
|
156
|
+
}
|
|
157
|
+
export interface MultipleOfExpression<T extends number = number> extends ExpressionOptions {
|
|
158
|
+
type: 'MultipleOf';
|
|
159
|
+
value: T;
|
|
160
|
+
}
|
|
161
|
+
export interface PropertiesIncludePatternExpression<E extends Expression = Expression> extends ExpressionOptions {
|
|
162
|
+
type: 'PropertiesIncludePattern';
|
|
163
|
+
pattern: string;
|
|
164
|
+
expr: E;
|
|
165
|
+
}
|
|
166
|
+
export interface PropertiesIncludeExpression<E extends Expression = Expression, K extends string[] = string[]>
|
|
167
|
+
extends ExpressionOptions {
|
|
168
|
+
type: 'PropertiesInclude';
|
|
169
|
+
keys: K;
|
|
170
|
+
expr: E;
|
|
171
|
+
}
|
|
172
|
+
export interface PropertiesExcludePatternExpression<E extends Expression = Expression> extends ExpressionOptions {
|
|
173
|
+
type: 'PropertiesExcludePattern';
|
|
174
|
+
pattern: string;
|
|
175
|
+
expr: E;
|
|
176
|
+
}
|
|
177
|
+
export interface PropertiesExcludeExpression<E extends Expression = Expression, K extends string[] = string[]>
|
|
178
|
+
extends ExpressionOptions {
|
|
179
|
+
type: 'PropertiesExclude';
|
|
180
|
+
keys: K;
|
|
181
|
+
expr: E;
|
|
182
|
+
}
|
|
183
|
+
export interface PropertiesLengthExpression<T extends number = number> extends ExpressionOptions {
|
|
184
|
+
type: 'PropertiesLength';
|
|
185
|
+
value: T;
|
|
186
|
+
}
|
|
187
|
+
export interface PropertiesMaximumExpression<T extends number = number> extends ExpressionOptions {
|
|
188
|
+
type: 'PropertiesMaximum';
|
|
189
|
+
value: T;
|
|
190
|
+
}
|
|
191
|
+
export interface PropertiesMinimumExpression<T extends number = number> extends ExpressionOptions {
|
|
192
|
+
type: 'PropertiesMinimum';
|
|
193
|
+
value: T;
|
|
194
|
+
}
|
|
195
|
+
export interface PropertiesExpression<E extends Expression = Expression> extends ExpressionOptions {
|
|
196
|
+
type: 'Properties';
|
|
197
|
+
expr: E;
|
|
198
|
+
}
|
|
199
|
+
export interface PropertyKeysExpression<T extends readonly string[] = string[]> extends ExpressionOptions {
|
|
200
|
+
type: 'PropertyKeys';
|
|
201
|
+
keys: [...T];
|
|
202
|
+
}
|
|
203
|
+
export interface PropertyExpression<E extends Expression = Expression, K extends string = string>
|
|
204
|
+
extends ExpressionOptions {
|
|
205
|
+
type: 'Property';
|
|
206
|
+
key: K;
|
|
207
|
+
expr: E;
|
|
208
|
+
}
|
|
209
|
+
export interface RefExpression<T extends string = string> extends ExpressionOptions {
|
|
210
|
+
type: 'Ref';
|
|
211
|
+
$ref: T;
|
|
212
|
+
}
|
|
213
|
+
export interface IsPatternExpression extends ExpressionOptions {
|
|
214
|
+
type: 'IsPattern';
|
|
215
|
+
pattern: string;
|
|
216
|
+
}
|
|
217
|
+
export interface TrueExpression extends ExpressionOptions {
|
|
218
|
+
type: 'True';
|
|
219
|
+
}
|
|
220
|
+
export interface TypeOfExpression<T extends TypeOf = TypeOf> extends ExpressionOptions {
|
|
221
|
+
type: 'TypeOf';
|
|
222
|
+
value: T;
|
|
223
|
+
}
|
|
224
|
+
export type Expression =
|
|
225
|
+
| AndExpression
|
|
226
|
+
| CallExpression
|
|
227
|
+
| FalseExpression
|
|
228
|
+
| FunctionExpression
|
|
229
|
+
| ElementsDistinctExpression
|
|
230
|
+
| ElementsExpression
|
|
231
|
+
| EqualsExpression
|
|
232
|
+
| GreaterThanExpression
|
|
233
|
+
| GreaterThanEqualExpression
|
|
234
|
+
| IfThenElseExpression
|
|
235
|
+
| IndexExpression
|
|
236
|
+
| InstanceOfExpression
|
|
237
|
+
| IsArrayExpression
|
|
238
|
+
| IsIntegerExpression
|
|
239
|
+
| IsNaNExpression
|
|
240
|
+
| IsObjectExpression
|
|
241
|
+
| IsBigIntExpression
|
|
242
|
+
| IsBooleanExpression
|
|
243
|
+
| IsFiniteExpression
|
|
244
|
+
| IsFunctionExpression
|
|
245
|
+
| IsNullExpression
|
|
246
|
+
| IsNumberExpression
|
|
247
|
+
| IsSafeIntegerExpression
|
|
248
|
+
| IsStringExpression
|
|
249
|
+
| IsSymbolExpression
|
|
250
|
+
| IsUndefinedExpression
|
|
251
|
+
| KeyInExpression
|
|
252
|
+
| LessThanEqualExpression
|
|
253
|
+
| LessThanExpression
|
|
254
|
+
| MultipleOfExpression
|
|
255
|
+
| NotExpression
|
|
256
|
+
| OrExpression
|
|
257
|
+
| PropertiesIncludeExpression
|
|
258
|
+
| PropertiesIncludePatternExpression
|
|
259
|
+
| PropertiesExcludeExpression
|
|
260
|
+
| PropertiesExcludePatternExpression
|
|
261
|
+
| PropertiesLengthExpression
|
|
262
|
+
| PropertiesMaximumExpression
|
|
263
|
+
| PropertiesMinimumExpression
|
|
264
|
+
| PropertiesExpression
|
|
265
|
+
| PropertyKeysExpression
|
|
266
|
+
| PropertyExpression
|
|
267
|
+
| RefExpression
|
|
268
|
+
| IsPatternExpression
|
|
269
|
+
| TrueExpression
|
|
270
|
+
| TypeOfExpression;
|
|
271
|
+
|
|
272
|
+
// ---------------------------------------------------------------
|
|
273
|
+
// Expression: Builder
|
|
274
|
+
// ---------------------------------------------------------------
|
|
275
|
+
|
|
276
|
+
/** Type Expressions builder used to assert JavaScript values */
|
|
277
|
+
export namespace Expression {
|
|
278
|
+
/** Creates a `And` expression where each sub expression is evaluated in sequence */
|
|
279
|
+
export function And<E extends Expression>(
|
|
280
|
+
expressions: (() => Generator<E>) | Array<E>,
|
|
281
|
+
options: ExpressionOptions = {},
|
|
282
|
+
): Expression {
|
|
283
|
+
const expr = globalThis.Array.isArray(expressions) ? expressions : [...expressions()];
|
|
284
|
+
if (expr.length === 0) return Expression.False();
|
|
285
|
+
if (expr.length === 1) return expr[0];
|
|
286
|
+
return { ...options, type: 'And', expr };
|
|
287
|
+
}
|
|
288
|
+
/** Creates a `Call` expression that will invoke the object target and check the return for the given sub expression */
|
|
289
|
+
export function Call<E extends Expression, T extends string, P extends unknown[]>(
|
|
290
|
+
target: T,
|
|
291
|
+
parameters: P,
|
|
292
|
+
expression: E,
|
|
293
|
+
options: ExpressionOptions = {},
|
|
294
|
+
): CallExpression<E, T, P> {
|
|
295
|
+
return { ...options, type: 'Call', target, parameters, expr: expression };
|
|
296
|
+
}
|
|
297
|
+
/** Creates a `Equals` expression that will compare for value equality */
|
|
298
|
+
export function Equals<T extends Equatable>(value: T, options: ExpressionOptions = {}): EqualsExpression<T> {
|
|
299
|
+
return { ...options, type: 'Equals', value };
|
|
300
|
+
}
|
|
301
|
+
/** Creates a `Function` expression which invokes the given callback to check a value */
|
|
302
|
+
export function Function<F extends (value: unknown) => boolean>(
|
|
303
|
+
callback: F,
|
|
304
|
+
options: ExpressionOptions = {},
|
|
305
|
+
): FunctionExpression<F> {
|
|
306
|
+
return { ...options, type: 'Function', callback };
|
|
307
|
+
}
|
|
308
|
+
/** Creates a `ElementsDistinct` expression which will check an arrays elements are structurally distinct */
|
|
309
|
+
export function ElementsDistinct(options: ExpressionOptions = {}): ElementsDistinctExpression {
|
|
310
|
+
return { ...options, type: 'ElementsDistinct' };
|
|
311
|
+
}
|
|
312
|
+
/** Creates a `Elements` expression that will check an arrays elements for the given sub expression */
|
|
313
|
+
export function Elements<E extends Expression>(
|
|
314
|
+
expression: E,
|
|
315
|
+
options: ExpressionOptions = {},
|
|
316
|
+
): ElementsExpression<E> {
|
|
317
|
+
return { ...options, type: 'Elements', expr: expression };
|
|
318
|
+
}
|
|
319
|
+
/** Creates a `False` expression that evaluates `false` */
|
|
320
|
+
export function False(options: ExpressionOptions = {}): FalseExpression {
|
|
321
|
+
return { ...options, type: 'False' };
|
|
322
|
+
}
|
|
323
|
+
/** Creates a `GreaterThanEqual` comparison expression */
|
|
324
|
+
export function GreaterThanEqual<T extends Compariable>(
|
|
325
|
+
value: T,
|
|
326
|
+
options: ExpressionOptions = {},
|
|
327
|
+
): GreaterThanEqualExpression<T> {
|
|
328
|
+
return { ...options, type: 'GreaterThanEqual', value };
|
|
329
|
+
}
|
|
330
|
+
/** Creates a `GreaterThan` comparison expression */
|
|
331
|
+
export function GreaterThan<T extends Compariable>(
|
|
332
|
+
value: T,
|
|
333
|
+
options: ExpressionOptions = {},
|
|
334
|
+
): GreaterThanExpression<T> {
|
|
335
|
+
return { ...options, type: 'GreaterThan', value };
|
|
336
|
+
}
|
|
337
|
+
/** Creates a `IfThenElse` expression that will evaluate the `$if` expression followed by either the `$then` of `$else` expressions */
|
|
338
|
+
export function IfThenElse(
|
|
339
|
+
$if: Expression,
|
|
340
|
+
$then: Expression,
|
|
341
|
+
$else: Expression,
|
|
342
|
+
options: ExpressionOptions = {},
|
|
343
|
+
): IfThenElseExpression {
|
|
344
|
+
return { ...options, type: 'IfThenElse', if: $if, then: $then, else: $else };
|
|
345
|
+
}
|
|
346
|
+
/** Creates a `Index` expression that will evaluate an array element by the given sub expression */
|
|
347
|
+
export function Index<E extends Expression, I extends number>(
|
|
348
|
+
index: I,
|
|
349
|
+
expression: E,
|
|
350
|
+
options: ExpressionOptions = {},
|
|
351
|
+
): IndexExpression<E, I> {
|
|
352
|
+
return { ...options, type: 'Index', index, expr: expression };
|
|
353
|
+
}
|
|
354
|
+
/** Creates a `InstanceOf` expression that will apply the `instanceof` operator */
|
|
355
|
+
export function InstanceOf<T extends string>(value: T, options: ExpressionOptions = {}): InstanceOfExpression<T> {
|
|
356
|
+
return { ...options, type: 'InstanceOf', value };
|
|
357
|
+
}
|
|
358
|
+
/** Creates a `IsArray` expression that will check a value as an array */
|
|
359
|
+
export function IsArray(options: ExpressionOptions = {}): IsArrayExpression {
|
|
360
|
+
return { ...options, type: 'IsArray' };
|
|
361
|
+
}
|
|
362
|
+
/** Creates a `IsNaN` expression that will check for NaN */
|
|
363
|
+
export function IsNaN(options: ExpressionOptions = {}): IsNaNExpression {
|
|
364
|
+
return { ...options, type: 'IsNaN' };
|
|
365
|
+
}
|
|
366
|
+
/** Creates a `IsInteger` expression that will check for numeric integer values */
|
|
367
|
+
export function IsInteger(options: ExpressionOptions = {}): IsIntegerExpression {
|
|
368
|
+
return { ...options, type: 'IsInteger' };
|
|
369
|
+
}
|
|
370
|
+
/** Creates a `IsObject` expression that will check a value as an object */
|
|
371
|
+
export function IsObject(options: ExpressionOptions = {}): IsObjectExpression {
|
|
372
|
+
return Expression.TypeOf('object', options);
|
|
373
|
+
}
|
|
374
|
+
/** Creates a `IsBigInt` expression that will check a value as a bigint */
|
|
375
|
+
export function IsBigInt(options: ExpressionOptions = {}): IsBigIntExpression {
|
|
376
|
+
return Expression.TypeOf('bigint', options);
|
|
377
|
+
}
|
|
378
|
+
/** Creates a `IsBoolean` expression that will check a value as a boolean */
|
|
379
|
+
export function IsBoolean(options: ExpressionOptions = {}): IsBooleanExpression {
|
|
380
|
+
return Expression.TypeOf('boolean', options);
|
|
381
|
+
}
|
|
382
|
+
/** Creates a `IsFinite` expression that will check a numeric value if finite */
|
|
383
|
+
export function IsFinite(options: ExpressionOptions = {}): IsFiniteExpression {
|
|
384
|
+
return { ...options, type: 'IsFinite' };
|
|
385
|
+
}
|
|
386
|
+
/** Creates a `IsFunction` expression that will check a value as a function */
|
|
387
|
+
export function IsFunction(options: ExpressionOptions = {}): IsFunctionExpression {
|
|
388
|
+
return Expression.TypeOf('function', options);
|
|
389
|
+
}
|
|
390
|
+
/** Creates a `IsNumber` expression that will check a value as a number */
|
|
391
|
+
export function IsNumber(options: ExpressionOptions = {}): IsNumberExpression {
|
|
392
|
+
return Expression.TypeOf('number', options);
|
|
393
|
+
}
|
|
394
|
+
/** Creates a `IsSafeInteger` expression that will check a numeric value if finite */
|
|
395
|
+
export function IsSafeInteger(options: ExpressionOptions = {}): IsSafeIntegerExpression {
|
|
396
|
+
return { ...options, type: 'IsSafeInteger' };
|
|
397
|
+
}
|
|
398
|
+
/** Creates a `IsString` expression that will check a value as a string */
|
|
399
|
+
export function IsString(options: ExpressionOptions = {}): IsStringExpression {
|
|
400
|
+
return Expression.TypeOf('string', options);
|
|
401
|
+
}
|
|
402
|
+
/** Creates a `IsSymbol` expression that will check a value as a symbol */
|
|
403
|
+
export function IsSymbol(options: ExpressionOptions = {}): IsSymbolExpression {
|
|
404
|
+
return Expression.TypeOf('symbol', options);
|
|
405
|
+
}
|
|
406
|
+
/** Creates a `IsUndefined` expression that will check a value is undefined */
|
|
407
|
+
export function IsUndefined(options: ExpressionOptions = {}): IsUndefinedExpression {
|
|
408
|
+
return { ...options, type: 'IsUndefined' };
|
|
409
|
+
}
|
|
410
|
+
/** Creates a `IsNull` expression that will check a value is null */
|
|
411
|
+
export function IsNull(options: ExpressionOptions = {}): IsNullExpression {
|
|
412
|
+
return Expression.Equals(null, options);
|
|
413
|
+
}
|
|
414
|
+
/** Creates a `IsPattern` expression that will check a string with a regular expression */
|
|
415
|
+
export function IsPattern(pattern: string, options: ExpressionOptions = {}): IsPatternExpression {
|
|
416
|
+
return { ...options, type: 'IsPattern', pattern };
|
|
417
|
+
}
|
|
418
|
+
/** Creates a KeyIn expression that will check if a key exists on this value */
|
|
419
|
+
export function KeyIn<T extends string>(value: T, options: ExpressionOptions = {}): KeyInExpression<T> {
|
|
420
|
+
return { ...options, type: 'KeyIn', value };
|
|
421
|
+
}
|
|
422
|
+
/** Creates a `LessThanEqual` comparison expression */
|
|
423
|
+
export function LessThanEqual<T extends Compariable>(
|
|
424
|
+
value: T,
|
|
425
|
+
options: ExpressionOptions = {},
|
|
426
|
+
): LessThanEqualExpression<T> {
|
|
427
|
+
return { ...options, type: 'LessThanEqual', value };
|
|
428
|
+
}
|
|
429
|
+
/** Creates a `LessThan` comparison expression */
|
|
430
|
+
export function LessThan<T extends Compariable>(value: T, options: ExpressionOptions = {}): LessThanExpression<T> {
|
|
431
|
+
return { ...options, type: 'LessThan', value };
|
|
432
|
+
}
|
|
433
|
+
/** Creates a `MultipleOf` modulus expression that is true if the result is zero */
|
|
434
|
+
export function MultipleOf<T extends number>(value: T, options: ExpressionOptions = {}): MultipleOfExpression<T> {
|
|
435
|
+
return { ...options, type: 'MultipleOf', value };
|
|
436
|
+
}
|
|
437
|
+
/** Creates a `Not` expression where the result of the sub expression is inverted */
|
|
438
|
+
export function Not<E extends Expression>(expression: E, options: ExpressionOptions = {}): NotExpression<E> {
|
|
439
|
+
return { ...options, type: 'Not', expr: expression };
|
|
440
|
+
}
|
|
441
|
+
/** Creates a `Or` expression where each sub expression is evaluated in sequence */
|
|
442
|
+
export function Or<E extends Expression>(
|
|
443
|
+
expressions: (() => Generator<E>) | Array<E>,
|
|
444
|
+
options: ExpressionOptions = {},
|
|
445
|
+
): Expression {
|
|
446
|
+
const expr = globalThis.Array.isArray(expressions) ? expressions : [...expressions()];
|
|
447
|
+
if (expr.length === 0) return Expression.False();
|
|
448
|
+
if (expr.length === 1) return expr[0];
|
|
449
|
+
return { ...options, type: 'Or', expr };
|
|
450
|
+
}
|
|
451
|
+
/** Creates a `PropertiesExcludePattern` expression that will enumerate each key matching the given regular expression */
|
|
452
|
+
export function PropertiesExcludePattern<E extends Expression>(
|
|
453
|
+
pattern: string,
|
|
454
|
+
expression: E,
|
|
455
|
+
options: ExpressionOptions = {},
|
|
456
|
+
): PropertiesExcludePatternExpression<E> {
|
|
457
|
+
return { ...options, type: 'PropertiesExcludePattern', expr: expression, pattern };
|
|
458
|
+
}
|
|
459
|
+
/** Creates a `PropertiesExclude` expression that will enumerate the unselected keys and check each for the sub expression */
|
|
460
|
+
export function PropertiesExclude<E extends Expression, K extends string[]>(
|
|
461
|
+
keys: K,
|
|
462
|
+
expression: E,
|
|
463
|
+
options: ExpressionOptions = {},
|
|
464
|
+
): PropertiesExcludeExpression<E, K> {
|
|
465
|
+
return { ...options, type: 'PropertiesExclude', expr: expression, keys };
|
|
466
|
+
}
|
|
467
|
+
/** Creates a `PropertiesIncludePattern` expression that will enumerate each key matching the given regular expression */
|
|
468
|
+
export function PropertiesIncludePattern<E extends Expression>(
|
|
469
|
+
pattern: string,
|
|
470
|
+
expression: E,
|
|
471
|
+
options: ExpressionOptions = {},
|
|
472
|
+
): PropertiesIncludePatternExpression<E> {
|
|
473
|
+
return { ...options, type: 'PropertiesIncludePattern', expr: expression, pattern };
|
|
474
|
+
}
|
|
475
|
+
/** Creates a `PropertiesInclude` expression that will enumerate the selected keys and check each for the sub expression */
|
|
476
|
+
export function PropertiesInclude<E extends Expression, K extends string[]>(
|
|
477
|
+
keys: K,
|
|
478
|
+
expression: E,
|
|
479
|
+
options: ExpressionOptions = {},
|
|
480
|
+
): PropertiesIncludeExpression<E, K> {
|
|
481
|
+
return { ...options, type: 'PropertiesInclude', expr: expression, keys };
|
|
482
|
+
}
|
|
483
|
+
/** Creates a `PropertiesLength` expression that checks an object a property length that equals the given value */
|
|
484
|
+
export function PropertiesLength<T extends number>(
|
|
485
|
+
value: T,
|
|
486
|
+
options: ExpressionOptions = {},
|
|
487
|
+
): PropertiesLengthExpression<T> {
|
|
488
|
+
return { ...options, type: 'PropertiesLength', value };
|
|
489
|
+
}
|
|
490
|
+
/** Creates a `PropertiesMaximum` expression that will check an object has a property length less or equal the given value */
|
|
491
|
+
export function PropertiesMaximum<T extends number>(
|
|
492
|
+
value: T,
|
|
493
|
+
options: ExpressionOptions = {},
|
|
494
|
+
): PropertiesMaximumExpression<T> {
|
|
495
|
+
return { ...options, type: 'PropertiesMaximum', value };
|
|
496
|
+
}
|
|
497
|
+
/** Creates a `PropertiesMinimum` expression that will check an object has a property length greater or equal the given value */
|
|
498
|
+
export function PropertiesMinimum<T extends number>(
|
|
499
|
+
value: T,
|
|
500
|
+
options: ExpressionOptions = {},
|
|
501
|
+
): PropertiesMinimumExpression<T> {
|
|
502
|
+
return { ...options, type: 'PropertiesMinimum', value };
|
|
503
|
+
}
|
|
504
|
+
/** Creates a `Properties` expression that will enumerate all object properties and check for the given sub expression */
|
|
505
|
+
export function Properties<E extends Expression>(
|
|
506
|
+
expression: E,
|
|
507
|
+
options: ExpressionOptions = {},
|
|
508
|
+
): PropertiesExpression<E> {
|
|
509
|
+
return { ...options, type: 'Properties', expr: expression };
|
|
510
|
+
}
|
|
511
|
+
/** Creates a `PropertyKeys` expression that will check an object has the specified keys */
|
|
512
|
+
export function PropertyKeys<T extends string[]>(
|
|
513
|
+
keys: T,
|
|
514
|
+
options: ExpressionOptions = {},
|
|
515
|
+
): PropertyKeysExpression<T> {
|
|
516
|
+
return { ...options, type: 'PropertyKeys', keys };
|
|
517
|
+
}
|
|
518
|
+
/** Creates a `Property` expression that will evaluate the property value by the given sub expression */
|
|
519
|
+
export function Property<E extends Expression, K extends string>(
|
|
520
|
+
key: K,
|
|
521
|
+
expression: E,
|
|
522
|
+
options: ExpressionOptions = {},
|
|
523
|
+
): PropertyExpression<E, K> {
|
|
524
|
+
return { ...options, type: 'Property', key, expr: expression };
|
|
525
|
+
}
|
|
526
|
+
/** Creates a `Ref` that will reference another part of the expression tree via $id */
|
|
527
|
+
export function Ref<T extends string>(value: T, options: ExpressionOptions = {}): RefExpression<T> {
|
|
528
|
+
return { ...options, type: 'Ref', $ref: value };
|
|
529
|
+
}
|
|
530
|
+
/** Creates a `True` expression that evaluates `true` */
|
|
531
|
+
export function True(options: ExpressionOptions = {}): TrueExpression {
|
|
532
|
+
return { ...options, type: 'True' };
|
|
533
|
+
}
|
|
534
|
+
/** Creates a `TypeOf` expression that will apply `typeof` operator for the evaluated value */
|
|
535
|
+
export function TypeOf<E extends TypeOf>(value: E, options: ExpressionOptions = {}): TypeOfExpression<E> {
|
|
536
|
+
return { ...options, type: 'TypeOf', value };
|
|
537
|
+
}
|
|
538
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
@sinclair/typebox-expression
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in
|
|
17
|
+
all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
THE SOFTWARE.
|
|
26
|
+
|
|
27
|
+
---------------------------------------------------------------------------*/
|
|
28
|
+
|
|
29
|
+
export * from './compiler';
|
|
30
|
+
export * from './errors';
|
|
31
|
+
export * from './evaluator';
|
|
32
|
+
export * from './expression';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
@sinclair/typebox-codegen
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
---------------------------------------------------------------------------*/
|
|
26
|
+
|
|
27
|
+
export * from './common';
|
|
28
|
+
export * from './model';
|
|
29
|
+
export * from './typescript';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
@sinclair/typebox-codegen
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
---------------------------------------------------------------------------*/
|
|
26
|
+
|
|
27
|
+
export * from './model-to-arktype';
|
|
28
|
+
export * from './model-to-expression';
|
|
29
|
+
export * from './model-to-grpc';
|
|
30
|
+
export * from './model-to-io-ts';
|
|
31
|
+
export * from './model-to-javascript';
|
|
32
|
+
export * from './model-to-json-schema';
|
|
33
|
+
export * from './model-to-typebox';
|
|
34
|
+
export * from './model-to-typescript';
|
|
35
|
+
export * from './model-to-valibot';
|
|
36
|
+
export * from './model-to-value';
|
|
37
|
+
export * from './model-to-yrel';
|
|
38
|
+
export * from './model-to-yup';
|
|
39
|
+
export * from './model-to-zod';
|
|
40
|
+
export * from './model';
|