@dev-sergeev/datalab-kit 0.1.5 → 0.1.6
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/CHANGELOG.md +11 -0
- package/README.md +23 -1
- package/THIRD_PARTY_NOTICES.md +3 -0
- package/dist/extension.js +2 -0
- package/dist/skills.d.ts +2 -0
- package/dist/skills.js +54 -0
- package/package.json +36 -9
- package/skills/init/SKILL.md +31 -0
- package/skills/skill-creator/LICENSE.txt +202 -0
- package/skills/skill-creator/SKILL.md +610 -0
- package/skills/skill-creator/agents/analyzer.md +291 -0
- package/skills/skill-creator/agents/comparator.md +213 -0
- package/skills/skill-creator/agents/grader.md +234 -0
- package/skills/skill-creator/assets/eval_review.html +146 -0
- package/skills/skill-creator/eval-viewer/generate_review.py +453 -0
- package/skills/skill-creator/eval-viewer/viewer.html +1329 -0
- package/skills/skill-creator/references/schemas.md +521 -0
- package/skills/skill-creator/scripts/aggregate_benchmark.py +415 -0
- package/skills/skill-creator/scripts/generate_report.py +329 -0
- package/skills/skill-creator/scripts/improve_description.py +225 -0
- package/skills/skill-creator/scripts/package_skill.py +136 -0
- package/skills/skill-creator/scripts/pi_runtime.py +177 -0
- package/skills/skill-creator/scripts/quick_validate.py +107 -0
- package/skills/skill-creator/scripts/run_eval.py +215 -0
- package/skills/skill-creator/scripts/run_loop.py +334 -0
- package/skills/skill-creator/scripts/utils.py +41 -0
- package/node_modules/node-addon-api/common 2.gypi +0 -21
- package/node_modules/node-addon-api/except 2.gypi +0 -25
- package/node_modules/node-addon-api/napi 2.h +0 -3463
- package/node_modules/node-addon-api/napi-inl 2.h +0 -7250
- package/node_modules/node-addon-api/napi-inl.deprecated 2.h +0 -186
- package/node_modules/node-addon-api/node_addon_api 2.gyp +0 -42
- package/node_modules/node-addon-api/node_api 2.gyp +0 -9
- package/node_modules/node-addon-api/noexcept 2.gypi +0 -26
- package/node_modules/pi-toggle-skills/toggle-skills 2.ts +0 -316
- package/node_modules/pi-toggle-skills/vitest.config 2.ts +0 -15
- package/node_modules/sprintf-js/.npmignore 2 +0 -1
- package/node_modules/sprintf-js/LICENSE 2 +0 -24
- package/node_modules/sprintf-js/README 2.md +0 -88
- package/node_modules/sprintf-js/bower 2.json +0 -14
- package/node_modules/sprintf-js/gruntfile 2.js +0 -36
- package/node_modules/sprintf-js/package 2.json +0 -22
- package/node_modules/tree-sitter-bash/tree-sitter-bash 2.wasm +0 -0
- package/node_modules/typebox/license 2 +0 -23
- package/node_modules/typebox/package 2.json +0 -87
- package/node_modules/typebox/readme 2.md +0 -370
- package/node_modules/zod/compile 2.cjs +0 -96
- package/node_modules/zod/compile 2.js +0 -52
- package/node_modules/zod/index 2.cjs +0 -52
- package/node_modules/zod/index 2.js +0 -7
- /package/{node_modules/node-addon-api/nothing 2.c → skills/skill-creator/scripts/__init__.py} +0 -0
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# sprintf.js
|
|
2
|
-
**sprintf.js** is a complete open source JavaScript sprintf implementation for the *browser* and *node.js*.
|
|
3
|
-
|
|
4
|
-
Its prototype is simple:
|
|
5
|
-
|
|
6
|
-
string sprintf(string format , [mixed arg1 [, mixed arg2 [ ,...]]])
|
|
7
|
-
|
|
8
|
-
The placeholders in the format string are marked by `%` and are followed by one or more of these elements, in this order:
|
|
9
|
-
|
|
10
|
-
* An optional number followed by a `$` sign that selects which argument index to use for the value. If not specified, arguments will be placed in the same order as the placeholders in the input string.
|
|
11
|
-
* An optional `+` sign that forces to preceed the result with a plus or minus sign on numeric values. By default, only the `-` sign is used on negative numbers.
|
|
12
|
-
* An optional padding specifier that says what character to use for padding (if specified). Possible values are `0` or any other character precedeed by a `'` (single quote). The default is to pad with *spaces*.
|
|
13
|
-
* An optional `-` sign, that causes sprintf to left-align the result of this placeholder. The default is to right-align the result.
|
|
14
|
-
* An optional number, that says how many characters the result should have. If the value to be returned is shorter than this number, the result will be padded. When used with the `j` (JSON) type specifier, the padding length specifies the tab size used for indentation.
|
|
15
|
-
* An optional precision modifier, consisting of a `.` (dot) followed by a number, that says how many digits should be displayed for floating point numbers. When used with the `g` type specifier, it specifies the number of significant digits. When used on a string, it causes the result to be truncated.
|
|
16
|
-
* A type specifier that can be any of:
|
|
17
|
-
* `%` — yields a literal `%` character
|
|
18
|
-
* `b` — yields an integer as a binary number
|
|
19
|
-
* `c` — yields an integer as the character with that ASCII value
|
|
20
|
-
* `d` or `i` — yields an integer as a signed decimal number
|
|
21
|
-
* `e` — yields a float using scientific notation
|
|
22
|
-
* `u` — yields an integer as an unsigned decimal number
|
|
23
|
-
* `f` — yields a float as is; see notes on precision above
|
|
24
|
-
* `g` — yields a float as is; see notes on precision above
|
|
25
|
-
* `o` — yields an integer as an octal number
|
|
26
|
-
* `s` — yields a string as is
|
|
27
|
-
* `x` — yields an integer as a hexadecimal number (lower-case)
|
|
28
|
-
* `X` — yields an integer as a hexadecimal number (upper-case)
|
|
29
|
-
* `j` — yields a JavaScript object or array as a JSON encoded string
|
|
30
|
-
|
|
31
|
-
## JavaScript `vsprintf`
|
|
32
|
-
`vsprintf` is the same as `sprintf` except that it accepts an array of arguments, rather than a variable number of arguments:
|
|
33
|
-
|
|
34
|
-
vsprintf("The first 4 letters of the english alphabet are: %s, %s, %s and %s", ["a", "b", "c", "d"])
|
|
35
|
-
|
|
36
|
-
## Argument swapping
|
|
37
|
-
You can also swap the arguments. That is, the order of the placeholders doesn't have to match the order of the arguments. You can do that by simply indicating in the format string which arguments the placeholders refer to:
|
|
38
|
-
|
|
39
|
-
sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants")
|
|
40
|
-
And, of course, you can repeat the placeholders without having to increase the number of arguments.
|
|
41
|
-
|
|
42
|
-
## Named arguments
|
|
43
|
-
Format strings may contain replacement fields rather than positional placeholders. Instead of referring to a certain argument, you can now refer to a certain key within an object. Replacement fields are surrounded by rounded parentheses - `(` and `)` - and begin with a keyword that refers to a key:
|
|
44
|
-
|
|
45
|
-
var user = {
|
|
46
|
-
name: "Dolly"
|
|
47
|
-
}
|
|
48
|
-
sprintf("Hello %(name)s", user) // Hello Dolly
|
|
49
|
-
Keywords in replacement fields can be optionally followed by any number of keywords or indexes:
|
|
50
|
-
|
|
51
|
-
var users = [
|
|
52
|
-
{name: "Dolly"},
|
|
53
|
-
{name: "Molly"},
|
|
54
|
-
{name: "Polly"}
|
|
55
|
-
]
|
|
56
|
-
sprintf("Hello %(users[0].name)s, %(users[1].name)s and %(users[2].name)s", {users: users}) // Hello Dolly, Molly and Polly
|
|
57
|
-
Note: mixing positional and named placeholders is not (yet) supported
|
|
58
|
-
|
|
59
|
-
## Computed values
|
|
60
|
-
You can pass in a function as a dynamic value and it will be invoked (with no arguments) in order to compute the value on-the-fly.
|
|
61
|
-
|
|
62
|
-
sprintf("Current timestamp: %d", Date.now) // Current timestamp: 1398005382890
|
|
63
|
-
sprintf("Current date and time: %s", function() { return new Date().toString() })
|
|
64
|
-
|
|
65
|
-
# AngularJS
|
|
66
|
-
You can now use `sprintf` and `vsprintf` (also aliased as `fmt` and `vfmt` respectively) in your AngularJS projects. See `demo/`.
|
|
67
|
-
|
|
68
|
-
# Installation
|
|
69
|
-
|
|
70
|
-
## Via Bower
|
|
71
|
-
|
|
72
|
-
bower install sprintf
|
|
73
|
-
|
|
74
|
-
## Or as a node.js module
|
|
75
|
-
|
|
76
|
-
npm install sprintf-js
|
|
77
|
-
|
|
78
|
-
### Usage
|
|
79
|
-
|
|
80
|
-
var sprintf = require("sprintf-js").sprintf,
|
|
81
|
-
vsprintf = require("sprintf-js").vsprintf
|
|
82
|
-
|
|
83
|
-
sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants")
|
|
84
|
-
vsprintf("The first 4 letters of the english alphabet are: %s, %s, %s and %s", ["a", "b", "c", "d"])
|
|
85
|
-
|
|
86
|
-
# License
|
|
87
|
-
|
|
88
|
-
**sprintf.js** is licensed under the terms of the 3-clause BSD license.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "sprintf",
|
|
3
|
-
"description": "JavaScript sprintf implementation",
|
|
4
|
-
"version": "1.0.3",
|
|
5
|
-
"main": "src/sprintf.js",
|
|
6
|
-
"license": "BSD-3-Clause-Clear",
|
|
7
|
-
"keywords": ["sprintf", "string", "formatting"],
|
|
8
|
-
"authors": ["Alexandru Marasteanu <hello@alexei.ro> (http://alexei.ro/)"],
|
|
9
|
-
"homepage": "https://github.com/alexei/sprintf.js",
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git://github.com/alexei/sprintf.js.git"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
module.exports = function(grunt) {
|
|
2
|
-
grunt.initConfig({
|
|
3
|
-
pkg: grunt.file.readJSON("package.json"),
|
|
4
|
-
|
|
5
|
-
uglify: {
|
|
6
|
-
options: {
|
|
7
|
-
banner: "/*! <%= pkg.name %> | <%= pkg.author %> | <%= pkg.license %> */\n",
|
|
8
|
-
sourceMap: true
|
|
9
|
-
},
|
|
10
|
-
build: {
|
|
11
|
-
files: [
|
|
12
|
-
{
|
|
13
|
-
src: "src/sprintf.js",
|
|
14
|
-
dest: "dist/sprintf.min.js"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
src: "src/angular-sprintf.js",
|
|
18
|
-
dest: "dist/angular-sprintf.min.js"
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
watch: {
|
|
25
|
-
js: {
|
|
26
|
-
files: "src/*.js",
|
|
27
|
-
tasks: ["uglify"]
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
grunt.loadNpmTasks("grunt-contrib-uglify")
|
|
33
|
-
grunt.loadNpmTasks("grunt-contrib-watch")
|
|
34
|
-
|
|
35
|
-
grunt.registerTask("default", ["uglify", "watch"])
|
|
36
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "sprintf-js",
|
|
3
|
-
"version": "1.0.3",
|
|
4
|
-
"description": "JavaScript sprintf implementation",
|
|
5
|
-
"author": "Alexandru Marasteanu <hello@alexei.ro> (http://alexei.ro/)",
|
|
6
|
-
"main": "src/sprintf.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test": "mocha test/test.js"
|
|
9
|
-
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "https://github.com/alexei/sprintf.js.git"
|
|
13
|
-
},
|
|
14
|
-
"license": "BSD-3-Clause",
|
|
15
|
-
"readmeFilename": "README.md",
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"mocha": "*",
|
|
18
|
-
"grunt": "*",
|
|
19
|
-
"grunt-contrib-watch": "*",
|
|
20
|
-
"grunt-contrib-uglify": "*"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
Binary file
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
TypeBox
|
|
2
|
-
|
|
3
|
-
The MIT License (MIT)
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2017-2026 Haydn Paterson
|
|
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.
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "typebox",
|
|
3
|
-
"description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
|
|
4
|
-
"version": "1.3.7",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"typescript",
|
|
7
|
-
"jsonschema"
|
|
8
|
-
],
|
|
9
|
-
"license": "MIT",
|
|
10
|
-
"author": "sinclairzx81",
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "https://github.com/sinclairzx81/typebox"
|
|
14
|
-
},
|
|
15
|
-
"type": "module",
|
|
16
|
-
"types": "./build/index.d.mts",
|
|
17
|
-
"module": "./build/index.mjs",
|
|
18
|
-
"exports": {
|
|
19
|
-
"./schema": {
|
|
20
|
-
"import": "./build/schema/index.mjs",
|
|
21
|
-
"default": "./build/schema/index.mjs"
|
|
22
|
-
},
|
|
23
|
-
"./system": {
|
|
24
|
-
"import": "./build/system/index.mjs",
|
|
25
|
-
"default": "./build/system/index.mjs"
|
|
26
|
-
},
|
|
27
|
-
"./compile": {
|
|
28
|
-
"import": "./build/compile/index.mjs",
|
|
29
|
-
"default": "./build/compile/index.mjs"
|
|
30
|
-
},
|
|
31
|
-
"./value": {
|
|
32
|
-
"import": "./build/value/index.mjs",
|
|
33
|
-
"default": "./build/value/index.mjs"
|
|
34
|
-
},
|
|
35
|
-
"./type": {
|
|
36
|
-
"import": "./build/type/index.mjs",
|
|
37
|
-
"default": "./build/type/index.mjs"
|
|
38
|
-
},
|
|
39
|
-
"./error": {
|
|
40
|
-
"import": "./build/error/index.mjs",
|
|
41
|
-
"default": "./build/error/index.mjs"
|
|
42
|
-
},
|
|
43
|
-
"./format": {
|
|
44
|
-
"import": "./build/format/index.mjs",
|
|
45
|
-
"default": "./build/format/index.mjs"
|
|
46
|
-
},
|
|
47
|
-
"./guard": {
|
|
48
|
-
"import": "./build/guard/index.mjs",
|
|
49
|
-
"default": "./build/guard/index.mjs"
|
|
50
|
-
},
|
|
51
|
-
".": {
|
|
52
|
-
"import": "./build/index.mjs",
|
|
53
|
-
"default": "./build/index.mjs"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"typesVersions": {
|
|
57
|
-
"*": {
|
|
58
|
-
"schema": [
|
|
59
|
-
"./build/schema/index.d.mts"
|
|
60
|
-
],
|
|
61
|
-
"system": [
|
|
62
|
-
"./build/system/index.d.mts"
|
|
63
|
-
],
|
|
64
|
-
"compile": [
|
|
65
|
-
"./build/compile/index.d.mts"
|
|
66
|
-
],
|
|
67
|
-
"value": [
|
|
68
|
-
"./build/value/index.d.mts"
|
|
69
|
-
],
|
|
70
|
-
"type": [
|
|
71
|
-
"./build/type/index.d.mts"
|
|
72
|
-
],
|
|
73
|
-
"error": [
|
|
74
|
-
"./build/error/index.d.mts"
|
|
75
|
-
],
|
|
76
|
-
"format": [
|
|
77
|
-
"./build/format/index.d.mts"
|
|
78
|
-
],
|
|
79
|
-
"guard": [
|
|
80
|
-
"./build/guard/index.d.mts"
|
|
81
|
-
],
|
|
82
|
-
".": [
|
|
83
|
-
"./build/index.d.mts"
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
<div align='center'>
|
|
2
|
-
|
|
3
|
-
<h1>TypeBox</h1>
|
|
4
|
-
|
|
5
|
-
<p>JSON Schema Type Builder with Static Type Resolution for TypeScript</p>
|
|
6
|
-
|
|
7
|
-
<img src="typebox.png" />
|
|
8
|
-
|
|
9
|
-
<br />
|
|
10
|
-
<br />
|
|
11
|
-
|
|
12
|
-
[](https://badge.fury.io/js/typebox)
|
|
13
|
-
[](https://www.npmjs.com/package/typebox)
|
|
14
|
-
[](https://github.com/sinclairzx81/typebox/actions/workflows/build.yml)
|
|
15
|
-
[](https://opensource.org/licenses/MIT)
|
|
16
|
-
|
|
17
|
-
</div>
|
|
18
|
-
|
|
19
|
-
## Install
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
$ npm install typebox
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## Usage
|
|
27
|
-
|
|
28
|
-
```typescript
|
|
29
|
-
import Type from 'typebox'
|
|
30
|
-
|
|
31
|
-
const T = Type.Object({ // const T = {
|
|
32
|
-
x: Type.Number(), // type: 'object',
|
|
33
|
-
y: Type.Number(), // properties: {
|
|
34
|
-
z: Type.Number() // x: { type: 'number' },
|
|
35
|
-
}) // y: { type: 'number' },
|
|
36
|
-
// z: { type: 'number' }
|
|
37
|
-
// },
|
|
38
|
-
// required: ['x', 'y', 'z']
|
|
39
|
-
// }
|
|
40
|
-
|
|
41
|
-
type T = Type.Static<typeof T> // type T = {
|
|
42
|
-
// x: number,
|
|
43
|
-
// y: number,
|
|
44
|
-
// z: number
|
|
45
|
-
// }
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Overview
|
|
50
|
-
|
|
51
|
-
[Documentation](https://sinclairzx81.github.io/typebox/)
|
|
52
|
-
|
|
53
|
-
TypeBox is a runtime type system that creates in-memory JSON Schema objects that infer as TypeScript types. The schematics produced by this library are designed to match the static type checking rules of the TypeScript compiler. TypeBox offers a unified type that can be statically checked by TypeScript and runtime checked using standard JSON Schema validation.
|
|
54
|
-
|
|
55
|
-
This library is designed to allow JSON Schema to compose similar to how types compose within TypeScript's type system. It can be used as a simple tool to build up complex schematics or integrated into REST and RPC services to help validate data received over the wire.
|
|
56
|
-
|
|
57
|
-
License: MIT
|
|
58
|
-
|
|
59
|
-
## Contents
|
|
60
|
-
|
|
61
|
-
- [Type](#Type)
|
|
62
|
-
- [Script](#Script)
|
|
63
|
-
- [Schema](#Schema)
|
|
64
|
-
- [Versions](#Versions)
|
|
65
|
-
- [Contribute](#Contribute)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<a name="Type"></a>
|
|
69
|
-
|
|
70
|
-
## Type
|
|
71
|
-
|
|
72
|
-
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/type/overview) | [Example](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFonmXW32POvueHb7kafo16ix4ic2oBjCADsAzvACqC1FDgBeREQB0AeWIArVNJgAKAN5wbtu-Yc26cWYpVqN2y5RvAAJgBcOmi6AMowUMByAObmAJQANI7JKfbONoRoQXgQxqYweAk+cHIAhiCoQYKoYRFRsYmpTQ7pcGDYaLDAqApB3jaoIKXAADZVeuGRMVaY0EMw2YPDI3hwAL5xya2+gXDWmZX4SlPRq2tFG81X11v0dmUVfXAH2cf1Z0U3X99w23BLoyexR+INSfwyRFedRihTgwNBCLSd3sGDmpQW+ABKzhiNxdj+a3heIRrUJxLxrSgqAAjgBXYBU3YAbSJ5J+fzw-lhrLZXw5D1Q3N5JORNjwWKowtBrQAujypc1nIThJJVWr1XxnOF0cBpCqNQbDZxqAc4Kp1FpgjVtTBdQAeA4QDBmjwAPmuzlN5s8e3lCqarX8QTeMU+-u+rQFweh0TD4ZurSx0ZOfvjjiVQA)
|
|
73
|
-
|
|
74
|
-
TypeBox types are JSON Schema fragments that compose into more complex types. The library offers a set of types used to construct JSON Schema compliant schematics as well as a set of extended types used to model constructs native to the JavaScript language. The schematics produced by TypeBox can be passed directly to any JSON Schema compliant validator.
|
|
75
|
-
|
|
76
|
-
### Example
|
|
77
|
-
|
|
78
|
-
The following creates a User type and infers with Static.
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
import Type from 'typebox'
|
|
82
|
-
|
|
83
|
-
// Type
|
|
84
|
-
|
|
85
|
-
const User = Type.Object({ // const User = {
|
|
86
|
-
id: Type.String(), // type: 'object',
|
|
87
|
-
name: Type.String(), // properties: {
|
|
88
|
-
email: Type.String({ format: 'email' }) // id: { type: 'string' },
|
|
89
|
-
}) // name: { type: 'string' },
|
|
90
|
-
// email: {
|
|
91
|
-
// type: 'string',
|
|
92
|
-
// format: 'email'
|
|
93
|
-
// }
|
|
94
|
-
// }
|
|
95
|
-
// required: [
|
|
96
|
-
// 'id',
|
|
97
|
-
// 'name',
|
|
98
|
-
// 'email'
|
|
99
|
-
// ]
|
|
100
|
-
// }
|
|
101
|
-
|
|
102
|
-
// Static
|
|
103
|
-
|
|
104
|
-
type User = Type.Static<typeof User> // type User = {
|
|
105
|
-
// id: string,
|
|
106
|
-
// name: string,
|
|
107
|
-
// email: string
|
|
108
|
-
// }
|
|
109
|
-
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## Script
|
|
113
|
-
|
|
114
|
-
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/script/overview) | [Example 1](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFkIATAVwBtVKBjCAOwDO8BgEMYACzgBeREQB0AZW5RgYGAAoABpThxCaOADVU3GNABM0uAG84ZAFxw+rEMVRQANHCSPnr93AAvjp6REYmZlAAzFa2Dk4ubp7evonuXgBeqf5QQSH66Mam0AAssXbZSV4+CTmZlelwAO4NucGaAJTUdHAAIqhofMyofMIsHFy8gvC2DKgCkoFWyGiKyqoaohJemrr5YcawqGSxIbqQAsAwwPyORZElHmdO0CAi7HcR0FFPurqsADdPsUoOYQsFdAU4ABxVA4VAwKBIU5-OAA9zXbjzT5HMgAbQAur8-sAhsAsQJWoTwfsDFt3MB3ii-iJXMARjBgQ9ibpmMAMBhWAJUFzSjy4AI0NwOCIoKKoCUaZCwnMFszdABzOEgBFIxyw+GIpDit4wBnvRz0lTvGmdbr0ABKrFGoHQDtQGE4phufEoqvEcjA2DQsHZAjkWsNSMDwYxYbk6NDFLkV1QIHDQYgIeu80DEEu134MazcdzZD98wDmez8cjOqNxZrucTmNzqfTjdL4b4r3endDZYrC37OfDdd1SBH8Zb5LbZo71a7ckBU8H-tX4dN5vYG7kfIFQtQu-L68XA83Ym3u9ZxHZo2PQ6rsfPci31p3Z9HcklJhlUAftD0AoMBiOScAAJJ8Bg7gjFilCCnw3r8HAUAjMMUDqDqCyOCsR7AaB3AADwFBAGCMJWAB8HQ2CEWEBuODYzhSeIAAwEnmBY+nI5a6HREbahOCZxsxbFyD2UBvDuPFwHxDHRkx8ysexK7SXxb6Mju+6CsK3G0ZWr6Xu+cg3neMC6bx+nqX2P7Suwsq6YEQA) | [Example 2](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFkIATAVwBtVKA7AQxFQBnMLwDG6BrxgALOAG9KcOKjKRYcURG6D4ANVSiY0AExwAvIiIA6APLEAVgZgAKOXDIAuS2isA5ViDEqFDOAJQANHBIXsg+-oHBYXAAvqGKyqrQ8Jraek7QAMzm3qi2Dk6u7jHW8UEhEVHVcQF1YZEAXk2ltYmhKWlKKmrZWjpw+obQACzFsaV2joaVniV+Lb2R0as99R1dawm7cADu+ztJqZTJ1HRwACKoaNzMqNzwTGyclDlj+rAqs2sCwqCiUkEEwBgwC0XkkMisEyMUCm4XS3GgIF47FhUmkCPyUAKqKUrAAbjj4YiTFc0j94ABxVA4VAwKBIQE+YFLUFwUnBKHiQT7ACCUCgvCQzj+MBUEXSwGewEFIrFEuccwOrVCaUudMYUmCwCxHPm5W56X4xGArxgFLxVORxLgzGAGAwrEEqDt+MmjvSwgMHF4UG9DqmNO+o3eQlkFg1XJcPIA5kyBKytozmemnZiZVAjdj9XmCxHaPQAEqsN6gdDl1AYTiGaHcSgMGNWMDYNCwa2CKwprNsjtd-m9qx8nuCqyQ1AgPudiDdqFCDsQCFQrTDxejldkVvthdLscDtNDw87vsTgUrmdzrdHlfoqCY9j3i9WPdtwR4889lcnlkzxHP9L1HKdb3nYDlz7Mk3xAj992-ODoKsXNDSxZCxxdN0PVKX8UM-A8oLHND8ww-Cx0ta03kw3dEJ-YiV1IgtaL7ANRCDKBWIQss4AAZRgKQlTgABJbgMGCV5xEod1uCbLQ4CgV4XhCARv32AShNEAAeQg0AgDBGBjAA+PoeTUvEAPTccwKEABtAAGABdVd12bBClAs-tU0ApAbMneznKsJ8Xw8uAvKsocryVQKXNgvdPPbZiMOw91PTCrzktfKibQypKDTI192M4hDkiAA) | [Challenge](test/typescript/readme.md)
|
|
115
|
-
|
|
116
|
-
TypeBox includes a runtime scripting engine that can transform TypeScript definitions into JSON Schema. The engine is implemented symmetrically at runtime and inside TypeScript's type system. It supports many programmable type-level constructs such as Conditional, Mapped, Indexed, Generic, Distributive Conditional, and more. The engine is designed for TypeScript 7 but is supported in TypeScript 5 and above.
|
|
117
|
-
|
|
118
|
-
### Example
|
|
119
|
-
|
|
120
|
-
Syntax highlighting is available via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=sinclairzx81.typebox-script)
|
|
121
|
-
|
|
122
|
-
```typescript
|
|
123
|
-
// Module
|
|
124
|
-
const Math = Type.Script(`
|
|
125
|
-
type Vector2 = { x: number, y: number }
|
|
126
|
-
type Vector3 = { x: number, y: number, z: number }
|
|
127
|
-
type Vector4 = { x: number, y: number, z: number, w: number }
|
|
128
|
-
`)
|
|
129
|
-
|
|
130
|
-
// Dependent Module
|
|
131
|
-
const { Mesh } = Type.Script(Math, `
|
|
132
|
-
type Vertex = {
|
|
133
|
-
position: Vector4,
|
|
134
|
-
normal: Vector3,
|
|
135
|
-
uv: Vector2
|
|
136
|
-
}
|
|
137
|
-
type Geometry = {
|
|
138
|
-
vertices: Vertex[],
|
|
139
|
-
indices: number[]
|
|
140
|
-
}
|
|
141
|
-
type Material = {
|
|
142
|
-
ambient: Vector4,
|
|
143
|
-
diffuse: Vector4,
|
|
144
|
-
specular: Vector4
|
|
145
|
-
}
|
|
146
|
-
type Mesh = {
|
|
147
|
-
geometry: Geometry,
|
|
148
|
-
material: Material
|
|
149
|
-
}
|
|
150
|
-
`)
|
|
151
|
-
|
|
152
|
-
// Runtime Reflection
|
|
153
|
-
Mesh.properties.geometry.properties.vertices.items.properties.position.properties.x
|
|
154
|
-
Mesh.properties.geometry.properties.vertices.items.properties.normal.properties.x
|
|
155
|
-
Mesh.properties.geometry.properties.vertices.items.properties.uv.properties.x
|
|
156
|
-
Mesh.properties.material.properties.diffuse.properties.x
|
|
157
|
-
Mesh.properties.material.properties.ambient.properties.x
|
|
158
|
-
Mesh.properties.material.properties.specular.properties.x
|
|
159
|
-
|
|
160
|
-
// Static Inference
|
|
161
|
-
function render(mesh: Type.Static<typeof Mesh>) {
|
|
162
|
-
mesh.geometry.vertices[0].position.x
|
|
163
|
-
mesh.geometry.vertices[0].normal.x
|
|
164
|
-
mesh.geometry.vertices[0].uv.x
|
|
165
|
-
mesh.material.diffuse.x
|
|
166
|
-
mesh.material.ambient.x
|
|
167
|
-
mesh.material.specular.x
|
|
168
|
-
}
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
<a name="Schema"></a>
|
|
172
|
-
|
|
173
|
-
## Schema
|
|
174
|
-
|
|
175
|
-
[Documentation](https://sinclairzx81.github.io/typebox/#/docs/schema/overview) | [Example 1](https://www.typescriptlang.org/play/#code/JYWwDg9gTgLgBAZQMYAsCmICGcBmUIhwDkMAnmGgEYQAeA9AM6oaZEBQbddcAtH-wMFDhI0WPESenbgGECYYABs003pPUbNW-hyQQAdg3gBVBmihwAvImZYAdHPBK0ACgDebOHDIUAXMQhKACs0JBgiABpPODB8ClhgNAZ-Dy8vYAATFO9yNH8iIyhgfQBzIjgAXyi0uH1MEDy4Nxy-YkLissrqtJYlbJ9Ggpgi0sjcaCwYfN7FcoroquioNABHAFdgZay4AG1oryJMsf3iOobjmqIZ9i8AXTYKgEoOLjVtd4+P1QAFTCgzVSfIHAyS6AxGOBrMwWaymcx2X7-VzNGqotHouCvPSGeBQ8wpaKZfIANgArDgAIyYABMlAAzEgACwZUloYk4ADsmAAHJQAJxIAAMGQpYwx6Ne6W27VK3TOgzxUDF4pVqq8ktq9UaMpK3Rm+UVAAEMgRMMU7HoQOU1SqNfq4DqHo8bS7XajXhUrHA7D6gA) | [Example 2](https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAZQMYAsCmICGcBmUIhwDkMAnmGgEYQAeA9AM6oaZEBQokscAKuWrnyES-ajXZs6dOAFo58hYqXKVqteo0zJ0gMIEwwADZptszeYuWr8tmyQQAdg3gBVBmihwAvImZYAdHrgRmgAFHwU-gDylABWaEgwoQDebHBwwAAmAFy8-P4IMFDADgDmoQCUADRpcA6YIGi5EWgFRSXl1bUsRs35hcVlKbjQWDC5RD2GRHAAvhVs8wum1qtr61pScAAKmFDuKxtHx6q29k7wAK7unj5uHv67+2HJ6W-vH5-vW+fOcNceXKpdJZCYANgArDgAIyYABMlAAzEgACyZCFoME4ADsmAAHJQAJxIAAMmWhRCqX2pcC2IJycGcg1KNXS9UaEwBUEpNN5fO+0jZDSajPaZVZcCmnJuAAFMgRMCV-PYQDN+by6ZKsL1RczFhV1YajR8trNvHB-JagA)
|
|
176
|
-
|
|
177
|
-
TypeBox includes a high-performance JIT compiler that supports JSON Schema Draft 3 through to 2020-12. It is designed to be a lightweight industry-grade alternative to Ajv and offers improved compilation and validation performance. It also provides automatic fallback to dynamic validation in JIT restricted environments such as Cloudflare Workers.
|
|
178
|
-
|
|
179
|
-
The compiler is available via optional sub module import.
|
|
180
|
-
|
|
181
|
-
```typescript
|
|
182
|
-
import Schema from 'typebox/schema'
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### Compile
|
|
186
|
-
|
|
187
|
-
The compiler accepts JSON Schema and returns Validator instances.
|
|
188
|
-
|
|
189
|
-
```typescript
|
|
190
|
-
const Vector = Schema.Compile(Type.Object({ // const Vector: Validator<TObject<{
|
|
191
|
-
x: Type.Number(), // x: TNumber
|
|
192
|
-
y: Type.Number(), // y: TNumber
|
|
193
|
-
z: Type.Number() // z: TNumber
|
|
194
|
-
})) // }>>
|
|
195
|
-
```
|
|
196
|
-
With JSON Schema
|
|
197
|
-
```typescript
|
|
198
|
-
const Vector = Schema.Compile({ // const Vector: Validator<{
|
|
199
|
-
type: 'object', // type: "object";
|
|
200
|
-
required: ['x', 'y', 'z'], // required: ["x", "y", "z"];
|
|
201
|
-
properties: { // properties: { ... };
|
|
202
|
-
x: { type: 'number' }, // }, { ... }>
|
|
203
|
-
y: { type: 'number' },
|
|
204
|
-
z: { type: 'number' }
|
|
205
|
-
}
|
|
206
|
-
})
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
### Validate
|
|
210
|
-
|
|
211
|
-
Validator instances provide functions to Check and Parse values.
|
|
212
|
-
|
|
213
|
-
```typescript
|
|
214
|
-
const Vector = Schema.Compile(Type.Script(`{
|
|
215
|
-
x: number
|
|
216
|
-
y: number
|
|
217
|
-
z: number
|
|
218
|
-
}`))
|
|
219
|
-
|
|
220
|
-
const valid = Vector.Check({ // const valid: boolean
|
|
221
|
-
x: 1,
|
|
222
|
-
y: 0,
|
|
223
|
-
z: 0
|
|
224
|
-
})
|
|
225
|
-
|
|
226
|
-
const value = Vector.Parse({ // const value: {
|
|
227
|
-
x: 1, // x: number
|
|
228
|
-
y: 0, // y: number
|
|
229
|
-
z: 0 // z: number
|
|
230
|
-
}) // }
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
### Coverage
|
|
236
|
-
|
|
237
|
-
The following table shows specification coverage implemented by TypeBox.
|
|
238
|
-
|
|
239
|
-
Ref: [JSON Schema Test Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite)
|
|
240
|
-
|
|
241
|
-
| Spec | 3 | 4 | 6 | 7 | 2019-09 | 2020-12 | v1 |
|
|
242
|
-
|:-----|:--|:--|:--|:--|:--|:--|:--|
|
|
243
|
-
| additionalItems | ✅ | ✅ | ✅ | ✅ | ✅ | - | - |
|
|
244
|
-
| additionalProperties | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
245
|
-
| allOf | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
246
|
-
| anchor | - | - | - | - | ✅ | ✅ | ✅ |
|
|
247
|
-
| anyOf | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
248
|
-
| boolean_schema | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
249
|
-
| const | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
250
|
-
| contains | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
251
|
-
| content | - | - | - | - | ✅ | ✅ | ✅ |
|
|
252
|
-
| default | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
253
|
-
| dependencies | 17/18 | ✅ | ✅ | ✅ | - | - | - |
|
|
254
|
-
| dependentRequired | - | - | - | - | ✅ | ✅ | ✅ |
|
|
255
|
-
| dependentSchemas | - | - | - | - | ✅ | ✅ | ✅ |
|
|
256
|
-
| dynamicRef | - | - | - | - | - | 38/44 | 19/27 |
|
|
257
|
-
| enum | 14/16 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
258
|
-
| exclusiveMaximum | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
259
|
-
| exclusiveMinimum | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
260
|
-
| if-then-else | - | - | - | ✅ | ✅ | ✅ | ✅ |
|
|
261
|
-
| infinite-loop-detection | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
262
|
-
| items | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
263
|
-
| maxContains | - | - | - | - | ✅ | ✅ | ✅ |
|
|
264
|
-
| maximum | 13/14 | 13/14 | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
265
|
-
| maxItems | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
266
|
-
| maxLength | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
267
|
-
| maxProperties | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
268
|
-
| minContains | - | - | - | - | ✅ | ✅ | ✅ |
|
|
269
|
-
| minimum | 12/13 | 16/17 | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
270
|
-
| minItems | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
271
|
-
| minLength | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
272
|
-
| minProperties | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
273
|
-
| multipleOf | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
274
|
-
| not | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
275
|
-
| oneOf | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
276
|
-
| pattern | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
277
|
-
| patternProperties | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
278
|
-
| prefixItems | - | - | - | - | - | ✅ | ✅ |
|
|
279
|
-
| properties | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
280
|
-
| propertyNames | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
281
|
-
| recursiveRef | - | - | - | - | ✅ | - | - |
|
|
282
|
-
| ref | 23/27 | 37/45 | 67/70 | 75/78 | 79/81 | 77/79 | 77/79 |
|
|
283
|
-
| required | 3/4 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
284
|
-
| type | 73/80 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
285
|
-
| unevaluatedItems | - | - | - | - | ✅ | 65/71 | 64/71 |
|
|
286
|
-
| unevaluatedProperties | - | - | - | - | ✅ | ✅ | 124/125 |
|
|
287
|
-
| uniqueItems | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
### Performance
|
|
291
|
-
|
|
292
|
-
The following table shows compile performance for various JSON Schema structures using AJV8 as a basis for comparison.
|
|
293
|
-
|
|
294
|
-
```python
|
|
295
|
-
┌──────────────────────┬─────────────┬─────────────┐
|
|
296
|
-
│ Compile │ TB1X │ AJV8 │
|
|
297
|
-
├──────────────────────┼─────────────┼─────────────┤
|
|
298
|
-
│ Boolean │ 39.7K ops/s │ 6.8K ops/s │
|
|
299
|
-
│ Number │ 86.2K ops/s │ 7.5K ops/s │
|
|
300
|
-
│ String │ 82.6K ops/s │ 8.2K ops/s │
|
|
301
|
-
│ Null │ 62K ops/s │ 7.3K ops/s │
|
|
302
|
-
│ Literal_String │ 72.1K ops/s │ 5.7K ops/s │
|
|
303
|
-
│ Literal_Number │ 72.7K ops/s │ 6.9K ops/s │
|
|
304
|
-
│ Literal_Boolean │ 80.9K ops/s │ 7K ops/s │
|
|
305
|
-
│ Pattern │ 38.7K ops/s │ 5.7K ops/s │
|
|
306
|
-
│ Object_Open │ 16.3K ops/s │ 1.3K ops/s │
|
|
307
|
-
│ Object_Close │ 15.7K ops/s │ 952 ops/s │
|
|
308
|
-
│ Object_Vector3 │ 40.2K ops/s │ 3.2K ops/s │
|
|
309
|
-
│ Object_Basis3 │ 16.1K ops/s │ 834 ops/s │
|
|
310
|
-
│ Intersect_And │ 45.7K ops/s │ 3.5K ops/s │
|
|
311
|
-
│ Intersect_Structural │ 21K ops/s │ 1.6K ops/s │
|
|
312
|
-
│ Union_Or │ 45.1K ops/s │ 3.4K ops/s │
|
|
313
|
-
│ Union_Structural │ 27.6K ops/s │ 2K ops/s │
|
|
314
|
-
│ Tuple_Values │ 14.7K ops/s │ 2K ops/s │
|
|
315
|
-
│ Tuple_Objects │ 3.7K ops/s │ 380 ops/s │
|
|
316
|
-
│ Array_Numbers_4 │ 73.6K ops/s │ 4.3K ops/s │
|
|
317
|
-
│ Array_Numbers_8 │ 50.9K ops/s │ 3.8K ops/s │
|
|
318
|
-
│ Array_Numbers_16 │ 85K ops/s │ 3.9K ops/s │
|
|
319
|
-
│ Array_Objects_Open │ 18.9K ops/s │ 789 ops/s │
|
|
320
|
-
│ Array_Objects_Close │ 17.9K ops/s │ 909 ops/s │
|
|
321
|
-
└──────────────────────┴─────────────┴─────────────┘
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
The following tables shows validation performance for various JSON Schema structures using AJV8 as a basis for comparison.
|
|
326
|
-
|
|
327
|
-
```python
|
|
328
|
-
┌──────────────────────┬──────────────┬──────────────┐
|
|
329
|
-
│ Validate │ TB1X │ AJV8 │
|
|
330
|
-
├──────────────────────┼──────────────┼──────────────┤
|
|
331
|
-
│ Boolean │ 192.2M ops/s │ 189.5M ops/s │
|
|
332
|
-
│ Number │ 112.4M ops/s │ 61M ops/s │
|
|
333
|
-
│ String │ 113.7M ops/s │ 64.1M ops/s │
|
|
334
|
-
│ Null │ 112.8M ops/s │ 64.9M ops/s │
|
|
335
|
-
│ Literal_String │ 108M ops/s │ 62.9M ops/s │
|
|
336
|
-
│ Literal_Number │ 113.5M ops/s │ 63.2M ops/s │
|
|
337
|
-
│ Literal_Boolean │ 109.2M ops/s │ 64.1M ops/s │
|
|
338
|
-
│ Pattern │ 26.5M ops/s │ 22.4M ops/s │
|
|
339
|
-
│ Object_Open │ 78M ops/s │ 47.2M ops/s │
|
|
340
|
-
│ Object_Close │ 38.6M ops/s │ 27.6M ops/s │
|
|
341
|
-
│ Object_Vector3 │ 91M ops/s │ 51.3M ops/s │
|
|
342
|
-
│ Object_Basis3 │ 41.1M ops/s │ 27.4M ops/s │
|
|
343
|
-
│ Intersect_And │ 107.6M ops/s │ 59.9M ops/s │
|
|
344
|
-
│ Intersect_Structural │ 83.6M ops/s │ 46.3M ops/s │
|
|
345
|
-
│ Union_Or │ 95M ops/s │ 7.9M ops/s │
|
|
346
|
-
│ Union_Structural │ 84.5M ops/s │ 52.3M ops/s │
|
|
347
|
-
│ Tuple_Values │ 74.7M ops/s │ 53M ops/s │
|
|
348
|
-
│ Tuple_Objects │ 32.9M ops/s │ 22.3M ops/s │
|
|
349
|
-
│ Array_Numbers_4 │ 93.3M ops/s │ 55.1M ops/s │
|
|
350
|
-
│ Array_Numbers_8 │ 90.3M ops/s │ 50.8M ops/s │
|
|
351
|
-
│ Array_Numbers_16 │ 76.8M ops/s │ 39.6M ops/s │
|
|
352
|
-
│ Array_Objects_Open │ 28.7M ops/s │ 20.4M ops/s │
|
|
353
|
-
│ Array_Objects_Close │ 10.3M ops/s │ 10.8M ops/s │
|
|
354
|
-
└──────────────────────┴──────────────┴──────────────┘
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
<a name="Versions"></a>
|
|
358
|
-
|
|
359
|
-
## Versions
|
|
360
|
-
|
|
361
|
-
TypeBox ships two distinct versions that span two generations of the TypeScript compiler.
|
|
362
|
-
|
|
363
|
-
| TypeBox | TypeScript | Description |
|
|
364
|
-
| :--- | :--- | :--- |
|
|
365
|
-
| 1.x | 6.0 - 7.0+ | **Latest.** Developed against the TypeScript 7 native compiler. Provides advanced type inference and native JSON Schema 2020-12 support. Includes backwards compatibility with `0.x` types. **ESM only.** |
|
|
366
|
-
| 0.x | 5.0 - 6.0 | **LTS.** Developed against older TypeScript versions and actively maintained under Long Term Support. Compatible with both **ESM and CJS**. Issues should be submitted to the [Sinclair TypeBox](https://github.com/sinclairzx81/sinclair-typebox) repository. |
|
|
367
|
-
|
|
368
|
-
## Contribute
|
|
369
|
-
|
|
370
|
-
TypeBox is open to community contribution. Please ensure you submit an issue before submitting a pull request. The TypeBox project prefers open community discussion before accepting new features.
|