typebox 1.0.61 → 1.0.62

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.
@@ -34,7 +34,7 @@ export declare class Validator<Context extends TProperties = TProperties, Type e
34
34
  /** Clones this validator. */
35
35
  Clone(): Validator<Context, Type>;
36
36
  /** Parses a value */
37
- Parse(value: unknown): Decode;
37
+ Parse(value: unknown): Encode;
38
38
  /** Decodes a value */
39
39
  Decode(value: unknown): Decode;
40
40
  /** Encodes a value */
@@ -1,5 +1,6 @@
1
1
  // deno-fmt-ignore-file
2
2
  // deno-lint-ignore-file
3
+ // auto-generated: design/syntax/syntax.ts
3
4
  import * as S from './mapping.mjs';
4
5
  import * as Token from './token/index.mjs';
5
6
  const If = (result, left, right = () => []) => result.length === 2 ? left(result) : right();
@@ -152,7 +152,7 @@ export interface TNumberOptions extends TSchemaOptions {
152
152
  */
153
153
  multipleOf?: number | bigint;
154
154
  }
155
- export type TFormat = 'date-time' | 'date' | 'duration' | 'email' | 'hostname' | 'idn-email' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'iri-reference' | 'iri' | 'json-pointer-uri-fragment' | 'json-pointer' | 'json-string' | 'regex' | 'relative-json-pointer' | 'time' | 'uri-reference' | 'uri-template' | 'url' | 'uuid' | ({} & string);
155
+ export type TFormat = 'date-time' | 'date' | 'duration' | 'email' | 'hostname' | 'idn-email' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'iri-reference' | 'iri' | 'json-pointer-uri-fragment' | 'json-pointer' | 'json-string' | 'regex' | 'relative-json-pointer' | 'time' | 'uri-reference' | 'uri-template' | 'uri' | 'url' | 'uuid' | ({} & string);
156
156
  export interface TStringOptions extends TSchemaOptions {
157
157
  /**
158
158
  * Specifies the expected string format.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "typebox",
3
3
  "description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
4
- "version": "1.0.61",
4
+ "version": "1.0.62",
5
5
  "keywords": [
6
6
  "typescript",
7
7
  "jsonschema"
package/readme.md CHANGED
@@ -61,8 +61,8 @@ License: MIT
61
61
  - [Type](#Type)
62
62
  - [Value](#Value)
63
63
  - [Compile](#Compile)
64
- - [Schema](#Schema)
65
64
  - [Script](#Script)
65
+ - [Schema](#Schema)
66
66
  - [Contribute](#Contribute)
67
67
 
68
68
  ## Upgrade
@@ -180,48 +180,6 @@ const A = C.Parse({ // const A: {
180
180
  }) // } = ...
181
181
  ```
182
182
 
183
- <a name="Schema"></a>
184
-
185
- ## Schema
186
-
187
- [Example 1](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgYQuYAbApnAvnAMyjTgHIYBPMLAIwgA8B6AYzTEy1ICgfWA7AM7xkcALwo2HABQIucOJWoAuMhBoArLMxikANHLhQsARwCuwIwBMVAbVL09ZCo9IAvUgF198sMWqxgLAEVWXl5ehCFKiwVUj5TEBosKFI8bzCKSMUYsnjE5NTcdPlXLOjYvKSUvANcLlwASl4IQXgAQTEUADoABQBDKAEsGTDRsfGJycZGOH4hODaQgwi4AAZdSc2t7YnpsJXK5PTMtY2d84uxvfkTw6h00rgARkvXy+u4R7v6hre-95m+HEXRBQA) | [Example 2](https://tsplay.dev/mxrl7w)
188
-
189
- TypeBox is built upon a high-performance validation infrastructure that supports the direct compilation and inference of Json Schema schematics. TypeBox implements Draft 3 to 2020-12 and is compliance tested via the official Json Schema [Test Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite). It offers high-performance JIT compilation with automatic fallback to dynamic checking in JIT restricted environments.
190
-
191
- ### Example
192
-
193
- The following compiles Json Schema. Type inference is supported.
194
-
195
- ```typescript
196
- const C = Compile({
197
- type: 'object',
198
- required: ['x', 'y', 'z'],
199
- properties: {
200
- x: { type: 'number' },
201
- y: { type: 'number' },
202
- z: { type: 'number' }
203
- }
204
- })
205
-
206
- const A = C.Parse({ // const A: {
207
- x: 0, // x: number,
208
- y: 0, // y: number,
209
- z: 1 // z: number
210
- }) // } = ...
211
- ```
212
-
213
- It can also be used to accelerate remote libraries via Json Schema translation.
214
-
215
- ```typescript
216
- const C = Compile(x.toJsonSchema(x.object({
217
- x: x.number(),
218
- y: x.number(),
219
- z: x.number()
220
- })))
221
-
222
- const A = C.Check(...) // high performance runtime checking
223
- ```
224
-
225
183
  ## Script
226
184
 
227
185
  [Documentation](https://sinclairzx81.github.io/typebox/#/docs/script/overview) | [Example 1](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgGUBjKYMGVAE0SOqYgB2AZ3gI4AXh5oAdM1bsAFAAMA3nEpw4ZAFxwBAVxDFUUADTrNSXSNYCA5uY1wAXrtIQANqgCGA9QF8lAEpNULDwiMio6PC6OH5hUV0EAHliACtUJhgAHhUnGMKi4rC4zR1EADlDYzMCkobG0vpLZIYYWwd6pp7ispdkgCEITx8Bbt7JqLj-AD5qOIApIUFGJgALVBBvOABJAQ6IITRs4EFqBGlCNCnb0Li8CAysmCpLqFQAR31gD+47npxADaeAo5jwSDw4OceAAupRLmBsGhYMBUEIAY04moKtI8eYrHA8dJzK4iXi4P4FvQ5GwONxkDcFABhHBgfT0oJ8QQiRgSKSoWQsOkKNRifzmVROIEAaTgwD8AGtUEgIBhELDkrLYXAAD56fQeDyUQIhTF3OIJXkMZJpTLZPITc2TfoVBAAVQEZwEOSBCGqRhM5n9ho8sNmpidzsBLTghI9XsEvoQ7U6weqRvDkejAP6ZIT3uTw1GvnTofDUZzDRm81oNJgvk43ig3H2GBMqAETFQ1Gu6AY-MZgva3hgwCYOT7asYs1ucT7fMk+Src9jFQMgageoNRuzK5dscJNgVdm3Bl3lf3hTzbhGXl8Z9Dl6v0RmQA) | [Example 2](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgAkIA3VKOGAC1QGd0NocYADsMbVMIDG6ABQ9OEAK4AbACZwQAQxiTOHbnB6SowMDFTrCaAJSVUZSLA5E4AMQgQ4AXkREAdADKMNrAkgA8VqgQGG4eAHx2DtDwkXAAQprsPshogcEwoRFE0emZCbT0AMIQYEhwmsLqYJo85ogBzmg8QsIwnjmogcamMDJ+49b1jXAA5qjwxJqSANadqAC0PJpicABSAQDyAHJwAbqoWomO8JIQwq1wAN6xEAA0pewAvt6+uWcmZhkAANKKl3J4fI9KHA4GQAFxwYSKEDENjQuBIBFIlFomEALyxyNRUEon2oqQyWSe6KgqE0qjuyjqAG0ANI9ODLVBIErg+rdACymjAYVZcQAugiAIKqZgNaSqUVxOAAHxebPFpPJLhlcqkFlF3PeADVMsAGjBuj48AANPCq-AATXtarwAC08MqfDJ0QAdIG+gAkjwAqmA0FBJC1UIakHFPkHHqaTBaeJ91qBIDweMBiMpUP7KLZQS4hSLWdyvXAwxGo3wwuiK3V7OZGt08BQ4AB+fCae1wxvcuAtiSqdtIe09vDEfuD5tkVtj-B4yf4SSzmHCVCsEnlIG2OhwA6KGBgE9rbqZfgqJlwWkYfOSYJ59D7Y6nc6XcF+VIwv---9DzwCBiAAK1QJ97TgShvzAbAIwKXgAL-Q9nnhOBxj8d5MQw8Z3gJXC-DgMlv1pABHRRgFpdRkJQ+hmQ7PB3jwCdmJXcUgA)
@@ -266,6 +224,47 @@ type S = Type.Static<typeof S> // type S = {
266
224
  // }
267
225
  ```
268
226
 
227
+ <a name="Schema"></a>
228
+
229
+ ## Schema
230
+
231
+ [Documentation](https://sinclairzx81.github.io/typebox/#/docs/schema/overview) | [Example 1](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgYQuYAbApnAvnAMyjTgHIYBPMLAIwgA8B6AYzTEy1ICgfWA7AM7xkcALwo2HABQIucOJWoAuMhBoArLMxikANHLhQsARwCuwIwBMVAbVL09ZCo9IAvUgF198sMWqxgLAEVWXl5ehCFKiwVUj5TEBosKFI8bzCKSMUYsnjE5NTcdPlXLOjYvKSUvANcLlwASl4IQXgAQTEUADoABQBDKAEsGTDRsfGJycZGOH4hODaQgwi4AAZdSc2t7YnpsJXK5PTMtY2d84uxvfkTw6h00rgARkvXy+u4R7v6hre-95m+HEXRBQA) | [Example 2](https://tsplay.dev/mxrl7w)
232
+
233
+ TypeBox is built upon a high-performance validation infrastructure that supports the direct compilation and inference of Json Schema schematics. TypeBox implements Draft 3 to 2020-12 and is compliance tested via the official Json Schema [Test Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite). It offers high-performance JIT compilation with automatic fallback to dynamic checking in JIT restricted environments.
234
+
235
+ ### Example
236
+
237
+ The following compiles Json Schema. Type inference is supported.
238
+
239
+ ```typescript
240
+ const C = Compile({
241
+ type: 'object',
242
+ required: ['x', 'y', 'z'],
243
+ properties: {
244
+ x: { type: 'number' },
245
+ y: { type: 'number' },
246
+ z: { type: 'number' }
247
+ }
248
+ })
249
+
250
+ const A = C.Parse({ // const A: {
251
+ x: 0, // x: number,
252
+ y: 0, // y: number,
253
+ z: 1 // z: number
254
+ }) // } = ...
255
+ ```
256
+
257
+ It can also be used to accelerate remote libraries via Json Schema translation.
258
+
259
+ ```typescript
260
+ const C = Compile(x.toJsonSchema(x.object({
261
+ x: x.number(),
262
+ y: x.number(),
263
+ z: x.number()
264
+ })))
265
+
266
+ const A = C.Check(...) // high performance runtime checking
267
+ ```
269
268
 
270
269
  ## Contribute
271
270