@wener/utils 1.1.32 → 1.1.35
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/lib/asyncs/nextOfAsyncIterator.js +8 -0
- package/lib/asyncs/nextOfAsyncIterator.js.map +1 -1
- package/lib/asyncs/timeout.js +9 -5
- package/lib/asyncs/timeout.js.map +1 -1
- package/lib/cn/index.js +3 -0
- package/lib/cn/index.js.map +1 -0
- package/lib/cn/parseChineseNumber.js +94 -0
- package/lib/cn/parseChineseNumber.js.map +1 -0
- package/lib/crypto/getRandomValues.js +6 -3
- package/lib/crypto/getRandomValues.js.map +1 -1
- package/lib/errors/Errors.js +1 -1
- package/lib/errors/Errors.js.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/io/Bytes.js +51 -0
- package/lib/io/Bytes.js.map +1 -0
- package/lib/isomorphics/structuredClone.js +1 -3
- package/lib/isomorphics/structuredClone.js.map +1 -1
- package/lib/langs/AsyncCloser.js +40 -0
- package/lib/langs/AsyncCloser.js.map +1 -0
- package/lib/langs/Closer.js +34 -0
- package/lib/langs/Closer.js.map +1 -0
- package/lib/logging/Logger.js.map +1 -1
- package/lib/logging/slog.js.map +1 -1
- package/lib/objects/merge/merge.js +1 -0
- package/lib/schema/typebox/gen/codegen/common/encoder.js +0 -6
- package/lib/schema/typebox/gen/codegen/common/encoder.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/common/formatter.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/common/index.js +25 -1
- package/lib/schema/typebox/gen/codegen/common/jsdoc.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/expression/compiler.js +2 -5
- package/lib/schema/typebox/gen/codegen/expression/compiler.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/expression/errors.js +1 -1
- package/lib/schema/typebox/gen/codegen/expression/errors.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/expression/evaluator.js +1 -1
- package/lib/schema/typebox/gen/codegen/expression/evaluator.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/expression/expression.js +48 -51
- package/lib/schema/typebox/gen/codegen/expression/expression.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/expression/index.js +27 -1
- package/lib/schema/typebox/gen/codegen/index.js +25 -1
- package/lib/schema/typebox/gen/codegen/model/index.js +25 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-arktype.js +25 -4
- package/lib/schema/typebox/gen/codegen/model/model-to-arktype.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-expression.js +26 -2
- package/lib/schema/typebox/gen/codegen/model/model-to-expression.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-grpc.js +25 -4
- package/lib/schema/typebox/gen/codegen/model/model-to-grpc.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-io-ts.js +25 -4
- package/lib/schema/typebox/gen/codegen/model/model-to-io-ts.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-javascript.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-json-schema.js +25 -4
- package/lib/schema/typebox/gen/codegen/model/model-to-json-schema.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-typebox.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-typescript.js +25 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-typescript.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-valibot.js +25 -4
- package/lib/schema/typebox/gen/codegen/model/model-to-valibot.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-value.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-yrel.js +25 -4
- package/lib/schema/typebox/gen/codegen/model/model-to-yrel.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-yup.js +25 -4
- package/lib/schema/typebox/gen/codegen/model/model-to-yup.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/model/model-to-zod.js +25 -4
- package/lib/schema/typebox/gen/codegen/model/model-to-zod.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/model/model.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/typescript/index.js +25 -1
- package/lib/schema/typebox/gen/codegen/typescript/typescript-to-model.js +25 -1
- package/lib/schema/typebox/gen/codegen/typescript/typescript-to-model.js.map +1 -1
- package/lib/schema/typebox/gen/codegen/typescript/typescript-to-typebox.js +27 -3
- package/lib/schema/typebox/gen/codegen/typescript/typescript-to-typebox.js.map +1 -1
- package/lib/server/crypto/md5.js.map +1 -0
- package/lib/server/fetch/createFetchWithProxy.js.map +1 -0
- package/lib/server/fetch/createFetchWithProxyByNodeFetch.js.map +1 -0
- package/lib/server/fetch/createFetchWithProxyByUndici.js.map +1 -0
- package/lib/server/getPackageDir.js.map +1 -0
- package/lib/server/index.js +7 -0
- package/lib/server/index.js.map +1 -0
- package/lib/server/jsdom.js.map +1 -0
- package/lib/server/node-fetch.js.map +1 -0
- package/lib/server/polyfill/polyfillBrowser.js.map +1 -0
- package/lib/server/polyfill/polyfillCrypto.js.map +1 -0
- package/lib/server/polyfill/polyfillFetch.js.map +1 -0
- package/lib/server/polyfill/polyfillJsDom.js.map +1 -0
- package/lib/{servers → server}/polyfill/polyfillWebSocket.js +5 -0
- package/lib/server/polyfill/polyfillWebSocket.js.map +1 -0
- package/lib/server/ws.js.map +1 -0
- package/lib/{types/index.d.js → types.d.js} +1 -1
- package/lib/types.d.js.map +1 -0
- package/package.json +37 -71
- package/src/asyncs/nextOfAsyncIterator.ts +13 -1
- package/src/asyncs/timeout.ts +15 -12
- package/src/cn/index.ts +1 -0
- package/src/cn/parseChineseNumber.test.ts +24 -0
- package/src/cn/parseChineseNumber.ts +97 -0
- package/src/crypto/getRandomValues.ts +5 -3
- package/src/crypto/hashing.test.ts +1 -1
- package/src/errors/Errors.test.ts +22 -0
- package/src/errors/Errors.ts +1 -4
- package/src/index.ts +2 -0
- package/src/io/Bytes.ts +64 -0
- package/src/isomorphics/structuredClone.ts +0 -3
- package/src/langs/AsyncCloser.ts +45 -0
- package/src/langs/Closer.ts +39 -0
- package/src/server/index.ts +6 -0
- package/src/{servers → server}/polyfill/polyfillWebSocket.ts +5 -0
- package/src/{types/index.d.ts → types.d.ts} +12 -0
- package/tsconfig.json +7 -5
- package/index.ts +0 -1
- package/lib/server.js +0 -7
- package/lib/server.js.map +0 -1
- package/lib/servers/crypto/md5.js.map +0 -1
- package/lib/servers/fetch/createFetchWithProxy.js.map +0 -1
- package/lib/servers/fetch/createFetchWithProxyByNodeFetch.js.map +0 -1
- package/lib/servers/fetch/createFetchWithProxyByUndici.js.map +0 -1
- package/lib/servers/getPackageDir.js.map +0 -1
- package/lib/servers/jsdom.js.map +0 -1
- package/lib/servers/node-fetch.js.map +0 -1
- package/lib/servers/polyfill/polyfillBrowser.js.map +0 -1
- package/lib/servers/polyfill/polyfillCrypto.js.map +0 -1
- package/lib/servers/polyfill/polyfillFetch.js.map +0 -1
- package/lib/servers/polyfill/polyfillJsDom.js.map +0 -1
- package/lib/servers/polyfill/polyfillWebSocket.js.map +0 -1
- package/lib/servers/ws.js.map +0 -1
- package/lib/types/global.d.js +0 -2
- package/lib/types/global.d.js.map +0 -1
- package/lib/types/index.d.js.map +0 -1
- package/schema/typebox/gen/index.ts +0 -1
- package/schema/typebox/index.ts +0 -1
- package/server/jsdom.ts +0 -1
- package/server/node-fetch.ts +0 -1
- package/server/ws.ts +0 -1
- package/server.ts +0 -1
- package/src/server.ts +0 -6
- package/src/types/global.d.ts +0 -11
- package/types.d.ts +0 -1
- /package/lib/{servers → server}/crypto/md5.js +0 -0
- /package/lib/{servers → server}/fetch/createFetchWithProxy.js +0 -0
- /package/lib/{servers → server}/fetch/createFetchWithProxyByNodeFetch.js +0 -0
- /package/lib/{servers → server}/fetch/createFetchWithProxyByUndici.js +0 -0
- /package/lib/{servers → server}/getPackageDir.js +0 -0
- /package/lib/{servers → server}/jsdom.js +0 -0
- /package/lib/{servers → server}/node-fetch.js +0 -0
- /package/lib/{servers → server}/polyfill/polyfillBrowser.js +0 -0
- /package/lib/{servers → server}/polyfill/polyfillCrypto.js +0 -0
- /package/lib/{servers → server}/polyfill/polyfillFetch.js +0 -0
- /package/lib/{servers → server}/polyfill/polyfillJsDom.js +0 -0
- /package/lib/{servers → server}/ws.js +0 -0
- /package/src/{servers → server}/crypto/md5.ts +0 -0
- /package/src/{servers → server}/fetch/createFetchWithProxy.ts +0 -0
- /package/src/{servers → server}/fetch/createFetchWithProxyByNodeFetch.ts +0 -0
- /package/src/{servers → server}/fetch/createFetchWithProxyByUndici.ts +0 -0
- /package/src/{servers → server}/getPackageDir.ts +0 -0
- /package/src/{servers → server}/jsdom.ts +0 -0
- /package/src/{servers → server}/node-fetch.ts +0 -0
- /package/src/{servers → server}/polyfill/polyfillBrowser.test.ts +0 -0
- /package/src/{servers → server}/polyfill/polyfillBrowser.ts +0 -0
- /package/src/{servers → server}/polyfill/polyfillCrypto.ts +0 -0
- /package/src/{servers → server}/polyfill/polyfillFetch.ts +0 -0
- /package/src/{servers → server}/polyfill/polyfillJsDom.ts +0 -0
- /package/src/{servers → server}/ws.ts +0 -0
|
@@ -27,11 +27,8 @@ THE SOFTWARE.
|
|
|
27
27
|
---------------------------------------------------------------------------*/ // -------------------------------------------------------------------------
|
|
28
28
|
// Expression: Error
|
|
29
29
|
// -------------------------------------------------------------------------
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// ---------------------------------------------------------------
|
|
33
|
-
/** Type Expressions builder used to assert JavaScript values */ export var Expression;
|
|
34
|
-
(function(Expression1) {
|
|
30
|
+
export var Expression;
|
|
31
|
+
(function(Expression) {
|
|
35
32
|
function And(expressions, options = {}) {
|
|
36
33
|
const expr = globalThis.Array.isArray(expressions) ? expressions : [
|
|
37
34
|
...expressions()
|
|
@@ -44,7 +41,7 @@ THE SOFTWARE.
|
|
|
44
41
|
expr
|
|
45
42
|
};
|
|
46
43
|
}
|
|
47
|
-
|
|
44
|
+
/** Creates a `And` expression where each sub expression is evaluated in sequence */ Expression.And = And;
|
|
48
45
|
function Call(target, parameters, expression, options = {}) {
|
|
49
46
|
return {
|
|
50
47
|
...options,
|
|
@@ -54,7 +51,7 @@ THE SOFTWARE.
|
|
|
54
51
|
expr: expression
|
|
55
52
|
};
|
|
56
53
|
}
|
|
57
|
-
|
|
54
|
+
/** Creates a `Call` expression that will invoke the object target and check the return for the given sub expression */ Expression.Call = Call;
|
|
58
55
|
function Equals(value, options = {}) {
|
|
59
56
|
return {
|
|
60
57
|
...options,
|
|
@@ -62,7 +59,7 @@ THE SOFTWARE.
|
|
|
62
59
|
value
|
|
63
60
|
};
|
|
64
61
|
}
|
|
65
|
-
|
|
62
|
+
/** Creates a `Equals` expression that will compare for value equality */ Expression.Equals = Equals;
|
|
66
63
|
function Function(callback, options = {}) {
|
|
67
64
|
return {
|
|
68
65
|
...options,
|
|
@@ -70,14 +67,14 @@ THE SOFTWARE.
|
|
|
70
67
|
callback
|
|
71
68
|
};
|
|
72
69
|
}
|
|
73
|
-
|
|
70
|
+
/** Creates a `Function` expression which invokes the given callback to check a value */ Expression.Function = Function;
|
|
74
71
|
function ElementsDistinct(options = {}) {
|
|
75
72
|
return {
|
|
76
73
|
...options,
|
|
77
74
|
type: 'ElementsDistinct'
|
|
78
75
|
};
|
|
79
76
|
}
|
|
80
|
-
|
|
77
|
+
/** Creates a `ElementsDistinct` expression which will check an arrays elements are structurally distinct */ Expression.ElementsDistinct = ElementsDistinct;
|
|
81
78
|
function Elements(expression, options = {}) {
|
|
82
79
|
return {
|
|
83
80
|
...options,
|
|
@@ -85,14 +82,14 @@ THE SOFTWARE.
|
|
|
85
82
|
expr: expression
|
|
86
83
|
};
|
|
87
84
|
}
|
|
88
|
-
|
|
85
|
+
/** Creates a `Elements` expression that will check an arrays elements for the given sub expression */ Expression.Elements = Elements;
|
|
89
86
|
function False(options = {}) {
|
|
90
87
|
return {
|
|
91
88
|
...options,
|
|
92
89
|
type: 'False'
|
|
93
90
|
};
|
|
94
91
|
}
|
|
95
|
-
|
|
92
|
+
/** Creates a `False` expression that evaluates `false` */ Expression.False = False;
|
|
96
93
|
function GreaterThanEqual(value, options = {}) {
|
|
97
94
|
return {
|
|
98
95
|
...options,
|
|
@@ -100,7 +97,7 @@ THE SOFTWARE.
|
|
|
100
97
|
value
|
|
101
98
|
};
|
|
102
99
|
}
|
|
103
|
-
|
|
100
|
+
/** Creates a `GreaterThanEqual` comparison expression */ Expression.GreaterThanEqual = GreaterThanEqual;
|
|
104
101
|
function GreaterThan(value, options = {}) {
|
|
105
102
|
return {
|
|
106
103
|
...options,
|
|
@@ -108,7 +105,7 @@ THE SOFTWARE.
|
|
|
108
105
|
value
|
|
109
106
|
};
|
|
110
107
|
}
|
|
111
|
-
|
|
108
|
+
/** Creates a `GreaterThan` comparison expression */ Expression.GreaterThan = GreaterThan;
|
|
112
109
|
function IfThenElse($if, $then, $else, options = {}) {
|
|
113
110
|
return {
|
|
114
111
|
...options,
|
|
@@ -118,7 +115,7 @@ THE SOFTWARE.
|
|
|
118
115
|
else: $else
|
|
119
116
|
};
|
|
120
117
|
}
|
|
121
|
-
|
|
118
|
+
/** Creates a `IfThenElse` expression that will evaluate the `$if` expression followed by either the `$then` of `$else` expressions */ Expression.IfThenElse = IfThenElse;
|
|
122
119
|
function Index(index, expression, options = {}) {
|
|
123
120
|
return {
|
|
124
121
|
...options,
|
|
@@ -127,7 +124,7 @@ THE SOFTWARE.
|
|
|
127
124
|
expr: expression
|
|
128
125
|
};
|
|
129
126
|
}
|
|
130
|
-
|
|
127
|
+
/** Creates a `Index` expression that will evaluate an array element by the given sub expression */ Expression.Index = Index;
|
|
131
128
|
function InstanceOf(value, options = {}) {
|
|
132
129
|
return {
|
|
133
130
|
...options,
|
|
@@ -135,81 +132,81 @@ THE SOFTWARE.
|
|
|
135
132
|
value
|
|
136
133
|
};
|
|
137
134
|
}
|
|
138
|
-
|
|
135
|
+
/** Creates a `InstanceOf` expression that will apply the `instanceof` operator */ Expression.InstanceOf = InstanceOf;
|
|
139
136
|
function IsArray(options = {}) {
|
|
140
137
|
return {
|
|
141
138
|
...options,
|
|
142
139
|
type: 'IsArray'
|
|
143
140
|
};
|
|
144
141
|
}
|
|
145
|
-
|
|
142
|
+
/** Creates a `IsArray` expression that will check a value as an array */ Expression.IsArray = IsArray;
|
|
146
143
|
function IsNaN(options = {}) {
|
|
147
144
|
return {
|
|
148
145
|
...options,
|
|
149
146
|
type: 'IsNaN'
|
|
150
147
|
};
|
|
151
148
|
}
|
|
152
|
-
|
|
149
|
+
/** Creates a `IsNaN` expression that will check for NaN */ Expression.IsNaN = IsNaN;
|
|
153
150
|
function IsInteger(options = {}) {
|
|
154
151
|
return {
|
|
155
152
|
...options,
|
|
156
153
|
type: 'IsInteger'
|
|
157
154
|
};
|
|
158
155
|
}
|
|
159
|
-
|
|
156
|
+
/** Creates a `IsInteger` expression that will check for numeric integer values */ Expression.IsInteger = IsInteger;
|
|
160
157
|
function IsObject(options = {}) {
|
|
161
158
|
return Expression.TypeOf('object', options);
|
|
162
159
|
}
|
|
163
|
-
|
|
160
|
+
/** Creates a `IsObject` expression that will check a value as an object */ Expression.IsObject = IsObject;
|
|
164
161
|
function IsBigInt(options = {}) {
|
|
165
162
|
return Expression.TypeOf('bigint', options);
|
|
166
163
|
}
|
|
167
|
-
|
|
164
|
+
/** Creates a `IsBigInt` expression that will check a value as a bigint */ Expression.IsBigInt = IsBigInt;
|
|
168
165
|
function IsBoolean(options = {}) {
|
|
169
166
|
return Expression.TypeOf('boolean', options);
|
|
170
167
|
}
|
|
171
|
-
|
|
168
|
+
/** Creates a `IsBoolean` expression that will check a value as a boolean */ Expression.IsBoolean = IsBoolean;
|
|
172
169
|
function IsFinite(options = {}) {
|
|
173
170
|
return {
|
|
174
171
|
...options,
|
|
175
172
|
type: 'IsFinite'
|
|
176
173
|
};
|
|
177
174
|
}
|
|
178
|
-
|
|
175
|
+
/** Creates a `IsFinite` expression that will check a numeric value if finite */ Expression.IsFinite = IsFinite;
|
|
179
176
|
function IsFunction(options = {}) {
|
|
180
177
|
return Expression.TypeOf('function', options);
|
|
181
178
|
}
|
|
182
|
-
|
|
179
|
+
/** Creates a `IsFunction` expression that will check a value as a function */ Expression.IsFunction = IsFunction;
|
|
183
180
|
function IsNumber(options = {}) {
|
|
184
181
|
return Expression.TypeOf('number', options);
|
|
185
182
|
}
|
|
186
|
-
|
|
183
|
+
/** Creates a `IsNumber` expression that will check a value as a number */ Expression.IsNumber = IsNumber;
|
|
187
184
|
function IsSafeInteger(options = {}) {
|
|
188
185
|
return {
|
|
189
186
|
...options,
|
|
190
187
|
type: 'IsSafeInteger'
|
|
191
188
|
};
|
|
192
189
|
}
|
|
193
|
-
|
|
190
|
+
/** Creates a `IsSafeInteger` expression that will check a numeric value if finite */ Expression.IsSafeInteger = IsSafeInteger;
|
|
194
191
|
function IsString(options = {}) {
|
|
195
192
|
return Expression.TypeOf('string', options);
|
|
196
193
|
}
|
|
197
|
-
|
|
194
|
+
/** Creates a `IsString` expression that will check a value as a string */ Expression.IsString = IsString;
|
|
198
195
|
function IsSymbol(options = {}) {
|
|
199
196
|
return Expression.TypeOf('symbol', options);
|
|
200
197
|
}
|
|
201
|
-
|
|
198
|
+
/** Creates a `IsSymbol` expression that will check a value as a symbol */ Expression.IsSymbol = IsSymbol;
|
|
202
199
|
function IsUndefined(options = {}) {
|
|
203
200
|
return {
|
|
204
201
|
...options,
|
|
205
202
|
type: 'IsUndefined'
|
|
206
203
|
};
|
|
207
204
|
}
|
|
208
|
-
|
|
205
|
+
/** Creates a `IsUndefined` expression that will check a value is undefined */ Expression.IsUndefined = IsUndefined;
|
|
209
206
|
function IsNull(options = {}) {
|
|
210
207
|
return Expression.Equals(null, options);
|
|
211
208
|
}
|
|
212
|
-
|
|
209
|
+
/** Creates a `IsNull` expression that will check a value is null */ Expression.IsNull = IsNull;
|
|
213
210
|
function IsPattern(pattern, options = {}) {
|
|
214
211
|
return {
|
|
215
212
|
...options,
|
|
@@ -217,7 +214,7 @@ THE SOFTWARE.
|
|
|
217
214
|
pattern
|
|
218
215
|
};
|
|
219
216
|
}
|
|
220
|
-
|
|
217
|
+
/** Creates a `IsPattern` expression that will check a string with a regular expression */ Expression.IsPattern = IsPattern;
|
|
221
218
|
function KeyIn(value, options = {}) {
|
|
222
219
|
return {
|
|
223
220
|
...options,
|
|
@@ -225,7 +222,7 @@ THE SOFTWARE.
|
|
|
225
222
|
value
|
|
226
223
|
};
|
|
227
224
|
}
|
|
228
|
-
|
|
225
|
+
/** Creates a KeyIn expression that will check if a key exists on this value */ Expression.KeyIn = KeyIn;
|
|
229
226
|
function LessThanEqual(value, options = {}) {
|
|
230
227
|
return {
|
|
231
228
|
...options,
|
|
@@ -233,7 +230,7 @@ THE SOFTWARE.
|
|
|
233
230
|
value
|
|
234
231
|
};
|
|
235
232
|
}
|
|
236
|
-
|
|
233
|
+
/** Creates a `LessThanEqual` comparison expression */ Expression.LessThanEqual = LessThanEqual;
|
|
237
234
|
function LessThan(value, options = {}) {
|
|
238
235
|
return {
|
|
239
236
|
...options,
|
|
@@ -241,7 +238,7 @@ THE SOFTWARE.
|
|
|
241
238
|
value
|
|
242
239
|
};
|
|
243
240
|
}
|
|
244
|
-
|
|
241
|
+
/** Creates a `LessThan` comparison expression */ Expression.LessThan = LessThan;
|
|
245
242
|
function MultipleOf(value, options = {}) {
|
|
246
243
|
return {
|
|
247
244
|
...options,
|
|
@@ -249,7 +246,7 @@ THE SOFTWARE.
|
|
|
249
246
|
value
|
|
250
247
|
};
|
|
251
248
|
}
|
|
252
|
-
|
|
249
|
+
/** Creates a `MultipleOf` modulus expression that is true if the result is zero */ Expression.MultipleOf = MultipleOf;
|
|
253
250
|
function Not(expression, options = {}) {
|
|
254
251
|
return {
|
|
255
252
|
...options,
|
|
@@ -257,7 +254,7 @@ THE SOFTWARE.
|
|
|
257
254
|
expr: expression
|
|
258
255
|
};
|
|
259
256
|
}
|
|
260
|
-
|
|
257
|
+
/** Creates a `Not` expression where the result of the sub expression is inverted */ Expression.Not = Not;
|
|
261
258
|
function Or(expressions, options = {}) {
|
|
262
259
|
const expr = globalThis.Array.isArray(expressions) ? expressions : [
|
|
263
260
|
...expressions()
|
|
@@ -270,7 +267,7 @@ THE SOFTWARE.
|
|
|
270
267
|
expr
|
|
271
268
|
};
|
|
272
269
|
}
|
|
273
|
-
|
|
270
|
+
/** Creates a `Or` expression where each sub expression is evaluated in sequence */ Expression.Or = Or;
|
|
274
271
|
function PropertiesExcludePattern(pattern, expression, options = {}) {
|
|
275
272
|
return {
|
|
276
273
|
...options,
|
|
@@ -279,7 +276,7 @@ THE SOFTWARE.
|
|
|
279
276
|
pattern
|
|
280
277
|
};
|
|
281
278
|
}
|
|
282
|
-
|
|
279
|
+
/** Creates a `PropertiesExcludePattern` expression that will enumerate each key matching the given regular expression */ Expression.PropertiesExcludePattern = PropertiesExcludePattern;
|
|
283
280
|
function PropertiesExclude(keys, expression, options = {}) {
|
|
284
281
|
return {
|
|
285
282
|
...options,
|
|
@@ -288,7 +285,7 @@ THE SOFTWARE.
|
|
|
288
285
|
keys
|
|
289
286
|
};
|
|
290
287
|
}
|
|
291
|
-
|
|
288
|
+
/** Creates a `PropertiesExclude` expression that will enumerate the unselected keys and check each for the sub expression */ Expression.PropertiesExclude = PropertiesExclude;
|
|
292
289
|
function PropertiesIncludePattern(pattern, expression, options = {}) {
|
|
293
290
|
return {
|
|
294
291
|
...options,
|
|
@@ -297,7 +294,7 @@ THE SOFTWARE.
|
|
|
297
294
|
pattern
|
|
298
295
|
};
|
|
299
296
|
}
|
|
300
|
-
|
|
297
|
+
/** Creates a `PropertiesIncludePattern` expression that will enumerate each key matching the given regular expression */ Expression.PropertiesIncludePattern = PropertiesIncludePattern;
|
|
301
298
|
function PropertiesInclude(keys, expression, options = {}) {
|
|
302
299
|
return {
|
|
303
300
|
...options,
|
|
@@ -306,7 +303,7 @@ THE SOFTWARE.
|
|
|
306
303
|
keys
|
|
307
304
|
};
|
|
308
305
|
}
|
|
309
|
-
|
|
306
|
+
/** Creates a `PropertiesInclude` expression that will enumerate the selected keys and check each for the sub expression */ Expression.PropertiesInclude = PropertiesInclude;
|
|
310
307
|
function PropertiesLength(value, options = {}) {
|
|
311
308
|
return {
|
|
312
309
|
...options,
|
|
@@ -314,7 +311,7 @@ THE SOFTWARE.
|
|
|
314
311
|
value
|
|
315
312
|
};
|
|
316
313
|
}
|
|
317
|
-
|
|
314
|
+
/** Creates a `PropertiesLength` expression that checks an object a property length that equals the given value */ Expression.PropertiesLength = PropertiesLength;
|
|
318
315
|
function PropertiesMaximum(value, options = {}) {
|
|
319
316
|
return {
|
|
320
317
|
...options,
|
|
@@ -322,7 +319,7 @@ THE SOFTWARE.
|
|
|
322
319
|
value
|
|
323
320
|
};
|
|
324
321
|
}
|
|
325
|
-
|
|
322
|
+
/** Creates a `PropertiesMaximum` expression that will check an object has a property length less or equal the given value */ Expression.PropertiesMaximum = PropertiesMaximum;
|
|
326
323
|
function PropertiesMinimum(value, options = {}) {
|
|
327
324
|
return {
|
|
328
325
|
...options,
|
|
@@ -330,7 +327,7 @@ THE SOFTWARE.
|
|
|
330
327
|
value
|
|
331
328
|
};
|
|
332
329
|
}
|
|
333
|
-
|
|
330
|
+
/** Creates a `PropertiesMinimum` expression that will check an object has a property length greater or equal the given value */ Expression.PropertiesMinimum = PropertiesMinimum;
|
|
334
331
|
function Properties(expression, options = {}) {
|
|
335
332
|
return {
|
|
336
333
|
...options,
|
|
@@ -338,7 +335,7 @@ THE SOFTWARE.
|
|
|
338
335
|
expr: expression
|
|
339
336
|
};
|
|
340
337
|
}
|
|
341
|
-
|
|
338
|
+
/** Creates a `Properties` expression that will enumerate all object properties and check for the given sub expression */ Expression.Properties = Properties;
|
|
342
339
|
function PropertyKeys(keys, options = {}) {
|
|
343
340
|
return {
|
|
344
341
|
...options,
|
|
@@ -346,7 +343,7 @@ THE SOFTWARE.
|
|
|
346
343
|
keys
|
|
347
344
|
};
|
|
348
345
|
}
|
|
349
|
-
|
|
346
|
+
/** Creates a `PropertyKeys` expression that will check an object has the specified keys */ Expression.PropertyKeys = PropertyKeys;
|
|
350
347
|
function Property(key, expression, options = {}) {
|
|
351
348
|
return {
|
|
352
349
|
...options,
|
|
@@ -355,7 +352,7 @@ THE SOFTWARE.
|
|
|
355
352
|
expr: expression
|
|
356
353
|
};
|
|
357
354
|
}
|
|
358
|
-
|
|
355
|
+
/** Creates a `Property` expression that will evaluate the property value by the given sub expression */ Expression.Property = Property;
|
|
359
356
|
function Ref(value, options = {}) {
|
|
360
357
|
return {
|
|
361
358
|
...options,
|
|
@@ -363,14 +360,14 @@ THE SOFTWARE.
|
|
|
363
360
|
$ref: value
|
|
364
361
|
};
|
|
365
362
|
}
|
|
366
|
-
|
|
363
|
+
/** Creates a `Ref` that will reference another part of the expression tree via $id */ Expression.Ref = Ref;
|
|
367
364
|
function True(options = {}) {
|
|
368
365
|
return {
|
|
369
366
|
...options,
|
|
370
367
|
type: 'True'
|
|
371
368
|
};
|
|
372
369
|
}
|
|
373
|
-
|
|
370
|
+
/** Creates a `True` expression that evaluates `true` */ Expression.True = True;
|
|
374
371
|
function TypeOf(value, options = {}) {
|
|
375
372
|
return {
|
|
376
373
|
...options,
|
|
@@ -378,7 +375,7 @@ THE SOFTWARE.
|
|
|
378
375
|
value
|
|
379
376
|
};
|
|
380
377
|
}
|
|
381
|
-
|
|
378
|
+
/** Creates a `TypeOf` expression that will apply `typeof` operator for the evaluated value */ Expression.TypeOf = TypeOf;
|
|
382
379
|
})(Expression || (Expression = {}));
|
|
383
380
|
|
|
384
381
|
//# sourceMappingURL=expression.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/schema/typebox/gen/codegen/expression/expression.ts"],"sourcesContent":["/*--------------------------------------------------------------------------\n\n@sinclair/typebox-expression\n\nThe MIT License (MIT)\n\nCopyright (c) 2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n---------------------------------------------------------------------------*/\n\n// -------------------------------------------------------------------------\n// Expression: Error\n// -------------------------------------------------------------------------\nexport interface ExpressionError {\n expression: Expression;\n path: string;\n value: unknown;\n}\n\n// -------------------------------------------------------------------------\n// Expression: Tree\n// -------------------------------------------------------------------------\n\nexport type Equatable = string | number | boolean | null | undefined;\nexport type Compariable = number | bigint;\nexport type TypeOf = 'undefined' | 'symbol' | 'function' | 'string' | 'number' | 'boolean' | 'bigint' | 'object';\n\nexport interface ExpressionOptions {\n $id?: string;\n [key: string]: any;\n}\nexport interface AndExpression extends ExpressionOptions {\n type: 'And';\n expr: Expression[];\n}\nexport interface CallExpression<\n E extends Expression = Expression,\n T extends string = string,\n A extends unknown[] = unknown[],\n> extends ExpressionOptions {\n type: 'Call';\n target: T;\n parameters: [...A];\n expr: E;\n}\n\nexport interface ElementsDistinctExpression extends ExpressionOptions {\n type: 'ElementsDistinct';\n}\nexport interface ElementsExpression<E extends Expression = Expression> extends ExpressionOptions {\n type: 'Elements';\n expr: E;\n}\nexport interface EqualsExpression<T extends Equatable = Equatable> extends ExpressionOptions {\n type: 'Equals';\n value: T;\n}\nexport type FunctionExpressionCallback = (value: unknown) => boolean;\n\nexport interface FunctionExpression<F extends FunctionExpressionCallback = FunctionExpressionCallback>\n extends ExpressionOptions {\n type: 'Function';\n callback: F;\n}\nexport interface GreaterThanEqualExpression<T extends Compariable = Compariable> extends ExpressionOptions {\n type: 'GreaterThanEqual';\n value: T;\n}\nexport interface GreaterThanExpression<T extends Compariable = Compariable> extends ExpressionOptions {\n type: 'GreaterThan';\n value: T;\n}\nexport interface FalseExpression extends ExpressionOptions {\n type: 'False';\n}\nexport interface IfThenElseExpression extends ExpressionOptions {\n type: 'IfThenElse';\n if: Expression;\n then: Expression;\n else: Expression;\n}\nexport interface InstanceOfExpression<T extends string = string> extends ExpressionOptions {\n type: 'InstanceOf';\n value: T;\n}\nexport interface IndexExpression<E extends Expression = Expression, I extends number = number>\n extends ExpressionOptions {\n type: 'Index';\n index: I;\n expr: E;\n}\n\nexport interface IsArrayExpression extends ExpressionOptions {\n type: 'IsArray';\n}\nexport interface IsBigIntExpression extends TypeOfExpression<'bigint'> {}\nexport interface IsBooleanExpression extends TypeOfExpression<'boolean'> {}\nexport interface IsFiniteExpression extends ExpressionOptions {\n type: 'IsFinite';\n}\nexport interface IsFunctionExpression extends TypeOfExpression<'function'> {}\nexport interface IsIntegerExpression extends ExpressionOptions {\n type: 'IsInteger';\n}\nexport interface IsNaNExpression extends ExpressionOptions {\n type: 'IsNaN';\n}\nexport interface IsNullExpression extends EqualsExpression<null> {}\nexport interface IsNumberExpression extends TypeOfExpression<'number'> {}\nexport interface IsSafeIntegerExpression extends ExpressionOptions {\n type: 'IsSafeInteger';\n}\nexport interface IsObjectExpression extends TypeOfExpression<'object'> {}\nexport interface IsStringExpression extends TypeOfExpression<'string'> {}\nexport interface IsSymbolExpression extends TypeOfExpression<'symbol'> {}\nexport interface IsUndefinedExpression extends ExpressionOptions {\n type: 'IsUndefined';\n}\nexport interface KeyInExpression<T extends string = string> extends ExpressionOptions {\n type: 'KeyIn';\n value: T;\n}\nexport interface OrExpression extends ExpressionOptions {\n type: 'Or';\n expr: Expression[];\n}\nexport interface NotExpression<E extends Expression = Expression> extends ExpressionOptions {\n type: 'Not';\n expr: E;\n}\nexport interface LessThanEqualExpression<T extends Compariable = Compariable> extends ExpressionOptions {\n type: 'LessThanEqual';\n value: T;\n}\nexport interface LessThanExpression<T extends Compariable = Compariable> extends ExpressionOptions {\n type: 'LessThan';\n value: T;\n}\nexport interface MultipleOfExpression<T extends number = number> extends ExpressionOptions {\n type: 'MultipleOf';\n value: T;\n}\nexport interface PropertiesIncludePatternExpression<E extends Expression = Expression> extends ExpressionOptions {\n type: 'PropertiesIncludePattern';\n pattern: string;\n expr: E;\n}\nexport interface PropertiesIncludeExpression<E extends Expression = Expression, K extends string[] = string[]>\n extends ExpressionOptions {\n type: 'PropertiesInclude';\n keys: K;\n expr: E;\n}\nexport interface PropertiesExcludePatternExpression<E extends Expression = Expression> extends ExpressionOptions {\n type: 'PropertiesExcludePattern';\n pattern: string;\n expr: E;\n}\nexport interface PropertiesExcludeExpression<E extends Expression = Expression, K extends string[] = string[]>\n extends ExpressionOptions {\n type: 'PropertiesExclude';\n keys: K;\n expr: E;\n}\nexport interface PropertiesLengthExpression<T extends number = number> extends ExpressionOptions {\n type: 'PropertiesLength';\n value: T;\n}\nexport interface PropertiesMaximumExpression<T extends number = number> extends ExpressionOptions {\n type: 'PropertiesMaximum';\n value: T;\n}\nexport interface PropertiesMinimumExpression<T extends number = number> extends ExpressionOptions {\n type: 'PropertiesMinimum';\n value: T;\n}\nexport interface PropertiesExpression<E extends Expression = Expression> extends ExpressionOptions {\n type: 'Properties';\n expr: E;\n}\nexport interface PropertyKeysExpression<T extends readonly string[] = string[]> extends ExpressionOptions {\n type: 'PropertyKeys';\n keys: [...T];\n}\nexport interface PropertyExpression<E extends Expression = Expression, K extends string = string>\n extends ExpressionOptions {\n type: 'Property';\n key: K;\n expr: E;\n}\nexport interface RefExpression<T extends string = string> extends ExpressionOptions {\n type: 'Ref';\n $ref: T;\n}\nexport interface IsPatternExpression extends ExpressionOptions {\n type: 'IsPattern';\n pattern: string;\n}\nexport interface TrueExpression extends ExpressionOptions {\n type: 'True';\n}\nexport interface TypeOfExpression<T extends TypeOf = TypeOf> extends ExpressionOptions {\n type: 'TypeOf';\n value: T;\n}\nexport type Expression =\n | AndExpression\n | CallExpression\n | FalseExpression\n | FunctionExpression\n | ElementsDistinctExpression\n | ElementsExpression\n | EqualsExpression\n | GreaterThanExpression\n | GreaterThanEqualExpression\n | IfThenElseExpression\n | IndexExpression\n | InstanceOfExpression\n | IsArrayExpression\n | IsIntegerExpression\n | IsNaNExpression\n | IsObjectExpression\n | IsBigIntExpression\n | IsBooleanExpression\n | IsFiniteExpression\n | IsFunctionExpression\n | IsNullExpression\n | IsNumberExpression\n | IsSafeIntegerExpression\n | IsStringExpression\n | IsSymbolExpression\n | IsUndefinedExpression\n | KeyInExpression\n | LessThanEqualExpression\n | LessThanExpression\n | MultipleOfExpression\n | NotExpression\n | OrExpression\n | PropertiesIncludeExpression\n | PropertiesIncludePatternExpression\n | PropertiesExcludeExpression\n | PropertiesExcludePatternExpression\n | PropertiesLengthExpression\n | PropertiesMaximumExpression\n | PropertiesMinimumExpression\n | PropertiesExpression\n | PropertyKeysExpression\n | PropertyExpression\n | RefExpression\n | IsPatternExpression\n | TrueExpression\n | TypeOfExpression;\n\n// ---------------------------------------------------------------\n// Expression: Builder\n// ---------------------------------------------------------------\n\n/** Type Expressions builder used to assert JavaScript values */\nexport namespace Expression {\n /** Creates a `And` expression where each sub expression is evaluated in sequence */\n export function And<E extends Expression>(\n expressions: (() => Generator<E>) | Array<E>,\n options: ExpressionOptions = {},\n ): Expression {\n const expr = globalThis.Array.isArray(expressions) ? expressions : [...expressions()];\n if (expr.length === 0) return Expression.False();\n if (expr.length === 1) return expr[0];\n return { ...options, type: 'And', expr };\n }\n /** Creates a `Call` expression that will invoke the object target and check the return for the given sub expression */\n export function Call<E extends Expression, T extends string, P extends unknown[]>(\n target: T,\n parameters: P,\n expression: E,\n options: ExpressionOptions = {},\n ): CallExpression<E, T, P> {\n return { ...options, type: 'Call', target, parameters, expr: expression };\n }\n /** Creates a `Equals` expression that will compare for value equality */\n export function Equals<T extends Equatable>(value: T, options: ExpressionOptions = {}): EqualsExpression<T> {\n return { ...options, type: 'Equals', value };\n }\n /** Creates a `Function` expression which invokes the given callback to check a value */\n export function Function<F extends (value: unknown) => boolean>(\n callback: F,\n options: ExpressionOptions = {},\n ): FunctionExpression<F> {\n return { ...options, type: 'Function', callback };\n }\n /** Creates a `ElementsDistinct` expression which will check an arrays elements are structurally distinct */\n export function ElementsDistinct(options: ExpressionOptions = {}): ElementsDistinctExpression {\n return { ...options, type: 'ElementsDistinct' };\n }\n /** Creates a `Elements` expression that will check an arrays elements for the given sub expression */\n export function Elements<E extends Expression>(\n expression: E,\n options: ExpressionOptions = {},\n ): ElementsExpression<E> {\n return { ...options, type: 'Elements', expr: expression };\n }\n /** Creates a `False` expression that evaluates `false` */\n export function False(options: ExpressionOptions = {}): FalseExpression {\n return { ...options, type: 'False' };\n }\n /** Creates a `GreaterThanEqual` comparison expression */\n export function GreaterThanEqual<T extends Compariable>(\n value: T,\n options: ExpressionOptions = {},\n ): GreaterThanEqualExpression<T> {\n return { ...options, type: 'GreaterThanEqual', value };\n }\n /** Creates a `GreaterThan` comparison expression */\n export function GreaterThan<T extends Compariable>(\n value: T,\n options: ExpressionOptions = {},\n ): GreaterThanExpression<T> {\n return { ...options, type: 'GreaterThan', value };\n }\n /** Creates a `IfThenElse` expression that will evaluate the `$if` expression followed by either the `$then` of `$else` expressions */\n export function IfThenElse(\n $if: Expression,\n $then: Expression,\n $else: Expression,\n options: ExpressionOptions = {},\n ): IfThenElseExpression {\n return { ...options, type: 'IfThenElse', if: $if, then: $then, else: $else };\n }\n /** Creates a `Index` expression that will evaluate an array element by the given sub expression */\n export function Index<E extends Expression, I extends number>(\n index: I,\n expression: E,\n options: ExpressionOptions = {},\n ): IndexExpression<E, I> {\n return { ...options, type: 'Index', index, expr: expression };\n }\n /** Creates a `InstanceOf` expression that will apply the `instanceof` operator */\n export function InstanceOf<T extends string>(value: T, options: ExpressionOptions = {}): InstanceOfExpression<T> {\n return { ...options, type: 'InstanceOf', value };\n }\n /** Creates a `IsArray` expression that will check a value as an array */\n export function IsArray(options: ExpressionOptions = {}): IsArrayExpression {\n return { ...options, type: 'IsArray' };\n }\n /** Creates a `IsNaN` expression that will check for NaN */\n export function IsNaN(options: ExpressionOptions = {}): IsNaNExpression {\n return { ...options, type: 'IsNaN' };\n }\n /** Creates a `IsInteger` expression that will check for numeric integer values */\n export function IsInteger(options: ExpressionOptions = {}): IsIntegerExpression {\n return { ...options, type: 'IsInteger' };\n }\n /** Creates a `IsObject` expression that will check a value as an object */\n export function IsObject(options: ExpressionOptions = {}): IsObjectExpression {\n return Expression.TypeOf('object', options);\n }\n /** Creates a `IsBigInt` expression that will check a value as a bigint */\n export function IsBigInt(options: ExpressionOptions = {}): IsBigIntExpression {\n return Expression.TypeOf('bigint', options);\n }\n /** Creates a `IsBoolean` expression that will check a value as a boolean */\n export function IsBoolean(options: ExpressionOptions = {}): IsBooleanExpression {\n return Expression.TypeOf('boolean', options);\n }\n /** Creates a `IsFinite` expression that will check a numeric value if finite */\n export function IsFinite(options: ExpressionOptions = {}): IsFiniteExpression {\n return { ...options, type: 'IsFinite' };\n }\n /** Creates a `IsFunction` expression that will check a value as a function */\n export function IsFunction(options: ExpressionOptions = {}): IsFunctionExpression {\n return Expression.TypeOf('function', options);\n }\n /** Creates a `IsNumber` expression that will check a value as a number */\n export function IsNumber(options: ExpressionOptions = {}): IsNumberExpression {\n return Expression.TypeOf('number', options);\n }\n /** Creates a `IsSafeInteger` expression that will check a numeric value if finite */\n export function IsSafeInteger(options: ExpressionOptions = {}): IsSafeIntegerExpression {\n return { ...options, type: 'IsSafeInteger' };\n }\n /** Creates a `IsString` expression that will check a value as a string */\n export function IsString(options: ExpressionOptions = {}): IsStringExpression {\n return Expression.TypeOf('string', options);\n }\n /** Creates a `IsSymbol` expression that will check a value as a symbol */\n export function IsSymbol(options: ExpressionOptions = {}): IsSymbolExpression {\n return Expression.TypeOf('symbol', options);\n }\n /** Creates a `IsUndefined` expression that will check a value is undefined */\n export function IsUndefined(options: ExpressionOptions = {}): IsUndefinedExpression {\n return { ...options, type: 'IsUndefined' };\n }\n /** Creates a `IsNull` expression that will check a value is null */\n export function IsNull(options: ExpressionOptions = {}): IsNullExpression {\n return Expression.Equals(null, options);\n }\n /** Creates a `IsPattern` expression that will check a string with a regular expression */\n export function IsPattern(pattern: string, options: ExpressionOptions = {}): IsPatternExpression {\n return { ...options, type: 'IsPattern', pattern };\n }\n /** Creates a KeyIn expression that will check if a key exists on this value */\n export function KeyIn<T extends string>(value: T, options: ExpressionOptions = {}): KeyInExpression<T> {\n return { ...options, type: 'KeyIn', value };\n }\n /** Creates a `LessThanEqual` comparison expression */\n export function LessThanEqual<T extends Compariable>(\n value: T,\n options: ExpressionOptions = {},\n ): LessThanEqualExpression<T> {\n return { ...options, type: 'LessThanEqual', value };\n }\n /** Creates a `LessThan` comparison expression */\n export function LessThan<T extends Compariable>(value: T, options: ExpressionOptions = {}): LessThanExpression<T> {\n return { ...options, type: 'LessThan', value };\n }\n /** Creates a `MultipleOf` modulus expression that is true if the result is zero */\n export function MultipleOf<T extends number>(value: T, options: ExpressionOptions = {}): MultipleOfExpression<T> {\n return { ...options, type: 'MultipleOf', value };\n }\n /** Creates a `Not` expression where the result of the sub expression is inverted */\n export function Not<E extends Expression>(expression: E, options: ExpressionOptions = {}): NotExpression<E> {\n return { ...options, type: 'Not', expr: expression };\n }\n /** Creates a `Or` expression where each sub expression is evaluated in sequence */\n export function Or<E extends Expression>(\n expressions: (() => Generator<E>) | Array<E>,\n options: ExpressionOptions = {},\n ): Expression {\n const expr = globalThis.Array.isArray(expressions) ? expressions : [...expressions()];\n if (expr.length === 0) return Expression.False();\n if (expr.length === 1) return expr[0];\n return { ...options, type: 'Or', expr };\n }\n /** Creates a `PropertiesExcludePattern` expression that will enumerate each key matching the given regular expression */\n export function PropertiesExcludePattern<E extends Expression>(\n pattern: string,\n expression: E,\n options: ExpressionOptions = {},\n ): PropertiesExcludePatternExpression<E> {\n return { ...options, type: 'PropertiesExcludePattern', expr: expression, pattern };\n }\n /** Creates a `PropertiesExclude` expression that will enumerate the unselected keys and check each for the sub expression */\n export function PropertiesExclude<E extends Expression, K extends string[]>(\n keys: K,\n expression: E,\n options: ExpressionOptions = {},\n ): PropertiesExcludeExpression<E, K> {\n return { ...options, type: 'PropertiesExclude', expr: expression, keys };\n }\n /** Creates a `PropertiesIncludePattern` expression that will enumerate each key matching the given regular expression */\n export function PropertiesIncludePattern<E extends Expression>(\n pattern: string,\n expression: E,\n options: ExpressionOptions = {},\n ): PropertiesIncludePatternExpression<E> {\n return { ...options, type: 'PropertiesIncludePattern', expr: expression, pattern };\n }\n /** Creates a `PropertiesInclude` expression that will enumerate the selected keys and check each for the sub expression */\n export function PropertiesInclude<E extends Expression, K extends string[]>(\n keys: K,\n expression: E,\n options: ExpressionOptions = {},\n ): PropertiesIncludeExpression<E, K> {\n return { ...options, type: 'PropertiesInclude', expr: expression, keys };\n }\n /** Creates a `PropertiesLength` expression that checks an object a property length that equals the given value */\n export function PropertiesLength<T extends number>(\n value: T,\n options: ExpressionOptions = {},\n ): PropertiesLengthExpression<T> {\n return { ...options, type: 'PropertiesLength', value };\n }\n /** Creates a `PropertiesMaximum` expression that will check an object has a property length less or equal the given value */\n export function PropertiesMaximum<T extends number>(\n value: T,\n options: ExpressionOptions = {},\n ): PropertiesMaximumExpression<T> {\n return { ...options, type: 'PropertiesMaximum', value };\n }\n /** Creates a `PropertiesMinimum` expression that will check an object has a property length greater or equal the given value */\n export function PropertiesMinimum<T extends number>(\n value: T,\n options: ExpressionOptions = {},\n ): PropertiesMinimumExpression<T> {\n return { ...options, type: 'PropertiesMinimum', value };\n }\n /** Creates a `Properties` expression that will enumerate all object properties and check for the given sub expression */\n export function Properties<E extends Expression>(\n expression: E,\n options: ExpressionOptions = {},\n ): PropertiesExpression<E> {\n return { ...options, type: 'Properties', expr: expression };\n }\n /** Creates a `PropertyKeys` expression that will check an object has the specified keys */\n export function PropertyKeys<T extends string[]>(\n keys: T,\n options: ExpressionOptions = {},\n ): PropertyKeysExpression<T> {\n return { ...options, type: 'PropertyKeys', keys };\n }\n /** Creates a `Property` expression that will evaluate the property value by the given sub expression */\n export function Property<E extends Expression, K extends string>(\n key: K,\n expression: E,\n options: ExpressionOptions = {},\n ): PropertyExpression<E, K> {\n return { ...options, type: 'Property', key, expr: expression };\n }\n /** Creates a `Ref` that will reference another part of the expression tree via $id */\n export function Ref<T extends string>(value: T, options: ExpressionOptions = {}): RefExpression<T> {\n return { ...options, type: 'Ref', $ref: value };\n }\n /** Creates a `True` expression that evaluates `true` */\n export function True(options: ExpressionOptions = {}): TrueExpression {\n return { ...options, type: 'True' };\n }\n /** Creates a `TypeOf` expression that will apply `typeof` operator for the evaluated value */\n export function TypeOf<E extends TypeOf>(value: E, options: ExpressionOptions = {}): TypeOfExpression<E> {\n return { ...options, type: 'TypeOf', value };\n }\n}\n"],"names":["Expression","And","expressions","options","expr","globalThis","Array","isArray","length","False","type","Call","target","parameters","expression","Equals","value","Function","callback","ElementsDistinct","Elements","GreaterThanEqual","GreaterThan","IfThenElse","$if","$then","$else","if","then","else","Index","index","InstanceOf","IsArray","IsNaN","IsInteger","IsObject","TypeOf","IsBigInt","IsBoolean","IsFinite","IsFunction","IsNumber","IsSafeInteger","IsString","IsSymbol","IsUndefined","IsNull","IsPattern","pattern","KeyIn","LessThanEqual","LessThan","MultipleOf","Not","Or","PropertiesExcludePattern","PropertiesExclude","keys","PropertiesIncludePattern","PropertiesInclude","PropertiesLength","PropertiesMaximum","PropertiesMinimum","Properties","PropertyKeys","Property","key","Ref","$ref","True"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;2EA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B,OAAO;YAAE,GAAGA,OAAO;YAAEO,MAAM;YAAYyD;YAAK/D,MAAMU;QAAW;IAC/D;gBANgBoD,WAAAA;IAQT,SAASE,IAAsBpD,KAAQ,EAAEb,UAA6B,CAAC,CAAC;QAC7E,OAAO;YAAE,GAAGA,OAAO;YAAEO,MAAM;YAAO2D,MAAMrD;QAAM;IAChD;gBAFgBoD,MAAAA;IAIT,SAASE,KAAKnE,UAA6B,CAAC,CAAC;QAClD,OAAO;YAAE,GAAGA,OAAO;YAAEO,MAAM;QAAO;IACpC;gBAFgB4D,OAAAA;IAIT,SAASjC,OAAyBrB,KAAQ,EAAEb,UAA6B,CAAC,CAAC;QAChF,OAAO;YAAE,GAAGA,OAAO;YAAEO,MAAM;YAAUM;QAAM;IAC7C;gBAFgBqB,SAAAA;GAlQDrC,eAAAA"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/schema/typebox/gen/codegen/expression/expression.ts"],"sourcesContent":["/*--------------------------------------------------------------------------\n\n@sinclair/typebox-expression\n\nThe MIT License (MIT)\n\nCopyright (c) 2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n---------------------------------------------------------------------------*/\n\n// -------------------------------------------------------------------------\n// Expression: Error\n// -------------------------------------------------------------------------\nexport interface ExpressionError {\n expression: Expression;\n path: string;\n value: unknown;\n}\n\n// -------------------------------------------------------------------------\n// Expression: Tree\n// -------------------------------------------------------------------------\n\nexport type Equatable = string | number | boolean | null | undefined;\nexport type Compariable = number | bigint;\nexport type TypeOf = 'undefined' | 'symbol' | 'function' | 'string' | 'number' | 'boolean' | 'bigint' | 'object';\n\nexport interface ExpressionOptions {\n $id?: string;\n [key: string]: any;\n}\nexport interface AndExpression extends ExpressionOptions {\n type: 'And';\n expr: Expression[];\n}\nexport interface CallExpression<\n E extends Expression = Expression,\n T extends string = string,\n A extends unknown[] = unknown[],\n> extends ExpressionOptions {\n type: 'Call';\n target: T;\n parameters: [...A];\n expr: E;\n}\n\nexport interface ElementsDistinctExpression extends ExpressionOptions {\n type: 'ElementsDistinct';\n}\nexport interface ElementsExpression<E extends Expression = Expression> extends ExpressionOptions {\n type: 'Elements';\n expr: E;\n}\nexport interface EqualsExpression<T extends Equatable = Equatable> extends ExpressionOptions {\n type: 'Equals';\n value: T;\n}\nexport type FunctionExpressionCallback = (value: unknown) => boolean;\n\nexport interface FunctionExpression<F extends FunctionExpressionCallback = FunctionExpressionCallback>\n extends ExpressionOptions {\n type: 'Function';\n callback: F;\n}\nexport interface GreaterThanEqualExpression<T extends Compariable = Compariable> extends ExpressionOptions {\n type: 'GreaterThanEqual';\n value: T;\n}\nexport interface GreaterThanExpression<T extends Compariable = Compariable> extends ExpressionOptions {\n type: 'GreaterThan';\n value: T;\n}\nexport interface FalseExpression extends ExpressionOptions {\n type: 'False';\n}\nexport interface IfThenElseExpression extends ExpressionOptions {\n type: 'IfThenElse';\n if: Expression;\n then: Expression;\n else: Expression;\n}\nexport interface InstanceOfExpression<T extends string = string> extends ExpressionOptions {\n type: 'InstanceOf';\n value: T;\n}\nexport interface IndexExpression<E extends Expression = Expression, I extends number = number>\n extends ExpressionOptions {\n type: 'Index';\n index: I;\n expr: E;\n}\n\nexport interface IsArrayExpression extends ExpressionOptions {\n type: 'IsArray';\n}\nexport interface IsBigIntExpression extends TypeOfExpression<'bigint'> {}\nexport interface IsBooleanExpression extends TypeOfExpression<'boolean'> {}\nexport interface IsFiniteExpression extends ExpressionOptions {\n type: 'IsFinite';\n}\nexport interface IsFunctionExpression extends TypeOfExpression<'function'> {}\nexport interface IsIntegerExpression extends ExpressionOptions {\n type: 'IsInteger';\n}\nexport interface IsNaNExpression extends ExpressionOptions {\n type: 'IsNaN';\n}\nexport interface IsNullExpression extends EqualsExpression<null> {}\nexport interface IsNumberExpression extends TypeOfExpression<'number'> {}\nexport interface IsSafeIntegerExpression extends ExpressionOptions {\n type: 'IsSafeInteger';\n}\nexport interface IsObjectExpression extends TypeOfExpression<'object'> {}\nexport interface IsStringExpression extends TypeOfExpression<'string'> {}\nexport interface IsSymbolExpression extends TypeOfExpression<'symbol'> {}\nexport interface IsUndefinedExpression extends ExpressionOptions {\n type: 'IsUndefined';\n}\nexport interface KeyInExpression<T extends string = string> extends ExpressionOptions {\n type: 'KeyIn';\n value: T;\n}\nexport interface OrExpression extends ExpressionOptions {\n type: 'Or';\n expr: Expression[];\n}\nexport interface NotExpression<E extends Expression = Expression> extends ExpressionOptions {\n type: 'Not';\n expr: E;\n}\nexport interface LessThanEqualExpression<T extends Compariable = Compariable> extends ExpressionOptions {\n type: 'LessThanEqual';\n value: T;\n}\nexport interface LessThanExpression<T extends Compariable = Compariable> extends ExpressionOptions {\n type: 'LessThan';\n value: T;\n}\nexport interface MultipleOfExpression<T extends number = number> extends ExpressionOptions {\n type: 'MultipleOf';\n value: T;\n}\nexport interface PropertiesIncludePatternExpression<E extends Expression = Expression> extends ExpressionOptions {\n type: 'PropertiesIncludePattern';\n pattern: string;\n expr: E;\n}\nexport interface PropertiesIncludeExpression<E extends Expression = Expression, K extends string[] = string[]>\n extends ExpressionOptions {\n type: 'PropertiesInclude';\n keys: K;\n expr: E;\n}\nexport interface PropertiesExcludePatternExpression<E extends Expression = Expression> extends ExpressionOptions {\n type: 'PropertiesExcludePattern';\n pattern: string;\n expr: E;\n}\nexport interface PropertiesExcludeExpression<E extends Expression = Expression, K extends string[] = string[]>\n extends ExpressionOptions {\n type: 'PropertiesExclude';\n keys: K;\n expr: E;\n}\nexport interface PropertiesLengthExpression<T extends number = number> extends ExpressionOptions {\n type: 'PropertiesLength';\n value: T;\n}\nexport interface PropertiesMaximumExpression<T extends number = number> extends ExpressionOptions {\n type: 'PropertiesMaximum';\n value: T;\n}\nexport interface PropertiesMinimumExpression<T extends number = number> extends ExpressionOptions {\n type: 'PropertiesMinimum';\n value: T;\n}\nexport interface PropertiesExpression<E extends Expression = Expression> extends ExpressionOptions {\n type: 'Properties';\n expr: E;\n}\nexport interface PropertyKeysExpression<T extends readonly string[] = string[]> extends ExpressionOptions {\n type: 'PropertyKeys';\n keys: [...T];\n}\nexport interface PropertyExpression<E extends Expression = Expression, K extends string = string>\n extends ExpressionOptions {\n type: 'Property';\n key: K;\n expr: E;\n}\nexport interface RefExpression<T extends string = string> extends ExpressionOptions {\n type: 'Ref';\n $ref: T;\n}\nexport interface IsPatternExpression extends ExpressionOptions {\n type: 'IsPattern';\n pattern: string;\n}\nexport interface TrueExpression extends ExpressionOptions {\n type: 'True';\n}\nexport interface TypeOfExpression<T extends TypeOf = TypeOf> extends ExpressionOptions {\n type: 'TypeOf';\n value: T;\n}\nexport type Expression =\n | AndExpression\n | CallExpression\n | FalseExpression\n | FunctionExpression\n | ElementsDistinctExpression\n | ElementsExpression\n | EqualsExpression\n | GreaterThanExpression\n | GreaterThanEqualExpression\n | IfThenElseExpression\n | IndexExpression\n | InstanceOfExpression\n | IsArrayExpression\n | IsIntegerExpression\n | IsNaNExpression\n | IsObjectExpression\n | IsBigIntExpression\n | IsBooleanExpression\n | IsFiniteExpression\n | IsFunctionExpression\n | IsNullExpression\n | IsNumberExpression\n | IsSafeIntegerExpression\n | IsStringExpression\n | IsSymbolExpression\n | IsUndefinedExpression\n | KeyInExpression\n | LessThanEqualExpression\n | LessThanExpression\n | MultipleOfExpression\n | NotExpression\n | OrExpression\n | PropertiesIncludeExpression\n | PropertiesIncludePatternExpression\n | PropertiesExcludeExpression\n | PropertiesExcludePatternExpression\n | PropertiesLengthExpression\n | PropertiesMaximumExpression\n | PropertiesMinimumExpression\n | PropertiesExpression\n | PropertyKeysExpression\n | PropertyExpression\n | RefExpression\n | IsPatternExpression\n | TrueExpression\n | TypeOfExpression;\n\n// ---------------------------------------------------------------\n// Expression: Builder\n// ---------------------------------------------------------------\n\n/** Type Expressions builder used to assert JavaScript values */\nexport namespace Expression {\n /** Creates a `And` expression where each sub expression is evaluated in sequence */\n export function And<E extends Expression>(\n expressions: (() => Generator<E>) | Array<E>,\n options: ExpressionOptions = {},\n ): Expression {\n const expr = globalThis.Array.isArray(expressions) ? expressions : [...expressions()];\n if (expr.length === 0) return Expression.False();\n if (expr.length === 1) return expr[0];\n return { ...options, type: 'And', expr };\n }\n /** Creates a `Call` expression that will invoke the object target and check the return for the given sub expression */\n export function Call<E extends Expression, T extends string, P extends unknown[]>(\n target: T,\n parameters: P,\n expression: E,\n options: ExpressionOptions = {},\n ): CallExpression<E, T, P> {\n return { ...options, type: 'Call', target, parameters, expr: expression };\n }\n /** Creates a `Equals` expression that will compare for value equality */\n export function Equals<T extends Equatable>(value: T, options: ExpressionOptions = {}): EqualsExpression<T> {\n return { ...options, type: 'Equals', value };\n }\n /** Creates a `Function` expression which invokes the given callback to check a value */\n export function Function<F extends (value: unknown) => boolean>(\n callback: F,\n options: ExpressionOptions = {},\n ): FunctionExpression<F> {\n return { ...options, type: 'Function', callback };\n }\n /** Creates a `ElementsDistinct` expression which will check an arrays elements are structurally distinct */\n export function ElementsDistinct(options: ExpressionOptions = {}): ElementsDistinctExpression {\n return { ...options, type: 'ElementsDistinct' };\n }\n /** Creates a `Elements` expression that will check an arrays elements for the given sub expression */\n export function Elements<E extends Expression>(\n expression: E,\n options: ExpressionOptions = {},\n ): ElementsExpression<E> {\n return { ...options, type: 'Elements', expr: expression };\n }\n /** Creates a `False` expression that evaluates `false` */\n export function False(options: ExpressionOptions = {}): FalseExpression {\n return { ...options, type: 'False' };\n }\n /** Creates a `GreaterThanEqual` comparison expression */\n export function GreaterThanEqual<T extends Compariable>(\n value: T,\n options: ExpressionOptions = {},\n ): GreaterThanEqualExpression<T> {\n return { ...options, type: 'GreaterThanEqual', value };\n }\n /** Creates a `GreaterThan` comparison expression */\n export function GreaterThan<T extends Compariable>(\n value: T,\n options: ExpressionOptions = {},\n ): GreaterThanExpression<T> {\n return { ...options, type: 'GreaterThan', value };\n }\n /** Creates a `IfThenElse` expression that will evaluate the `$if` expression followed by either the `$then` of `$else` expressions */\n export function IfThenElse(\n $if: Expression,\n $then: Expression,\n $else: Expression,\n options: ExpressionOptions = {},\n ): IfThenElseExpression {\n return { ...options, type: 'IfThenElse', if: $if, then: $then, else: $else };\n }\n /** Creates a `Index` expression that will evaluate an array element by the given sub expression */\n export function Index<E extends Expression, I extends number>(\n index: I,\n expression: E,\n options: ExpressionOptions = {},\n ): IndexExpression<E, I> {\n return { ...options, type: 'Index', index, expr: expression };\n }\n /** Creates a `InstanceOf` expression that will apply the `instanceof` operator */\n export function InstanceOf<T extends string>(value: T, options: ExpressionOptions = {}): InstanceOfExpression<T> {\n return { ...options, type: 'InstanceOf', value };\n }\n /** Creates a `IsArray` expression that will check a value as an array */\n export function IsArray(options: ExpressionOptions = {}): IsArrayExpression {\n return { ...options, type: 'IsArray' };\n }\n /** Creates a `IsNaN` expression that will check for NaN */\n export function IsNaN(options: ExpressionOptions = {}): IsNaNExpression {\n return { ...options, type: 'IsNaN' };\n }\n /** Creates a `IsInteger` expression that will check for numeric integer values */\n export function IsInteger(options: ExpressionOptions = {}): IsIntegerExpression {\n return { ...options, type: 'IsInteger' };\n }\n /** Creates a `IsObject` expression that will check a value as an object */\n export function IsObject(options: ExpressionOptions = {}): IsObjectExpression {\n return Expression.TypeOf('object', options);\n }\n /** Creates a `IsBigInt` expression that will check a value as a bigint */\n export function IsBigInt(options: ExpressionOptions = {}): IsBigIntExpression {\n return Expression.TypeOf('bigint', options);\n }\n /** Creates a `IsBoolean` expression that will check a value as a boolean */\n export function IsBoolean(options: ExpressionOptions = {}): IsBooleanExpression {\n return Expression.TypeOf('boolean', options);\n }\n /** Creates a `IsFinite` expression that will check a numeric value if finite */\n export function IsFinite(options: ExpressionOptions = {}): IsFiniteExpression {\n return { ...options, type: 'IsFinite' };\n }\n /** Creates a `IsFunction` expression that will check a value as a function */\n export function IsFunction(options: ExpressionOptions = {}): IsFunctionExpression {\n return Expression.TypeOf('function', options);\n }\n /** Creates a `IsNumber` expression that will check a value as a number */\n export function IsNumber(options: ExpressionOptions = {}): IsNumberExpression {\n return Expression.TypeOf('number', options);\n }\n /** Creates a `IsSafeInteger` expression that will check a numeric value if finite */\n export function IsSafeInteger(options: ExpressionOptions = {}): IsSafeIntegerExpression {\n return { ...options, type: 'IsSafeInteger' };\n }\n /** Creates a `IsString` expression that will check a value as a string */\n export function IsString(options: ExpressionOptions = {}): IsStringExpression {\n return Expression.TypeOf('string', options);\n }\n /** Creates a `IsSymbol` expression that will check a value as a symbol */\n export function IsSymbol(options: ExpressionOptions = {}): IsSymbolExpression {\n return Expression.TypeOf('symbol', options);\n }\n /** Creates a `IsUndefined` expression that will check a value is undefined */\n export function IsUndefined(options: ExpressionOptions = {}): IsUndefinedExpression {\n return { ...options, type: 'IsUndefined' };\n }\n /** Creates a `IsNull` expression that will check a value is null */\n export function IsNull(options: ExpressionOptions = {}): IsNullExpression {\n return Expression.Equals(null, options);\n }\n /** Creates a `IsPattern` expression that will check a string with a regular expression */\n export function IsPattern(pattern: string, options: ExpressionOptions = {}): IsPatternExpression {\n return { ...options, type: 'IsPattern', pattern };\n }\n /** Creates a KeyIn expression that will check if a key exists on this value */\n export function KeyIn<T extends string>(value: T, options: ExpressionOptions = {}): KeyInExpression<T> {\n return { ...options, type: 'KeyIn', value };\n }\n /** Creates a `LessThanEqual` comparison expression */\n export function LessThanEqual<T extends Compariable>(\n value: T,\n options: ExpressionOptions = {},\n ): LessThanEqualExpression<T> {\n return { ...options, type: 'LessThanEqual', value };\n }\n /** Creates a `LessThan` comparison expression */\n export function LessThan<T extends Compariable>(value: T, options: ExpressionOptions = {}): LessThanExpression<T> {\n return { ...options, type: 'LessThan', value };\n }\n /** Creates a `MultipleOf` modulus expression that is true if the result is zero */\n export function MultipleOf<T extends number>(value: T, options: ExpressionOptions = {}): MultipleOfExpression<T> {\n return { ...options, type: 'MultipleOf', value };\n }\n /** Creates a `Not` expression where the result of the sub expression is inverted */\n export function Not<E extends Expression>(expression: E, options: ExpressionOptions = {}): NotExpression<E> {\n return { ...options, type: 'Not', expr: expression };\n }\n /** Creates a `Or` expression where each sub expression is evaluated in sequence */\n export function Or<E extends Expression>(\n expressions: (() => Generator<E>) | Array<E>,\n options: ExpressionOptions = {},\n ): Expression {\n const expr = globalThis.Array.isArray(expressions) ? expressions : [...expressions()];\n if (expr.length === 0) return Expression.False();\n if (expr.length === 1) return expr[0];\n return { ...options, type: 'Or', expr };\n }\n /** Creates a `PropertiesExcludePattern` expression that will enumerate each key matching the given regular expression */\n export function PropertiesExcludePattern<E extends Expression>(\n pattern: string,\n expression: E,\n options: ExpressionOptions = {},\n ): PropertiesExcludePatternExpression<E> {\n return { ...options, type: 'PropertiesExcludePattern', expr: expression, pattern };\n }\n /** Creates a `PropertiesExclude` expression that will enumerate the unselected keys and check each for the sub expression */\n export function PropertiesExclude<E extends Expression, K extends string[]>(\n keys: K,\n expression: E,\n options: ExpressionOptions = {},\n ): PropertiesExcludeExpression<E, K> {\n return { ...options, type: 'PropertiesExclude', expr: expression, keys };\n }\n /** Creates a `PropertiesIncludePattern` expression that will enumerate each key matching the given regular expression */\n export function PropertiesIncludePattern<E extends Expression>(\n pattern: string,\n expression: E,\n options: ExpressionOptions = {},\n ): PropertiesIncludePatternExpression<E> {\n return { ...options, type: 'PropertiesIncludePattern', expr: expression, pattern };\n }\n /** Creates a `PropertiesInclude` expression that will enumerate the selected keys and check each for the sub expression */\n export function PropertiesInclude<E extends Expression, K extends string[]>(\n keys: K,\n expression: E,\n options: ExpressionOptions = {},\n ): PropertiesIncludeExpression<E, K> {\n return { ...options, type: 'PropertiesInclude', expr: expression, keys };\n }\n /** Creates a `PropertiesLength` expression that checks an object a property length that equals the given value */\n export function PropertiesLength<T extends number>(\n value: T,\n options: ExpressionOptions = {},\n ): PropertiesLengthExpression<T> {\n return { ...options, type: 'PropertiesLength', value };\n }\n /** Creates a `PropertiesMaximum` expression that will check an object has a property length less or equal the given value */\n export function PropertiesMaximum<T extends number>(\n value: T,\n options: ExpressionOptions = {},\n ): PropertiesMaximumExpression<T> {\n return { ...options, type: 'PropertiesMaximum', value };\n }\n /** Creates a `PropertiesMinimum` expression that will check an object has a property length greater or equal the given value */\n export function PropertiesMinimum<T extends number>(\n value: T,\n options: ExpressionOptions = {},\n ): PropertiesMinimumExpression<T> {\n return { ...options, type: 'PropertiesMinimum', value };\n }\n /** Creates a `Properties` expression that will enumerate all object properties and check for the given sub expression */\n export function Properties<E extends Expression>(\n expression: E,\n options: ExpressionOptions = {},\n ): PropertiesExpression<E> {\n return { ...options, type: 'Properties', expr: expression };\n }\n /** Creates a `PropertyKeys` expression that will check an object has the specified keys */\n export function PropertyKeys<T extends string[]>(\n keys: T,\n options: ExpressionOptions = {},\n ): PropertyKeysExpression<T> {\n return { ...options, type: 'PropertyKeys', keys };\n }\n /** Creates a `Property` expression that will evaluate the property value by the given sub expression */\n export function Property<E extends Expression, K extends string>(\n key: K,\n expression: E,\n options: ExpressionOptions = {},\n ): PropertyExpression<E, K> {\n return { ...options, type: 'Property', key, expr: expression };\n }\n /** Creates a `Ref` that will reference another part of the expression tree via $id */\n export function Ref<T extends string>(value: T, options: ExpressionOptions = {}): RefExpression<T> {\n return { ...options, type: 'Ref', $ref: value };\n }\n /** Creates a `True` expression that evaluates `true` */\n export function True(options: ExpressionOptions = {}): TrueExpression {\n return { ...options, type: 'True' };\n }\n /** Creates a `TypeOf` expression that will apply `typeof` operator for the evaluated value */\n export function TypeOf<E extends TypeOf>(value: E, options: ExpressionOptions = {}): TypeOfExpression<E> {\n return { ...options, type: 'TypeOf', value };\n }\n}\n"],"names":["Expression","And","expressions","options","expr","globalThis","Array","isArray","length","False","type","Call","target","parameters","expression","Equals","value","Function","callback","ElementsDistinct","Elements","GreaterThanEqual","GreaterThan","IfThenElse","$if","$then","$else","if","then","else","Index","index","InstanceOf","IsArray","IsNaN","IsInteger","IsObject","TypeOf","IsBigInt","IsBoolean","IsFinite","IsFunction","IsNumber","IsSafeInteger","IsString","IsSymbol","IsUndefined","IsNull","IsPattern","pattern","KeyIn","LessThanEqual","LessThan","MultipleOf","Not","Or","PropertiesExcludePattern","PropertiesExclude","keys","PropertiesIncludePattern","PropertiesInclude","PropertiesLength","PropertiesMaximum","PropertiesMinimum","Properties","PropertyKeys","Property","key","Ref","$ref","True"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;2EA0B2E,GAE3E,4EAA4E;AAC5E,oBAAoB;AACpB,4EAA4E;;UAsP3DA;IAER,SAASC,IACdC,WAA4C,EAC5CC,UAA6B,CAAC,CAAC;QAE/B,MAAMC,OAAOC,WAAWC,KAAK,CAACC,OAAO,CAACL,eAAeA,cAAc;eAAIA;SAAc;QACrF,IAAIE,KAAKI,MAAM,KAAK,GAAG,OAAOR,WAAWS,KAAK;QAC9C,IAAIL,KAAKI,MAAM,KAAK,GAAG,OAAOJ,IAAI,CAAC,EAAE;QACrC,OAAO;YAAE,GAAGD,OAAO;YAAEO,MAAM;YAAON;QAAK;IACzC;IATA,kFAAkF,cAClEH,MAAAA;IAUT,SAASU,KACdC,MAAS,EACTC,UAAa,EACbC,UAAa,EACbX,UAA6B,CAAC,CAAC;QAE/B,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AK/D,MAAMU;QAAW;IAC/D;IAPA,sGAAsG,cACtFoD,WAAAA;IAQT,SAASE,IAAsBpD,KAAQ,EAAEb,UAA6B,CAAC,CAAC;QAC7E,OAAO;YAAE,GAAGA,OAAO;YAAEO,MAAM;YAAO2D,MAAMrD;QAAM;IAChD;IAHA,oFAAoF,cACpEoD,MAAAA;IAIT,SAASE,KAAKnE,UAA6B,CAAC,CAAC;QAClD,OAAO;YAAE,GAAGA,OAAO;YAAEO,MAAM;QAAO;IACpC;IAHA,sDAAsD,cACtC4D,OAAAA;IAIT,SAASjC,OAAyBrB,KAAQ,EAAEb,UAA6B,CAAC,CAAC;QAChF,OAAO;YAAE,GAAGA,OAAO;YAAEO,MAAM;YAAUM;QAAM;IAC7C;IAHA,4FAA4F,cAC5EqB,SAAAA;AAGlB,GArQiBrC,eAAAA"}
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
|
|
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
|
+
---------------------------------------------------------------------------*/ export * from './compiler.js';
|
|
2
28
|
export * from './errors.js';
|
|
3
29
|
export * from './evaluator.js';
|
|
4
30
|
export * from './expression.js';
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
|
|
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
|
+
---------------------------------------------------------------------------*/ export * from './common/index.js';
|
|
2
26
|
export * from './model/index.js';
|
|
3
27
|
export * from './typescript/index.js';
|
|
4
28
|
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
|
|
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
|
+
---------------------------------------------------------------------------*/ export * from './model-to-arktype.js';
|
|
2
26
|
export * from './model-to-expression.js';
|
|
3
27
|
export * from './model-to-grpc.js';
|
|
4
28
|
export * from './model-to-io-ts.js';
|
|
@@ -1,8 +1,29 @@
|
|
|
1
|
-
|
|
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
|
+
---------------------------------------------------------------------------*/ import * as Types from '@sinclair/typebox';
|
|
2
26
|
import { Formatter, PropertyEncoder } from '../common/index.js';
|
|
3
|
-
// --------------------------------------------------------------------------
|
|
4
|
-
// ModelToArkType
|
|
5
|
-
// --------------------------------------------------------------------------
|
|
6
27
|
export var ModelToArkType;
|
|
7
28
|
(function(ModelToArkType) {
|
|
8
29
|
// ------------------------------------------------------------------------
|