change model nginx domain
This commit is contained in:
parent
dabebeb6fa
commit
b1a5f6fe48
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
||||
/php/odt_reader/*.ods
|
||||
/org-parse/tasks.org
|
||||
**/*/node_modules
|
||||
/node_modules/
|
||||
|
@ -32,7 +32,7 @@ export const domainsConfig = [
|
||||
name: 'rtfm',
|
||||
domain: 'www.free-software-academy.com',
|
||||
framework: 'static',
|
||||
// disableSSL: true,
|
||||
disableSSL: true,
|
||||
},
|
||||
{
|
||||
LXCcontainerLocalIP,
|
||||
|
@ -102,21 +102,24 @@ upstream php-handler {
|
||||
include /etc/nginx/snippets/letsencrypt-acme-challenge.conf;
|
||||
`;
|
||||
|
||||
let secureAccess = `listen 443 ssl http2;
|
||||
let secureAccess = `
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
server_name ${domainConfig.domain};
|
||||
ssl_certificate /etc/letsencrypt/live/${domainConfig.domain}-0001/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/${domainConfig.domain}-0001/privkey.pem;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";`
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
|
||||
|
||||
}
|
||||
`
|
||||
;
|
||||
if(domainConfig.disableSSL){
|
||||
secureAccess = `
|
||||
# ---------- SSL is disabled -----------------
|
||||
listen 443 http2;
|
||||
listen [::]:443 http2;
|
||||
|
||||
server_name ${domainConfig.domain};
|
||||
# ---------- SSL is disabled -----------------
|
||||
|
||||
`
|
||||
;
|
||||
}
|
||||
@ -151,18 +154,8 @@ ${redirectToNoWWW ? redirectToNoWWWConf : '' }
|
||||
${redirectToWWW ? redirectToWWWConf : '' }
|
||||
|
||||
${redirectToHTTPS ? redirectToHTTPSConf : '' }
|
||||
${ secureAccess }
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
server_name ${domainConfig.domain};
|
||||
ssl_certificate /etc/letsencrypt/live/${domainConfig.domain}-0001/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/${domainConfig.domain}-0001/privkey.pem;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
|
||||
|
||||
${hostingFileAccess}
|
||||
}
|
||||
`,
|
||||
containerNginxConf: `
|
||||
# ============ ${domainConfig.name} | côté conteneur LXC ===============
|
||||
|
1
node_modules/.bin/is-docker
generated
vendored
1
node_modules/.bin/is-docker
generated
vendored
@ -1 +0,0 @@
|
||||
../is-docker/cli.js
|
1
node_modules/.bin/node-which
generated
vendored
1
node_modules/.bin/node-which
generated
vendored
@ -1 +0,0 @@
|
||||
../which/bin/node-which
|
1
node_modules/.bin/rc
generated
vendored
1
node_modules/.bin/rc
generated
vendored
@ -1 +0,0 @@
|
||||
../rc/cli.js
|
1
node_modules/.bin/serve
generated
vendored
1
node_modules/.bin/serve
generated
vendored
@ -1 +0,0 @@
|
||||
../serve/build/main.js
|
984
node_modules/.package-lock.json
generated
vendored
984
node_modules/.package-lock.json
generated
vendored
@ -1,984 +0,0 @@
|
||||
{
|
||||
"name": "scripts",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@zeit/schemas": {
|
||||
"version": "2.29.0",
|
||||
"resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.29.0.tgz",
|
||||
"integrity": "sha512-g5QiLIfbg3pLuYUJPlisNKY+epQJTcMDsOnVNkscrDP1oi7vmJnzOANYJI/1pZcVJ6umUkBv3aFtlg1UvUHGzA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mime-types": "~2.1.34",
|
||||
"negotiator": "0.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/ajv": {
|
||||
"version": "8.11.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz",
|
||||
"integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"json-schema-traverse": "^1.0.0",
|
||||
"require-from-string": "^2.0.2",
|
||||
"uri-js": "^4.2.2"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-align": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz",
|
||||
"integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"string-width": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-align/node_modules/ansi-regex": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-align/node_modules/emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/ansi-align/node_modules/string-width": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
"strip-ansi": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-align/node_modules/strip-ansi": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
|
||||
"integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz",
|
||||
"integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/arch": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz",
|
||||
"integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/arg": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz",
|
||||
"integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/boxen": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/boxen/-/boxen-7.0.0.tgz",
|
||||
"integrity": "sha512-j//dBVuyacJbvW+tvZ9HuH03fZ46QcaKvvhZickZqtB271DxJ7SNRSNxrV/dZX0085m7hISRZWbzWlJvx/rHSg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-align": "^3.0.1",
|
||||
"camelcase": "^7.0.0",
|
||||
"chalk": "^5.0.1",
|
||||
"cli-boxes": "^3.0.0",
|
||||
"string-width": "^5.1.2",
|
||||
"type-fest": "^2.13.0",
|
||||
"widest-line": "^4.0.1",
|
||||
"wrap-ansi": "^8.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
|
||||
"integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/camelcase": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-7.0.1.tgz",
|
||||
"integrity": "sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz",
|
||||
"integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.17.0 || ^14.13 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk-template": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/chalk-template/-/chalk-template-0.4.0.tgz",
|
||||
"integrity": "sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"chalk": "^4.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/chalk-template?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk-template/node_modules/ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk-template/node_modules/chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/cli-boxes": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz",
|
||||
"integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/clipboardy": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-3.0.0.tgz",
|
||||
"integrity": "sha512-Su+uU5sr1jkUy1sGRpLKjKrvEOVXgSgiSInwa/qeID6aJ07yh+5NWc3h2QfjHjBnfX4LhtFcuAWKUsJ3r+fjbg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"arch": "^2.2.0",
|
||||
"execa": "^5.1.1",
|
||||
"is-wsl": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/compressible": {
|
||||
"version": "2.0.18",
|
||||
"resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz",
|
||||
"integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mime-db": ">= 1.43.0 < 2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/compression": {
|
||||
"version": "1.7.4",
|
||||
"resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz",
|
||||
"integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"accepts": "~1.3.5",
|
||||
"bytes": "3.0.0",
|
||||
"compressible": "~2.0.16",
|
||||
"debug": "2.6.9",
|
||||
"on-headers": "~1.0.2",
|
||||
"safe-buffer": "5.1.2",
|
||||
"vary": "~1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/content-disposition": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
|
||||
"integrity": "sha512-kRGRZw3bLlFISDBgwTSA1TMBFN6J6GWDeubmDE3AF+3+yXL8hTWv8r5rkLbqYXY4RjPk/EzHnClI3zQf1cFmHA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"path-key": "^3.1.0",
|
||||
"shebang-command": "^2.0.0",
|
||||
"which": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/deep-extend": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
|
||||
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eastasianwidth": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
|
||||
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
|
||||
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/execa": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
|
||||
"integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.3",
|
||||
"get-stream": "^6.0.0",
|
||||
"human-signals": "^2.1.0",
|
||||
"is-stream": "^2.0.0",
|
||||
"merge-stream": "^2.0.0",
|
||||
"npm-run-path": "^4.0.1",
|
||||
"onetime": "^5.1.2",
|
||||
"signal-exit": "^3.0.3",
|
||||
"strip-final-newline": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sindresorhus/execa?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/fast-url-parser": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-url-parser/-/fast-url-parser-1.1.3.tgz",
|
||||
"integrity": "sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"punycode": "^1.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/get-stream": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
|
||||
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/human-signals": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
|
||||
"integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10.17.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ini": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
||||
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/is-docker": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
|
||||
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"is-docker": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/is-fullwidth-code-point": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/is-port-reachable": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-port-reachable/-/is-port-reachable-4.0.0.tgz",
|
||||
"integrity": "sha512-9UoipoxYmSk6Xy7QFgRv2HDyaysmgSG75TFQs6S+3pDM7ZhKTF/bskZV+0UlABHzKjNVhPjYCLfeZUEg1wXxig==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/is-stream": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
|
||||
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/is-wsl": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
|
||||
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-docker": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/isexe": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/json-schema-traverse": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
|
||||
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/merge-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mimic-fn": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
|
||||
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||
"dev": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/negotiator": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
||||
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/npm-run-path": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
|
||||
"integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"path-key": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/on-headers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
|
||||
"integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/onetime": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
|
||||
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mimic-fn": "^2.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/path-is-inside": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz",
|
||||
"integrity": "sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/path-key": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-to-regexp": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.2.1.tgz",
|
||||
"integrity": "sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
|
||||
"integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/range-parser": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
|
||||
"integrity": "sha512-kA5WQoNVo4t9lNx2kQNFCxKeBl5IbbSNBl1M/tLkw9WCn+hxNBAW5Qh8gdhs63CJnhjJ2zQWFoqPJP2sK1AV5A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/rc": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
|
||||
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"deep-extend": "^0.6.0",
|
||||
"ini": "~1.3.0",
|
||||
"minimist": "^1.2.0",
|
||||
"strip-json-comments": "~2.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"rc": "cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/registry-auth-token": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.2.tgz",
|
||||
"integrity": "sha512-JL39c60XlzCVgNrO+qq68FoNb56w/m7JYvGR2jT5iR1xBrUA3Mfx5Twk5rqTThPmQKMWydGmq8oFtDlxfrmxnQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"rc": "^1.1.6",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/registry-url": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz",
|
||||
"integrity": "sha512-ZbgR5aZEdf4UKZVBPYIgaglBmSF2Hi94s2PcIHhRGFjKYu+chjJdYfHn4rt3hB6eCKLJ8giVIIfgMa1ehDfZKA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"rc": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/require-from-string": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
|
||||
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/serve": {
|
||||
"version": "14.2.0",
|
||||
"resolved": "https://registry.npmjs.org/serve/-/serve-14.2.0.tgz",
|
||||
"integrity": "sha512-+HOw/XK1bW8tw5iBilBz/mJLWRzM8XM6MPxL4J/dKzdxq1vfdEWSwhaR7/yS8EJp5wzvP92p1qirysJvnEtjXg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@zeit/schemas": "2.29.0",
|
||||
"ajv": "8.11.0",
|
||||
"arg": "5.0.2",
|
||||
"boxen": "7.0.0",
|
||||
"chalk": "5.0.1",
|
||||
"chalk-template": "0.4.0",
|
||||
"clipboardy": "3.0.0",
|
||||
"compression": "1.7.4",
|
||||
"is-port-reachable": "4.0.0",
|
||||
"serve-handler": "6.1.5",
|
||||
"update-check": "1.5.4"
|
||||
},
|
||||
"bin": {
|
||||
"serve": "build/main.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/serve-handler": {
|
||||
"version": "6.1.5",
|
||||
"resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.5.tgz",
|
||||
"integrity": "sha512-ijPFle6Hwe8zfmBxJdE+5fta53fdIY0lHISJvuikXB3VYFafRjMRpOffSPvCYsbKyBA7pvy9oYr/BT1O3EArlg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"bytes": "3.0.0",
|
||||
"content-disposition": "0.5.2",
|
||||
"fast-url-parser": "1.1.3",
|
||||
"mime-types": "2.1.18",
|
||||
"minimatch": "3.1.2",
|
||||
"path-is-inside": "1.0.2",
|
||||
"path-to-regexp": "2.2.1",
|
||||
"range-parser": "1.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/serve-handler/node_modules/mime-db": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz",
|
||||
"integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/serve-handler/node_modules/mime-types": {
|
||||
"version": "2.1.18",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz",
|
||||
"integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mime-db": "~1.33.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"shebang-regex": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/shebang-regex": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/signal-exit": {
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
|
||||
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/string-width": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
|
||||
"integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"eastasianwidth": "^0.2.0",
|
||||
"emoji-regex": "^9.2.2",
|
||||
"strip-ansi": "^7.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
|
||||
"integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-regex": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-final-newline": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
|
||||
"integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-json-comments": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
||||
"integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/type-fest": {
|
||||
"version": "2.19.0",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz",
|
||||
"integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12.20"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/update-check": {
|
||||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmjs.org/update-check/-/update-check-1.5.4.tgz",
|
||||
"integrity": "sha512-5YHsflzHP4t1G+8WGPlvKbJEbAJGCgw+Em+dGR1KmBUbr1J36SJBqlHLjR7oob7sco5hWHGQVcr9B2poIVDDTQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"registry-auth-token": "3.3.2",
|
||||
"registry-url": "3.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/uri-js": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/uri-js/node_modules/punycode": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
|
||||
"integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"isexe": "^2.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"node-which": "bin/node-which"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/widest-line": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/widest-line/-/widest-line-4.0.1.tgz",
|
||||
"integrity": "sha512-o0cyEG0e8GPzT4iGHphIOh0cJOV8fivsXxddQasHPHfoZf1ZexrfeA21w2NaEN1RHE+fXlfISmOE8R9N3u3Qig==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"string-width": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
|
||||
"integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-styles": "^6.1.0",
|
||||
"string-width": "^5.0.1",
|
||||
"strip-ansi": "^7.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
node_modules/@zeit/schemas/.editorconfig
generated
vendored
37
node_modules/@zeit/schemas/.editorconfig
generated
vendored
@ -1,37 +0,0 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[{*.json,*.json.example,*.gyp,*.yml,*.yaml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[{*.py,*.asm}]
|
||||
indent_style = space
|
||||
|
||||
[*.py]
|
||||
indent_size = 4
|
||||
|
||||
[*.asm]
|
||||
indent_size = 8
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
# Ideal settings - some plugins might support these.
|
||||
[*.js]
|
||||
quote_type = single
|
||||
|
||||
[{*.c,*.cc,*.h,*.hh,*.cpp,*.hpp,*.m,*.mm,*.mpp,*.js,*.java,*.go,*.rs,*.php,*.ng,*.jsx,*.ts,*.d,*.cs,*.swift}]
|
||||
curly_bracket_next_line = false
|
||||
spaces_around_operators = true
|
||||
spaces_around_brackets = outside
|
||||
# close enough to 1TB
|
||||
indent_brace_style = K&R
|
23
node_modules/@zeit/schemas/.github/workflows/ci.yaml
generated
vendored
23
node_modules/@zeit/schemas/.github/workflows/ci.yaml
generated
vendored
@ -1,23 +0,0 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- uses: actions/setup-node@v3
|
||||
timeout-minutes: 5 # See https://github.com/actions/cache/issues/810
|
||||
with:
|
||||
cache: 'yarn'
|
||||
|
||||
- run: yarn install --network-timeout 1000000 --frozen-lockfile
|
||||
- run: yarn test
|
24
node_modules/@zeit/schemas/.github/workflows/publish.yaml
generated
vendored
24
node_modules/@zeit/schemas/.github/workflows/publish.yaml
generated
vendored
@ -1,24 +0,0 @@
|
||||
name: Publish Package
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
timeout-minutes: 5 # See https://github.com/actions/cache/issues/810
|
||||
with:
|
||||
cache: 'yarn'
|
||||
node-version: '18.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- run: yarn install --network-timeout 1000000 --frozen-lockfile
|
||||
- run: yarn test
|
||||
- run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
|
1
node_modules/@zeit/schemas/.yarnrc
generated
vendored
1
node_modules/@zeit/schemas/.yarnrc
generated
vendored
@ -1 +0,0 @@
|
||||
save-prefix ""
|
21
node_modules/@zeit/schemas/LICENSE
generated
vendored
21
node_modules/@zeit/schemas/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 ZEIT
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
35
node_modules/@zeit/schemas/README.md
generated
vendored
35
node_modules/@zeit/schemas/README.md
generated
vendored
@ -1,35 +0,0 @@
|
||||
# Vercel Schemas
|
||||
|
||||
Schemas used across many Vercel packages to validating config files, requests to APIs, and more.
|
||||
|
||||
## Why?
|
||||
|
||||
- Keep schemas used across Vercel projects in sync
|
||||
- We use `.js` instead of `.json` because parsing JSON takes longer
|
||||
|
||||
## Usage
|
||||
|
||||
To get started, pick one of the schemas in this repository and load it:
|
||||
|
||||
```js
|
||||
const schema = require('@zeit/schemas/deployment/config');
|
||||
```
|
||||
|
||||
Next, set up [AJV](https://github.com/epoberezkin/ajv) (the validator) and run the schema through it:
|
||||
|
||||
```js
|
||||
const AJV = require('ajv');
|
||||
|
||||
const ajv = new AJV({ allErrors: true });
|
||||
const isValid = ajv.validate(schema, <object-to-validate>);
|
||||
|
||||
if (!isValid) {
|
||||
console.error(`The following entries are wrong: ${JSON.stringify(ajv.errors)}`);
|
||||
}
|
||||
```
|
||||
|
||||
That is all! :tada:
|
||||
|
||||
## Contributing
|
||||
|
||||
We are currently not accepting external contributions for this repository.
|
41
node_modules/@zeit/schemas/deployment/config-env.js
generated
vendored
41
node_modules/@zeit/schemas/deployment/config-env.js
generated
vendored
@ -1,41 +0,0 @@
|
||||
const maxEnvLength = 100;
|
||||
|
||||
const EnvKey = {
|
||||
type: 'string',
|
||||
pattern: '^[A-z0-9_]+$',
|
||||
minLength: 1,
|
||||
maxLength: 256
|
||||
};
|
||||
|
||||
const EnvKeys = {
|
||||
type: 'array',
|
||||
minItems: 0,
|
||||
maxItems: maxEnvLength,
|
||||
uniqueItems: true,
|
||||
items: EnvKey,
|
||||
additionalProperties: false
|
||||
};
|
||||
|
||||
const EnvValue = {
|
||||
type: 'string',
|
||||
minLength: 0,
|
||||
maxLength: 65536
|
||||
};
|
||||
|
||||
// { 'FOO': 'BAR' }
|
||||
const EnvObject = {
|
||||
type: 'object',
|
||||
minProperties: 0,
|
||||
maxProperties: maxEnvLength,
|
||||
patternProperties: {
|
||||
'.+': EnvValue
|
||||
},
|
||||
additionalProperties: false
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
EnvKey,
|
||||
EnvKeys,
|
||||
EnvValue,
|
||||
EnvObject
|
||||
};
|
79
node_modules/@zeit/schemas/deployment/config-static.js
generated
vendored
79
node_modules/@zeit/schemas/deployment/config-static.js
generated
vendored
@ -1,79 +0,0 @@
|
||||
module.exports = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
'public': {
|
||||
type: 'string'
|
||||
},
|
||||
'cleanUrls': {
|
||||
type: [
|
||||
'boolean',
|
||||
'array'
|
||||
]
|
||||
},
|
||||
'rewrites': {
|
||||
type: 'array'
|
||||
},
|
||||
'redirects': {
|
||||
type: 'array'
|
||||
},
|
||||
'headers': {
|
||||
type: 'array',
|
||||
maxItems: 50,
|
||||
minItems: 1,
|
||||
uniqueItems: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
required: ['source', 'headers'],
|
||||
properties: {
|
||||
source: {
|
||||
type: 'string',
|
||||
maxLength: 100,
|
||||
minLength: 1
|
||||
},
|
||||
headers: {
|
||||
type: 'array',
|
||||
maxItems: 50,
|
||||
minItems: 1,
|
||||
uniqueItems: true,
|
||||
items: {
|
||||
type: 'object',
|
||||
required: ['key', 'value'],
|
||||
properties: {
|
||||
key: {
|
||||
type: 'string',
|
||||
minLength: 1,
|
||||
maxLength: 128,
|
||||
pattern: "^[a-zA-Z0-9_!#$%&'*+.^`|~-]+$"
|
||||
},
|
||||
value: {
|
||||
type: 'string',
|
||||
minLength: 1,
|
||||
maxLength: 2048,
|
||||
pattern: '^[\u0020-\u007e\u00a0-\u00ff]+$'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
}
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
}
|
||||
},
|
||||
'directoryListing': {
|
||||
type: [
|
||||
'boolean',
|
||||
'array'
|
||||
]
|
||||
},
|
||||
'unlisted': {
|
||||
type: 'array'
|
||||
},
|
||||
'trailingSlash': {
|
||||
type: 'boolean'
|
||||
},
|
||||
'renderSingle': {
|
||||
type: 'boolean'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
};
|
170
node_modules/@zeit/schemas/deployment/config.js
generated
vendored
170
node_modules/@zeit/schemas/deployment/config.js
generated
vendored
@ -1,170 +0,0 @@
|
||||
const {Service} = require('./service');
|
||||
const {EnvKeys, EnvObject} = require('./config-env');
|
||||
const staticSchema = require('./config-static');
|
||||
|
||||
module.exports = {
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
dependencies: {
|
||||
slot: {
|
||||
type: 'object',
|
||||
required: ['features'],
|
||||
properties: {
|
||||
features: {
|
||||
type: 'object',
|
||||
required: ['cloud'],
|
||||
properties: {
|
||||
cloud: {
|
||||
'const': 'v2'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
properties: {
|
||||
'name': {
|
||||
type: 'string',
|
||||
minLength: 1
|
||||
},
|
||||
'project': {
|
||||
type: 'string',
|
||||
minLength: 1
|
||||
},
|
||||
'alias': {
|
||||
type: [
|
||||
'string',
|
||||
'array'
|
||||
]
|
||||
},
|
||||
'env': { anyOf: [EnvObject, EnvKeys] },
|
||||
'build': {
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
env: EnvObject
|
||||
}
|
||||
},
|
||||
'scale': {
|
||||
type: 'object',
|
||||
patternProperties: {
|
||||
'.+': {
|
||||
'type': 'object',
|
||||
'required': ['max', 'min'],
|
||||
'properties': {
|
||||
max: {
|
||||
anyOf: [
|
||||
{
|
||||
type: 'number',
|
||||
minimum: 1
|
||||
},
|
||||
{'const': 'auto'}
|
||||
]
|
||||
},
|
||||
min: {
|
||||
type: 'number',
|
||||
minimum: 0
|
||||
}
|
||||
},
|
||||
'if': {
|
||||
properties: {
|
||||
max: {
|
||||
type: 'number'
|
||||
}
|
||||
}
|
||||
},
|
||||
'then': {
|
||||
properties: {
|
||||
min: {
|
||||
maximum: {
|
||||
$data: '1/max'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
},
|
||||
'regions': {
|
||||
type: 'array'
|
||||
},
|
||||
'dotenv': {
|
||||
type: [
|
||||
'boolean',
|
||||
'string'
|
||||
]
|
||||
},
|
||||
'files': {
|
||||
type: 'array'
|
||||
},
|
||||
'type': {
|
||||
type: 'string'
|
||||
},
|
||||
'forwardNpm': {
|
||||
type: 'boolean'
|
||||
},
|
||||
'public': {
|
||||
type: 'boolean'
|
||||
},
|
||||
'engines': {
|
||||
type: 'object'
|
||||
},
|
||||
'api': {
|
||||
type: 'string'
|
||||
},
|
||||
'static': staticSchema,
|
||||
'limits': {
|
||||
type: 'object',
|
||||
properties: {
|
||||
duration: {
|
||||
type: 'number',
|
||||
minimum: 60000,
|
||||
maximum: 60000 * 15 // max 15m runtime
|
||||
},
|
||||
maxConcurrentReqs: {
|
||||
type: 'number',
|
||||
minimum: 1,
|
||||
maximum: 256
|
||||
},
|
||||
timeout: {
|
||||
type: 'number',
|
||||
minimum: 60000,
|
||||
maximum: 60000 * 15 // max duration
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
},
|
||||
'features': {
|
||||
type: 'object',
|
||||
patternProperties: {
|
||||
'.*': {
|
||||
type: ['string', 'number', 'boolean']
|
||||
}
|
||||
}
|
||||
},
|
||||
'github': {
|
||||
type: 'object',
|
||||
properties: {
|
||||
enabled: {
|
||||
type: 'boolean'
|
||||
},
|
||||
autoAlias: {
|
||||
type: 'boolean'
|
||||
},
|
||||
autoJobCancelation: {
|
||||
type: 'boolean'
|
||||
},
|
||||
silent: {
|
||||
type: 'boolean'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
},
|
||||
'slot': {
|
||||
type: 'string',
|
||||
pattern: 'c.125-m512|c1-m4096|staging-*'
|
||||
},
|
||||
'service': Service
|
||||
}
|
||||
};
|
15
node_modules/@zeit/schemas/deployment/service.js
generated
vendored
15
node_modules/@zeit/schemas/deployment/service.js
generated
vendored
@ -1,15 +0,0 @@
|
||||
const Service = {
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
port: {
|
||||
type: 'number',
|
||||
minimum: 1,
|
||||
maximum: 32767
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
Service
|
||||
};
|
28
node_modules/@zeit/schemas/package.json
generated
vendored
28
node_modules/@zeit/schemas/package.json
generated
vendored
@ -1,28 +0,0 @@
|
||||
{
|
||||
"name": "@zeit/schemas",
|
||||
"version": "2.29.0",
|
||||
"description": "All schemas used for validation that are shared between our projects",
|
||||
"scripts": {
|
||||
"test": "yarn run lint && best --verbose",
|
||||
"lint": "zeit-eslint --ext .jsx,.js .",
|
||||
"lint-staged": "git diff --diff-filter=ACMRT --cached --name-only '*.js' '*.jsx' | xargs zeit-eslint"
|
||||
},
|
||||
"repository": "zeit/schemas",
|
||||
"author": "leo",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@zeit/best": "0.4.3",
|
||||
"@zeit/eslint-config-node": "0.3.0",
|
||||
"@zeit/git-hooks": "0.1.4",
|
||||
"ajv": "6.5.1",
|
||||
"eslint": "4.19.1"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"@zeit/eslint-config-node"
|
||||
]
|
||||
},
|
||||
"git": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
}
|
88
node_modules/@zeit/schemas/test/deployment-env.js
generated
vendored
88
node_modules/@zeit/schemas/test/deployment-env.js
generated
vendored
@ -1,88 +0,0 @@
|
||||
/* eslint camelcase: 0 */
|
||||
const AJV = require('ajv');
|
||||
const assert = require('assert');
|
||||
const {
|
||||
EnvKeys,
|
||||
EnvObject
|
||||
} = require('../deployment/config-env');
|
||||
|
||||
const ajv = new AJV({allErrors: true});
|
||||
|
||||
// EnvKeys
|
||||
exports.test_env_keys_valid = () => {
|
||||
const isValid = ajv.validate(EnvKeys, [
|
||||
'FOO',
|
||||
'BAR'
|
||||
]);
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_env_keys_too_short = () => {
|
||||
const isValid = ajv.validate(EnvKeys, [
|
||||
'FOO',
|
||||
''
|
||||
]);
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors[0].keyword, 'minLength');
|
||||
};
|
||||
|
||||
exports.test_env_keys_too_long = () => {
|
||||
const isValid = ajv.validate(EnvKeys, [
|
||||
'FOO',
|
||||
'A'.repeat(257)
|
||||
]);
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors[0].keyword, 'maxLength');
|
||||
};
|
||||
|
||||
exports.test_env_keys_invalid_chars = () => {
|
||||
const isValid = ajv.validate(EnvKeys, [
|
||||
'FOO',
|
||||
'BA,D'
|
||||
]);
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors[0].keyword, 'pattern');
|
||||
};
|
||||
|
||||
exports.test_env_keys_invalid_type = () => {
|
||||
const isValid = ajv.validate(EnvKeys, [
|
||||
'FOO',
|
||||
true
|
||||
]);
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors[0].keyword, 'type');
|
||||
};
|
||||
|
||||
exports.test_env_keys_non_unique = () => {
|
||||
const isValid = ajv.validate(EnvKeys, [
|
||||
'FOO',
|
||||
'FOO'
|
||||
]);
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors[0].keyword, 'uniqueItems');
|
||||
};
|
||||
|
||||
// EnvObject
|
||||
exports.test_env_object_valid = () => {
|
||||
const isValid = ajv.validate(EnvObject, {
|
||||
FOO: 'BAR',
|
||||
BAZ: '@secret'
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_env_object_bad_type = () => {
|
||||
const isValid = ajv.validate(EnvObject, {
|
||||
FOO: true
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors[0].keyword, 'type');
|
||||
};
|
||||
|
||||
exports.test_env_object_too_long = () => {
|
||||
const isValid = ajv.validate(EnvObject, {
|
||||
FOO: 'a'.repeat(70000)
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors[0].keyword, 'maxLength');
|
||||
};
|
404
node_modules/@zeit/schemas/test/deployment.js
generated
vendored
404
node_modules/@zeit/schemas/test/deployment.js
generated
vendored
@ -1,404 +0,0 @@
|
||||
/* eslint camelcase: 0 */
|
||||
const AJV = require('ajv');
|
||||
const assert = require('assert');
|
||||
const deploymentConfigSchema = require('../deployment/config');
|
||||
|
||||
const ajv = new AJV({allErrors: true, $data: true});
|
||||
|
||||
exports.test_unknown_keys = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
foo: 1,
|
||||
bar: 2
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors.length, 2);
|
||||
['foo', 'bar'].forEach((prop, i) => {
|
||||
const error = ajv.errors[i];
|
||||
assert.equal(error.keyword, 'additionalProperties');
|
||||
assert.equal(error.params.additionalProperty, prop);
|
||||
});
|
||||
};
|
||||
|
||||
exports.test_features_object = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
features: {
|
||||
foo: 'v2',
|
||||
bar: 2
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_slot_key = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
features: {
|
||||
cloud: 'v2'
|
||||
},
|
||||
slot: 'c.125-m512'
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_staging_slot_key = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
features: {
|
||||
cloud: 'v2'
|
||||
},
|
||||
slot: 'staging-c.5-t1-w-m1024'
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_invalid_slot_key = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
features: {
|
||||
cloud: 'v2'
|
||||
},
|
||||
slot: 'invalid-key'
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_slot_key_without_cloud_v2 = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
slot: 'c.125-m512'
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_invalid_features_object = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
features: {
|
||||
foo: []
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_features_object = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
limits: {
|
||||
duration: 60000,
|
||||
maxConcurrentReqs: 2,
|
||||
timeout: 60000 * 2
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_invalid_limits_object = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
limits: {
|
||||
foo: []
|
||||
}
|
||||
});
|
||||
assert.equal(!isValid, true);
|
||||
};
|
||||
|
||||
exports.test_valid_env_types = () => {
|
||||
let isValid = ajv.validate(deploymentConfigSchema, {
|
||||
env: {
|
||||
VALID: '1'
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
|
||||
isValid = ajv.validate(deploymentConfigSchema, {
|
||||
env: [
|
||||
'VALID'
|
||||
]
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_invalid_env_types = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
env: {
|
||||
INVALID: true
|
||||
}
|
||||
});
|
||||
assert.equal(!isValid, true);
|
||||
};
|
||||
|
||||
exports.test_valid_build_env_types = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
build: {
|
||||
env: {
|
||||
VALID: '1'
|
||||
}
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_invalid_build_env_types = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
build: {
|
||||
env: {
|
||||
INVALID: true
|
||||
}
|
||||
}
|
||||
});
|
||||
assert.equal(!isValid, true);
|
||||
};
|
||||
|
||||
exports.test_invalid_static_object = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
'static': {
|
||||
foo: []
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_valid_static_headers_object = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
'static': {
|
||||
headers: [
|
||||
{
|
||||
source: '/_next/webpack/chunks/*',
|
||||
headers: [{
|
||||
key: 'Cache-Control',
|
||||
value: 'adssds'
|
||||
}]
|
||||
},
|
||||
{
|
||||
source: '/_next/static/commons/**',
|
||||
headers: [{
|
||||
key: 'Cache-Control',
|
||||
value: 'public, max-age=31536000, immutable'
|
||||
}]
|
||||
},
|
||||
{
|
||||
source: '/_next/*/page/**/*.js',
|
||||
headers: [{
|
||||
key: 'Cache-Control',
|
||||
value: 'public, max-age=31536000, immutable'
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
assert.equal(isValid, true);
|
||||
|
||||
for (let i = 0x20; i <= 0xff; i++) {
|
||||
if (i > 0x7e && i < 0xa0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const result = ajv.validate(deploymentConfigSchema, {
|
||||
'static': {
|
||||
headers: [
|
||||
{
|
||||
source: '/',
|
||||
headers: [{
|
||||
key: 'X-Test',
|
||||
value: `value ${String.fromCharCode(i)}`
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
assert.equal(result, true, `Failed to validate for char: 0x${i.toString(16)}`);
|
||||
}
|
||||
};
|
||||
|
||||
exports.test_invalid_static_headers_object = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
'static': {
|
||||
headers: [
|
||||
{
|
||||
source: '/_next/webpack/chunks/*',
|
||||
headers: [{
|
||||
key: ':alternate-protocol',
|
||||
value: 'foo\x00bar'
|
||||
}]
|
||||
},
|
||||
{
|
||||
source: '/_next/static/commons/**',
|
||||
headers: [{
|
||||
key: 'Cache-Control',
|
||||
value: 'public, max-age=31536000, immutable'
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
assert.equal(isValid, false);
|
||||
|
||||
// Use 256 to go above 0xff
|
||||
for (let i = 0; i <= 256; i++) {
|
||||
if ((i >= 0x20 && i <= 0x7e) || (i >= 0xa0 && i <= 0xff)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const result = ajv.validate(deploymentConfigSchema, {
|
||||
'static': {
|
||||
headers: {
|
||||
source: '/',
|
||||
headers: [{
|
||||
key: 'X-Test',
|
||||
value: `value ${String.fromCharCode(i)}`
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
assert.equal(result, false, `Failed to error for char: 0x${i.toString(16)}`);
|
||||
}
|
||||
};
|
||||
|
||||
exports.test_valid_static_object_trailing_slash = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
'static': {
|
||||
trailingSlash: true
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_valid_static_object_invalid_prop = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
'static': {
|
||||
trailingSlash: []
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_project = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
project: 'cool-project'
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_github_enabled = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
github: {
|
||||
enabled: false
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_github_silent = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
github: {
|
||||
silent: true
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_github_auto_alias = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
github: {
|
||||
autoAlias: false
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_github_auto_job_cancelation = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
github: {
|
||||
autoJobCancelation: false
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_github_additional_field = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
github: {
|
||||
abc: 'bbc'
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_scale_sfo1 = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
scale: {
|
||||
sfo1: {
|
||||
min: 0,
|
||||
max: 1
|
||||
}
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_scale_all = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
scale: {
|
||||
all: {
|
||||
min: 0,
|
||||
max: 'auto'
|
||||
}
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_scale_invalid = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
scale: {
|
||||
foo: {
|
||||
min: -1,
|
||||
max: 'auto'
|
||||
}
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_scale_invalid_min = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
scale: {
|
||||
foo: {
|
||||
min: 2,
|
||||
max: 1
|
||||
}
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_service_invalid = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
service: 'foo'
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_service_port_valid = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
service: {
|
||||
port: 80
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, true);
|
||||
};
|
||||
|
||||
exports.test_service_port_invalid = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
service: {
|
||||
port: 0
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_service_port_invalid_type = () => {
|
||||
const isValid = ajv.validate(deploymentConfigSchema, {
|
||||
service: {
|
||||
port: '3000'
|
||||
}
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
343
node_modules/@zeit/schemas/test/user.js
generated
vendored
343
node_modules/@zeit/schemas/test/user.js
generated
vendored
@ -1,343 +0,0 @@
|
||||
/* eslint camelcase: 0 */
|
||||
const AJV = require('ajv');
|
||||
const assert = require('assert');
|
||||
const { User } = require('../user');
|
||||
|
||||
const ajv = new AJV({ allErrors: true });
|
||||
|
||||
// Username
|
||||
exports.test_username_null = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
username: null
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors.length, 1);
|
||||
assert.equal(ajv.errors[0].dataPath, '.username');
|
||||
assert.equal(ajv.errors[0].message, 'should be string');
|
||||
};
|
||||
|
||||
exports.test_username_invalid_pattern = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
username: '!!!'
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors.length, 1);
|
||||
assert.equal(ajv.errors[0].dataPath, '.username');
|
||||
assert.equal(
|
||||
ajv.errors[0].message,
|
||||
'should match pattern "^[a-z0-9][a-z0-9-]*[a-z0-9]$"'
|
||||
);
|
||||
};
|
||||
|
||||
exports.test_username_too_short = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
username: ''
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors.length, 2);
|
||||
assert.equal(ajv.errors[0].dataPath, '.username');
|
||||
assert.equal(
|
||||
ajv.errors[0].message,
|
||||
'should NOT be shorter than 1 characters'
|
||||
);
|
||||
assert.equal(ajv.errors[1].dataPath, '.username');
|
||||
assert.equal(
|
||||
ajv.errors[1].message,
|
||||
'should match pattern "^[a-z0-9][a-z0-9-]*[a-z0-9]$"'
|
||||
);
|
||||
};
|
||||
|
||||
exports.test_username_too_long = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
username: 'a'.repeat(50)
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors.length, 1);
|
||||
assert.equal(ajv.errors[0].dataPath, '.username');
|
||||
assert.equal(
|
||||
ajv.errors[0].message,
|
||||
'should NOT be longer than 48 characters'
|
||||
);
|
||||
};
|
||||
|
||||
exports.test_username_valid = () => {
|
||||
assert(ajv.validate(User, { username: 'n8' }));
|
||||
assert(ajv.validate(User, { username: 'rauchg' }));
|
||||
};
|
||||
|
||||
// Name
|
||||
exports.test_name_too_short = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
name: ''
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors.length, 1);
|
||||
assert.equal(ajv.errors[0].dataPath, '.name');
|
||||
assert.equal(
|
||||
ajv.errors[0].message,
|
||||
'should NOT be shorter than 1 characters'
|
||||
);
|
||||
};
|
||||
|
||||
exports.test_name_too_long = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
name: 'a'.repeat(50)
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors.length, 1);
|
||||
assert.equal(ajv.errors[0].dataPath, '.name');
|
||||
assert.equal(
|
||||
ajv.errors[0].message,
|
||||
'should NOT be longer than 32 characters'
|
||||
);
|
||||
};
|
||||
|
||||
exports.test_name_valid = () => {
|
||||
assert(ajv.validate(User, { name: 'Nate' }));
|
||||
};
|
||||
|
||||
// BillingChecked
|
||||
exports.test_billing_checked_null = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
billingChecked: null
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors.length, 1);
|
||||
assert.equal(ajv.errors[0].dataPath, '.billingChecked');
|
||||
assert.equal(ajv.errors[0].message, 'should be boolean');
|
||||
};
|
||||
|
||||
exports.test_billing_checked_valid = () => {
|
||||
assert(ajv.validate(User, { billingChecked: true }));
|
||||
};
|
||||
|
||||
// Avatar
|
||||
exports.test_avatar_too_short = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
avatar: 'abc'
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors.length, 1);
|
||||
assert.equal(ajv.errors[0].dataPath, '.avatar');
|
||||
assert.equal(
|
||||
ajv.errors[0].message,
|
||||
'should NOT be shorter than 40 characters'
|
||||
);
|
||||
};
|
||||
|
||||
exports.test_avatar_too_long = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
avatar: 'a'.repeat(50)
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors.length, 1);
|
||||
assert.equal(ajv.errors[0].dataPath, '.avatar');
|
||||
assert.equal(
|
||||
ajv.errors[0].message,
|
||||
'should NOT be longer than 40 characters'
|
||||
);
|
||||
};
|
||||
|
||||
exports.test_avatar_invalid = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
avatar: 'n'.repeat(40)
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
assert.equal(ajv.errors.length, 1);
|
||||
assert.equal(ajv.errors[0].dataPath, '.avatar');
|
||||
assert.equal(ajv.errors[0].message, 'should match pattern "^[0-9a-f]+$"');
|
||||
};
|
||||
|
||||
exports.test_avatar_valid = () => {
|
||||
assert(ajv.validate(User, { avatar: 'a'.repeat(40) }));
|
||||
};
|
||||
|
||||
exports.test_email_valid = () => {
|
||||
assert(ajv.validate(User, { email: 'nate@zeit.co' }));
|
||||
};
|
||||
|
||||
exports.test_email_invalid = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
email: `${'n'.repeat(256)}@zeit.co`
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_avatar_invalid_length = () => {
|
||||
assert(ajv.validate(User, { avatar: 'a'.repeat(40) }));
|
||||
};
|
||||
|
||||
exports.test_platformVersion_null_valid = () => {
|
||||
assert(ajv.validate(User, { platformVersion: null }));
|
||||
};
|
||||
|
||||
exports.test_platformVersion_zero_invalid = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
platformVersion: 0
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_platformVersion_one_valid = () => {
|
||||
assert(ajv.validate(User, { platformVersion: 1 }));
|
||||
};
|
||||
|
||||
exports.test_platformVersion_two_valid = () => {
|
||||
assert(ajv.validate(User, { platformVersion: 2 }));
|
||||
};
|
||||
|
||||
exports.test_platformVersion_three_invalid = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
platformVersion: 3
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_importFlowGitProvider_github_valid = () => {
|
||||
assert(ajv.validate(User, { importFlowGitProvider: 'github' }));
|
||||
};
|
||||
|
||||
exports.test_importFlowGitProvider_gitlab_valid = () => {
|
||||
assert(ajv.validate(User, { importFlowGitProvider: 'gitlab' }));
|
||||
};
|
||||
|
||||
exports.test_importFlowGitProvider_bitbucket_valid = () => {
|
||||
assert(ajv.validate(User, { importFlowGitProvider: 'bitbucket' }));
|
||||
};
|
||||
|
||||
exports.test_importFlowGitProvider_null_valid = () => {
|
||||
assert(ajv.validate(User, { importFlowGitProvider: null }));
|
||||
};
|
||||
|
||||
exports.test_importFlowGitProvider_invalid_value = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
importFlowGitProvider: 'test'
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_importFlowGitProvider_number_invalid = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
importFlowGitProvider: 10
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_importFlowGitNamespace_string_valid = () => {
|
||||
assert(ajv.validate(User, { importFlowGitNamespace: 'test' }));
|
||||
};
|
||||
|
||||
exports.test_importFlowGitNamespace_null_valid = () => {
|
||||
assert(ajv.validate(User, { importFlowGitNamespace: null }));
|
||||
};
|
||||
|
||||
exports.test_importFlowGitNamespace_number_invalid = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
importFlowGitNamespace: 10
|
||||
});
|
||||
assert.strictEqual(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_importFlowGitNamespace_boolean_invalid = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
importFlowGitNamespace: true
|
||||
});
|
||||
assert.strictEqual(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_importFlowGitNamespaceId_string_valid = () => {
|
||||
assert(ajv.validate(User, { importFlowGitNamespaceId: 'test' }));
|
||||
};
|
||||
|
||||
exports.test_importFlowGitNamespaceId_number_valid = () => {
|
||||
assert(ajv.validate(User, { importFlowGitNamespaceId: 10 }));
|
||||
};
|
||||
|
||||
exports.test_importFlowGitNamespaceId_null_valid = () => {
|
||||
assert(ajv.validate(User, { importFlowGitNamespaceId: null }));
|
||||
};
|
||||
|
||||
exports.test_importFlowGitNamespaceId_boolean_invalid = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
importFlowGitNamespaceId: true
|
||||
});
|
||||
assert.strictEqual(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_scopeId_valid = () => {
|
||||
assert(ajv.validate(User, { scopeId: '123test' }));
|
||||
};
|
||||
|
||||
exports.test_scopeId_invalid = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
scopeId: null
|
||||
});
|
||||
assert.strictEqual(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_gitNamespaceId_string_valid = () => {
|
||||
assert(ajv.validate(User, { gitNamespaceId: 'test' }));
|
||||
};
|
||||
|
||||
exports.test_gitNamespaceId_number_valid = () => {
|
||||
assert(ajv.validate(User, { gitNamespaceId: 123 }));
|
||||
};
|
||||
|
||||
exports.test_gitNamespaceId_null_valid = () => {
|
||||
assert(ajv.validate(User, { gitNamespaceId: null }));
|
||||
};
|
||||
|
||||
exports.test_gitNamespaceId_boolean_invalid = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
gitNamespaceId: true
|
||||
});
|
||||
assert.strictEqual(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_viewPreference_cards_valid = () => {
|
||||
assert(ajv.validate(User, { viewPreference: 'cards' }));
|
||||
};
|
||||
|
||||
exports.test_viewPreference_list_valid = () => {
|
||||
assert(ajv.validate(User, { viewPreference: 'list' }));
|
||||
};
|
||||
|
||||
exports.test_viewPreference_null_valid = () => {
|
||||
assert(ajv.validate(User, { viewPreference: null }));
|
||||
};
|
||||
|
||||
exports.test_viewPreference_invalid_value = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
viewPreference: 'test'
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_viewPreference_number_invalid = () => {
|
||||
const isValid = ajv.validate(User, {
|
||||
viewPreference: 10
|
||||
});
|
||||
assert.equal(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_remoteCaching_valid = () => {
|
||||
assert(ajv.validate(User, { remoteCaching: { enabled: true } }));
|
||||
};
|
||||
|
||||
exports.test_remoteCaching_valid = () => {
|
||||
const isValid = ajv.validate(User, { remoteCaching: { enabled: 'yes' } });
|
||||
assert.strictEqual(isValid, false);
|
||||
};
|
||||
|
||||
exports.test_dismissedToasts_valid = () => {
|
||||
assert(ajv.validate(User, { dismissedToasts: [] }));
|
||||
};
|
||||
|
||||
exports.test_dismissedToasts_valid = () => {
|
||||
assert(ajv.validate(User, { dismissedToasts: [{ name: ' exampleToast', dismissals: [{ scopeId: 'exampleScopeId', createdAt: 1656442351576 }] }] }));
|
||||
};
|
||||
|
||||
exports.test_dismissedToasts_invalid = () => {
|
||||
const isValid = ajv.validate(User, { dismissedToasts: [{ name: ' exampleToast', otherProp: 'abc' }] });
|
||||
assert.strictEqual(isValid, false);
|
||||
};
|
242
node_modules/@zeit/schemas/user/index.js
generated
vendored
242
node_modules/@zeit/schemas/user/index.js
generated
vendored
@ -1,242 +0,0 @@
|
||||
const Username = {
|
||||
type: 'string',
|
||||
minLength: 1,
|
||||
maxLength: 48,
|
||||
pattern: '^[a-z0-9][a-z0-9-]*[a-z0-9]$'
|
||||
};
|
||||
|
||||
const Name = {
|
||||
type: 'string',
|
||||
minLength: 1,
|
||||
maxLength: 32
|
||||
};
|
||||
|
||||
const Email = {
|
||||
type: 'string',
|
||||
minLength: 5,
|
||||
maxLength: 256
|
||||
};
|
||||
|
||||
const ImportFlowGitProvider = {
|
||||
oneOf: [
|
||||
{
|
||||
'enum': ['github', 'gitlab', 'bitbucket']
|
||||
},
|
||||
{
|
||||
type: 'null'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const ImportFlowGitNamespace = {
|
||||
oneOf: [
|
||||
{
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
type: 'null'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const ImportFlowGitNamespaceId = {
|
||||
oneOf: [
|
||||
{
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
type: 'number'
|
||||
},
|
||||
{
|
||||
type: 'null'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const ScopeId = {
|
||||
type: 'string'
|
||||
};
|
||||
|
||||
const GitNamespaceId = {
|
||||
oneOf: [
|
||||
{
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
type: 'number'
|
||||
},
|
||||
{
|
||||
type: 'null'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const ViewPreference = {
|
||||
oneOf: [
|
||||
{
|
||||
'enum': ['cards', 'list']
|
||||
},
|
||||
{
|
||||
type: 'null'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const PlatformVersion = {
|
||||
oneOf: [
|
||||
{
|
||||
// A `null` platform version means to always use the latest
|
||||
type: 'null'
|
||||
},
|
||||
{
|
||||
type: 'integer',
|
||||
minimum: 1,
|
||||
maximum: 2
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const Avatar = {
|
||||
type: 'string',
|
||||
minLength: 40,
|
||||
maxLength: 40,
|
||||
pattern: '^[0-9a-f]+$'
|
||||
};
|
||||
|
||||
const Bio = {
|
||||
type: 'string'
|
||||
};
|
||||
|
||||
const Website = {
|
||||
type: 'string',
|
||||
minLength: 4,
|
||||
maxLength: 40
|
||||
};
|
||||
|
||||
const Profile = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
service: {
|
||||
type: 'string'
|
||||
},
|
||||
link: {
|
||||
type: 'string'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
};
|
||||
|
||||
const Profiles = {
|
||||
type: 'array',
|
||||
minItems: 0,
|
||||
maxItems: 100,
|
||||
uniqueItems: true,
|
||||
items: Profile,
|
||||
additionalProperties: false
|
||||
};
|
||||
|
||||
const RemoteCaching = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
enabled: {
|
||||
type: 'boolean'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
};
|
||||
|
||||
const ToastDismissal = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
scopeId: {
|
||||
type: 'string'
|
||||
},
|
||||
createdAt: {
|
||||
type: 'number'
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
};
|
||||
|
||||
const DismissedToast = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string'
|
||||
},
|
||||
dismissals: {
|
||||
type: 'array',
|
||||
minItems: 0,
|
||||
maxItems: 50,
|
||||
items: ToastDismissal
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
};
|
||||
|
||||
const DismissedToasts = {
|
||||
type: 'array',
|
||||
minItems: 0,
|
||||
maxItems: 50,
|
||||
items: DismissedToast,
|
||||
additionalProperties: false
|
||||
};
|
||||
|
||||
const EnablePreviewFeedback = {
|
||||
oneOf: [
|
||||
{
|
||||
'enum': [
|
||||
'on',
|
||||
'off',
|
||||
'default',
|
||||
'on-force',
|
||||
'off-force',
|
||||
'default-force'
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'null'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const User = {
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
username: Username,
|
||||
name: Name,
|
||||
email: Email,
|
||||
billingChecked: { type: 'boolean' },
|
||||
avatar: Avatar,
|
||||
platformVersion: PlatformVersion,
|
||||
bio: Bio,
|
||||
website: Website,
|
||||
profiles: Profiles,
|
||||
importFlowGitProvider: ImportFlowGitProvider,
|
||||
importFlowGitNamespace: ImportFlowGitNamespace,
|
||||
importFlowGitNamespaceId: ImportFlowGitNamespaceId,
|
||||
scopeId: ScopeId,
|
||||
gitNamespaceId: GitNamespaceId,
|
||||
viewPreference: ViewPreference,
|
||||
remoteCaching: RemoteCaching,
|
||||
dismissedToasts: DismissedToasts,
|
||||
enablePreviewFeedback: EnablePreviewFeedback
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
User,
|
||||
Username,
|
||||
Name,
|
||||
Email,
|
||||
Avatar,
|
||||
PlatformVersion,
|
||||
ImportFlowGitProvider,
|
||||
ImportFlowGitNamespace,
|
||||
ImportFlowGitNamespaceId,
|
||||
ScopeId,
|
||||
GitNamespaceId,
|
||||
ViewPreference,
|
||||
DismissedToasts
|
||||
};
|
243
node_modules/accepts/HISTORY.md
generated
vendored
243
node_modules/accepts/HISTORY.md
generated
vendored
@ -1,243 +0,0 @@
|
||||
1.3.8 / 2022-02-02
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.34
|
||||
- deps: mime-db@~1.51.0
|
||||
* deps: negotiator@0.6.3
|
||||
|
||||
1.3.7 / 2019-04-29
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.6.2
|
||||
- Fix sorting charset, encoding, and language with extra parameters
|
||||
|
||||
1.3.6 / 2019-04-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.24
|
||||
- deps: mime-db@~1.40.0
|
||||
|
||||
1.3.5 / 2018-02-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.18
|
||||
- deps: mime-db@~1.33.0
|
||||
|
||||
1.3.4 / 2017-08-22
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.16
|
||||
- deps: mime-db@~1.29.0
|
||||
|
||||
1.3.3 / 2016-05-02
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.11
|
||||
- deps: mime-db@~1.23.0
|
||||
* deps: negotiator@0.6.1
|
||||
- perf: improve `Accept` parsing speed
|
||||
- perf: improve `Accept-Charset` parsing speed
|
||||
- perf: improve `Accept-Encoding` parsing speed
|
||||
- perf: improve `Accept-Language` parsing speed
|
||||
|
||||
1.3.2 / 2016-03-08
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.10
|
||||
- Fix extension of `application/dash+xml`
|
||||
- Update primary extension for `audio/mp4`
|
||||
- deps: mime-db@~1.22.0
|
||||
|
||||
1.3.1 / 2016-01-19
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.9
|
||||
- deps: mime-db@~1.21.0
|
||||
|
||||
1.3.0 / 2015-09-29
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.7
|
||||
- deps: mime-db@~1.19.0
|
||||
* deps: negotiator@0.6.0
|
||||
- Fix including type extensions in parameters in `Accept` parsing
|
||||
- Fix parsing `Accept` parameters with quoted equals
|
||||
- Fix parsing `Accept` parameters with quoted semicolons
|
||||
- Lazy-load modules from main entry point
|
||||
- perf: delay type concatenation until needed
|
||||
- perf: enable strict mode
|
||||
- perf: hoist regular expressions
|
||||
- perf: remove closures getting spec properties
|
||||
- perf: remove a closure from media type parsing
|
||||
- perf: remove property delete from media type parsing
|
||||
|
||||
1.2.13 / 2015-09-06
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.6
|
||||
- deps: mime-db@~1.18.0
|
||||
|
||||
1.2.12 / 2015-07-30
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.4
|
||||
- deps: mime-db@~1.16.0
|
||||
|
||||
1.2.11 / 2015-07-16
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.3
|
||||
- deps: mime-db@~1.15.0
|
||||
|
||||
1.2.10 / 2015-07-01
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.2
|
||||
- deps: mime-db@~1.14.0
|
||||
|
||||
1.2.9 / 2015-06-08
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.1
|
||||
- perf: fix deopt during mapping
|
||||
|
||||
1.2.8 / 2015-06-07
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.0
|
||||
- deps: mime-db@~1.13.0
|
||||
* perf: avoid argument reassignment & argument slice
|
||||
* perf: avoid negotiator recursive construction
|
||||
* perf: enable strict mode
|
||||
* perf: remove unnecessary bitwise operator
|
||||
|
||||
1.2.7 / 2015-05-10
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.5.3
|
||||
- Fix media type parameter matching to be case-insensitive
|
||||
|
||||
1.2.6 / 2015-05-07
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.11
|
||||
- deps: mime-db@~1.9.1
|
||||
* deps: negotiator@0.5.2
|
||||
- Fix comparing media types with quoted values
|
||||
- Fix splitting media types with quoted commas
|
||||
|
||||
1.2.5 / 2015-03-13
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.10
|
||||
- deps: mime-db@~1.8.0
|
||||
|
||||
1.2.4 / 2015-02-14
|
||||
==================
|
||||
|
||||
* Support Node.js 0.6
|
||||
* deps: mime-types@~2.0.9
|
||||
- deps: mime-db@~1.7.0
|
||||
* deps: negotiator@0.5.1
|
||||
- Fix preference sorting to be stable for long acceptable lists
|
||||
|
||||
1.2.3 / 2015-01-31
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.8
|
||||
- deps: mime-db@~1.6.0
|
||||
|
||||
1.2.2 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.7
|
||||
- deps: mime-db@~1.5.0
|
||||
|
||||
1.2.1 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.5
|
||||
- deps: mime-db@~1.3.1
|
||||
|
||||
1.2.0 / 2014-12-19
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.5.0
|
||||
- Fix list return order when large accepted list
|
||||
- Fix missing identity encoding when q=0 exists
|
||||
- Remove dynamic building of Negotiator class
|
||||
|
||||
1.1.4 / 2014-12-10
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.4
|
||||
- deps: mime-db@~1.3.0
|
||||
|
||||
1.1.3 / 2014-11-09
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.3
|
||||
- deps: mime-db@~1.2.0
|
||||
|
||||
1.1.2 / 2014-10-14
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.9
|
||||
- Fix error when media type has invalid parameter
|
||||
|
||||
1.1.1 / 2014-09-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.2
|
||||
- deps: mime-db@~1.1.0
|
||||
* deps: negotiator@0.4.8
|
||||
- Fix all negotiations to be case-insensitive
|
||||
- Stable sort preferences of same quality according to client order
|
||||
|
||||
1.1.0 / 2014-09-02
|
||||
==================
|
||||
|
||||
* update `mime-types`
|
||||
|
||||
1.0.7 / 2014-07-04
|
||||
==================
|
||||
|
||||
* Fix wrong type returned from `type` when match after unknown extension
|
||||
|
||||
1.0.6 / 2014-06-24
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.7
|
||||
|
||||
1.0.5 / 2014-06-20
|
||||
==================
|
||||
|
||||
* fix crash when unknown extension given
|
||||
|
||||
1.0.4 / 2014-06-19
|
||||
==================
|
||||
|
||||
* use `mime-types`
|
||||
|
||||
1.0.3 / 2014-06-11
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.6
|
||||
- Order by specificity when quality is the same
|
||||
|
||||
1.0.2 / 2014-05-29
|
||||
==================
|
||||
|
||||
* Fix interpretation when header not in request
|
||||
* deps: pin negotiator@0.4.5
|
||||
|
||||
1.0.1 / 2014-01-18
|
||||
==================
|
||||
|
||||
* Identity encoding isn't always acceptable
|
||||
* deps: negotiator@~0.4.0
|
||||
|
||||
1.0.0 / 2013-12-27
|
||||
==================
|
||||
|
||||
* Genesis
|
23
node_modules/accepts/LICENSE
generated
vendored
23
node_modules/accepts/LICENSE
generated
vendored
@ -1,23 +0,0 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
140
node_modules/accepts/README.md
generated
vendored
140
node_modules/accepts/README.md
generated
vendored
@ -1,140 +0,0 @@
|
||||
# accepts
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
|
||||
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
||||
|
||||
In addition to negotiator, it allows:
|
||||
|
||||
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
|
||||
as well as `('text/html', 'application/json')`.
|
||||
- Allows type shorthands such as `json`.
|
||||
- Returns `false` when no types match
|
||||
- Treats non-existent headers as `*`
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install accepts
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var accepts = require('accepts')
|
||||
```
|
||||
|
||||
### accepts(req)
|
||||
|
||||
Create a new `Accepts` object for the given `req`.
|
||||
|
||||
#### .charset(charsets)
|
||||
|
||||
Return the first accepted charset. If nothing in `charsets` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .charsets()
|
||||
|
||||
Return the charsets that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .encoding(encodings)
|
||||
|
||||
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .encodings()
|
||||
|
||||
Return the encodings that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .language(languages)
|
||||
|
||||
Return the first accepted language. If nothing in `languages` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .languages()
|
||||
|
||||
Return the languages that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .type(types)
|
||||
|
||||
Return the first accepted type (and it is returned as the same text as what
|
||||
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
||||
is returned.
|
||||
|
||||
The `types` array can contain full MIME types or file extensions. Any value
|
||||
that is not a full MIME types is passed to `require('mime-types').lookup`.
|
||||
|
||||
#### .types()
|
||||
|
||||
Return the types that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
## Examples
|
||||
|
||||
### Simple type negotiation
|
||||
|
||||
This simple example shows how to use `accepts` to return a different typed
|
||||
respond body based on what the client wants to accept. The server lists it's
|
||||
preferences in order and will get back the best match between the client and
|
||||
server.
|
||||
|
||||
```js
|
||||
var accepts = require('accepts')
|
||||
var http = require('http')
|
||||
|
||||
function app (req, res) {
|
||||
var accept = accepts(req)
|
||||
|
||||
// the order of this list is significant; should be server preferred order
|
||||
switch (accept.type(['json', 'html'])) {
|
||||
case 'json':
|
||||
res.setHeader('Content-Type', 'application/json')
|
||||
res.write('{"hello":"world!"}')
|
||||
break
|
||||
case 'html':
|
||||
res.setHeader('Content-Type', 'text/html')
|
||||
res.write('<b>hello, world!</b>')
|
||||
break
|
||||
default:
|
||||
// the fallback is text/plain, so no need to specify it above
|
||||
res.setHeader('Content-Type', 'text/plain')
|
||||
res.write('hello, world!')
|
||||
break
|
||||
}
|
||||
|
||||
res.end()
|
||||
}
|
||||
|
||||
http.createServer(app).listen(3000)
|
||||
```
|
||||
|
||||
You can test this out with the cURL program:
|
||||
```sh
|
||||
curl -I -H'Accept: text/html' http://localhost:3000/
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
|
||||
[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci
|
||||
[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml
|
||||
[node-version-image]: https://badgen.net/npm/node/accepts
|
||||
[node-version-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
|
||||
[npm-url]: https://npmjs.org/package/accepts
|
||||
[npm-version-image]: https://badgen.net/npm/v/accepts
|
238
node_modules/accepts/index.js
generated
vendored
238
node_modules/accepts/index.js
generated
vendored
@ -1,238 +0,0 @@
|
||||
/*!
|
||||
* accepts
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var Negotiator = require('negotiator')
|
||||
var mime = require('mime-types')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = Accepts
|
||||
|
||||
/**
|
||||
* Create a new Accepts object for the given req.
|
||||
*
|
||||
* @param {object} req
|
||||
* @public
|
||||
*/
|
||||
|
||||
function Accepts (req) {
|
||||
if (!(this instanceof Accepts)) {
|
||||
return new Accepts(req)
|
||||
}
|
||||
|
||||
this.headers = req.headers
|
||||
this.negotiator = new Negotiator(req)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given `type(s)` is acceptable, returning
|
||||
* the best match when true, otherwise `undefined`, in which
|
||||
* case you should respond with 406 "Not Acceptable".
|
||||
*
|
||||
* The `type` value may be a single mime type string
|
||||
* such as "application/json", the extension name
|
||||
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
|
||||
* or array is given the _best_ match, if any is returned.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* // Accept: text/html
|
||||
* this.types('html');
|
||||
* // => "html"
|
||||
*
|
||||
* // Accept: text/*, application/json
|
||||
* this.types('html');
|
||||
* // => "html"
|
||||
* this.types('text/html');
|
||||
* // => "text/html"
|
||||
* this.types('json', 'text');
|
||||
* // => "json"
|
||||
* this.types('application/json');
|
||||
* // => "application/json"
|
||||
*
|
||||
* // Accept: text/*, application/json
|
||||
* this.types('image/png');
|
||||
* this.types('png');
|
||||
* // => undefined
|
||||
*
|
||||
* // Accept: text/*;q=.5, application/json
|
||||
* this.types(['html', 'json']);
|
||||
* this.types('html', 'json');
|
||||
* // => "json"
|
||||
*
|
||||
* @param {String|Array} types...
|
||||
* @return {String|Array|Boolean}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.type =
|
||||
Accepts.prototype.types = function (types_) {
|
||||
var types = types_
|
||||
|
||||
// support flattened arguments
|
||||
if (types && !Array.isArray(types)) {
|
||||
types = new Array(arguments.length)
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no types, return all requested types
|
||||
if (!types || types.length === 0) {
|
||||
return this.negotiator.mediaTypes()
|
||||
}
|
||||
|
||||
// no accept header, return first given type
|
||||
if (!this.headers.accept) {
|
||||
return types[0]
|
||||
}
|
||||
|
||||
var mimes = types.map(extToMime)
|
||||
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
|
||||
var first = accepts[0]
|
||||
|
||||
return first
|
||||
? types[mimes.indexOf(first)]
|
||||
: false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted encodings or best fit based on `encodings`.
|
||||
*
|
||||
* Given `Accept-Encoding: gzip, deflate`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['gzip', 'deflate']
|
||||
*
|
||||
* @param {String|Array} encodings...
|
||||
* @return {String|Array}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.encoding =
|
||||
Accepts.prototype.encodings = function (encodings_) {
|
||||
var encodings = encodings_
|
||||
|
||||
// support flattened arguments
|
||||
if (encodings && !Array.isArray(encodings)) {
|
||||
encodings = new Array(arguments.length)
|
||||
for (var i = 0; i < encodings.length; i++) {
|
||||
encodings[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no encodings, return all requested encodings
|
||||
if (!encodings || encodings.length === 0) {
|
||||
return this.negotiator.encodings()
|
||||
}
|
||||
|
||||
return this.negotiator.encodings(encodings)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted charsets or best fit based on `charsets`.
|
||||
*
|
||||
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['utf-8', 'utf-7', 'iso-8859-1']
|
||||
*
|
||||
* @param {String|Array} charsets...
|
||||
* @return {String|Array}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.charset =
|
||||
Accepts.prototype.charsets = function (charsets_) {
|
||||
var charsets = charsets_
|
||||
|
||||
// support flattened arguments
|
||||
if (charsets && !Array.isArray(charsets)) {
|
||||
charsets = new Array(arguments.length)
|
||||
for (var i = 0; i < charsets.length; i++) {
|
||||
charsets[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no charsets, return all requested charsets
|
||||
if (!charsets || charsets.length === 0) {
|
||||
return this.negotiator.charsets()
|
||||
}
|
||||
|
||||
return this.negotiator.charsets(charsets)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted languages or best fit based on `langs`.
|
||||
*
|
||||
* Given `Accept-Language: en;q=0.8, es, pt`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['es', 'pt', 'en']
|
||||
*
|
||||
* @param {String|Array} langs...
|
||||
* @return {Array|String}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.lang =
|
||||
Accepts.prototype.langs =
|
||||
Accepts.prototype.language =
|
||||
Accepts.prototype.languages = function (languages_) {
|
||||
var languages = languages_
|
||||
|
||||
// support flattened arguments
|
||||
if (languages && !Array.isArray(languages)) {
|
||||
languages = new Array(arguments.length)
|
||||
for (var i = 0; i < languages.length; i++) {
|
||||
languages[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no languages, return all requested languages
|
||||
if (!languages || languages.length === 0) {
|
||||
return this.negotiator.languages()
|
||||
}
|
||||
|
||||
return this.negotiator.languages(languages)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert extnames to mime.
|
||||
*
|
||||
* @param {String} type
|
||||
* @return {String}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function extToMime (type) {
|
||||
return type.indexOf('/') === -1
|
||||
? mime.lookup(type)
|
||||
: type
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if mime is valid.
|
||||
*
|
||||
* @param {String} type
|
||||
* @return {String}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function validMime (type) {
|
||||
return typeof type === 'string'
|
||||
}
|
47
node_modules/accepts/package.json
generated
vendored
47
node_modules/accepts/package.json
generated
vendored
@ -1,47 +0,0 @@
|
||||
{
|
||||
"name": "accepts",
|
||||
"description": "Higher-level content negotiation",
|
||||
"version": "1.3.8",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "jshttp/accepts",
|
||||
"dependencies": {
|
||||
"mime-types": "~2.1.34",
|
||||
"negotiator": "0.6.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"deep-equal": "1.0.1",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.25.4",
|
||||
"eslint-plugin-markdown": "2.2.1",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "4.3.1",
|
||||
"eslint-plugin-standard": "4.1.0",
|
||||
"mocha": "9.2.0",
|
||||
"nyc": "15.1.0"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
},
|
||||
"keywords": [
|
||||
"content",
|
||||
"negotiation",
|
||||
"accept",
|
||||
"accepts"
|
||||
]
|
||||
}
|
23
node_modules/ajv/.runkit_example.js
generated
vendored
23
node_modules/ajv/.runkit_example.js
generated
vendored
@ -1,23 +0,0 @@
|
||||
const Ajv = require("ajv")
|
||||
const ajv = new Ajv({allErrors: true})
|
||||
|
||||
const schema = {
|
||||
type: "object",
|
||||
properties: {
|
||||
foo: {type: "string"},
|
||||
bar: {type: "number", maximum: 3},
|
||||
},
|
||||
required: ["foo", "bar"],
|
||||
additionalProperties: false,
|
||||
}
|
||||
|
||||
const validate = ajv.compile(schema)
|
||||
|
||||
test({foo: "abc", bar: 2})
|
||||
test({foo: 2, bar: 4})
|
||||
|
||||
function test(data) {
|
||||
const valid = validate(data)
|
||||
if (valid) console.log("Valid!")
|
||||
else console.log("Invalid: " + ajv.errorsText(validate.errors))
|
||||
}
|
22
node_modules/ajv/LICENSE
generated
vendored
22
node_modules/ajv/LICENSE
generated
vendored
@ -1,22 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2021 Evgeny Poberezkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
193
node_modules/ajv/README.md
generated
vendored
193
node_modules/ajv/README.md
generated
vendored
@ -1,193 +0,0 @@
|
||||
<img align="right" alt="Ajv logo" width="160" src="https://ajv.js.org/img/ajv.svg">
|
||||
|
||||
|
||||
|
||||
# Ajv JSON schema validator
|
||||
|
||||
The fastest JSON validator for Node.js and browser.
|
||||
|
||||
Supports JSON Schema draft-04/06/07/2019-09/2020-12 ([draft-04 support](https://ajv.js.org/json-schema.html#draft-04) requires ajv-draft-04 package) and JSON Type Definition [RFC8927](https://datatracker.ietf.org/doc/rfc8927/).
|
||||
|
||||
[![build](https://github.com/ajv-validator/ajv/workflows/build/badge.svg)](https://github.com/ajv-validator/ajv/actions?query=workflow%3Abuild)
|
||||
[![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv)
|
||||
[![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv)
|
||||
[![Coverage Status](https://coveralls.io/repos/github/ajv-validator/ajv/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv?branch=master)
|
||||
[![SimpleX](https://img.shields.io/badge/chat-on%20SimpleX-%2307b4b9)](https://simplex.chat/contact#/?v=1&smp=smp%3A%2F%2Fu2dS9sG8nMNURyZwqASV4yROM28Er0luVTx5X1CsMrU%3D%40smp4.simplex.im%2Fap4lMFzfXF8Hzmh-Vz0WNxp_1jKiOa-h%23MCowBQYDK2VuAyEAcdefddRvDfI8iAuBpztm_J3qFucj8MDZoVs_2EcMTzU%3D)
|
||||
[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv)
|
||||
[![GitHub Sponsors](https://img.shields.io/badge/$-sponsors-brightgreen)](https://github.com/sponsors/epoberezkin)
|
||||
|
||||
## Ajv sponsors
|
||||
|
||||
[<img src="https://ajv.js.org/img/mozilla.svg" width="45%" alt="Mozilla">](https://www.mozilla.org)<img src="https://ajv.js.org/img/gap.svg" width="9%">[<img src="https://ajv.js.org/img/reserved.svg" width="45%">](https://opencollective.com/ajv)
|
||||
|
||||
[<img src="https://ajv.js.org/img/microsoft.png" width="31%" alt="Microsoft">](https://opensource.microsoft.com)<img src="https://ajv.js.org/img/gap.svg" width="3%">[<img src="https://ajv.js.org/img/reserved.svg" width="31%">](https://opencollective.com/ajv)<img src="https://ajv.js.org/img/gap.svg" width="3%">[<img src="https://ajv.js.org/img/reserved.svg" width="31%">](https://opencollective.com/ajv)
|
||||
|
||||
[<img src="https://ajv.js.org/img/retool.svg" width="22.5%" alt="Retool">](https://retool.com/?utm_source=sponsor&utm_campaign=ajv)<img src="https://ajv.js.org/img/gap.svg" width="3%">[<img src="https://ajv.js.org/img/tidelift.svg" width="22.5%" alt="Tidelift">](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=enterprise)<img src="https://ajv.js.org/img/gap.svg" width="3%">[<img src="https://ajv.js.org/img/simplex.svg" width="22.5%" alt="SimpleX">](https://github.com/simplex-chat/simplex-chat)<img src="https://ajv.js.org/img/gap.svg" width="3%">[<img src="https://ajv.js.org/img/reserved.svg" width="22.5%">](https://opencollective.com/ajv)
|
||||
|
||||
## Contributing
|
||||
|
||||
More than 100 people contributed to Ajv, and we would love to have you join the development. We welcome implementing new features that will benefit many users and ideas to improve our documentation.
|
||||
|
||||
Please review [Contributing guidelines](./CONTRIBUTING.md) and [Code components](https://ajv.js.org/components.html).
|
||||
|
||||
## Documentation
|
||||
|
||||
All documentation is available on the [Ajv website](https://ajv.js.org).
|
||||
|
||||
Some useful site links:
|
||||
- [Getting started](https://ajv.js.org/guide/getting-started.html)
|
||||
- [JSON Schema vs JSON Type Definition](https://ajv.js.org/guide/schema-language.html)
|
||||
- [API reference](https://ajv.js.org/api.html)
|
||||
- [Strict mode](https://ajv.js.org/strict-mode.html)
|
||||
- [Standalone validation code](https://ajv.js.org/standalone.html)
|
||||
- [Security considerations](https://ajv.js.org/security.html)
|
||||
- [Command line interface](https://ajv.js.org/packages/ajv-cli.html)
|
||||
- [Frequently Asked Questions](https://ajv.js.org/faq.html)
|
||||
|
||||
## <a name="sponsors"></a>Please [sponsor Ajv development](https://github.com/sponsors/epoberezkin)
|
||||
|
||||
Since I asked to support Ajv development 40 people and 6 organizations contributed via GitHub and OpenCollective - this support helped receiving the MOSS grant!
|
||||
|
||||
Your continuing support is very important - the funds will be used to develop and maintain Ajv once the next major version is released.
|
||||
|
||||
Please sponsor Ajv via:
|
||||
|
||||
- [GitHub sponsors page](https://github.com/sponsors/epoberezkin) (GitHub will match it)
|
||||
- [Ajv Open Collective️](https://opencollective.com/ajv)
|
||||
|
||||
Thank you.
|
||||
|
||||
#### Open Collective sponsors
|
||||
|
||||
<a href="https://opencollective.com/ajv"><img src="https://opencollective.com/ajv/individuals.svg?width=890"></a>
|
||||
|
||||
<a href="https://opencollective.com/ajv/organization/0/website"><img src="https://opencollective.com/ajv/organization/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/1/website"><img src="https://opencollective.com/ajv/organization/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/2/website"><img src="https://opencollective.com/ajv/organization/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/3/website"><img src="https://opencollective.com/ajv/organization/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/4/website"><img src="https://opencollective.com/ajv/organization/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/5/website"><img src="https://opencollective.com/ajv/organization/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/6/website"><img src="https://opencollective.com/ajv/organization/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/7/website"><img src="https://opencollective.com/ajv/organization/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/8/website"><img src="https://opencollective.com/ajv/organization/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/9/website"><img src="https://opencollective.com/ajv/organization/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/10/website"><img src="https://opencollective.com/ajv/organization/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ajv/organization/11/website"><img src="https://opencollective.com/ajv/organization/11/avatar.svg"></a>
|
||||
|
||||
## Performance
|
||||
|
||||
Ajv generates code to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization.
|
||||
|
||||
Currently Ajv is the fastest and the most standard compliant validator according to these benchmarks:
|
||||
|
||||
- [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark) - 50% faster than the second place
|
||||
- [jsck benchmark](https://github.com/pandastrike/jsck#benchmarks) - 20-190% faster
|
||||
- [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html)
|
||||
- [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html)
|
||||
|
||||
Performance of different validators by [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark):
|
||||
|
||||
[![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=62,4,1&chs=600x416&chxl=-1:|ajv|@exodus/schemasafe|is-my-json-valid|djv|@cfworker/json-schema|jsonschema&chd=t:100,69.2,51.5,13.1,5.1,1.2)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance)
|
||||
|
||||
## Features
|
||||
|
||||
- Ajv implements JSON Schema [draft-06/07/2019-09/2020-12](http://json-schema.org/) standards (draft-04 is supported in v6):
|
||||
- all validation keywords (see [JSON Schema validation keywords](https://ajv.js.org/json-schema.html))
|
||||
- [OpenAPI](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md) extensions:
|
||||
- NEW: keyword [discriminator](https://ajv.js.org/json-schema.html#discriminator).
|
||||
- keyword [nullable](https://ajv.js.org/json-schema.html#nullable).
|
||||
- full support of remote references (remote schemas have to be added with `addSchema` or compiled to be available)
|
||||
- support of recursive references between schemas
|
||||
- correct string lengths for strings with unicode pairs
|
||||
- JSON Schema [formats](https://ajv.js.org/guide/formats.html) (with [ajv-formats](https://github.com/ajv-validator/ajv-formats) plugin).
|
||||
- [validates schemas against meta-schema](https://ajv.js.org/api.html#api-validateschema)
|
||||
- NEW: supports [JSON Type Definition](https://datatracker.ietf.org/doc/rfc8927/):
|
||||
- all keywords (see [JSON Type Definition schema forms](https://ajv.js.org/json-type-definition.html))
|
||||
- meta-schema for JTD schemas
|
||||
- "union" keyword and user-defined keywords (can be used inside "metadata" member of the schema)
|
||||
- supports [browsers](https://ajv.js.org/guide/environments.html#browsers) and Node.js 10.x - current
|
||||
- [asynchronous loading](https://ajv.js.org/guide/managing-schemas.html#asynchronous-schema-loading) of referenced schemas during compilation
|
||||
- "All errors" validation mode with [option allErrors](https://ajv.js.org/options.html#allerrors)
|
||||
- [error messages with parameters](https://ajv.js.org/api.html#validation-errors) describing error reasons to allow error message generation
|
||||
- i18n error messages support with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package
|
||||
- [removing-additional-properties](https://ajv.js.org/guide/modifying-data.html#removing-additional-properties)
|
||||
- [assigning defaults](https://ajv.js.org/guide/modifying-data.html#assigning-defaults) to missing properties and items
|
||||
- [coercing data](https://ajv.js.org/guide/modifying-data.html#coercing-data-types) to the types specified in `type` keywords
|
||||
- [user-defined keywords](https://ajv.js.org/guide/user-keywords.html)
|
||||
- additional extension keywords with [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package
|
||||
- [\$data reference](https://ajv.js.org/guide/combining-schemas.html#data-reference) to use values from the validated data as values for the schema keywords
|
||||
- [asynchronous validation](https://ajv.js.org/guide/async-validation.html) of user-defined formats and keywords
|
||||
|
||||
## Install
|
||||
|
||||
To install version 8:
|
||||
|
||||
```
|
||||
npm install ajv
|
||||
```
|
||||
|
||||
## <a name="usage"></a>Getting started
|
||||
|
||||
Try it in the Node.js REPL: https://runkit.com/npm/ajv
|
||||
|
||||
In JavaScript:
|
||||
|
||||
```javascript
|
||||
// or ESM/TypeScript import
|
||||
import Ajv from "ajv"
|
||||
// Node.js require:
|
||||
const Ajv = require("ajv")
|
||||
|
||||
const ajv = new Ajv() // options can be passed, e.g. {allErrors: true}
|
||||
|
||||
const schema = {
|
||||
type: "object",
|
||||
properties: {
|
||||
foo: {type: "integer"},
|
||||
bar: {type: "string"}
|
||||
},
|
||||
required: ["foo"],
|
||||
additionalProperties: false,
|
||||
}
|
||||
|
||||
const data = {
|
||||
foo: 1,
|
||||
bar: "abc"
|
||||
}
|
||||
|
||||
const validate = ajv.compile(schema)
|
||||
const valid = validate(data)
|
||||
if (!valid) console.log(validate.errors)
|
||||
```
|
||||
|
||||
Learn how to use Ajv and see more examples in the [Guide: getting started](https://ajv.js.org/guide/getting-started.html)
|
||||
|
||||
## Changes history
|
||||
|
||||
See [https://github.com/ajv-validator/ajv/releases](https://github.com/ajv-validator/ajv/releases)
|
||||
|
||||
**Please note**: [Changes in version 8.0.0](https://github.com/ajv-validator/ajv/releases/tag/v8.0.0)
|
||||
|
||||
[Version 7.0.0](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0)
|
||||
|
||||
[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0).
|
||||
|
||||
## Code of conduct
|
||||
|
||||
Please review and follow the [Code of conduct](./CODE_OF_CONDUCT.md).
|
||||
|
||||
Please report any unacceptable behaviour to ajv.validator@gmail.com - it will be reviewed by the project team.
|
||||
|
||||
## Security contact
|
||||
|
||||
To report a security vulnerability, please use the
|
||||
[Tidelift security contact](https://tidelift.com/security).
|
||||
Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerabilities via GitHub issues.
|
||||
|
||||
## Open-source software support
|
||||
|
||||
Ajv is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE)
|
17
node_modules/ajv/dist/2019.d.ts
generated
vendored
17
node_modules/ajv/dist/2019.d.ts
generated
vendored
@ -1,17 +0,0 @@
|
||||
import type { AnySchemaObject } from "./types";
|
||||
import AjvCore, { Options } from "./core";
|
||||
declare class Ajv2019 extends AjvCore {
|
||||
constructor(opts?: Options);
|
||||
_addVocabularies(): void;
|
||||
_addDefaultMetaSchema(): void;
|
||||
defaultMeta(): string | AnySchemaObject | undefined;
|
||||
}
|
||||
export default Ajv2019;
|
||||
export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, } from "./types";
|
||||
export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core";
|
||||
export { SchemaCxt, SchemaObjCxt } from "./compile";
|
||||
export { KeywordCxt } from "./compile/validate";
|
||||
export { DefinedError } from "./vocabularies/errors";
|
||||
export { JSONType } from "./compile/rules";
|
||||
export { JSONSchemaType } from "./types/json-schema";
|
||||
export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen";
|
55
node_modules/ajv/dist/2019.js
generated
vendored
55
node_modules/ajv/dist/2019.js
generated
vendored
@ -1,55 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
||||
const core_1 = require("./core");
|
||||
const draft7_1 = require("./vocabularies/draft7");
|
||||
const dynamic_1 = require("./vocabularies/dynamic");
|
||||
const next_1 = require("./vocabularies/next");
|
||||
const unevaluated_1 = require("./vocabularies/unevaluated");
|
||||
const discriminator_1 = require("./vocabularies/discriminator");
|
||||
const json_schema_2019_09_1 = require("./refs/json-schema-2019-09");
|
||||
const META_SCHEMA_ID = "https://json-schema.org/draft/2019-09/schema";
|
||||
class Ajv2019 extends core_1.default {
|
||||
constructor(opts = {}) {
|
||||
super({
|
||||
...opts,
|
||||
dynamicRef: true,
|
||||
next: true,
|
||||
unevaluated: true,
|
||||
});
|
||||
}
|
||||
_addVocabularies() {
|
||||
super._addVocabularies();
|
||||
this.addVocabulary(dynamic_1.default);
|
||||
draft7_1.default.forEach((v) => this.addVocabulary(v));
|
||||
this.addVocabulary(next_1.default);
|
||||
this.addVocabulary(unevaluated_1.default);
|
||||
if (this.opts.discriminator)
|
||||
this.addKeyword(discriminator_1.default);
|
||||
}
|
||||
_addDefaultMetaSchema() {
|
||||
super._addDefaultMetaSchema();
|
||||
const { $data, meta } = this.opts;
|
||||
if (!meta)
|
||||
return;
|
||||
json_schema_2019_09_1.default.call(this, $data);
|
||||
this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
|
||||
}
|
||||
defaultMeta() {
|
||||
return (this.opts.defaultMeta =
|
||||
super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
|
||||
}
|
||||
}
|
||||
module.exports = exports = Ajv2019;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Ajv2019;
|
||||
var validate_1 = require("./compile/validate");
|
||||
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
|
||||
var codegen_1 = require("./compile/codegen");
|
||||
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
|
||||
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
|
||||
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
|
||||
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
||||
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
||||
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
||||
//# sourceMappingURL=2019.js.map
|
1
node_modules/ajv/dist/2019.js.map
generated
vendored
1
node_modules/ajv/dist/2019.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"2019.js","sourceRoot":"","sources":["../lib/2019.ts"],"names":[],"mappings":";;;AACA,iCAAuC;AAEvC,kDAAsD;AACtD,oDAAsD;AACtD,8CAAgD;AAChD,4DAA8D;AAC9D,gEAAwD;AACxD,oEAA0D;AAE1D,MAAM,cAAc,GAAG,8CAA8C,CAAA;AAErE,MAAM,OAAQ,SAAQ,cAAO;IAC3B,YAAY,OAAgB,EAAE;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,IAAI;SAClB,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAA;QACrC,gBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QACxD,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;QAClC,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAA;QACzC,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,MAAM,EAAC,KAAK,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QAC/B,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,6BAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA;AAClC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,OAAO,CAAA;AAyBtB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"}
|
17
node_modules/ajv/dist/2020.d.ts
generated
vendored
17
node_modules/ajv/dist/2020.d.ts
generated
vendored
@ -1,17 +0,0 @@
|
||||
import type { AnySchemaObject } from "./types";
|
||||
import AjvCore, { Options } from "./core";
|
||||
declare class Ajv2020 extends AjvCore {
|
||||
constructor(opts?: Options);
|
||||
_addVocabularies(): void;
|
||||
_addDefaultMetaSchema(): void;
|
||||
defaultMeta(): string | AnySchemaObject | undefined;
|
||||
}
|
||||
export default Ajv2020;
|
||||
export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, } from "./types";
|
||||
export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core";
|
||||
export { SchemaCxt, SchemaObjCxt } from "./compile";
|
||||
export { KeywordCxt } from "./compile/validate";
|
||||
export { DefinedError } from "./vocabularies/errors";
|
||||
export { JSONType } from "./compile/rules";
|
||||
export { JSONSchemaType } from "./types/json-schema";
|
||||
export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen";
|
49
node_modules/ajv/dist/2020.js
generated
vendored
49
node_modules/ajv/dist/2020.js
generated
vendored
@ -1,49 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
||||
const core_1 = require("./core");
|
||||
const draft2020_1 = require("./vocabularies/draft2020");
|
||||
const discriminator_1 = require("./vocabularies/discriminator");
|
||||
const json_schema_2020_12_1 = require("./refs/json-schema-2020-12");
|
||||
const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema";
|
||||
class Ajv2020 extends core_1.default {
|
||||
constructor(opts = {}) {
|
||||
super({
|
||||
...opts,
|
||||
dynamicRef: true,
|
||||
next: true,
|
||||
unevaluated: true,
|
||||
});
|
||||
}
|
||||
_addVocabularies() {
|
||||
super._addVocabularies();
|
||||
draft2020_1.default.forEach((v) => this.addVocabulary(v));
|
||||
if (this.opts.discriminator)
|
||||
this.addKeyword(discriminator_1.default);
|
||||
}
|
||||
_addDefaultMetaSchema() {
|
||||
super._addDefaultMetaSchema();
|
||||
const { $data, meta } = this.opts;
|
||||
if (!meta)
|
||||
return;
|
||||
json_schema_2020_12_1.default.call(this, $data);
|
||||
this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
|
||||
}
|
||||
defaultMeta() {
|
||||
return (this.opts.defaultMeta =
|
||||
super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
|
||||
}
|
||||
}
|
||||
module.exports = exports = Ajv2020;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Ajv2020;
|
||||
var validate_1 = require("./compile/validate");
|
||||
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
|
||||
var codegen_1 = require("./compile/codegen");
|
||||
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
|
||||
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
|
||||
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
|
||||
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
||||
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
||||
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
||||
//# sourceMappingURL=2020.js.map
|
1
node_modules/ajv/dist/2020.js.map
generated
vendored
1
node_modules/ajv/dist/2020.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"2020.js","sourceRoot":"","sources":["../lib/2020.ts"],"names":[],"mappings":";;;AACA,iCAAuC;AAEvC,wDAA4D;AAC5D,gEAAwD;AACxD,oEAA0D;AAE1D,MAAM,cAAc,GAAG,8CAA8C,CAAA;AAErE,MAAM,OAAQ,SAAQ,cAAO;IAC3B,YAAY,OAAgB,EAAE;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,IAAI;SAClB,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,mBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QAC3D,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,MAAM,EAAC,KAAK,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QAC/B,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,6BAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA;AAClC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,OAAO,CAAA;AAyBtB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"}
|
16
node_modules/ajv/dist/ajv.d.ts
generated
vendored
16
node_modules/ajv/dist/ajv.d.ts
generated
vendored
@ -1,16 +0,0 @@
|
||||
import type { AnySchemaObject } from "./types";
|
||||
import AjvCore from "./core";
|
||||
declare class Ajv extends AjvCore {
|
||||
_addVocabularies(): void;
|
||||
_addDefaultMetaSchema(): void;
|
||||
defaultMeta(): string | AnySchemaObject | undefined;
|
||||
}
|
||||
export default Ajv;
|
||||
export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, SchemaValidateFunction, ErrorObject, ErrorNoParams, } from "./types";
|
||||
export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core";
|
||||
export { SchemaCxt, SchemaObjCxt } from "./compile";
|
||||
export { KeywordCxt } from "./compile/validate";
|
||||
export { DefinedError } from "./vocabularies/errors";
|
||||
export { JSONType } from "./compile/rules";
|
||||
export { JSONSchemaType } from "./types/json-schema";
|
||||
export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen";
|
44
node_modules/ajv/dist/ajv.js
generated
vendored
44
node_modules/ajv/dist/ajv.js
generated
vendored
@ -1,44 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
||||
const core_1 = require("./core");
|
||||
const draft7_1 = require("./vocabularies/draft7");
|
||||
const discriminator_1 = require("./vocabularies/discriminator");
|
||||
const draft7MetaSchema = require("./refs/json-schema-draft-07.json");
|
||||
const META_SUPPORT_DATA = ["/properties"];
|
||||
const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
|
||||
class Ajv extends core_1.default {
|
||||
_addVocabularies() {
|
||||
super._addVocabularies();
|
||||
draft7_1.default.forEach((v) => this.addVocabulary(v));
|
||||
if (this.opts.discriminator)
|
||||
this.addKeyword(discriminator_1.default);
|
||||
}
|
||||
_addDefaultMetaSchema() {
|
||||
super._addDefaultMetaSchema();
|
||||
if (!this.opts.meta)
|
||||
return;
|
||||
const metaSchema = this.opts.$data
|
||||
? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA)
|
||||
: draft7MetaSchema;
|
||||
this.addMetaSchema(metaSchema, META_SCHEMA_ID, false);
|
||||
this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
|
||||
}
|
||||
defaultMeta() {
|
||||
return (this.opts.defaultMeta =
|
||||
super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
|
||||
}
|
||||
}
|
||||
module.exports = exports = Ajv;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Ajv;
|
||||
var validate_1 = require("./compile/validate");
|
||||
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
|
||||
var codegen_1 = require("./compile/codegen");
|
||||
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
|
||||
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
|
||||
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
|
||||
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
||||
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
||||
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
||||
//# sourceMappingURL=ajv.js.map
|
1
node_modules/ajv/dist/ajv.js.map
generated
vendored
1
node_modules/ajv/dist/ajv.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"ajv.js","sourceRoot":"","sources":["../lib/ajv.ts"],"names":[],"mappings":";;;AACA,iCAA4B;AAC5B,kDAAsD;AACtD,gEAAwD;AACxD,qEAAoE;AAEpE,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,MAAM,cAAc,GAAG,wCAAwC,CAAA;AAE/D,MAAM,GAAI,SAAQ,cAAO;IACvB,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,gBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QACxD,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAM;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK;YAChC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;YAC3D,CAAC,CAAC,gBAAgB,CAAA;QACpB,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,CAAC,CAAA;QACrD,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,GAAG,CAAA;AAC9B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,GAAG,CAAA;AA0BlB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"}
|
40
node_modules/ajv/dist/compile/codegen/code.d.ts
generated
vendored
40
node_modules/ajv/dist/compile/codegen/code.d.ts
generated
vendored
@ -1,40 +0,0 @@
|
||||
export declare abstract class _CodeOrName {
|
||||
abstract readonly str: string;
|
||||
abstract readonly names: UsedNames;
|
||||
abstract toString(): string;
|
||||
abstract emptyStr(): boolean;
|
||||
}
|
||||
export declare const IDENTIFIER: RegExp;
|
||||
export declare class Name extends _CodeOrName {
|
||||
readonly str: string;
|
||||
constructor(s: string);
|
||||
toString(): string;
|
||||
emptyStr(): boolean;
|
||||
get names(): UsedNames;
|
||||
}
|
||||
export declare class _Code extends _CodeOrName {
|
||||
readonly _items: readonly CodeItem[];
|
||||
private _str?;
|
||||
private _names?;
|
||||
constructor(code: string | readonly CodeItem[]);
|
||||
toString(): string;
|
||||
emptyStr(): boolean;
|
||||
get str(): string;
|
||||
get names(): UsedNames;
|
||||
}
|
||||
export declare type CodeItem = Name | string | number | boolean | null;
|
||||
export declare type UsedNames = Record<string, number | undefined>;
|
||||
export declare type Code = _Code | Name;
|
||||
export declare type SafeExpr = Code | number | boolean | null;
|
||||
export declare const nil: _Code;
|
||||
declare type CodeArg = SafeExpr | string | undefined;
|
||||
export declare function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code;
|
||||
export declare function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code;
|
||||
export declare function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void;
|
||||
export declare function strConcat(c1: Code, c2: Code): Code;
|
||||
export declare function stringify(x: unknown): Code;
|
||||
export declare function safeStringify(x: unknown): string;
|
||||
export declare function getProperty(key: Code | string | number): Code;
|
||||
export declare function getEsmExportName(key: Code | string | number): Code;
|
||||
export declare function regexpCode(rx: RegExp): Code;
|
||||
export {};
|
155
node_modules/ajv/dist/compile/codegen/code.js
generated
vendored
155
node_modules/ajv/dist/compile/codegen/code.js
generated
vendored
@ -1,155 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
|
||||
class _CodeOrName {
|
||||
}
|
||||
exports._CodeOrName = _CodeOrName;
|
||||
exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
||||
class Name extends _CodeOrName {
|
||||
constructor(s) {
|
||||
super();
|
||||
if (!exports.IDENTIFIER.test(s))
|
||||
throw new Error("CodeGen: name must be a valid identifier");
|
||||
this.str = s;
|
||||
}
|
||||
toString() {
|
||||
return this.str;
|
||||
}
|
||||
emptyStr() {
|
||||
return false;
|
||||
}
|
||||
get names() {
|
||||
return { [this.str]: 1 };
|
||||
}
|
||||
}
|
||||
exports.Name = Name;
|
||||
class _Code extends _CodeOrName {
|
||||
constructor(code) {
|
||||
super();
|
||||
this._items = typeof code === "string" ? [code] : code;
|
||||
}
|
||||
toString() {
|
||||
return this.str;
|
||||
}
|
||||
emptyStr() {
|
||||
if (this._items.length > 1)
|
||||
return false;
|
||||
const item = this._items[0];
|
||||
return item === "" || item === '""';
|
||||
}
|
||||
get str() {
|
||||
var _a;
|
||||
return ((_a = this._str) !== null && _a !== void 0 ? _a : (this._str = this._items.reduce((s, c) => `${s}${c}`, "")));
|
||||
}
|
||||
get names() {
|
||||
var _a;
|
||||
return ((_a = this._names) !== null && _a !== void 0 ? _a : (this._names = this._items.reduce((names, c) => {
|
||||
if (c instanceof Name)
|
||||
names[c.str] = (names[c.str] || 0) + 1;
|
||||
return names;
|
||||
}, {})));
|
||||
}
|
||||
}
|
||||
exports._Code = _Code;
|
||||
exports.nil = new _Code("");
|
||||
function _(strs, ...args) {
|
||||
const code = [strs[0]];
|
||||
let i = 0;
|
||||
while (i < args.length) {
|
||||
addCodeArg(code, args[i]);
|
||||
code.push(strs[++i]);
|
||||
}
|
||||
return new _Code(code);
|
||||
}
|
||||
exports._ = _;
|
||||
const plus = new _Code("+");
|
||||
function str(strs, ...args) {
|
||||
const expr = [safeStringify(strs[0])];
|
||||
let i = 0;
|
||||
while (i < args.length) {
|
||||
expr.push(plus);
|
||||
addCodeArg(expr, args[i]);
|
||||
expr.push(plus, safeStringify(strs[++i]));
|
||||
}
|
||||
optimize(expr);
|
||||
return new _Code(expr);
|
||||
}
|
||||
exports.str = str;
|
||||
function addCodeArg(code, arg) {
|
||||
if (arg instanceof _Code)
|
||||
code.push(...arg._items);
|
||||
else if (arg instanceof Name)
|
||||
code.push(arg);
|
||||
else
|
||||
code.push(interpolate(arg));
|
||||
}
|
||||
exports.addCodeArg = addCodeArg;
|
||||
function optimize(expr) {
|
||||
let i = 1;
|
||||
while (i < expr.length - 1) {
|
||||
if (expr[i] === plus) {
|
||||
const res = mergeExprItems(expr[i - 1], expr[i + 1]);
|
||||
if (res !== undefined) {
|
||||
expr.splice(i - 1, 3, res);
|
||||
continue;
|
||||
}
|
||||
expr[i++] = "+";
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
function mergeExprItems(a, b) {
|
||||
if (b === '""')
|
||||
return a;
|
||||
if (a === '""')
|
||||
return b;
|
||||
if (typeof a == "string") {
|
||||
if (b instanceof Name || a[a.length - 1] !== '"')
|
||||
return;
|
||||
if (typeof b != "string")
|
||||
return `${a.slice(0, -1)}${b}"`;
|
||||
if (b[0] === '"')
|
||||
return a.slice(0, -1) + b.slice(1);
|
||||
return;
|
||||
}
|
||||
if (typeof b == "string" && b[0] === '"' && !(a instanceof Name))
|
||||
return `"${a}${b.slice(1)}`;
|
||||
return;
|
||||
}
|
||||
function strConcat(c1, c2) {
|
||||
return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`;
|
||||
}
|
||||
exports.strConcat = strConcat;
|
||||
// TODO do not allow arrays here
|
||||
function interpolate(x) {
|
||||
return typeof x == "number" || typeof x == "boolean" || x === null
|
||||
? x
|
||||
: safeStringify(Array.isArray(x) ? x.join(",") : x);
|
||||
}
|
||||
function stringify(x) {
|
||||
return new _Code(safeStringify(x));
|
||||
}
|
||||
exports.stringify = stringify;
|
||||
function safeStringify(x) {
|
||||
return JSON.stringify(x)
|
||||
.replace(/\u2028/g, "\\u2028")
|
||||
.replace(/\u2029/g, "\\u2029");
|
||||
}
|
||||
exports.safeStringify = safeStringify;
|
||||
function getProperty(key) {
|
||||
return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
|
||||
}
|
||||
exports.getProperty = getProperty;
|
||||
//Does best effort to format the name properly
|
||||
function getEsmExportName(key) {
|
||||
if (typeof key == "string" && exports.IDENTIFIER.test(key)) {
|
||||
return new _Code(`${key}`);
|
||||
}
|
||||
throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);
|
||||
}
|
||||
exports.getEsmExportName = getEsmExportName;
|
||||
function regexpCode(rx) {
|
||||
return new _Code(rx.toString());
|
||||
}
|
||||
exports.regexpCode = regexpCode;
|
||||
//# sourceMappingURL=code.js.map
|
1
node_modules/ajv/dist/compile/codegen/code.js.map
generated
vendored
1
node_modules/ajv/dist/compile/codegen/code.js.map
generated
vendored
File diff suppressed because one or more lines are too long
79
node_modules/ajv/dist/compile/codegen/index.d.ts
generated
vendored
79
node_modules/ajv/dist/compile/codegen/index.d.ts
generated
vendored
@ -1,79 +0,0 @@
|
||||
import type { ScopeValueSets, NameValue, ValueScope, ValueScopeName } from "./scope";
|
||||
import { _Code, Code, Name } from "./code";
|
||||
import { Scope } from "./scope";
|
||||
export { _, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code } from "./code";
|
||||
export { Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds } from "./scope";
|
||||
export declare type SafeExpr = Code | number | boolean | null;
|
||||
export declare type Block = Code | (() => void);
|
||||
export declare const operators: {
|
||||
GT: _Code;
|
||||
GTE: _Code;
|
||||
LT: _Code;
|
||||
LTE: _Code;
|
||||
EQ: _Code;
|
||||
NEQ: _Code;
|
||||
NOT: _Code;
|
||||
OR: _Code;
|
||||
AND: _Code;
|
||||
ADD: _Code;
|
||||
};
|
||||
export interface CodeGenOptions {
|
||||
es5?: boolean;
|
||||
lines?: boolean;
|
||||
ownProperties?: boolean;
|
||||
}
|
||||
export declare class CodeGen {
|
||||
readonly _scope: Scope;
|
||||
readonly _extScope: ValueScope;
|
||||
readonly _values: ScopeValueSets;
|
||||
private readonly _nodes;
|
||||
private readonly _blockStarts;
|
||||
private readonly _constants;
|
||||
private readonly opts;
|
||||
constructor(extScope: ValueScope, opts?: CodeGenOptions);
|
||||
toString(): string;
|
||||
name(prefix: string): Name;
|
||||
scopeName(prefix: string): ValueScopeName;
|
||||
scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name;
|
||||
getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined;
|
||||
scopeRefs(scopeName: Name): Code;
|
||||
scopeCode(): Code;
|
||||
private _def;
|
||||
const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name;
|
||||
let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name;
|
||||
var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name;
|
||||
assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen;
|
||||
add(lhs: Code, rhs: SafeExpr): CodeGen;
|
||||
code(c: Block | SafeExpr): CodeGen;
|
||||
object(...keyValues: [Name | string, SafeExpr | string][]): _Code;
|
||||
if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen;
|
||||
elseIf(condition: Code | boolean): CodeGen;
|
||||
else(): CodeGen;
|
||||
endIf(): CodeGen;
|
||||
private _for;
|
||||
for(iteration: Code, forBody?: Block): CodeGen;
|
||||
forRange(nameOrPrefix: Name | string, from: SafeExpr, to: SafeExpr, forBody: (index: Name) => void, varKind?: Code): CodeGen;
|
||||
forOf(nameOrPrefix: Name | string, iterable: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen;
|
||||
forIn(nameOrPrefix: Name | string, obj: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen;
|
||||
endFor(): CodeGen;
|
||||
label(label: Name): CodeGen;
|
||||
break(label?: Code): CodeGen;
|
||||
return(value: Block | SafeExpr): CodeGen;
|
||||
try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen;
|
||||
throw(error: Code): CodeGen;
|
||||
block(body?: Block, nodeCount?: number): CodeGen;
|
||||
endBlock(nodeCount?: number): CodeGen;
|
||||
func(name: Name, args?: Code, async?: boolean, funcBody?: Block): CodeGen;
|
||||
endFunc(): CodeGen;
|
||||
optimize(n?: number): void;
|
||||
private _leafNode;
|
||||
private _blockNode;
|
||||
private _endBlockNode;
|
||||
private _elseNode;
|
||||
private get _root();
|
||||
private get _currNode();
|
||||
private set _currNode(value);
|
||||
}
|
||||
export declare function not<T extends Code | SafeExpr>(x: T): T;
|
||||
export declare function and(...args: Code[]): Code;
|
||||
export declare function or(...args: Code[]): Code;
|
697
node_modules/ajv/dist/compile/codegen/index.js
generated
vendored
697
node_modules/ajv/dist/compile/codegen/index.js
generated
vendored
@ -1,697 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
|
||||
const code_1 = require("./code");
|
||||
const scope_1 = require("./scope");
|
||||
var code_2 = require("./code");
|
||||
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return code_2._; } });
|
||||
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return code_2.str; } });
|
||||
Object.defineProperty(exports, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } });
|
||||
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return code_2.nil; } });
|
||||
Object.defineProperty(exports, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } });
|
||||
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return code_2.stringify; } });
|
||||
Object.defineProperty(exports, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } });
|
||||
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return code_2.Name; } });
|
||||
var scope_2 = require("./scope");
|
||||
Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } });
|
||||
Object.defineProperty(exports, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } });
|
||||
Object.defineProperty(exports, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } });
|
||||
Object.defineProperty(exports, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } });
|
||||
exports.operators = {
|
||||
GT: new code_1._Code(">"),
|
||||
GTE: new code_1._Code(">="),
|
||||
LT: new code_1._Code("<"),
|
||||
LTE: new code_1._Code("<="),
|
||||
EQ: new code_1._Code("==="),
|
||||
NEQ: new code_1._Code("!=="),
|
||||
NOT: new code_1._Code("!"),
|
||||
OR: new code_1._Code("||"),
|
||||
AND: new code_1._Code("&&"),
|
||||
ADD: new code_1._Code("+"),
|
||||
};
|
||||
class Node {
|
||||
optimizeNodes() {
|
||||
return this;
|
||||
}
|
||||
optimizeNames(_names, _constants) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class Def extends Node {
|
||||
constructor(varKind, name, rhs) {
|
||||
super();
|
||||
this.varKind = varKind;
|
||||
this.name = name;
|
||||
this.rhs = rhs;
|
||||
}
|
||||
render({ es5, _n }) {
|
||||
const varKind = es5 ? scope_1.varKinds.var : this.varKind;
|
||||
const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`;
|
||||
return `${varKind} ${this.name}${rhs};` + _n;
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
if (!names[this.name.str])
|
||||
return;
|
||||
if (this.rhs)
|
||||
this.rhs = optimizeExpr(this.rhs, names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {};
|
||||
}
|
||||
}
|
||||
class Assign extends Node {
|
||||
constructor(lhs, rhs, sideEffects) {
|
||||
super();
|
||||
this.lhs = lhs;
|
||||
this.rhs = rhs;
|
||||
this.sideEffects = sideEffects;
|
||||
}
|
||||
render({ _n }) {
|
||||
return `${this.lhs} = ${this.rhs};` + _n;
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
||||
return;
|
||||
this.rhs = optimizeExpr(this.rhs, names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
const names = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names };
|
||||
return addExprNames(names, this.rhs);
|
||||
}
|
||||
}
|
||||
class AssignOp extends Assign {
|
||||
constructor(lhs, op, rhs, sideEffects) {
|
||||
super(lhs, rhs, sideEffects);
|
||||
this.op = op;
|
||||
}
|
||||
render({ _n }) {
|
||||
return `${this.lhs} ${this.op}= ${this.rhs};` + _n;
|
||||
}
|
||||
}
|
||||
class Label extends Node {
|
||||
constructor(label) {
|
||||
super();
|
||||
this.label = label;
|
||||
this.names = {};
|
||||
}
|
||||
render({ _n }) {
|
||||
return `${this.label}:` + _n;
|
||||
}
|
||||
}
|
||||
class Break extends Node {
|
||||
constructor(label) {
|
||||
super();
|
||||
this.label = label;
|
||||
this.names = {};
|
||||
}
|
||||
render({ _n }) {
|
||||
const label = this.label ? ` ${this.label}` : "";
|
||||
return `break${label};` + _n;
|
||||
}
|
||||
}
|
||||
class Throw extends Node {
|
||||
constructor(error) {
|
||||
super();
|
||||
this.error = error;
|
||||
}
|
||||
render({ _n }) {
|
||||
return `throw ${this.error};` + _n;
|
||||
}
|
||||
get names() {
|
||||
return this.error.names;
|
||||
}
|
||||
}
|
||||
class AnyCode extends Node {
|
||||
constructor(code) {
|
||||
super();
|
||||
this.code = code;
|
||||
}
|
||||
render({ _n }) {
|
||||
return `${this.code};` + _n;
|
||||
}
|
||||
optimizeNodes() {
|
||||
return `${this.code}` ? this : undefined;
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
this.code = optimizeExpr(this.code, names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
return this.code instanceof code_1._CodeOrName ? this.code.names : {};
|
||||
}
|
||||
}
|
||||
class ParentNode extends Node {
|
||||
constructor(nodes = []) {
|
||||
super();
|
||||
this.nodes = nodes;
|
||||
}
|
||||
render(opts) {
|
||||
return this.nodes.reduce((code, n) => code + n.render(opts), "");
|
||||
}
|
||||
optimizeNodes() {
|
||||
const { nodes } = this;
|
||||
let i = nodes.length;
|
||||
while (i--) {
|
||||
const n = nodes[i].optimizeNodes();
|
||||
if (Array.isArray(n))
|
||||
nodes.splice(i, 1, ...n);
|
||||
else if (n)
|
||||
nodes[i] = n;
|
||||
else
|
||||
nodes.splice(i, 1);
|
||||
}
|
||||
return nodes.length > 0 ? this : undefined;
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
const { nodes } = this;
|
||||
let i = nodes.length;
|
||||
while (i--) {
|
||||
// iterating backwards improves 1-pass optimization
|
||||
const n = nodes[i];
|
||||
if (n.optimizeNames(names, constants))
|
||||
continue;
|
||||
subtractNames(names, n.names);
|
||||
nodes.splice(i, 1);
|
||||
}
|
||||
return nodes.length > 0 ? this : undefined;
|
||||
}
|
||||
get names() {
|
||||
return this.nodes.reduce((names, n) => addNames(names, n.names), {});
|
||||
}
|
||||
}
|
||||
class BlockNode extends ParentNode {
|
||||
render(opts) {
|
||||
return "{" + opts._n + super.render(opts) + "}" + opts._n;
|
||||
}
|
||||
}
|
||||
class Root extends ParentNode {
|
||||
}
|
||||
class Else extends BlockNode {
|
||||
}
|
||||
Else.kind = "else";
|
||||
class If extends BlockNode {
|
||||
constructor(condition, nodes) {
|
||||
super(nodes);
|
||||
this.condition = condition;
|
||||
}
|
||||
render(opts) {
|
||||
let code = `if(${this.condition})` + super.render(opts);
|
||||
if (this.else)
|
||||
code += "else " + this.else.render(opts);
|
||||
return code;
|
||||
}
|
||||
optimizeNodes() {
|
||||
super.optimizeNodes();
|
||||
const cond = this.condition;
|
||||
if (cond === true)
|
||||
return this.nodes; // else is ignored here
|
||||
let e = this.else;
|
||||
if (e) {
|
||||
const ns = e.optimizeNodes();
|
||||
e = this.else = Array.isArray(ns) ? new Else(ns) : ns;
|
||||
}
|
||||
if (e) {
|
||||
if (cond === false)
|
||||
return e instanceof If ? e : e.nodes;
|
||||
if (this.nodes.length)
|
||||
return this;
|
||||
return new If(not(cond), e instanceof If ? [e] : e.nodes);
|
||||
}
|
||||
if (cond === false || !this.nodes.length)
|
||||
return undefined;
|
||||
return this;
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
var _a;
|
||||
this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
|
||||
if (!(super.optimizeNames(names, constants) || this.else))
|
||||
return;
|
||||
this.condition = optimizeExpr(this.condition, names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
const names = super.names;
|
||||
addExprNames(names, this.condition);
|
||||
if (this.else)
|
||||
addNames(names, this.else.names);
|
||||
return names;
|
||||
}
|
||||
}
|
||||
If.kind = "if";
|
||||
class For extends BlockNode {
|
||||
}
|
||||
For.kind = "for";
|
||||
class ForLoop extends For {
|
||||
constructor(iteration) {
|
||||
super();
|
||||
this.iteration = iteration;
|
||||
}
|
||||
render(opts) {
|
||||
return `for(${this.iteration})` + super.render(opts);
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
if (!super.optimizeNames(names, constants))
|
||||
return;
|
||||
this.iteration = optimizeExpr(this.iteration, names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
return addNames(super.names, this.iteration.names);
|
||||
}
|
||||
}
|
||||
class ForRange extends For {
|
||||
constructor(varKind, name, from, to) {
|
||||
super();
|
||||
this.varKind = varKind;
|
||||
this.name = name;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
render(opts) {
|
||||
const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind;
|
||||
const { name, from, to } = this;
|
||||
return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts);
|
||||
}
|
||||
get names() {
|
||||
const names = addExprNames(super.names, this.from);
|
||||
return addExprNames(names, this.to);
|
||||
}
|
||||
}
|
||||
class ForIter extends For {
|
||||
constructor(loop, varKind, name, iterable) {
|
||||
super();
|
||||
this.loop = loop;
|
||||
this.varKind = varKind;
|
||||
this.name = name;
|
||||
this.iterable = iterable;
|
||||
}
|
||||
render(opts) {
|
||||
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
if (!super.optimizeNames(names, constants))
|
||||
return;
|
||||
this.iterable = optimizeExpr(this.iterable, names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
return addNames(super.names, this.iterable.names);
|
||||
}
|
||||
}
|
||||
class Func extends BlockNode {
|
||||
constructor(name, args, async) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.args = args;
|
||||
this.async = async;
|
||||
}
|
||||
render(opts) {
|
||||
const _async = this.async ? "async " : "";
|
||||
return `${_async}function ${this.name}(${this.args})` + super.render(opts);
|
||||
}
|
||||
}
|
||||
Func.kind = "func";
|
||||
class Return extends ParentNode {
|
||||
render(opts) {
|
||||
return "return " + super.render(opts);
|
||||
}
|
||||
}
|
||||
Return.kind = "return";
|
||||
class Try extends BlockNode {
|
||||
render(opts) {
|
||||
let code = "try" + super.render(opts);
|
||||
if (this.catch)
|
||||
code += this.catch.render(opts);
|
||||
if (this.finally)
|
||||
code += this.finally.render(opts);
|
||||
return code;
|
||||
}
|
||||
optimizeNodes() {
|
||||
var _a, _b;
|
||||
super.optimizeNodes();
|
||||
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes();
|
||||
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
||||
return this;
|
||||
}
|
||||
optimizeNames(names, constants) {
|
||||
var _a, _b;
|
||||
super.optimizeNames(names, constants);
|
||||
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
|
||||
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);
|
||||
return this;
|
||||
}
|
||||
get names() {
|
||||
const names = super.names;
|
||||
if (this.catch)
|
||||
addNames(names, this.catch.names);
|
||||
if (this.finally)
|
||||
addNames(names, this.finally.names);
|
||||
return names;
|
||||
}
|
||||
}
|
||||
class Catch extends BlockNode {
|
||||
constructor(error) {
|
||||
super();
|
||||
this.error = error;
|
||||
}
|
||||
render(opts) {
|
||||
return `catch(${this.error})` + super.render(opts);
|
||||
}
|
||||
}
|
||||
Catch.kind = "catch";
|
||||
class Finally extends BlockNode {
|
||||
render(opts) {
|
||||
return "finally" + super.render(opts);
|
||||
}
|
||||
}
|
||||
Finally.kind = "finally";
|
||||
class CodeGen {
|
||||
constructor(extScope, opts = {}) {
|
||||
this._values = {};
|
||||
this._blockStarts = [];
|
||||
this._constants = {};
|
||||
this.opts = { ...opts, _n: opts.lines ? "\n" : "" };
|
||||
this._extScope = extScope;
|
||||
this._scope = new scope_1.Scope({ parent: extScope });
|
||||
this._nodes = [new Root()];
|
||||
}
|
||||
toString() {
|
||||
return this._root.render(this.opts);
|
||||
}
|
||||
// returns unique name in the internal scope
|
||||
name(prefix) {
|
||||
return this._scope.name(prefix);
|
||||
}
|
||||
// reserves unique name in the external scope
|
||||
scopeName(prefix) {
|
||||
return this._extScope.name(prefix);
|
||||
}
|
||||
// reserves unique name in the external scope and assigns value to it
|
||||
scopeValue(prefixOrName, value) {
|
||||
const name = this._extScope.value(prefixOrName, value);
|
||||
const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set());
|
||||
vs.add(name);
|
||||
return name;
|
||||
}
|
||||
getScopeValue(prefix, keyOrRef) {
|
||||
return this._extScope.getValue(prefix, keyOrRef);
|
||||
}
|
||||
// return code that assigns values in the external scope to the names that are used internally
|
||||
// (same names that were returned by gen.scopeName or gen.scopeValue)
|
||||
scopeRefs(scopeName) {
|
||||
return this._extScope.scopeRefs(scopeName, this._values);
|
||||
}
|
||||
scopeCode() {
|
||||
return this._extScope.scopeCode(this._values);
|
||||
}
|
||||
_def(varKind, nameOrPrefix, rhs, constant) {
|
||||
const name = this._scope.toName(nameOrPrefix);
|
||||
if (rhs !== undefined && constant)
|
||||
this._constants[name.str] = rhs;
|
||||
this._leafNode(new Def(varKind, name, rhs));
|
||||
return name;
|
||||
}
|
||||
// `const` declaration (`var` in es5 mode)
|
||||
const(nameOrPrefix, rhs, _constant) {
|
||||
return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant);
|
||||
}
|
||||
// `let` declaration with optional assignment (`var` in es5 mode)
|
||||
let(nameOrPrefix, rhs, _constant) {
|
||||
return this._def(scope_1.varKinds.let, nameOrPrefix, rhs, _constant);
|
||||
}
|
||||
// `var` declaration with optional assignment
|
||||
var(nameOrPrefix, rhs, _constant) {
|
||||
return this._def(scope_1.varKinds.var, nameOrPrefix, rhs, _constant);
|
||||
}
|
||||
// assignment code
|
||||
assign(lhs, rhs, sideEffects) {
|
||||
return this._leafNode(new Assign(lhs, rhs, sideEffects));
|
||||
}
|
||||
// `+=` code
|
||||
add(lhs, rhs) {
|
||||
return this._leafNode(new AssignOp(lhs, exports.operators.ADD, rhs));
|
||||
}
|
||||
// appends passed SafeExpr to code or executes Block
|
||||
code(c) {
|
||||
if (typeof c == "function")
|
||||
c();
|
||||
else if (c !== code_1.nil)
|
||||
this._leafNode(new AnyCode(c));
|
||||
return this;
|
||||
}
|
||||
// returns code for object literal for the passed argument list of key-value pairs
|
||||
object(...keyValues) {
|
||||
const code = ["{"];
|
||||
for (const [key, value] of keyValues) {
|
||||
if (code.length > 1)
|
||||
code.push(",");
|
||||
code.push(key);
|
||||
if (key !== value || this.opts.es5) {
|
||||
code.push(":");
|
||||
(0, code_1.addCodeArg)(code, value);
|
||||
}
|
||||
}
|
||||
code.push("}");
|
||||
return new code_1._Code(code);
|
||||
}
|
||||
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
||||
if(condition, thenBody, elseBody) {
|
||||
this._blockNode(new If(condition));
|
||||
if (thenBody && elseBody) {
|
||||
this.code(thenBody).else().code(elseBody).endIf();
|
||||
}
|
||||
else if (thenBody) {
|
||||
this.code(thenBody).endIf();
|
||||
}
|
||||
else if (elseBody) {
|
||||
throw new Error('CodeGen: "else" body without "then" body');
|
||||
}
|
||||
return this;
|
||||
}
|
||||
// `else if` clause - invalid without `if` or after `else` clauses
|
||||
elseIf(condition) {
|
||||
return this._elseNode(new If(condition));
|
||||
}
|
||||
// `else` clause - only valid after `if` or `else if` clauses
|
||||
else() {
|
||||
return this._elseNode(new Else());
|
||||
}
|
||||
// end `if` statement (needed if gen.if was used only with condition)
|
||||
endIf() {
|
||||
return this._endBlockNode(If, Else);
|
||||
}
|
||||
_for(node, forBody) {
|
||||
this._blockNode(node);
|
||||
if (forBody)
|
||||
this.code(forBody).endFor();
|
||||
return this;
|
||||
}
|
||||
// a generic `for` clause (or statement if `forBody` is passed)
|
||||
for(iteration, forBody) {
|
||||
return this._for(new ForLoop(iteration), forBody);
|
||||
}
|
||||
// `for` statement for a range of values
|
||||
forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {
|
||||
const name = this._scope.toName(nameOrPrefix);
|
||||
return this._for(new ForRange(varKind, name, from, to), () => forBody(name));
|
||||
}
|
||||
// `for-of` statement (in es5 mode replace with a normal for loop)
|
||||
forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) {
|
||||
const name = this._scope.toName(nameOrPrefix);
|
||||
if (this.opts.es5) {
|
||||
const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable);
|
||||
return this.forRange("_i", 0, (0, code_1._) `${arr}.length`, (i) => {
|
||||
this.var(name, (0, code_1._) `${arr}[${i}]`);
|
||||
forBody(name);
|
||||
});
|
||||
}
|
||||
return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name));
|
||||
}
|
||||
// `for-in` statement.
|
||||
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
||||
forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) {
|
||||
if (this.opts.ownProperties) {
|
||||
return this.forOf(nameOrPrefix, (0, code_1._) `Object.keys(${obj})`, forBody);
|
||||
}
|
||||
const name = this._scope.toName(nameOrPrefix);
|
||||
return this._for(new ForIter("in", varKind, name, obj), () => forBody(name));
|
||||
}
|
||||
// end `for` loop
|
||||
endFor() {
|
||||
return this._endBlockNode(For);
|
||||
}
|
||||
// `label` statement
|
||||
label(label) {
|
||||
return this._leafNode(new Label(label));
|
||||
}
|
||||
// `break` statement
|
||||
break(label) {
|
||||
return this._leafNode(new Break(label));
|
||||
}
|
||||
// `return` statement
|
||||
return(value) {
|
||||
const node = new Return();
|
||||
this._blockNode(node);
|
||||
this.code(value);
|
||||
if (node.nodes.length !== 1)
|
||||
throw new Error('CodeGen: "return" should have one node');
|
||||
return this._endBlockNode(Return);
|
||||
}
|
||||
// `try` statement
|
||||
try(tryBody, catchCode, finallyCode) {
|
||||
if (!catchCode && !finallyCode)
|
||||
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
||||
const node = new Try();
|
||||
this._blockNode(node);
|
||||
this.code(tryBody);
|
||||
if (catchCode) {
|
||||
const error = this.name("e");
|
||||
this._currNode = node.catch = new Catch(error);
|
||||
catchCode(error);
|
||||
}
|
||||
if (finallyCode) {
|
||||
this._currNode = node.finally = new Finally();
|
||||
this.code(finallyCode);
|
||||
}
|
||||
return this._endBlockNode(Catch, Finally);
|
||||
}
|
||||
// `throw` statement
|
||||
throw(error) {
|
||||
return this._leafNode(new Throw(error));
|
||||
}
|
||||
// start self-balancing block
|
||||
block(body, nodeCount) {
|
||||
this._blockStarts.push(this._nodes.length);
|
||||
if (body)
|
||||
this.code(body).endBlock(nodeCount);
|
||||
return this;
|
||||
}
|
||||
// end the current self-balancing block
|
||||
endBlock(nodeCount) {
|
||||
const len = this._blockStarts.pop();
|
||||
if (len === undefined)
|
||||
throw new Error("CodeGen: not in self-balancing block");
|
||||
const toClose = this._nodes.length - len;
|
||||
if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) {
|
||||
throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`);
|
||||
}
|
||||
this._nodes.length = len;
|
||||
return this;
|
||||
}
|
||||
// `function` heading (or definition if funcBody is passed)
|
||||
func(name, args = code_1.nil, async, funcBody) {
|
||||
this._blockNode(new Func(name, args, async));
|
||||
if (funcBody)
|
||||
this.code(funcBody).endFunc();
|
||||
return this;
|
||||
}
|
||||
// end function definition
|
||||
endFunc() {
|
||||
return this._endBlockNode(Func);
|
||||
}
|
||||
optimize(n = 1) {
|
||||
while (n-- > 0) {
|
||||
this._root.optimizeNodes();
|
||||
this._root.optimizeNames(this._root.names, this._constants);
|
||||
}
|
||||
}
|
||||
_leafNode(node) {
|
||||
this._currNode.nodes.push(node);
|
||||
return this;
|
||||
}
|
||||
_blockNode(node) {
|
||||
this._currNode.nodes.push(node);
|
||||
this._nodes.push(node);
|
||||
}
|
||||
_endBlockNode(N1, N2) {
|
||||
const n = this._currNode;
|
||||
if (n instanceof N1 || (N2 && n instanceof N2)) {
|
||||
this._nodes.pop();
|
||||
return this;
|
||||
}
|
||||
throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`);
|
||||
}
|
||||
_elseNode(node) {
|
||||
const n = this._currNode;
|
||||
if (!(n instanceof If)) {
|
||||
throw new Error('CodeGen: "else" without "if"');
|
||||
}
|
||||
this._currNode = n.else = node;
|
||||
return this;
|
||||
}
|
||||
get _root() {
|
||||
return this._nodes[0];
|
||||
}
|
||||
get _currNode() {
|
||||
const ns = this._nodes;
|
||||
return ns[ns.length - 1];
|
||||
}
|
||||
set _currNode(node) {
|
||||
const ns = this._nodes;
|
||||
ns[ns.length - 1] = node;
|
||||
}
|
||||
}
|
||||
exports.CodeGen = CodeGen;
|
||||
function addNames(names, from) {
|
||||
for (const n in from)
|
||||
names[n] = (names[n] || 0) + (from[n] || 0);
|
||||
return names;
|
||||
}
|
||||
function addExprNames(names, from) {
|
||||
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
||||
}
|
||||
function optimizeExpr(expr, names, constants) {
|
||||
if (expr instanceof code_1.Name)
|
||||
return replaceName(expr);
|
||||
if (!canOptimize(expr))
|
||||
return expr;
|
||||
return new code_1._Code(expr._items.reduce((items, c) => {
|
||||
if (c instanceof code_1.Name)
|
||||
c = replaceName(c);
|
||||
if (c instanceof code_1._Code)
|
||||
items.push(...c._items);
|
||||
else
|
||||
items.push(c);
|
||||
return items;
|
||||
}, []));
|
||||
function replaceName(n) {
|
||||
const c = constants[n.str];
|
||||
if (c === undefined || names[n.str] !== 1)
|
||||
return n;
|
||||
delete names[n.str];
|
||||
return c;
|
||||
}
|
||||
function canOptimize(e) {
|
||||
return (e instanceof code_1._Code &&
|
||||
e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== undefined));
|
||||
}
|
||||
}
|
||||
function subtractNames(names, from) {
|
||||
for (const n in from)
|
||||
names[n] = (names[n] || 0) - (from[n] || 0);
|
||||
}
|
||||
function not(x) {
|
||||
return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._) `!${par(x)}`;
|
||||
}
|
||||
exports.not = not;
|
||||
const andCode = mappend(exports.operators.AND);
|
||||
// boolean AND (&&) expression with the passed arguments
|
||||
function and(...args) {
|
||||
return args.reduce(andCode);
|
||||
}
|
||||
exports.and = and;
|
||||
const orCode = mappend(exports.operators.OR);
|
||||
// boolean OR (||) expression with the passed arguments
|
||||
function or(...args) {
|
||||
return args.reduce(orCode);
|
||||
}
|
||||
exports.or = or;
|
||||
function mappend(op) {
|
||||
return (x, y) => (x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._) `${par(x)} ${op} ${par(y)}`);
|
||||
}
|
||||
function par(x) {
|
||||
return x instanceof code_1.Name ? x : (0, code_1._) `(${x})`;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/ajv/dist/compile/codegen/index.js.map
generated
vendored
1
node_modules/ajv/dist/compile/codegen/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
79
node_modules/ajv/dist/compile/codegen/scope.d.ts
generated
vendored
79
node_modules/ajv/dist/compile/codegen/scope.d.ts
generated
vendored
@ -1,79 +0,0 @@
|
||||
import { Code, Name } from "./code";
|
||||
interface NameGroup {
|
||||
prefix: string;
|
||||
index: number;
|
||||
}
|
||||
export interface NameValue {
|
||||
ref: ValueReference;
|
||||
key?: unknown;
|
||||
code?: Code;
|
||||
}
|
||||
export declare type ValueReference = unknown;
|
||||
interface ScopeOptions {
|
||||
prefixes?: Set<string>;
|
||||
parent?: Scope;
|
||||
}
|
||||
interface ValueScopeOptions extends ScopeOptions {
|
||||
scope: ScopeStore;
|
||||
es5?: boolean;
|
||||
lines?: boolean;
|
||||
}
|
||||
export declare type ScopeStore = Record<string, ValueReference[] | undefined>;
|
||||
declare type ScopeValues = {
|
||||
[Prefix in string]?: Map<unknown, ValueScopeName>;
|
||||
};
|
||||
export declare type ScopeValueSets = {
|
||||
[Prefix in string]?: Set<ValueScopeName>;
|
||||
};
|
||||
export declare enum UsedValueState {
|
||||
Started = 0,
|
||||
Completed = 1
|
||||
}
|
||||
export declare type UsedScopeValues = {
|
||||
[Prefix in string]?: Map<ValueScopeName, UsedValueState | undefined>;
|
||||
};
|
||||
export declare const varKinds: {
|
||||
const: Name;
|
||||
let: Name;
|
||||
var: Name;
|
||||
};
|
||||
export declare class Scope {
|
||||
protected readonly _names: {
|
||||
[Prefix in string]?: NameGroup;
|
||||
};
|
||||
protected readonly _prefixes?: Set<string>;
|
||||
protected readonly _parent?: Scope;
|
||||
constructor({ prefixes, parent }?: ScopeOptions);
|
||||
toName(nameOrPrefix: Name | string): Name;
|
||||
name(prefix: string): Name;
|
||||
protected _newName(prefix: string): string;
|
||||
private _nameGroup;
|
||||
}
|
||||
interface ScopePath {
|
||||
property: string;
|
||||
itemIndex: number;
|
||||
}
|
||||
export declare class ValueScopeName extends Name {
|
||||
readonly prefix: string;
|
||||
value?: NameValue;
|
||||
scopePath?: Code;
|
||||
constructor(prefix: string, nameStr: string);
|
||||
setValue(value: NameValue, { property, itemIndex }: ScopePath): void;
|
||||
}
|
||||
interface VSOptions extends ValueScopeOptions {
|
||||
_n: Code;
|
||||
}
|
||||
export declare class ValueScope extends Scope {
|
||||
protected readonly _values: ScopeValues;
|
||||
protected readonly _scope: ScopeStore;
|
||||
readonly opts: VSOptions;
|
||||
constructor(opts: ValueScopeOptions);
|
||||
get(): ScopeStore;
|
||||
name(prefix: string): ValueScopeName;
|
||||
value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName;
|
||||
getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined;
|
||||
scopeRefs(scopeName: Name, values?: ScopeValues | ScopeValueSets): Code;
|
||||
scopeCode(values?: ScopeValues | ScopeValueSets, usedValues?: UsedScopeValues, getCode?: (n: ValueScopeName) => Code | undefined): Code;
|
||||
private _reduceValues;
|
||||
}
|
||||
export {};
|
143
node_modules/ajv/dist/compile/codegen/scope.js
generated
vendored
143
node_modules/ajv/dist/compile/codegen/scope.js
generated
vendored
@ -1,143 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
|
||||
const code_1 = require("./code");
|
||||
class ValueError extends Error {
|
||||
constructor(name) {
|
||||
super(`CodeGen: "code" for ${name} not defined`);
|
||||
this.value = name.value;
|
||||
}
|
||||
}
|
||||
var UsedValueState;
|
||||
(function (UsedValueState) {
|
||||
UsedValueState[UsedValueState["Started"] = 0] = "Started";
|
||||
UsedValueState[UsedValueState["Completed"] = 1] = "Completed";
|
||||
})(UsedValueState = exports.UsedValueState || (exports.UsedValueState = {}));
|
||||
exports.varKinds = {
|
||||
const: new code_1.Name("const"),
|
||||
let: new code_1.Name("let"),
|
||||
var: new code_1.Name("var"),
|
||||
};
|
||||
class Scope {
|
||||
constructor({ prefixes, parent } = {}) {
|
||||
this._names = {};
|
||||
this._prefixes = prefixes;
|
||||
this._parent = parent;
|
||||
}
|
||||
toName(nameOrPrefix) {
|
||||
return nameOrPrefix instanceof code_1.Name ? nameOrPrefix : this.name(nameOrPrefix);
|
||||
}
|
||||
name(prefix) {
|
||||
return new code_1.Name(this._newName(prefix));
|
||||
}
|
||||
_newName(prefix) {
|
||||
const ng = this._names[prefix] || this._nameGroup(prefix);
|
||||
return `${prefix}${ng.index++}`;
|
||||
}
|
||||
_nameGroup(prefix) {
|
||||
var _a, _b;
|
||||
if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || (this._prefixes && !this._prefixes.has(prefix))) {
|
||||
throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
|
||||
}
|
||||
return (this._names[prefix] = { prefix, index: 0 });
|
||||
}
|
||||
}
|
||||
exports.Scope = Scope;
|
||||
class ValueScopeName extends code_1.Name {
|
||||
constructor(prefix, nameStr) {
|
||||
super(nameStr);
|
||||
this.prefix = prefix;
|
||||
}
|
||||
setValue(value, { property, itemIndex }) {
|
||||
this.value = value;
|
||||
this.scopePath = (0, code_1._) `.${new code_1.Name(property)}[${itemIndex}]`;
|
||||
}
|
||||
}
|
||||
exports.ValueScopeName = ValueScopeName;
|
||||
const line = (0, code_1._) `\n`;
|
||||
class ValueScope extends Scope {
|
||||
constructor(opts) {
|
||||
super(opts);
|
||||
this._values = {};
|
||||
this._scope = opts.scope;
|
||||
this.opts = { ...opts, _n: opts.lines ? line : code_1.nil };
|
||||
}
|
||||
get() {
|
||||
return this._scope;
|
||||
}
|
||||
name(prefix) {
|
||||
return new ValueScopeName(prefix, this._newName(prefix));
|
||||
}
|
||||
value(nameOrPrefix, value) {
|
||||
var _a;
|
||||
if (value.ref === undefined)
|
||||
throw new Error("CodeGen: ref must be passed in value");
|
||||
const name = this.toName(nameOrPrefix);
|
||||
const { prefix } = name;
|
||||
const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref;
|
||||
let vs = this._values[prefix];
|
||||
if (vs) {
|
||||
const _name = vs.get(valueKey);
|
||||
if (_name)
|
||||
return _name;
|
||||
}
|
||||
else {
|
||||
vs = this._values[prefix] = new Map();
|
||||
}
|
||||
vs.set(valueKey, name);
|
||||
const s = this._scope[prefix] || (this._scope[prefix] = []);
|
||||
const itemIndex = s.length;
|
||||
s[itemIndex] = value.ref;
|
||||
name.setValue(value, { property: prefix, itemIndex });
|
||||
return name;
|
||||
}
|
||||
getValue(prefix, keyOrRef) {
|
||||
const vs = this._values[prefix];
|
||||
if (!vs)
|
||||
return;
|
||||
return vs.get(keyOrRef);
|
||||
}
|
||||
scopeRefs(scopeName, values = this._values) {
|
||||
return this._reduceValues(values, (name) => {
|
||||
if (name.scopePath === undefined)
|
||||
throw new Error(`CodeGen: name "${name}" has no value`);
|
||||
return (0, code_1._) `${scopeName}${name.scopePath}`;
|
||||
});
|
||||
}
|
||||
scopeCode(values = this._values, usedValues, getCode) {
|
||||
return this._reduceValues(values, (name) => {
|
||||
if (name.value === undefined)
|
||||
throw new Error(`CodeGen: name "${name}" has no value`);
|
||||
return name.value.code;
|
||||
}, usedValues, getCode);
|
||||
}
|
||||
_reduceValues(values, valueCode, usedValues = {}, getCode) {
|
||||
let code = code_1.nil;
|
||||
for (const prefix in values) {
|
||||
const vs = values[prefix];
|
||||
if (!vs)
|
||||
continue;
|
||||
const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map());
|
||||
vs.forEach((name) => {
|
||||
if (nameSet.has(name))
|
||||
return;
|
||||
nameSet.set(name, UsedValueState.Started);
|
||||
let c = valueCode(name);
|
||||
if (c) {
|
||||
const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const;
|
||||
code = (0, code_1._) `${code}${def} ${name} = ${c};${this.opts._n}`;
|
||||
}
|
||||
else if ((c = getCode === null || getCode === void 0 ? void 0 : getCode(name))) {
|
||||
code = (0, code_1._) `${code}${c}${this.opts._n}`;
|
||||
}
|
||||
else {
|
||||
throw new ValueError(name);
|
||||
}
|
||||
nameSet.set(name, UsedValueState.Completed);
|
||||
});
|
||||
}
|
||||
return code;
|
||||
}
|
||||
}
|
||||
exports.ValueScope = ValueScope;
|
||||
//# sourceMappingURL=scope.js.map
|
1
node_modules/ajv/dist/compile/codegen/scope.js.map
generated
vendored
1
node_modules/ajv/dist/compile/codegen/scope.js.map
generated
vendored
File diff suppressed because one or more lines are too long
13
node_modules/ajv/dist/compile/errors.d.ts
generated
vendored
13
node_modules/ajv/dist/compile/errors.d.ts
generated
vendored
@ -1,13 +0,0 @@
|
||||
import type { KeywordErrorCxt, KeywordErrorDefinition } from "../types";
|
||||
import { CodeGen, Code, Name } from "./codegen";
|
||||
export declare const keywordError: KeywordErrorDefinition;
|
||||
export declare const keyword$DataError: KeywordErrorDefinition;
|
||||
export interface ErrorPaths {
|
||||
instancePath?: Code;
|
||||
schemaPath?: string;
|
||||
parentSchema?: boolean;
|
||||
}
|
||||
export declare function reportError(cxt: KeywordErrorCxt, error?: KeywordErrorDefinition, errorPaths?: ErrorPaths, overrideAllErrors?: boolean): void;
|
||||
export declare function reportExtraError(cxt: KeywordErrorCxt, error?: KeywordErrorDefinition, errorPaths?: ErrorPaths): void;
|
||||
export declare function resetErrorsCount(gen: CodeGen, errsCount: Name): void;
|
||||
export declare function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }: KeywordErrorCxt): void;
|
123
node_modules/ajv/dist/compile/errors.js
generated
vendored
123
node_modules/ajv/dist/compile/errors.js
generated
vendored
@ -1,123 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
|
||||
const codegen_1 = require("./codegen");
|
||||
const util_1 = require("./util");
|
||||
const names_1 = require("./names");
|
||||
exports.keywordError = {
|
||||
message: ({ keyword }) => (0, codegen_1.str) `must pass "${keyword}" keyword validation`,
|
||||
};
|
||||
exports.keyword$DataError = {
|
||||
message: ({ keyword, schemaType }) => schemaType
|
||||
? (0, codegen_1.str) `"${keyword}" keyword must be ${schemaType} ($data)`
|
||||
: (0, codegen_1.str) `"${keyword}" keyword is invalid ($data)`,
|
||||
};
|
||||
function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) {
|
||||
const { it } = cxt;
|
||||
const { gen, compositeRule, allErrors } = it;
|
||||
const errObj = errorObjectCode(cxt, error, errorPaths);
|
||||
if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : (compositeRule || allErrors)) {
|
||||
addError(gen, errObj);
|
||||
}
|
||||
else {
|
||||
returnErrors(it, (0, codegen_1._) `[${errObj}]`);
|
||||
}
|
||||
}
|
||||
exports.reportError = reportError;
|
||||
function reportExtraError(cxt, error = exports.keywordError, errorPaths) {
|
||||
const { it } = cxt;
|
||||
const { gen, compositeRule, allErrors } = it;
|
||||
const errObj = errorObjectCode(cxt, error, errorPaths);
|
||||
addError(gen, errObj);
|
||||
if (!(compositeRule || allErrors)) {
|
||||
returnErrors(it, names_1.default.vErrors);
|
||||
}
|
||||
}
|
||||
exports.reportExtraError = reportExtraError;
|
||||
function resetErrorsCount(gen, errsCount) {
|
||||
gen.assign(names_1.default.errors, errsCount);
|
||||
gen.if((0, codegen_1._) `${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._) `${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null)));
|
||||
}
|
||||
exports.resetErrorsCount = resetErrorsCount;
|
||||
function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }) {
|
||||
/* istanbul ignore if */
|
||||
if (errsCount === undefined)
|
||||
throw new Error("ajv implementation error");
|
||||
const err = gen.name("err");
|
||||
gen.forRange("i", errsCount, names_1.default.errors, (i) => {
|
||||
gen.const(err, (0, codegen_1._) `${names_1.default.vErrors}[${i}]`);
|
||||
gen.if((0, codegen_1._) `${err}.instancePath === undefined`, () => gen.assign((0, codegen_1._) `${err}.instancePath`, (0, codegen_1.strConcat)(names_1.default.instancePath, it.errorPath)));
|
||||
gen.assign((0, codegen_1._) `${err}.schemaPath`, (0, codegen_1.str) `${it.errSchemaPath}/${keyword}`);
|
||||
if (it.opts.verbose) {
|
||||
gen.assign((0, codegen_1._) `${err}.schema`, schemaValue);
|
||||
gen.assign((0, codegen_1._) `${err}.data`, data);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.extendErrors = extendErrors;
|
||||
function addError(gen, errObj) {
|
||||
const err = gen.const("err", errObj);
|
||||
gen.if((0, codegen_1._) `${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._) `[${err}]`), (0, codegen_1._) `${names_1.default.vErrors}.push(${err})`);
|
||||
gen.code((0, codegen_1._) `${names_1.default.errors}++`);
|
||||
}
|
||||
function returnErrors(it, errs) {
|
||||
const { gen, validateName, schemaEnv } = it;
|
||||
if (schemaEnv.$async) {
|
||||
gen.throw((0, codegen_1._) `new ${it.ValidationError}(${errs})`);
|
||||
}
|
||||
else {
|
||||
gen.assign((0, codegen_1._) `${validateName}.errors`, errs);
|
||||
gen.return(false);
|
||||
}
|
||||
}
|
||||
const E = {
|
||||
keyword: new codegen_1.Name("keyword"),
|
||||
schemaPath: new codegen_1.Name("schemaPath"),
|
||||
params: new codegen_1.Name("params"),
|
||||
propertyName: new codegen_1.Name("propertyName"),
|
||||
message: new codegen_1.Name("message"),
|
||||
schema: new codegen_1.Name("schema"),
|
||||
parentSchema: new codegen_1.Name("parentSchema"),
|
||||
};
|
||||
function errorObjectCode(cxt, error, errorPaths) {
|
||||
const { createErrors } = cxt.it;
|
||||
if (createErrors === false)
|
||||
return (0, codegen_1._) `{}`;
|
||||
return errorObject(cxt, error, errorPaths);
|
||||
}
|
||||
function errorObject(cxt, error, errorPaths = {}) {
|
||||
const { gen, it } = cxt;
|
||||
const keyValues = [
|
||||
errorInstancePath(it, errorPaths),
|
||||
errorSchemaPath(cxt, errorPaths),
|
||||
];
|
||||
extraErrorProps(cxt, error, keyValues);
|
||||
return gen.object(...keyValues);
|
||||
}
|
||||
function errorInstancePath({ errorPath }, { instancePath }) {
|
||||
const instPath = instancePath
|
||||
? (0, codegen_1.str) `${errorPath}${(0, util_1.getErrorPath)(instancePath, util_1.Type.Str)}`
|
||||
: errorPath;
|
||||
return [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, instPath)];
|
||||
}
|
||||
function errorSchemaPath({ keyword, it: { errSchemaPath } }, { schemaPath, parentSchema }) {
|
||||
let schPath = parentSchema ? errSchemaPath : (0, codegen_1.str) `${errSchemaPath}/${keyword}`;
|
||||
if (schemaPath) {
|
||||
schPath = (0, codegen_1.str) `${schPath}${(0, util_1.getErrorPath)(schemaPath, util_1.Type.Str)}`;
|
||||
}
|
||||
return [E.schemaPath, schPath];
|
||||
}
|
||||
function extraErrorProps(cxt, { params, message }, keyValues) {
|
||||
const { keyword, data, schemaValue, it } = cxt;
|
||||
const { opts, propertyName, topSchemaRef, schemaPath } = it;
|
||||
keyValues.push([E.keyword, keyword], [E.params, typeof params == "function" ? params(cxt) : params || (0, codegen_1._) `{}`]);
|
||||
if (opts.messages) {
|
||||
keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]);
|
||||
}
|
||||
if (opts.verbose) {
|
||||
keyValues.push([E.schema, schemaValue], [E.parentSchema, (0, codegen_1._) `${topSchemaRef}${schemaPath}`], [names_1.default.data, data]);
|
||||
}
|
||||
if (propertyName)
|
||||
keyValues.push([E.propertyName, propertyName]);
|
||||
}
|
||||
//# sourceMappingURL=errors.js.map
|
1
node_modules/ajv/dist/compile/errors.js.map
generated
vendored
1
node_modules/ajv/dist/compile/errors.js.map
generated
vendored
File diff suppressed because one or more lines are too long
80
node_modules/ajv/dist/compile/index.d.ts
generated
vendored
80
node_modules/ajv/dist/compile/index.d.ts
generated
vendored
@ -1,80 +0,0 @@
|
||||
import type { AnySchema, AnySchemaObject, AnyValidateFunction, EvaluatedProperties, EvaluatedItems } from "../types";
|
||||
import type Ajv from "../core";
|
||||
import type { InstanceOptions } from "../core";
|
||||
import { CodeGen, Name, Code, ValueScopeName } from "./codegen";
|
||||
import { LocalRefs } from "./resolve";
|
||||
import { JSONType } from "./rules";
|
||||
export declare type SchemaRefs = {
|
||||
[Ref in string]?: SchemaEnv | AnySchema;
|
||||
};
|
||||
export interface SchemaCxt {
|
||||
readonly gen: CodeGen;
|
||||
readonly allErrors?: boolean;
|
||||
readonly data: Name;
|
||||
readonly parentData: Name;
|
||||
readonly parentDataProperty: Code | number;
|
||||
readonly dataNames: Name[];
|
||||
readonly dataPathArr: (Code | number)[];
|
||||
readonly dataLevel: number;
|
||||
dataTypes: JSONType[];
|
||||
definedProperties: Set<string>;
|
||||
readonly topSchemaRef: Code;
|
||||
readonly validateName: Name;
|
||||
evaluated?: Name;
|
||||
readonly ValidationError?: Name;
|
||||
readonly schema: AnySchema;
|
||||
readonly schemaEnv: SchemaEnv;
|
||||
readonly rootId: string;
|
||||
baseId: string;
|
||||
readonly schemaPath: Code;
|
||||
readonly errSchemaPath: string;
|
||||
readonly errorPath: Code;
|
||||
readonly propertyName?: Name;
|
||||
readonly compositeRule?: boolean;
|
||||
props?: EvaluatedProperties | Name;
|
||||
items?: EvaluatedItems | Name;
|
||||
jtdDiscriminator?: string;
|
||||
jtdMetadata?: boolean;
|
||||
readonly createErrors?: boolean;
|
||||
readonly opts: InstanceOptions;
|
||||
readonly self: Ajv;
|
||||
}
|
||||
export interface SchemaObjCxt extends SchemaCxt {
|
||||
readonly schema: AnySchemaObject;
|
||||
}
|
||||
interface SchemaEnvArgs {
|
||||
readonly schema: AnySchema;
|
||||
readonly schemaId?: "$id" | "id";
|
||||
readonly root?: SchemaEnv;
|
||||
readonly baseId?: string;
|
||||
readonly schemaPath?: string;
|
||||
readonly localRefs?: LocalRefs;
|
||||
readonly meta?: boolean;
|
||||
}
|
||||
export declare class SchemaEnv implements SchemaEnvArgs {
|
||||
readonly schema: AnySchema;
|
||||
readonly schemaId?: "$id" | "id";
|
||||
readonly root: SchemaEnv;
|
||||
baseId: string;
|
||||
schemaPath?: string;
|
||||
localRefs?: LocalRefs;
|
||||
readonly meta?: boolean;
|
||||
readonly $async?: boolean;
|
||||
readonly refs: SchemaRefs;
|
||||
readonly dynamicAnchors: {
|
||||
[Ref in string]?: true;
|
||||
};
|
||||
validate?: AnyValidateFunction;
|
||||
validateName?: ValueScopeName;
|
||||
serialize?: (data: unknown) => string;
|
||||
serializeName?: ValueScopeName;
|
||||
parse?: (data: string) => unknown;
|
||||
parseName?: ValueScopeName;
|
||||
constructor(env: SchemaEnvArgs);
|
||||
}
|
||||
export declare function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv;
|
||||
export declare function resolveRef(this: Ajv, root: SchemaEnv, baseId: string, ref: string): AnySchema | SchemaEnv | undefined;
|
||||
export declare function getCompilingSchema(this: Ajv, schEnv: SchemaEnv): SchemaEnv | void;
|
||||
export declare function resolveSchema(this: Ajv, root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it
|
||||
ref: string): SchemaEnv | undefined;
|
||||
export {};
|
242
node_modules/ajv/dist/compile/index.js
generated
vendored
242
node_modules/ajv/dist/compile/index.js
generated
vendored
@ -1,242 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveSchema = exports.getCompilingSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = void 0;
|
||||
const codegen_1 = require("./codegen");
|
||||
const validation_error_1 = require("../runtime/validation_error");
|
||||
const names_1 = require("./names");
|
||||
const resolve_1 = require("./resolve");
|
||||
const util_1 = require("./util");
|
||||
const validate_1 = require("./validate");
|
||||
class SchemaEnv {
|
||||
constructor(env) {
|
||||
var _a;
|
||||
this.refs = {};
|
||||
this.dynamicAnchors = {};
|
||||
let schema;
|
||||
if (typeof env.schema == "object")
|
||||
schema = env.schema;
|
||||
this.schema = env.schema;
|
||||
this.schemaId = env.schemaId;
|
||||
this.root = env.root || this;
|
||||
this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
|
||||
this.schemaPath = env.schemaPath;
|
||||
this.localRefs = env.localRefs;
|
||||
this.meta = env.meta;
|
||||
this.$async = schema === null || schema === void 0 ? void 0 : schema.$async;
|
||||
this.refs = {};
|
||||
}
|
||||
}
|
||||
exports.SchemaEnv = SchemaEnv;
|
||||
// let codeSize = 0
|
||||
// let nodeCount = 0
|
||||
// Compiles schema in SchemaEnv
|
||||
function compileSchema(sch) {
|
||||
// TODO refactor - remove compilations
|
||||
const _sch = getCompilingSchema.call(this, sch);
|
||||
if (_sch)
|
||||
return _sch;
|
||||
const rootId = (0, resolve_1.getFullPath)(this.opts.uriResolver, sch.root.baseId); // TODO if getFullPath removed 1 tests fails
|
||||
const { es5, lines } = this.opts.code;
|
||||
const { ownProperties } = this.opts;
|
||||
const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties });
|
||||
let _ValidationError;
|
||||
if (sch.$async) {
|
||||
_ValidationError = gen.scopeValue("Error", {
|
||||
ref: validation_error_1.default,
|
||||
code: (0, codegen_1._) `require("ajv/dist/runtime/validation_error").default`,
|
||||
});
|
||||
}
|
||||
const validateName = gen.scopeName("validate");
|
||||
sch.validateName = validateName;
|
||||
const schemaCxt = {
|
||||
gen,
|
||||
allErrors: this.opts.allErrors,
|
||||
data: names_1.default.data,
|
||||
parentData: names_1.default.parentData,
|
||||
parentDataProperty: names_1.default.parentDataProperty,
|
||||
dataNames: [names_1.default.data],
|
||||
dataPathArr: [codegen_1.nil],
|
||||
dataLevel: 0,
|
||||
dataTypes: [],
|
||||
definedProperties: new Set(),
|
||||
topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true
|
||||
? { ref: sch.schema, code: (0, codegen_1.stringify)(sch.schema) }
|
||||
: { ref: sch.schema }),
|
||||
validateName,
|
||||
ValidationError: _ValidationError,
|
||||
schema: sch.schema,
|
||||
schemaEnv: sch,
|
||||
rootId,
|
||||
baseId: sch.baseId || rootId,
|
||||
schemaPath: codegen_1.nil,
|
||||
errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"),
|
||||
errorPath: (0, codegen_1._) `""`,
|
||||
opts: this.opts,
|
||||
self: this,
|
||||
};
|
||||
let sourceCode;
|
||||
try {
|
||||
this._compilations.add(sch);
|
||||
(0, validate_1.validateFunctionCode)(schemaCxt);
|
||||
gen.optimize(this.opts.code.optimize);
|
||||
// gen.optimize(1)
|
||||
const validateCode = gen.toString();
|
||||
sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`;
|
||||
// console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount))
|
||||
if (this.opts.code.process)
|
||||
sourceCode = this.opts.code.process(sourceCode, sch);
|
||||
// console.log("\n\n\n *** \n", sourceCode)
|
||||
const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
|
||||
const validate = makeValidate(this, this.scope.get());
|
||||
this.scope.value(validateName, { ref: validate });
|
||||
validate.errors = null;
|
||||
validate.schema = sch.schema;
|
||||
validate.schemaEnv = sch;
|
||||
if (sch.$async)
|
||||
validate.$async = true;
|
||||
if (this.opts.code.source === true) {
|
||||
validate.source = { validateName, validateCode, scopeValues: gen._values };
|
||||
}
|
||||
if (this.opts.unevaluated) {
|
||||
const { props, items } = schemaCxt;
|
||||
validate.evaluated = {
|
||||
props: props instanceof codegen_1.Name ? undefined : props,
|
||||
items: items instanceof codegen_1.Name ? undefined : items,
|
||||
dynamicProps: props instanceof codegen_1.Name,
|
||||
dynamicItems: items instanceof codegen_1.Name,
|
||||
};
|
||||
if (validate.source)
|
||||
validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated);
|
||||
}
|
||||
sch.validate = validate;
|
||||
return sch;
|
||||
}
|
||||
catch (e) {
|
||||
delete sch.validate;
|
||||
delete sch.validateName;
|
||||
if (sourceCode)
|
||||
this.logger.error("Error compiling schema, function code:", sourceCode);
|
||||
// console.log("\n\n\n *** \n", sourceCode, this.opts)
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
this._compilations.delete(sch);
|
||||
}
|
||||
}
|
||||
exports.compileSchema = compileSchema;
|
||||
function resolveRef(root, baseId, ref) {
|
||||
var _a;
|
||||
ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
|
||||
const schOrFunc = root.refs[ref];
|
||||
if (schOrFunc)
|
||||
return schOrFunc;
|
||||
let _sch = resolve.call(this, root, ref);
|
||||
if (_sch === undefined) {
|
||||
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv
|
||||
const { schemaId } = this.opts;
|
||||
if (schema)
|
||||
_sch = new SchemaEnv({ schema, schemaId, root, baseId });
|
||||
}
|
||||
if (_sch === undefined)
|
||||
return;
|
||||
return (root.refs[ref] = inlineOrCompile.call(this, _sch));
|
||||
}
|
||||
exports.resolveRef = resolveRef;
|
||||
function inlineOrCompile(sch) {
|
||||
if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs))
|
||||
return sch.schema;
|
||||
return sch.validate ? sch : compileSchema.call(this, sch);
|
||||
}
|
||||
// Index of schema compilation in the currently compiled list
|
||||
function getCompilingSchema(schEnv) {
|
||||
for (const sch of this._compilations) {
|
||||
if (sameSchemaEnv(sch, schEnv))
|
||||
return sch;
|
||||
}
|
||||
}
|
||||
exports.getCompilingSchema = getCompilingSchema;
|
||||
function sameSchemaEnv(s1, s2) {
|
||||
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
||||
}
|
||||
// resolve and compile the references ($ref)
|
||||
// TODO returns AnySchemaObject (if the schema can be inlined) or validation function
|
||||
function resolve(root, // information about the root schema for the current schema
|
||||
ref // reference to resolve
|
||||
) {
|
||||
let sch;
|
||||
while (typeof (sch = this.refs[ref]) == "string")
|
||||
ref = sch;
|
||||
return sch || this.schemas[ref] || resolveSchema.call(this, root, ref);
|
||||
}
|
||||
// Resolve schema, its root and baseId
|
||||
function resolveSchema(root, // root object with properties schema, refs TODO below SchemaEnv is assigned to it
|
||||
ref // reference to resolve
|
||||
) {
|
||||
const p = this.opts.uriResolver.parse(ref);
|
||||
const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p);
|
||||
let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, undefined);
|
||||
// TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests
|
||||
if (Object.keys(root.schema).length > 0 && refPath === baseId) {
|
||||
return getJsonPointer.call(this, p, root);
|
||||
}
|
||||
const id = (0, resolve_1.normalizeId)(refPath);
|
||||
const schOrRef = this.refs[id] || this.schemas[id];
|
||||
if (typeof schOrRef == "string") {
|
||||
const sch = resolveSchema.call(this, root, schOrRef);
|
||||
if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object")
|
||||
return;
|
||||
return getJsonPointer.call(this, p, sch);
|
||||
}
|
||||
if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object")
|
||||
return;
|
||||
if (!schOrRef.validate)
|
||||
compileSchema.call(this, schOrRef);
|
||||
if (id === (0, resolve_1.normalizeId)(ref)) {
|
||||
const { schema } = schOrRef;
|
||||
const { schemaId } = this.opts;
|
||||
const schId = schema[schemaId];
|
||||
if (schId)
|
||||
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
||||
return new SchemaEnv({ schema, schemaId, root, baseId });
|
||||
}
|
||||
return getJsonPointer.call(this, p, schOrRef);
|
||||
}
|
||||
exports.resolveSchema = resolveSchema;
|
||||
const PREVENT_SCOPE_CHANGE = new Set([
|
||||
"properties",
|
||||
"patternProperties",
|
||||
"enum",
|
||||
"dependencies",
|
||||
"definitions",
|
||||
]);
|
||||
function getJsonPointer(parsedRef, { baseId, schema, root }) {
|
||||
var _a;
|
||||
if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/")
|
||||
return;
|
||||
for (const part of parsedRef.fragment.slice(1).split("/")) {
|
||||
if (typeof schema === "boolean")
|
||||
return;
|
||||
const partSchema = schema[(0, util_1.unescapeFragment)(part)];
|
||||
if (partSchema === undefined)
|
||||
return;
|
||||
schema = partSchema;
|
||||
// TODO PREVENT_SCOPE_CHANGE could be defined in keyword def?
|
||||
const schId = typeof schema === "object" && schema[this.opts.schemaId];
|
||||
if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {
|
||||
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
||||
}
|
||||
}
|
||||
let env;
|
||||
if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) {
|
||||
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref);
|
||||
env = resolveSchema.call(this, root, $ref);
|
||||
}
|
||||
// even though resolution failed we need to return SchemaEnv to throw exception
|
||||
// so that compileAsync loads missing schema.
|
||||
const { schemaId } = this.opts;
|
||||
env = env || new SchemaEnv({ schema, schemaId, root, baseId });
|
||||
if (env.schema !== env.root.schema)
|
||||
return env;
|
||||
return undefined;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/ajv/dist/compile/index.js.map
generated
vendored
1
node_modules/ajv/dist/compile/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
4
node_modules/ajv/dist/compile/jtd/parse.d.ts
generated
vendored
4
node_modules/ajv/dist/compile/jtd/parse.d.ts
generated
vendored
@ -1,4 +0,0 @@
|
||||
import type Ajv from "../../core";
|
||||
import { SchemaObjectMap } from "./types";
|
||||
import { SchemaEnv } from "..";
|
||||
export default function compileParser(this: Ajv, sch: SchemaEnv, definitions: SchemaObjectMap): SchemaEnv;
|
350
node_modules/ajv/dist/compile/jtd/parse.js
generated
vendored
350
node_modules/ajv/dist/compile/jtd/parse.js
generated
vendored
@ -1,350 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const types_1 = require("./types");
|
||||
const __1 = require("..");
|
||||
const codegen_1 = require("../codegen");
|
||||
const ref_error_1 = require("../ref_error");
|
||||
const names_1 = require("../names");
|
||||
const code_1 = require("../../vocabularies/code");
|
||||
const ref_1 = require("../../vocabularies/jtd/ref");
|
||||
const type_1 = require("../../vocabularies/jtd/type");
|
||||
const parseJson_1 = require("../../runtime/parseJson");
|
||||
const util_1 = require("../util");
|
||||
const timestamp_1 = require("../../runtime/timestamp");
|
||||
const genParse = {
|
||||
elements: parseElements,
|
||||
values: parseValues,
|
||||
discriminator: parseDiscriminator,
|
||||
properties: parseProperties,
|
||||
optionalProperties: parseProperties,
|
||||
enum: parseEnum,
|
||||
type: parseType,
|
||||
ref: parseRef,
|
||||
};
|
||||
function compileParser(sch, definitions) {
|
||||
const _sch = __1.getCompilingSchema.call(this, sch);
|
||||
if (_sch)
|
||||
return _sch;
|
||||
const { es5, lines } = this.opts.code;
|
||||
const { ownProperties } = this.opts;
|
||||
const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties });
|
||||
const parseName = gen.scopeName("parse");
|
||||
const cxt = {
|
||||
self: this,
|
||||
gen,
|
||||
schema: sch.schema,
|
||||
schemaEnv: sch,
|
||||
definitions,
|
||||
data: names_1.default.data,
|
||||
parseName,
|
||||
char: gen.name("c"),
|
||||
};
|
||||
let sourceCode;
|
||||
try {
|
||||
this._compilations.add(sch);
|
||||
sch.parseName = parseName;
|
||||
parserFunction(cxt);
|
||||
gen.optimize(this.opts.code.optimize);
|
||||
const parseFuncCode = gen.toString();
|
||||
sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${parseFuncCode}`;
|
||||
const makeParse = new Function(`${names_1.default.scope}`, sourceCode);
|
||||
const parse = makeParse(this.scope.get());
|
||||
this.scope.value(parseName, { ref: parse });
|
||||
sch.parse = parse;
|
||||
}
|
||||
catch (e) {
|
||||
if (sourceCode)
|
||||
this.logger.error("Error compiling parser, function code:", sourceCode);
|
||||
delete sch.parse;
|
||||
delete sch.parseName;
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
this._compilations.delete(sch);
|
||||
}
|
||||
return sch;
|
||||
}
|
||||
exports.default = compileParser;
|
||||
const undef = (0, codegen_1._) `undefined`;
|
||||
function parserFunction(cxt) {
|
||||
const { gen, parseName, char } = cxt;
|
||||
gen.func(parseName, (0, codegen_1._) `${names_1.default.json}, ${names_1.default.jsonPos}, ${names_1.default.jsonPart}`, false, () => {
|
||||
gen.let(names_1.default.data);
|
||||
gen.let(char);
|
||||
gen.assign((0, codegen_1._) `${parseName}.message`, undef);
|
||||
gen.assign((0, codegen_1._) `${parseName}.position`, undef);
|
||||
gen.assign(names_1.default.jsonPos, (0, codegen_1._) `${names_1.default.jsonPos} || 0`);
|
||||
gen.const(names_1.default.jsonLen, (0, codegen_1._) `${names_1.default.json}.length`);
|
||||
parseCode(cxt);
|
||||
skipWhitespace(cxt);
|
||||
gen.if(names_1.default.jsonPart, () => {
|
||||
gen.assign((0, codegen_1._) `${parseName}.position`, names_1.default.jsonPos);
|
||||
gen.return(names_1.default.data);
|
||||
});
|
||||
gen.if((0, codegen_1._) `${names_1.default.jsonPos} === ${names_1.default.jsonLen}`, () => gen.return(names_1.default.data));
|
||||
jsonSyntaxError(cxt);
|
||||
});
|
||||
}
|
||||
function parseCode(cxt) {
|
||||
let form;
|
||||
for (const key of types_1.jtdForms) {
|
||||
if (key in cxt.schema) {
|
||||
form = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (form)
|
||||
parseNullable(cxt, genParse[form]);
|
||||
else
|
||||
parseEmpty(cxt);
|
||||
}
|
||||
const parseBoolean = parseBooleanToken(true, parseBooleanToken(false, jsonSyntaxError));
|
||||
function parseNullable(cxt, parseForm) {
|
||||
const { gen, schema, data } = cxt;
|
||||
if (!schema.nullable)
|
||||
return parseForm(cxt);
|
||||
tryParseToken(cxt, "null", parseForm, () => gen.assign(data, null));
|
||||
}
|
||||
function parseElements(cxt) {
|
||||
const { gen, schema, data } = cxt;
|
||||
parseToken(cxt, "[");
|
||||
const ix = gen.let("i", 0);
|
||||
gen.assign(data, (0, codegen_1._) `[]`);
|
||||
parseItems(cxt, "]", () => {
|
||||
const el = gen.let("el");
|
||||
parseCode({ ...cxt, schema: schema.elements, data: el });
|
||||
gen.assign((0, codegen_1._) `${data}[${ix}++]`, el);
|
||||
});
|
||||
}
|
||||
function parseValues(cxt) {
|
||||
const { gen, schema, data } = cxt;
|
||||
parseToken(cxt, "{");
|
||||
gen.assign(data, (0, codegen_1._) `{}`);
|
||||
parseItems(cxt, "}", () => parseKeyValue(cxt, schema.values));
|
||||
}
|
||||
function parseItems(cxt, endToken, block) {
|
||||
tryParseItems(cxt, endToken, block);
|
||||
parseToken(cxt, endToken);
|
||||
}
|
||||
function tryParseItems(cxt, endToken, block) {
|
||||
const { gen } = cxt;
|
||||
gen.for((0, codegen_1._) `;${names_1.default.jsonPos}<${names_1.default.jsonLen} && ${jsonSlice(1)}!==${endToken};`, () => {
|
||||
block();
|
||||
tryParseToken(cxt, ",", () => gen.break(), hasItem);
|
||||
});
|
||||
function hasItem() {
|
||||
tryParseToken(cxt, endToken, () => { }, jsonSyntaxError);
|
||||
}
|
||||
}
|
||||
function parseKeyValue(cxt, schema) {
|
||||
const { gen } = cxt;
|
||||
const key = gen.let("key");
|
||||
parseString({ ...cxt, data: key });
|
||||
parseToken(cxt, ":");
|
||||
parsePropertyValue(cxt, key, schema);
|
||||
}
|
||||
function parseDiscriminator(cxt) {
|
||||
const { gen, data, schema } = cxt;
|
||||
const { discriminator, mapping } = schema;
|
||||
parseToken(cxt, "{");
|
||||
gen.assign(data, (0, codegen_1._) `{}`);
|
||||
const startPos = gen.const("pos", names_1.default.jsonPos);
|
||||
const value = gen.let("value");
|
||||
const tag = gen.let("tag");
|
||||
tryParseItems(cxt, "}", () => {
|
||||
const key = gen.let("key");
|
||||
parseString({ ...cxt, data: key });
|
||||
parseToken(cxt, ":");
|
||||
gen.if((0, codegen_1._) `${key} === ${discriminator}`, () => {
|
||||
parseString({ ...cxt, data: tag });
|
||||
gen.assign((0, codegen_1._) `${data}[${key}]`, tag);
|
||||
gen.break();
|
||||
}, () => parseEmpty({ ...cxt, data: value }) // can be discarded/skipped
|
||||
);
|
||||
});
|
||||
gen.assign(names_1.default.jsonPos, startPos);
|
||||
gen.if((0, codegen_1._) `${tag} === undefined`);
|
||||
parsingError(cxt, (0, codegen_1.str) `discriminator tag not found`);
|
||||
for (const tagValue in mapping) {
|
||||
gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`);
|
||||
parseSchemaProperties({ ...cxt, schema: mapping[tagValue] }, discriminator);
|
||||
}
|
||||
gen.else();
|
||||
parsingError(cxt, (0, codegen_1.str) `discriminator value not in schema`);
|
||||
gen.endIf();
|
||||
}
|
||||
function parseProperties(cxt) {
|
||||
const { gen, data } = cxt;
|
||||
parseToken(cxt, "{");
|
||||
gen.assign(data, (0, codegen_1._) `{}`);
|
||||
parseSchemaProperties(cxt);
|
||||
}
|
||||
function parseSchemaProperties(cxt, discriminator) {
|
||||
const { gen, schema, data } = cxt;
|
||||
const { properties, optionalProperties, additionalProperties } = schema;
|
||||
parseItems(cxt, "}", () => {
|
||||
const key = gen.let("key");
|
||||
parseString({ ...cxt, data: key });
|
||||
parseToken(cxt, ":");
|
||||
gen.if(false);
|
||||
parseDefinedProperty(cxt, key, properties);
|
||||
parseDefinedProperty(cxt, key, optionalProperties);
|
||||
if (discriminator) {
|
||||
gen.elseIf((0, codegen_1._) `${key} === ${discriminator}`);
|
||||
const tag = gen.let("tag");
|
||||
parseString({ ...cxt, data: tag }); // can be discarded, it is already assigned
|
||||
}
|
||||
gen.else();
|
||||
if (additionalProperties) {
|
||||
parseEmpty({ ...cxt, data: (0, codegen_1._) `${data}[${key}]` });
|
||||
}
|
||||
else {
|
||||
parsingError(cxt, (0, codegen_1.str) `property ${key} not allowed`);
|
||||
}
|
||||
gen.endIf();
|
||||
});
|
||||
if (properties) {
|
||||
const hasProp = (0, code_1.hasPropFunc)(gen);
|
||||
const allProps = (0, codegen_1.and)(...Object.keys(properties).map((p) => (0, codegen_1._) `${hasProp}.call(${data}, ${p})`));
|
||||
gen.if((0, codegen_1.not)(allProps), () => parsingError(cxt, (0, codegen_1.str) `missing required properties`));
|
||||
}
|
||||
}
|
||||
function parseDefinedProperty(cxt, key, schemas = {}) {
|
||||
const { gen } = cxt;
|
||||
for (const prop in schemas) {
|
||||
gen.elseIf((0, codegen_1._) `${key} === ${prop}`);
|
||||
parsePropertyValue(cxt, key, schemas[prop]);
|
||||
}
|
||||
}
|
||||
function parsePropertyValue(cxt, key, schema) {
|
||||
parseCode({ ...cxt, schema, data: (0, codegen_1._) `${cxt.data}[${key}]` });
|
||||
}
|
||||
function parseType(cxt) {
|
||||
const { gen, schema, data, self } = cxt;
|
||||
switch (schema.type) {
|
||||
case "boolean":
|
||||
parseBoolean(cxt);
|
||||
break;
|
||||
case "string":
|
||||
parseString(cxt);
|
||||
break;
|
||||
case "timestamp": {
|
||||
parseString(cxt);
|
||||
const vts = (0, util_1.useFunc)(gen, timestamp_1.default);
|
||||
const { allowDate, parseDate } = self.opts;
|
||||
const notValid = allowDate ? (0, codegen_1._) `!${vts}(${data}, true)` : (0, codegen_1._) `!${vts}(${data})`;
|
||||
const fail = parseDate
|
||||
? (0, codegen_1.or)(notValid, (0, codegen_1._) `(${data} = new Date(${data}), false)`, (0, codegen_1._) `isNaN(${data}.valueOf())`)
|
||||
: notValid;
|
||||
gen.if(fail, () => parsingError(cxt, (0, codegen_1.str) `invalid timestamp`));
|
||||
break;
|
||||
}
|
||||
case "float32":
|
||||
case "float64":
|
||||
parseNumber(cxt);
|
||||
break;
|
||||
default: {
|
||||
const t = schema.type;
|
||||
if (!self.opts.int32range && (t === "int32" || t === "uint32")) {
|
||||
parseNumber(cxt, 16); // 2 ** 53 - max safe integer
|
||||
if (t === "uint32") {
|
||||
gen.if((0, codegen_1._) `${data} < 0`, () => parsingError(cxt, (0, codegen_1.str) `integer out of range`));
|
||||
}
|
||||
}
|
||||
else {
|
||||
const [min, max, maxDigits] = type_1.intRange[t];
|
||||
parseNumber(cxt, maxDigits);
|
||||
gen.if((0, codegen_1._) `${data} < ${min} || ${data} > ${max}`, () => parsingError(cxt, (0, codegen_1.str) `integer out of range`));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function parseString(cxt) {
|
||||
parseToken(cxt, '"');
|
||||
parseWith(cxt, parseJson_1.parseJsonString);
|
||||
}
|
||||
function parseEnum(cxt) {
|
||||
const { gen, data, schema } = cxt;
|
||||
const enumSch = schema.enum;
|
||||
parseToken(cxt, '"');
|
||||
// TODO loopEnum
|
||||
gen.if(false);
|
||||
for (const value of enumSch) {
|
||||
const valueStr = JSON.stringify(value).slice(1); // remove starting quote
|
||||
gen.elseIf((0, codegen_1._) `${jsonSlice(valueStr.length)} === ${valueStr}`);
|
||||
gen.assign(data, (0, codegen_1.str) `${value}`);
|
||||
gen.add(names_1.default.jsonPos, valueStr.length);
|
||||
}
|
||||
gen.else();
|
||||
jsonSyntaxError(cxt);
|
||||
gen.endIf();
|
||||
}
|
||||
function parseNumber(cxt, maxDigits) {
|
||||
const { gen } = cxt;
|
||||
skipWhitespace(cxt);
|
||||
gen.if((0, codegen_1._) `"-0123456789".indexOf(${jsonSlice(1)}) < 0`, () => jsonSyntaxError(cxt), () => parseWith(cxt, parseJson_1.parseJsonNumber, maxDigits));
|
||||
}
|
||||
function parseBooleanToken(bool, fail) {
|
||||
return (cxt) => {
|
||||
const { gen, data } = cxt;
|
||||
tryParseToken(cxt, `${bool}`, () => fail(cxt), () => gen.assign(data, bool));
|
||||
};
|
||||
}
|
||||
function parseRef(cxt) {
|
||||
const { gen, self, definitions, schema, schemaEnv } = cxt;
|
||||
const { ref } = schema;
|
||||
const refSchema = definitions[ref];
|
||||
if (!refSchema)
|
||||
throw new ref_error_1.default(self.opts.uriResolver, "", ref, `No definition ${ref}`);
|
||||
if (!(0, ref_1.hasRef)(refSchema))
|
||||
return parseCode({ ...cxt, schema: refSchema });
|
||||
const { root } = schemaEnv;
|
||||
const sch = compileParser.call(self, new __1.SchemaEnv({ schema: refSchema, root }), definitions);
|
||||
partialParse(cxt, getParser(gen, sch), true);
|
||||
}
|
||||
function getParser(gen, sch) {
|
||||
return sch.parse
|
||||
? gen.scopeValue("parse", { ref: sch.parse })
|
||||
: (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.parse`;
|
||||
}
|
||||
function parseEmpty(cxt) {
|
||||
parseWith(cxt, parseJson_1.parseJson);
|
||||
}
|
||||
function parseWith(cxt, parseFunc, args) {
|
||||
partialParse(cxt, (0, util_1.useFunc)(cxt.gen, parseFunc), args);
|
||||
}
|
||||
function partialParse(cxt, parseFunc, args) {
|
||||
const { gen, data } = cxt;
|
||||
gen.assign(data, (0, codegen_1._) `${parseFunc}(${names_1.default.json}, ${names_1.default.jsonPos}${args ? (0, codegen_1._) `, ${args}` : codegen_1.nil})`);
|
||||
gen.assign(names_1.default.jsonPos, (0, codegen_1._) `${parseFunc}.position`);
|
||||
gen.if((0, codegen_1._) `${data} === undefined`, () => parsingError(cxt, (0, codegen_1._) `${parseFunc}.message`));
|
||||
}
|
||||
function parseToken(cxt, tok) {
|
||||
tryParseToken(cxt, tok, jsonSyntaxError);
|
||||
}
|
||||
function tryParseToken(cxt, tok, fail, success) {
|
||||
const { gen } = cxt;
|
||||
const n = tok.length;
|
||||
skipWhitespace(cxt);
|
||||
gen.if((0, codegen_1._) `${jsonSlice(n)} === ${tok}`, () => {
|
||||
gen.add(names_1.default.jsonPos, n);
|
||||
success === null || success === void 0 ? void 0 : success(cxt);
|
||||
}, () => fail(cxt));
|
||||
}
|
||||
function skipWhitespace({ gen, char: c }) {
|
||||
gen.code((0, codegen_1._) `while((${c}=${names_1.default.json}[${names_1.default.jsonPos}],${c}===" "||${c}==="\\n"||${c}==="\\r"||${c}==="\\t"))${names_1.default.jsonPos}++;`);
|
||||
}
|
||||
function jsonSlice(len) {
|
||||
return len === 1
|
||||
? (0, codegen_1._) `${names_1.default.json}[${names_1.default.jsonPos}]`
|
||||
: (0, codegen_1._) `${names_1.default.json}.slice(${names_1.default.jsonPos}, ${names_1.default.jsonPos}+${len})`;
|
||||
}
|
||||
function jsonSyntaxError(cxt) {
|
||||
parsingError(cxt, (0, codegen_1._) `"unexpected token " + ${names_1.default.json}[${names_1.default.jsonPos}]`);
|
||||
}
|
||||
function parsingError({ gen, parseName }, msg) {
|
||||
gen.assign((0, codegen_1._) `${parseName}.message`, msg);
|
||||
gen.assign((0, codegen_1._) `${parseName}.position`, names_1.default.jsonPos);
|
||||
gen.return(undef);
|
||||
}
|
||||
//# sourceMappingURL=parse.js.map
|
1
node_modules/ajv/dist/compile/jtd/parse.js.map
generated
vendored
1
node_modules/ajv/dist/compile/jtd/parse.js.map
generated
vendored
File diff suppressed because one or more lines are too long
4
node_modules/ajv/dist/compile/jtd/serialize.d.ts
generated
vendored
4
node_modules/ajv/dist/compile/jtd/serialize.d.ts
generated
vendored
@ -1,4 +0,0 @@
|
||||
import type Ajv from "../../core";
|
||||
import { SchemaObjectMap } from "./types";
|
||||
import { SchemaEnv } from "..";
|
||||
export default function compileSerializer(this: Ajv, sch: SchemaEnv, definitions: SchemaObjectMap): SchemaEnv;
|
218
node_modules/ajv/dist/compile/jtd/serialize.js
generated
vendored
218
node_modules/ajv/dist/compile/jtd/serialize.js
generated
vendored
@ -1,218 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const types_1 = require("./types");
|
||||
const __1 = require("..");
|
||||
const codegen_1 = require("../codegen");
|
||||
const ref_error_1 = require("../ref_error");
|
||||
const names_1 = require("../names");
|
||||
const code_1 = require("../../vocabularies/code");
|
||||
const ref_1 = require("../../vocabularies/jtd/ref");
|
||||
const util_1 = require("../util");
|
||||
const quote_1 = require("../../runtime/quote");
|
||||
const genSerialize = {
|
||||
elements: serializeElements,
|
||||
values: serializeValues,
|
||||
discriminator: serializeDiscriminator,
|
||||
properties: serializeProperties,
|
||||
optionalProperties: serializeProperties,
|
||||
enum: serializeString,
|
||||
type: serializeType,
|
||||
ref: serializeRef,
|
||||
};
|
||||
function compileSerializer(sch, definitions) {
|
||||
const _sch = __1.getCompilingSchema.call(this, sch);
|
||||
if (_sch)
|
||||
return _sch;
|
||||
const { es5, lines } = this.opts.code;
|
||||
const { ownProperties } = this.opts;
|
||||
const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties });
|
||||
const serializeName = gen.scopeName("serialize");
|
||||
const cxt = {
|
||||
self: this,
|
||||
gen,
|
||||
schema: sch.schema,
|
||||
schemaEnv: sch,
|
||||
definitions,
|
||||
data: names_1.default.data,
|
||||
};
|
||||
let sourceCode;
|
||||
try {
|
||||
this._compilations.add(sch);
|
||||
sch.serializeName = serializeName;
|
||||
gen.func(serializeName, names_1.default.data, false, () => {
|
||||
gen.let(names_1.default.json, (0, codegen_1.str) ``);
|
||||
serializeCode(cxt);
|
||||
gen.return(names_1.default.json);
|
||||
});
|
||||
gen.optimize(this.opts.code.optimize);
|
||||
const serializeFuncCode = gen.toString();
|
||||
sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${serializeFuncCode}`;
|
||||
const makeSerialize = new Function(`${names_1.default.scope}`, sourceCode);
|
||||
const serialize = makeSerialize(this.scope.get());
|
||||
this.scope.value(serializeName, { ref: serialize });
|
||||
sch.serialize = serialize;
|
||||
}
|
||||
catch (e) {
|
||||
if (sourceCode)
|
||||
this.logger.error("Error compiling serializer, function code:", sourceCode);
|
||||
delete sch.serialize;
|
||||
delete sch.serializeName;
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
this._compilations.delete(sch);
|
||||
}
|
||||
return sch;
|
||||
}
|
||||
exports.default = compileSerializer;
|
||||
function serializeCode(cxt) {
|
||||
let form;
|
||||
for (const key of types_1.jtdForms) {
|
||||
if (key in cxt.schema) {
|
||||
form = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
serializeNullable(cxt, form ? genSerialize[form] : serializeEmpty);
|
||||
}
|
||||
function serializeNullable(cxt, serializeForm) {
|
||||
const { gen, schema, data } = cxt;
|
||||
if (!schema.nullable)
|
||||
return serializeForm(cxt);
|
||||
gen.if((0, codegen_1._) `${data} === undefined || ${data} === null`, () => gen.add(names_1.default.json, (0, codegen_1._) `"null"`), () => serializeForm(cxt));
|
||||
}
|
||||
function serializeElements(cxt) {
|
||||
const { gen, schema, data } = cxt;
|
||||
gen.add(names_1.default.json, (0, codegen_1.str) `[`);
|
||||
const first = gen.let("first", true);
|
||||
gen.forOf("el", data, (el) => {
|
||||
addComma(cxt, first);
|
||||
serializeCode({ ...cxt, schema: schema.elements, data: el });
|
||||
});
|
||||
gen.add(names_1.default.json, (0, codegen_1.str) `]`);
|
||||
}
|
||||
function serializeValues(cxt) {
|
||||
const { gen, schema, data } = cxt;
|
||||
gen.add(names_1.default.json, (0, codegen_1.str) `{`);
|
||||
const first = gen.let("first", true);
|
||||
gen.forIn("key", data, (key) => serializeKeyValue(cxt, key, schema.values, first));
|
||||
gen.add(names_1.default.json, (0, codegen_1.str) `}`);
|
||||
}
|
||||
function serializeKeyValue(cxt, key, schema, first) {
|
||||
const { gen, data } = cxt;
|
||||
addComma(cxt, first);
|
||||
serializeString({ ...cxt, data: key });
|
||||
gen.add(names_1.default.json, (0, codegen_1.str) `:`);
|
||||
const value = gen.const("value", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(key)}`);
|
||||
serializeCode({ ...cxt, schema, data: value });
|
||||
}
|
||||
function serializeDiscriminator(cxt) {
|
||||
const { gen, schema, data } = cxt;
|
||||
const { discriminator } = schema;
|
||||
gen.add(names_1.default.json, (0, codegen_1.str) `{${JSON.stringify(discriminator)}:`);
|
||||
const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(discriminator)}`);
|
||||
serializeString({ ...cxt, data: tag });
|
||||
gen.if(false);
|
||||
for (const tagValue in schema.mapping) {
|
||||
gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`);
|
||||
const sch = schema.mapping[tagValue];
|
||||
serializeSchemaProperties({ ...cxt, schema: sch }, discriminator);
|
||||
}
|
||||
gen.endIf();
|
||||
gen.add(names_1.default.json, (0, codegen_1.str) `}`);
|
||||
}
|
||||
function serializeProperties(cxt) {
|
||||
const { gen } = cxt;
|
||||
gen.add(names_1.default.json, (0, codegen_1.str) `{`);
|
||||
serializeSchemaProperties(cxt);
|
||||
gen.add(names_1.default.json, (0, codegen_1.str) `}`);
|
||||
}
|
||||
function serializeSchemaProperties(cxt, discriminator) {
|
||||
const { gen, schema, data } = cxt;
|
||||
const { properties, optionalProperties } = schema;
|
||||
const props = keys(properties);
|
||||
const optProps = keys(optionalProperties);
|
||||
const allProps = allProperties(props.concat(optProps));
|
||||
let first = !discriminator;
|
||||
for (const key of props) {
|
||||
serializeProperty(key, properties[key], keyValue(key));
|
||||
}
|
||||
for (const key of optProps) {
|
||||
const value = keyValue(key);
|
||||
gen.if((0, codegen_1.and)((0, codegen_1._) `${value} !== undefined`, (0, code_1.isOwnProperty)(gen, data, key)), () => serializeProperty(key, optionalProperties[key], value));
|
||||
}
|
||||
if (schema.additionalProperties) {
|
||||
gen.forIn("key", data, (key) => gen.if(isAdditional(key, allProps), () => serializeKeyValue(cxt, key, {}, gen.let("first", first))));
|
||||
}
|
||||
function keys(ps) {
|
||||
return ps ? Object.keys(ps) : [];
|
||||
}
|
||||
function allProperties(ps) {
|
||||
if (discriminator)
|
||||
ps.push(discriminator);
|
||||
if (new Set(ps).size !== ps.length) {
|
||||
throw new Error("JTD: properties/optionalProperties/disciminator overlap");
|
||||
}
|
||||
return ps;
|
||||
}
|
||||
function keyValue(key) {
|
||||
return gen.const("value", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(key)}`);
|
||||
}
|
||||
function serializeProperty(key, propSchema, value) {
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
gen.add(names_1.default.json, (0, codegen_1.str) `,`);
|
||||
gen.add(names_1.default.json, (0, codegen_1.str) `${JSON.stringify(key)}:`);
|
||||
serializeCode({ ...cxt, schema: propSchema, data: value });
|
||||
}
|
||||
function isAdditional(key, ps) {
|
||||
return ps.length ? (0, codegen_1.and)(...ps.map((p) => (0, codegen_1._) `${key} !== ${p}`)) : true;
|
||||
}
|
||||
}
|
||||
function serializeType(cxt) {
|
||||
const { gen, schema, data } = cxt;
|
||||
switch (schema.type) {
|
||||
case "boolean":
|
||||
gen.add(names_1.default.json, (0, codegen_1._) `${data} ? "true" : "false"`);
|
||||
break;
|
||||
case "string":
|
||||
serializeString(cxt);
|
||||
break;
|
||||
case "timestamp":
|
||||
gen.if((0, codegen_1._) `${data} instanceof Date`, () => gen.add(names_1.default.json, (0, codegen_1._) `'"' + ${data}.toISOString() + '"'`), () => serializeString(cxt));
|
||||
break;
|
||||
default:
|
||||
serializeNumber(cxt);
|
||||
}
|
||||
}
|
||||
function serializeString({ gen, data }) {
|
||||
gen.add(names_1.default.json, (0, codegen_1._) `${(0, util_1.useFunc)(gen, quote_1.default)}(${data})`);
|
||||
}
|
||||
function serializeNumber({ gen, data }) {
|
||||
gen.add(names_1.default.json, (0, codegen_1._) `"" + ${data}`);
|
||||
}
|
||||
function serializeRef(cxt) {
|
||||
const { gen, self, data, definitions, schema, schemaEnv } = cxt;
|
||||
const { ref } = schema;
|
||||
const refSchema = definitions[ref];
|
||||
if (!refSchema)
|
||||
throw new ref_error_1.default(self.opts.uriResolver, "", ref, `No definition ${ref}`);
|
||||
if (!(0, ref_1.hasRef)(refSchema))
|
||||
return serializeCode({ ...cxt, schema: refSchema });
|
||||
const { root } = schemaEnv;
|
||||
const sch = compileSerializer.call(self, new __1.SchemaEnv({ schema: refSchema, root }), definitions);
|
||||
gen.add(names_1.default.json, (0, codegen_1._) `${getSerialize(gen, sch)}(${data})`);
|
||||
}
|
||||
function getSerialize(gen, sch) {
|
||||
return sch.serialize
|
||||
? gen.scopeValue("serialize", { ref: sch.serialize })
|
||||
: (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.serialize`;
|
||||
}
|
||||
function serializeEmpty({ gen, data }) {
|
||||
gen.add(names_1.default.json, (0, codegen_1._) `JSON.stringify(${data})`);
|
||||
}
|
||||
function addComma({ gen }, first) {
|
||||
gen.if(first, () => gen.assign(first, false), () => gen.add(names_1.default.json, (0, codegen_1.str) `,`));
|
||||
}
|
||||
//# sourceMappingURL=serialize.js.map
|
1
node_modules/ajv/dist/compile/jtd/serialize.js.map
generated
vendored
1
node_modules/ajv/dist/compile/jtd/serialize.js.map
generated
vendored
File diff suppressed because one or more lines are too long
6
node_modules/ajv/dist/compile/jtd/types.d.ts
generated
vendored
6
node_modules/ajv/dist/compile/jtd/types.d.ts
generated
vendored
@ -1,6 +0,0 @@
|
||||
import type { SchemaObject } from "../../types";
|
||||
export declare type SchemaObjectMap = {
|
||||
[Ref in string]?: SchemaObject;
|
||||
};
|
||||
export declare const jtdForms: readonly ["elements", "values", "discriminator", "properties", "optionalProperties", "enum", "type", "ref"];
|
||||
export declare type JTDForm = typeof jtdForms[number];
|
14
node_modules/ajv/dist/compile/jtd/types.js
generated
vendored
14
node_modules/ajv/dist/compile/jtd/types.js
generated
vendored
@ -1,14 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.jtdForms = void 0;
|
||||
exports.jtdForms = [
|
||||
"elements",
|
||||
"values",
|
||||
"discriminator",
|
||||
"properties",
|
||||
"optionalProperties",
|
||||
"enum",
|
||||
"type",
|
||||
"ref",
|
||||
];
|
||||
//# sourceMappingURL=types.js.map
|
1
node_modules/ajv/dist/compile/jtd/types.js.map
generated
vendored
1
node_modules/ajv/dist/compile/jtd/types.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/compile/jtd/types.ts"],"names":[],"mappings":";;;AAIa,QAAA,QAAQ,GAAG;IACtB,UAAU;IACV,QAAQ;IACR,eAAe;IACf,YAAY;IACZ,oBAAoB;IACpB,MAAM;IACN,MAAM;IACN,KAAK;CACG,CAAA"}
|
20
node_modules/ajv/dist/compile/names.d.ts
generated
vendored
20
node_modules/ajv/dist/compile/names.d.ts
generated
vendored
@ -1,20 +0,0 @@
|
||||
import { Name } from "./codegen";
|
||||
declare const names: {
|
||||
data: Name;
|
||||
valCxt: Name;
|
||||
instancePath: Name;
|
||||
parentData: Name;
|
||||
parentDataProperty: Name;
|
||||
rootData: Name;
|
||||
dynamicAnchors: Name;
|
||||
vErrors: Name;
|
||||
errors: Name;
|
||||
this: Name;
|
||||
self: Name;
|
||||
scope: Name;
|
||||
json: Name;
|
||||
jsonPos: Name;
|
||||
jsonLen: Name;
|
||||
jsonPart: Name;
|
||||
};
|
||||
export default names;
|
28
node_modules/ajv/dist/compile/names.js
generated
vendored
28
node_modules/ajv/dist/compile/names.js
generated
vendored
@ -1,28 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const codegen_1 = require("./codegen");
|
||||
const names = {
|
||||
// validation function arguments
|
||||
data: new codegen_1.Name("data"),
|
||||
// args passed from referencing schema
|
||||
valCxt: new codegen_1.Name("valCxt"),
|
||||
instancePath: new codegen_1.Name("instancePath"),
|
||||
parentData: new codegen_1.Name("parentData"),
|
||||
parentDataProperty: new codegen_1.Name("parentDataProperty"),
|
||||
rootData: new codegen_1.Name("rootData"),
|
||||
dynamicAnchors: new codegen_1.Name("dynamicAnchors"),
|
||||
// function scoped variables
|
||||
vErrors: new codegen_1.Name("vErrors"),
|
||||
errors: new codegen_1.Name("errors"),
|
||||
this: new codegen_1.Name("this"),
|
||||
// "globals"
|
||||
self: new codegen_1.Name("self"),
|
||||
scope: new codegen_1.Name("scope"),
|
||||
// JTD serialize/parse name for JSON string and position
|
||||
json: new codegen_1.Name("json"),
|
||||
jsonPos: new codegen_1.Name("jsonPos"),
|
||||
jsonLen: new codegen_1.Name("jsonLen"),
|
||||
jsonPart: new codegen_1.Name("jsonPart"),
|
||||
};
|
||||
exports.default = names;
|
||||
//# sourceMappingURL=names.js.map
|
1
node_modules/ajv/dist/compile/names.js.map
generated
vendored
1
node_modules/ajv/dist/compile/names.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"names.js","sourceRoot":"","sources":["../../lib/compile/names.ts"],"names":[],"mappings":";;AAAA,uCAA8B;AAE9B,MAAM,KAAK,GAAG;IACZ,gCAAgC;IAChC,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,sCAAsC;IACtC,MAAM,EAAE,IAAI,cAAI,CAAC,QAAQ,CAAC;IAC1B,YAAY,EAAE,IAAI,cAAI,CAAC,cAAc,CAAC;IACtC,UAAU,EAAE,IAAI,cAAI,CAAC,YAAY,CAAC;IAClC,kBAAkB,EAAE,IAAI,cAAI,CAAC,oBAAoB,CAAC;IAClD,QAAQ,EAAE,IAAI,cAAI,CAAC,UAAU,CAAC;IAC9B,cAAc,EAAE,IAAI,cAAI,CAAC,gBAAgB,CAAC;IAC1C,4BAA4B;IAC5B,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,MAAM,EAAE,IAAI,cAAI,CAAC,QAAQ,CAAC;IAC1B,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,YAAY;IACZ,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,KAAK,EAAE,IAAI,cAAI,CAAC,OAAO,CAAC;IACxB,wDAAwD;IACxD,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,QAAQ,EAAE,IAAI,cAAI,CAAC,UAAU,CAAC;CAC/B,CAAA;AAED,kBAAe,KAAK,CAAA"}
|
6
node_modules/ajv/dist/compile/ref_error.d.ts
generated
vendored
6
node_modules/ajv/dist/compile/ref_error.d.ts
generated
vendored
@ -1,6 +0,0 @@
|
||||
import type { UriResolver } from "../types";
|
||||
export default class MissingRefError extends Error {
|
||||
readonly missingRef: string;
|
||||
readonly missingSchema: string;
|
||||
constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string);
|
||||
}
|
12
node_modules/ajv/dist/compile/ref_error.js
generated
vendored
12
node_modules/ajv/dist/compile/ref_error.js
generated
vendored
@ -1,12 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const resolve_1 = require("./resolve");
|
||||
class MissingRefError extends Error {
|
||||
constructor(resolver, baseId, ref, msg) {
|
||||
super(msg || `can't resolve reference ${ref} from id ${baseId}`);
|
||||
this.missingRef = (0, resolve_1.resolveUrl)(resolver, baseId, ref);
|
||||
this.missingSchema = (0, resolve_1.normalizeId)((0, resolve_1.getFullPath)(resolver, this.missingRef));
|
||||
}
|
||||
}
|
||||
exports.default = MissingRefError;
|
||||
//# sourceMappingURL=ref_error.js.map
|
1
node_modules/ajv/dist/compile/ref_error.js.map
generated
vendored
1
node_modules/ajv/dist/compile/ref_error.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"ref_error.js","sourceRoot":"","sources":["../../lib/compile/ref_error.ts"],"names":[],"mappings":";;AAAA,uCAA8D;AAG9D,MAAqB,eAAgB,SAAQ,KAAK;IAIhD,YAAY,QAAqB,EAAE,MAAc,EAAE,GAAW,EAAE,GAAY;QAC1E,KAAK,CAAC,GAAG,IAAI,2BAA2B,GAAG,YAAY,MAAM,EAAE,CAAC,CAAA;QAChE,IAAI,CAAC,UAAU,GAAG,IAAA,oBAAU,EAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;QACnD,IAAI,CAAC,aAAa,GAAG,IAAA,qBAAW,EAAC,IAAA,qBAAW,EAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAA;IAC1E,CAAC;CACF;AATD,kCASC"}
|
12
node_modules/ajv/dist/compile/resolve.d.ts
generated
vendored
12
node_modules/ajv/dist/compile/resolve.d.ts
generated
vendored
@ -1,12 +0,0 @@
|
||||
import type { AnySchema, AnySchemaObject, UriResolver } from "../types";
|
||||
import type Ajv from "../ajv";
|
||||
import type { URIComponents } from "uri-js";
|
||||
export declare type LocalRefs = {
|
||||
[Ref in string]?: AnySchemaObject;
|
||||
};
|
||||
export declare function inlineRef(schema: AnySchema, limit?: boolean | number): boolean;
|
||||
export declare function getFullPath(resolver: UriResolver, id?: string, normalize?: boolean): string;
|
||||
export declare function _getFullPath(resolver: UriResolver, p: URIComponents): string;
|
||||
export declare function normalizeId(id: string | undefined): string;
|
||||
export declare function resolveUrl(resolver: UriResolver, baseId: string, id: string): string;
|
||||
export declare function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): LocalRefs;
|
155
node_modules/ajv/dist/compile/resolve.js
generated
vendored
155
node_modules/ajv/dist/compile/resolve.js
generated
vendored
@ -1,155 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = void 0;
|
||||
const util_1 = require("./util");
|
||||
const equal = require("fast-deep-equal");
|
||||
const traverse = require("json-schema-traverse");
|
||||
// TODO refactor to use keyword definitions
|
||||
const SIMPLE_INLINED = new Set([
|
||||
"type",
|
||||
"format",
|
||||
"pattern",
|
||||
"maxLength",
|
||||
"minLength",
|
||||
"maxProperties",
|
||||
"minProperties",
|
||||
"maxItems",
|
||||
"minItems",
|
||||
"maximum",
|
||||
"minimum",
|
||||
"uniqueItems",
|
||||
"multipleOf",
|
||||
"required",
|
||||
"enum",
|
||||
"const",
|
||||
]);
|
||||
function inlineRef(schema, limit = true) {
|
||||
if (typeof schema == "boolean")
|
||||
return true;
|
||||
if (limit === true)
|
||||
return !hasRef(schema);
|
||||
if (!limit)
|
||||
return false;
|
||||
return countKeys(schema) <= limit;
|
||||
}
|
||||
exports.inlineRef = inlineRef;
|
||||
const REF_KEYWORDS = new Set([
|
||||
"$ref",
|
||||
"$recursiveRef",
|
||||
"$recursiveAnchor",
|
||||
"$dynamicRef",
|
||||
"$dynamicAnchor",
|
||||
]);
|
||||
function hasRef(schema) {
|
||||
for (const key in schema) {
|
||||
if (REF_KEYWORDS.has(key))
|
||||
return true;
|
||||
const sch = schema[key];
|
||||
if (Array.isArray(sch) && sch.some(hasRef))
|
||||
return true;
|
||||
if (typeof sch == "object" && hasRef(sch))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function countKeys(schema) {
|
||||
let count = 0;
|
||||
for (const key in schema) {
|
||||
if (key === "$ref")
|
||||
return Infinity;
|
||||
count++;
|
||||
if (SIMPLE_INLINED.has(key))
|
||||
continue;
|
||||
if (typeof schema[key] == "object") {
|
||||
(0, util_1.eachItem)(schema[key], (sch) => (count += countKeys(sch)));
|
||||
}
|
||||
if (count === Infinity)
|
||||
return Infinity;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
function getFullPath(resolver, id = "", normalize) {
|
||||
if (normalize !== false)
|
||||
id = normalizeId(id);
|
||||
const p = resolver.parse(id);
|
||||
return _getFullPath(resolver, p);
|
||||
}
|
||||
exports.getFullPath = getFullPath;
|
||||
function _getFullPath(resolver, p) {
|
||||
const serialized = resolver.serialize(p);
|
||||
return serialized.split("#")[0] + "#";
|
||||
}
|
||||
exports._getFullPath = _getFullPath;
|
||||
const TRAILING_SLASH_HASH = /#\/?$/;
|
||||
function normalizeId(id) {
|
||||
return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
|
||||
}
|
||||
exports.normalizeId = normalizeId;
|
||||
function resolveUrl(resolver, baseId, id) {
|
||||
id = normalizeId(id);
|
||||
return resolver.resolve(baseId, id);
|
||||
}
|
||||
exports.resolveUrl = resolveUrl;
|
||||
const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
|
||||
function getSchemaRefs(schema, baseId) {
|
||||
if (typeof schema == "boolean")
|
||||
return {};
|
||||
const { schemaId, uriResolver } = this.opts;
|
||||
const schId = normalizeId(schema[schemaId] || baseId);
|
||||
const baseIds = { "": schId };
|
||||
const pathPrefix = getFullPath(uriResolver, schId, false);
|
||||
const localRefs = {};
|
||||
const schemaRefs = new Set();
|
||||
traverse(schema, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => {
|
||||
if (parentJsonPtr === undefined)
|
||||
return;
|
||||
const fullPath = pathPrefix + jsonPtr;
|
||||
let baseId = baseIds[parentJsonPtr];
|
||||
if (typeof sch[schemaId] == "string")
|
||||
baseId = addRef.call(this, sch[schemaId]);
|
||||
addAnchor.call(this, sch.$anchor);
|
||||
addAnchor.call(this, sch.$dynamicAnchor);
|
||||
baseIds[jsonPtr] = baseId;
|
||||
function addRef(ref) {
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
const _resolve = this.opts.uriResolver.resolve;
|
||||
ref = normalizeId(baseId ? _resolve(baseId, ref) : ref);
|
||||
if (schemaRefs.has(ref))
|
||||
throw ambiguos(ref);
|
||||
schemaRefs.add(ref);
|
||||
let schOrRef = this.refs[ref];
|
||||
if (typeof schOrRef == "string")
|
||||
schOrRef = this.refs[schOrRef];
|
||||
if (typeof schOrRef == "object") {
|
||||
checkAmbiguosRef(sch, schOrRef.schema, ref);
|
||||
}
|
||||
else if (ref !== normalizeId(fullPath)) {
|
||||
if (ref[0] === "#") {
|
||||
checkAmbiguosRef(sch, localRefs[ref], ref);
|
||||
localRefs[ref] = sch;
|
||||
}
|
||||
else {
|
||||
this.refs[ref] = fullPath;
|
||||
}
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
function addAnchor(anchor) {
|
||||
if (typeof anchor == "string") {
|
||||
if (!ANCHOR.test(anchor))
|
||||
throw new Error(`invalid anchor "${anchor}"`);
|
||||
addRef.call(this, `#${anchor}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
return localRefs;
|
||||
function checkAmbiguosRef(sch1, sch2, ref) {
|
||||
if (sch2 !== undefined && !equal(sch1, sch2))
|
||||
throw ambiguos(ref);
|
||||
}
|
||||
function ambiguos(ref) {
|
||||
return new Error(`reference "${ref}" resolves to more than one schema`);
|
||||
}
|
||||
}
|
||||
exports.getSchemaRefs = getSchemaRefs;
|
||||
//# sourceMappingURL=resolve.js.map
|
1
node_modules/ajv/dist/compile/resolve.js.map
generated
vendored
1
node_modules/ajv/dist/compile/resolve.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../lib/compile/resolve.ts"],"names":[],"mappings":";;;AAGA,iCAA+B;AAC/B,yCAAwC;AACxC,iDAAgD;AAKhD,2CAA2C;AAC3C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,MAAM;IACN,QAAQ;IACR,SAAS;IACT,WAAW;IACX,WAAW;IACX,eAAe;IACf,eAAe;IACf,UAAU;IACV,UAAU;IACV,SAAS;IACT,SAAS;IACT,aAAa;IACb,YAAY;IACZ,UAAU;IACV,MAAM;IACN,OAAO;CACR,CAAC,CAAA;AAEF,SAAgB,SAAS,CAAC,MAAiB,EAAE,QAA0B,IAAI;IACzE,IAAI,OAAO,MAAM,IAAI,SAAS;QAAE,OAAO,IAAI,CAAA;IAC3C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC1C,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAA;IACxB,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,CAAA;AACnC,CAAC;AALD,8BAKC;AAED,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,MAAM;IACN,eAAe;IACf,kBAAkB;IAClB,aAAa;IACb,gBAAgB;CACjB,CAAC,CAAA;AAEF,SAAS,MAAM,CAAC,MAAuB;IACrC,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;QACxB,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAA;QACtC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;QACvB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAA;QACvD,IAAI,OAAO,GAAG,IAAI,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAA;KACvD;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,SAAS,CAAC,MAAuB;IACxC,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;QACxB,IAAI,GAAG,KAAK,MAAM;YAAE,OAAO,QAAQ,CAAA;QACnC,KAAK,EAAE,CAAA;QACP,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAQ;QACrC,IAAI,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,QAAQ,EAAE;YAClC,IAAA,eAAQ,EAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;SAC1D;QACD,IAAI,KAAK,KAAK,QAAQ;YAAE,OAAO,QAAQ,CAAA;KACxC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAgB,WAAW,CAAC,QAAqB,EAAE,EAAE,GAAG,EAAE,EAAE,SAAmB;IAC7E,IAAI,SAAS,KAAK,KAAK;QAAE,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC,CAAA;IAC7C,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC5B,OAAO,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;AAClC,CAAC;AAJD,kCAIC;AAED,SAAgB,YAAY,CAAC,QAAqB,EAAE,CAAgB;IAClE,MAAM,UAAU,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IACxC,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;AACvC,CAAC;AAHD,oCAGC;AAED,MAAM,mBAAmB,GAAG,OAAO,CAAA;AACnC,SAAgB,WAAW,CAAC,EAAsB;IAChD,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACtD,CAAC;AAFD,kCAEC;AAED,SAAgB,UAAU,CAAC,QAAqB,EAAE,MAAc,EAAE,EAAU;IAC1E,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC,CAAA;IACpB,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AACrC,CAAC;AAHD,gCAGC;AAED,MAAM,MAAM,GAAG,uBAAuB,CAAA;AAEtC,SAAgB,aAAa,CAAY,MAAiB,EAAE,MAAc;IACxE,IAAI,OAAO,MAAM,IAAI,SAAS;QAAE,OAAO,EAAE,CAAA;IACzC,MAAM,EAAC,QAAQ,EAAE,WAAW,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IACzC,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAA;IACrD,MAAM,OAAO,GAAmC,EAAC,EAAE,EAAE,KAAK,EAAC,CAAA;IAC3D,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;IACzD,MAAM,SAAS,GAAc,EAAE,CAAA;IAC/B,MAAM,UAAU,GAAgB,IAAI,GAAG,EAAE,CAAA;IAEzC,QAAQ,CAAC,MAAM,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE;QACnE,IAAI,aAAa,KAAK,SAAS;YAAE,OAAM;QACvC,MAAM,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAA;QACrC,IAAI,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;QACnC,IAAI,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,QAAQ;YAAE,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAA;QAC/E,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;QACjC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,cAAc,CAAC,CAAA;QACxC,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM,CAAA;QAEzB,SAAS,MAAM,CAAY,GAAW;YACpC,6DAA6D;YAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAA;YAC9C,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YACvD,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAA;YAC5C,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACnB,IAAI,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YAC7B,IAAI,OAAO,QAAQ,IAAI,QAAQ;gBAAE,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YAC/D,IAAI,OAAO,QAAQ,IAAI,QAAQ,EAAE;gBAC/B,gBAAgB,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;aAC5C;iBAAM,IAAI,GAAG,KAAK,WAAW,CAAC,QAAQ,CAAC,EAAE;gBACxC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;oBAClB,gBAAgB,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;oBAC1C,SAAS,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;iBACrB;qBAAM;oBACL,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAA;iBAC1B;aACF;YACD,OAAO,GAAG,CAAA;QACZ,CAAC;QAED,SAAS,SAAS,CAAY,MAAe;YAC3C,IAAI,OAAO,MAAM,IAAI,QAAQ,EAAE;gBAC7B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,GAAG,CAAC,CAAA;gBACvE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC,CAAA;aAChC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;IAEhB,SAAS,gBAAgB,CAAC,IAAe,EAAE,IAA2B,EAAE,GAAW;QACjF,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;YAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAA;IACnE,CAAC;IAED,SAAS,QAAQ,CAAC,GAAW;QAC3B,OAAO,IAAI,KAAK,CAAC,cAAc,GAAG,oCAAoC,CAAC,CAAA;IACzE,CAAC;AACH,CAAC;AAxDD,sCAwDC"}
|
28
node_modules/ajv/dist/compile/rules.d.ts
generated
vendored
28
node_modules/ajv/dist/compile/rules.d.ts
generated
vendored
@ -1,28 +0,0 @@
|
||||
import type { AddedKeywordDefinition } from "../types";
|
||||
declare const _jsonTypes: readonly ["string", "number", "integer", "boolean", "null", "object", "array"];
|
||||
export declare type JSONType = typeof _jsonTypes[number];
|
||||
export declare function isJSONType(x: unknown): x is JSONType;
|
||||
declare type ValidationTypes = {
|
||||
[K in JSONType]: boolean | RuleGroup | undefined;
|
||||
};
|
||||
export interface ValidationRules {
|
||||
rules: RuleGroup[];
|
||||
post: RuleGroup;
|
||||
all: {
|
||||
[Key in string]?: boolean | Rule;
|
||||
};
|
||||
keywords: {
|
||||
[Key in string]?: boolean;
|
||||
};
|
||||
types: ValidationTypes;
|
||||
}
|
||||
export interface RuleGroup {
|
||||
type?: JSONType;
|
||||
rules: Rule[];
|
||||
}
|
||||
export interface Rule {
|
||||
keyword: string;
|
||||
definition: AddedKeywordDefinition;
|
||||
}
|
||||
export declare function getRules(): ValidationRules;
|
||||
export {};
|
26
node_modules/ajv/dist/compile/rules.js
generated
vendored
26
node_modules/ajv/dist/compile/rules.js
generated
vendored
@ -1,26 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getRules = exports.isJSONType = void 0;
|
||||
const _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"];
|
||||
const jsonTypes = new Set(_jsonTypes);
|
||||
function isJSONType(x) {
|
||||
return typeof x == "string" && jsonTypes.has(x);
|
||||
}
|
||||
exports.isJSONType = isJSONType;
|
||||
function getRules() {
|
||||
const groups = {
|
||||
number: { type: "number", rules: [] },
|
||||
string: { type: "string", rules: [] },
|
||||
array: { type: "array", rules: [] },
|
||||
object: { type: "object", rules: [] },
|
||||
};
|
||||
return {
|
||||
types: { ...groups, integer: true, boolean: true, null: true },
|
||||
rules: [{ rules: [] }, groups.number, groups.string, groups.array, groups.object],
|
||||
post: { rules: [] },
|
||||
all: {},
|
||||
keywords: {},
|
||||
};
|
||||
}
|
||||
exports.getRules = getRules;
|
||||
//# sourceMappingURL=rules.js.map
|
1
node_modules/ajv/dist/compile/rules.js.map
generated
vendored
1
node_modules/ajv/dist/compile/rules.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../lib/compile/rules.ts"],"names":[],"mappings":";;;AAEA,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAA;AAIjG,MAAM,SAAS,GAAgB,IAAI,GAAG,CAAC,UAAU,CAAC,CAAA;AAElD,SAAgB,UAAU,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,IAAI,QAAQ,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AACjD,CAAC;AAFD,gCAEC;AAyBD,SAAgB,QAAQ;IACtB,MAAM,MAAM,GAAgE;QAC1E,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;QACnC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;QACnC,KAAK,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAC;QACjC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;KACpC,CAAA;IACD,OAAO;QACL,KAAK,EAAE,EAAC,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC;QAC5D,KAAK,EAAE,CAAC,EAAC,KAAK,EAAE,EAAE,EAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;QAC/E,IAAI,EAAE,EAAC,KAAK,EAAE,EAAE,EAAC;QACjB,GAAG,EAAE,EAAE;QACP,QAAQ,EAAE,EAAE;KACb,CAAA;AACH,CAAC;AAdD,4BAcC"}
|
40
node_modules/ajv/dist/compile/util.d.ts
generated
vendored
40
node_modules/ajv/dist/compile/util.d.ts
generated
vendored
@ -1,40 +0,0 @@
|
||||
import type { AnySchema, EvaluatedProperties, EvaluatedItems } from "../types";
|
||||
import type { SchemaCxt, SchemaObjCxt } from ".";
|
||||
import { Code, Name, CodeGen } from "./codegen";
|
||||
import type { Rule, ValidationRules } from "./rules";
|
||||
export declare function toHash<T extends string = string>(arr: T[]): {
|
||||
[K in T]?: true;
|
||||
};
|
||||
export declare function alwaysValidSchema(it: SchemaCxt, schema: AnySchema): boolean | void;
|
||||
export declare function checkUnknownRules(it: SchemaCxt, schema?: AnySchema): void;
|
||||
export declare function schemaHasRules(schema: AnySchema, rules: {
|
||||
[Key in string]?: boolean | Rule;
|
||||
}): boolean;
|
||||
export declare function schemaHasRulesButRef(schema: AnySchema, RULES: ValidationRules): boolean;
|
||||
export declare function schemaRefOrVal({ topSchemaRef, schemaPath }: SchemaObjCxt, schema: unknown, keyword: string, $data?: string | false): Code | number | boolean;
|
||||
export declare function unescapeFragment(str: string): string;
|
||||
export declare function escapeFragment(str: string | number): string;
|
||||
export declare function escapeJsonPointer(str: string | number): string;
|
||||
export declare function unescapeJsonPointer(str: string): string;
|
||||
export declare function eachItem<T>(xs: T | T[], f: (x: T) => void): void;
|
||||
declare type SomeEvaluated = EvaluatedProperties | EvaluatedItems;
|
||||
declare type MergeEvaluatedFunc<T extends SomeEvaluated> = (gen: CodeGen, from: Name | T, to: Name | Exclude<T, true> | undefined, toName?: typeof Name) => Name | T;
|
||||
interface MergeEvaluated {
|
||||
props: MergeEvaluatedFunc<EvaluatedProperties>;
|
||||
items: MergeEvaluatedFunc<EvaluatedItems>;
|
||||
}
|
||||
export declare const mergeEvaluated: MergeEvaluated;
|
||||
export declare function evaluatedPropsToName(gen: CodeGen, ps?: EvaluatedProperties): Name;
|
||||
export declare function setEvaluated(gen: CodeGen, props: Name, ps: {
|
||||
[K in string]?: true;
|
||||
}): void;
|
||||
export declare function useFunc(gen: CodeGen, f: {
|
||||
code: string;
|
||||
}): Name;
|
||||
export declare enum Type {
|
||||
Num = 0,
|
||||
Str = 1
|
||||
}
|
||||
export declare function getErrorPath(dataProp: Name | string | number, dataPropType?: Type, jsPropertySyntax?: boolean): Code | string;
|
||||
export declare function checkStrictMode(it: SchemaCxt, msg: string, mode?: boolean | "log"): void;
|
||||
export {};
|
178
node_modules/ajv/dist/compile/util.js
generated
vendored
178
node_modules/ajv/dist/compile/util.js
generated
vendored
@ -1,178 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = void 0;
|
||||
const codegen_1 = require("./codegen");
|
||||
const code_1 = require("./codegen/code");
|
||||
// TODO refactor to use Set
|
||||
function toHash(arr) {
|
||||
const hash = {};
|
||||
for (const item of arr)
|
||||
hash[item] = true;
|
||||
return hash;
|
||||
}
|
||||
exports.toHash = toHash;
|
||||
function alwaysValidSchema(it, schema) {
|
||||
if (typeof schema == "boolean")
|
||||
return schema;
|
||||
if (Object.keys(schema).length === 0)
|
||||
return true;
|
||||
checkUnknownRules(it, schema);
|
||||
return !schemaHasRules(schema, it.self.RULES.all);
|
||||
}
|
||||
exports.alwaysValidSchema = alwaysValidSchema;
|
||||
function checkUnknownRules(it, schema = it.schema) {
|
||||
const { opts, self } = it;
|
||||
if (!opts.strictSchema)
|
||||
return;
|
||||
if (typeof schema === "boolean")
|
||||
return;
|
||||
const rules = self.RULES.keywords;
|
||||
for (const key in schema) {
|
||||
if (!rules[key])
|
||||
checkStrictMode(it, `unknown keyword: "${key}"`);
|
||||
}
|
||||
}
|
||||
exports.checkUnknownRules = checkUnknownRules;
|
||||
function schemaHasRules(schema, rules) {
|
||||
if (typeof schema == "boolean")
|
||||
return !schema;
|
||||
for (const key in schema)
|
||||
if (rules[key])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
exports.schemaHasRules = schemaHasRules;
|
||||
function schemaHasRulesButRef(schema, RULES) {
|
||||
if (typeof schema == "boolean")
|
||||
return !schema;
|
||||
for (const key in schema)
|
||||
if (key !== "$ref" && RULES.all[key])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
exports.schemaHasRulesButRef = schemaHasRulesButRef;
|
||||
function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword, $data) {
|
||||
if (!$data) {
|
||||
if (typeof schema == "number" || typeof schema == "boolean")
|
||||
return schema;
|
||||
if (typeof schema == "string")
|
||||
return (0, codegen_1._) `${schema}`;
|
||||
}
|
||||
return (0, codegen_1._) `${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
|
||||
}
|
||||
exports.schemaRefOrVal = schemaRefOrVal;
|
||||
function unescapeFragment(str) {
|
||||
return unescapeJsonPointer(decodeURIComponent(str));
|
||||
}
|
||||
exports.unescapeFragment = unescapeFragment;
|
||||
function escapeFragment(str) {
|
||||
return encodeURIComponent(escapeJsonPointer(str));
|
||||
}
|
||||
exports.escapeFragment = escapeFragment;
|
||||
function escapeJsonPointer(str) {
|
||||
if (typeof str == "number")
|
||||
return `${str}`;
|
||||
return str.replace(/~/g, "~0").replace(/\//g, "~1");
|
||||
}
|
||||
exports.escapeJsonPointer = escapeJsonPointer;
|
||||
function unescapeJsonPointer(str) {
|
||||
return str.replace(/~1/g, "/").replace(/~0/g, "~");
|
||||
}
|
||||
exports.unescapeJsonPointer = unescapeJsonPointer;
|
||||
function eachItem(xs, f) {
|
||||
if (Array.isArray(xs)) {
|
||||
for (const x of xs)
|
||||
f(x);
|
||||
}
|
||||
else {
|
||||
f(xs);
|
||||
}
|
||||
}
|
||||
exports.eachItem = eachItem;
|
||||
function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName, }) {
|
||||
return (gen, from, to, toName) => {
|
||||
const res = to === undefined
|
||||
? from
|
||||
: to instanceof codegen_1.Name
|
||||
? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to)
|
||||
: from instanceof codegen_1.Name
|
||||
? (mergeToName(gen, to, from), from)
|
||||
: mergeValues(from, to);
|
||||
return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res;
|
||||
};
|
||||
}
|
||||
exports.mergeEvaluated = {
|
||||
props: makeMergeEvaluated({
|
||||
mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => {
|
||||
gen.if((0, codegen_1._) `${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._) `${to} || {}`).code((0, codegen_1._) `Object.assign(${to}, ${from})`));
|
||||
}),
|
||||
mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => {
|
||||
if (from === true) {
|
||||
gen.assign(to, true);
|
||||
}
|
||||
else {
|
||||
gen.assign(to, (0, codegen_1._) `${to} || {}`);
|
||||
setEvaluated(gen, to, from);
|
||||
}
|
||||
}),
|
||||
mergeValues: (from, to) => (from === true ? true : { ...from, ...to }),
|
||||
resultToName: evaluatedPropsToName,
|
||||
}),
|
||||
items: makeMergeEvaluated({
|
||||
mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1._) `${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
|
||||
mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1._) `${to} > ${from} ? ${to} : ${from}`)),
|
||||
mergeValues: (from, to) => (from === true ? true : Math.max(from, to)),
|
||||
resultToName: (gen, items) => gen.var("items", items),
|
||||
}),
|
||||
};
|
||||
function evaluatedPropsToName(gen, ps) {
|
||||
if (ps === true)
|
||||
return gen.var("props", true);
|
||||
const props = gen.var("props", (0, codegen_1._) `{}`);
|
||||
if (ps !== undefined)
|
||||
setEvaluated(gen, props, ps);
|
||||
return props;
|
||||
}
|
||||
exports.evaluatedPropsToName = evaluatedPropsToName;
|
||||
function setEvaluated(gen, props, ps) {
|
||||
Object.keys(ps).forEach((p) => gen.assign((0, codegen_1._) `${props}${(0, codegen_1.getProperty)(p)}`, true));
|
||||
}
|
||||
exports.setEvaluated = setEvaluated;
|
||||
const snippets = {};
|
||||
function useFunc(gen, f) {
|
||||
return gen.scopeValue("func", {
|
||||
ref: f,
|
||||
code: snippets[f.code] || (snippets[f.code] = new code_1._Code(f.code)),
|
||||
});
|
||||
}
|
||||
exports.useFunc = useFunc;
|
||||
var Type;
|
||||
(function (Type) {
|
||||
Type[Type["Num"] = 0] = "Num";
|
||||
Type[Type["Str"] = 1] = "Str";
|
||||
})(Type = exports.Type || (exports.Type = {}));
|
||||
function getErrorPath(dataProp, dataPropType, jsPropertySyntax) {
|
||||
// let path
|
||||
if (dataProp instanceof codegen_1.Name) {
|
||||
const isNumber = dataPropType === Type.Num;
|
||||
return jsPropertySyntax
|
||||
? isNumber
|
||||
? (0, codegen_1._) `"[" + ${dataProp} + "]"`
|
||||
: (0, codegen_1._) `"['" + ${dataProp} + "']"`
|
||||
: isNumber
|
||||
? (0, codegen_1._) `"/" + ${dataProp}`
|
||||
: (0, codegen_1._) `"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`; // TODO maybe use global escapePointer
|
||||
}
|
||||
return jsPropertySyntax ? (0, codegen_1.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
|
||||
}
|
||||
exports.getErrorPath = getErrorPath;
|
||||
function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
|
||||
if (!mode)
|
||||
return;
|
||||
msg = `strict mode: ${msg}`;
|
||||
if (mode === true)
|
||||
throw new Error(msg);
|
||||
it.self.logger.warn(msg);
|
||||
}
|
||||
exports.checkStrictMode = checkStrictMode;
|
||||
//# sourceMappingURL=util.js.map
|
1
node_modules/ajv/dist/compile/util.js.map
generated
vendored
1
node_modules/ajv/dist/compile/util.js.map
generated
vendored
File diff suppressed because one or more lines are too long
6
node_modules/ajv/dist/compile/validate/applicability.d.ts
generated
vendored
6
node_modules/ajv/dist/compile/validate/applicability.d.ts
generated
vendored
@ -1,6 +0,0 @@
|
||||
import type { AnySchemaObject } from "../../types";
|
||||
import type { SchemaObjCxt } from "..";
|
||||
import type { JSONType, RuleGroup, Rule } from "../rules";
|
||||
export declare function schemaHasRulesForType({ schema, self }: SchemaObjCxt, type: JSONType): boolean | undefined;
|
||||
export declare function shouldUseGroup(schema: AnySchemaObject, group: RuleGroup): boolean;
|
||||
export declare function shouldUseRule(schema: AnySchemaObject, rule: Rule): boolean | undefined;
|
19
node_modules/ajv/dist/compile/validate/applicability.js
generated
vendored
19
node_modules/ajv/dist/compile/validate/applicability.js
generated
vendored
@ -1,19 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0;
|
||||
function schemaHasRulesForType({ schema, self }, type) {
|
||||
const group = self.RULES.types[type];
|
||||
return group && group !== true && shouldUseGroup(schema, group);
|
||||
}
|
||||
exports.schemaHasRulesForType = schemaHasRulesForType;
|
||||
function shouldUseGroup(schema, group) {
|
||||
return group.rules.some((rule) => shouldUseRule(schema, rule));
|
||||
}
|
||||
exports.shouldUseGroup = shouldUseGroup;
|
||||
function shouldUseRule(schema, rule) {
|
||||
var _a;
|
||||
return (schema[rule.keyword] !== undefined ||
|
||||
((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== undefined)));
|
||||
}
|
||||
exports.shouldUseRule = shouldUseRule;
|
||||
//# sourceMappingURL=applicability.js.map
|
1
node_modules/ajv/dist/compile/validate/applicability.js.map
generated
vendored
1
node_modules/ajv/dist/compile/validate/applicability.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"applicability.js","sourceRoot":"","sources":["../../../lib/compile/validate/applicability.ts"],"names":[],"mappings":";;;AAIA,SAAgB,qBAAqB,CACnC,EAAC,MAAM,EAAE,IAAI,EAAe,EAC5B,IAAc;IAEd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACpC,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,IAAI,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AACjE,CAAC;AAND,sDAMC;AAED,SAAgB,cAAc,CAAC,MAAuB,EAAE,KAAgB;IACtE,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;AAChE,CAAC;AAFD,wCAEC;AAED,SAAgB,aAAa,CAAC,MAAuB,EAAE,IAAU;;IAC/D,OAAO,CACL,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,SAAS;SAClC,MAAA,IAAI,CAAC,UAAU,CAAC,UAAU,0CAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAA,CACrE,CAAA;AACH,CAAC;AALD,sCAKC"}
|
4
node_modules/ajv/dist/compile/validate/boolSchema.d.ts
generated
vendored
4
node_modules/ajv/dist/compile/validate/boolSchema.d.ts
generated
vendored
@ -1,4 +0,0 @@
|
||||
import type { SchemaCxt } from "..";
|
||||
import { Name } from "../codegen";
|
||||
export declare function topBoolOrEmptySchema(it: SchemaCxt): void;
|
||||
export declare function boolOrEmptySchema(it: SchemaCxt, valid: Name): void;
|
50
node_modules/ajv/dist/compile/validate/boolSchema.js
generated
vendored
50
node_modules/ajv/dist/compile/validate/boolSchema.js
generated
vendored
@ -1,50 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0;
|
||||
const errors_1 = require("../errors");
|
||||
const codegen_1 = require("../codegen");
|
||||
const names_1 = require("../names");
|
||||
const boolError = {
|
||||
message: "boolean schema is false",
|
||||
};
|
||||
function topBoolOrEmptySchema(it) {
|
||||
const { gen, schema, validateName } = it;
|
||||
if (schema === false) {
|
||||
falseSchemaError(it, false);
|
||||
}
|
||||
else if (typeof schema == "object" && schema.$async === true) {
|
||||
gen.return(names_1.default.data);
|
||||
}
|
||||
else {
|
||||
gen.assign((0, codegen_1._) `${validateName}.errors`, null);
|
||||
gen.return(true);
|
||||
}
|
||||
}
|
||||
exports.topBoolOrEmptySchema = topBoolOrEmptySchema;
|
||||
function boolOrEmptySchema(it, valid) {
|
||||
const { gen, schema } = it;
|
||||
if (schema === false) {
|
||||
gen.var(valid, false); // TODO var
|
||||
falseSchemaError(it);
|
||||
}
|
||||
else {
|
||||
gen.var(valid, true); // TODO var
|
||||
}
|
||||
}
|
||||
exports.boolOrEmptySchema = boolOrEmptySchema;
|
||||
function falseSchemaError(it, overrideAllErrors) {
|
||||
const { gen, data } = it;
|
||||
// TODO maybe some other interface should be used for non-keyword validation errors...
|
||||
const cxt = {
|
||||
gen,
|
||||
keyword: "false schema",
|
||||
data,
|
||||
schema: false,
|
||||
schemaCode: false,
|
||||
schemaValue: false,
|
||||
params: {},
|
||||
it,
|
||||
};
|
||||
(0, errors_1.reportError)(cxt, boolError, undefined, overrideAllErrors);
|
||||
}
|
||||
//# sourceMappingURL=boolSchema.js.map
|
1
node_modules/ajv/dist/compile/validate/boolSchema.js.map
generated
vendored
1
node_modules/ajv/dist/compile/validate/boolSchema.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"boolSchema.js","sourceRoot":"","sources":["../../../lib/compile/validate/boolSchema.ts"],"names":[],"mappings":";;;AAEA,sCAAqC;AACrC,wCAAkC;AAClC,oCAAwB;AAExB,MAAM,SAAS,GAA2B;IACxC,OAAO,EAAE,yBAAyB;CACnC,CAAA;AAED,SAAgB,oBAAoB,CAAC,EAAa;IAChD,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAC,GAAG,EAAE,CAAA;IACtC,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,gBAAgB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;KAC5B;SAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,EAAE;QAC9D,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,IAAI,CAAC,CAAA;KACnB;SAAM;QACL,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,YAAY,SAAS,EAAE,IAAI,CAAC,CAAA;QAC3C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;KACjB;AACH,CAAC;AAVD,oDAUC;AAED,SAAgB,iBAAiB,CAAC,EAAa,EAAE,KAAW;IAC1D,MAAM,EAAC,GAAG,EAAE,MAAM,EAAC,GAAG,EAAE,CAAA;IACxB,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA,CAAC,WAAW;QACjC,gBAAgB,CAAC,EAAE,CAAC,CAAA;KACrB;SAAM;QACL,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA,CAAC,WAAW;KACjC;AACH,CAAC;AARD,8CAQC;AAED,SAAS,gBAAgB,CAAC,EAAa,EAAE,iBAA2B;IAClE,MAAM,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IACtB,sFAAsF;IACtF,MAAM,GAAG,GAAoB;QAC3B,GAAG;QACH,OAAO,EAAE,cAAc;QACvB,IAAI;QACJ,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,EAAE;QACV,EAAE;KACH,CAAA;IACD,IAAA,oBAAW,EAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAA;AAC3D,CAAC"}
|
17
node_modules/ajv/dist/compile/validate/dataType.d.ts
generated
vendored
17
node_modules/ajv/dist/compile/validate/dataType.d.ts
generated
vendored
@ -1,17 +0,0 @@
|
||||
import type { ErrorObject, AnySchemaObject } from "../../types";
|
||||
import type { SchemaObjCxt } from "..";
|
||||
import { JSONType } from "../rules";
|
||||
import { Code, Name } from "../codegen";
|
||||
export declare enum DataType {
|
||||
Correct = 0,
|
||||
Wrong = 1
|
||||
}
|
||||
export declare function getSchemaTypes(schema: AnySchemaObject): JSONType[];
|
||||
export declare function getJSONTypes(ts: unknown | unknown[]): JSONType[];
|
||||
export declare function coerceAndCheckDataType(it: SchemaObjCxt, types: JSONType[]): boolean;
|
||||
export declare function checkDataType(dataType: JSONType, data: Name, strictNums?: boolean | "log", correct?: DataType): Code;
|
||||
export declare function checkDataTypes(dataTypes: JSONType[], data: Name, strictNums?: boolean | "log", correct?: DataType): Code;
|
||||
export declare type TypeError = ErrorObject<"type", {
|
||||
type: string;
|
||||
}>;
|
||||
export declare function reportTypeError(it: SchemaObjCxt): void;
|
202
node_modules/ajv/dist/compile/validate/dataType.js
generated
vendored
202
node_modules/ajv/dist/compile/validate/dataType.js
generated
vendored
@ -1,202 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0;
|
||||
const rules_1 = require("../rules");
|
||||
const applicability_1 = require("./applicability");
|
||||
const errors_1 = require("../errors");
|
||||
const codegen_1 = require("../codegen");
|
||||
const util_1 = require("../util");
|
||||
var DataType;
|
||||
(function (DataType) {
|
||||
DataType[DataType["Correct"] = 0] = "Correct";
|
||||
DataType[DataType["Wrong"] = 1] = "Wrong";
|
||||
})(DataType = exports.DataType || (exports.DataType = {}));
|
||||
function getSchemaTypes(schema) {
|
||||
const types = getJSONTypes(schema.type);
|
||||
const hasNull = types.includes("null");
|
||||
if (hasNull) {
|
||||
if (schema.nullable === false)
|
||||
throw new Error("type: null contradicts nullable: false");
|
||||
}
|
||||
else {
|
||||
if (!types.length && schema.nullable !== undefined) {
|
||||
throw new Error('"nullable" cannot be used without "type"');
|
||||
}
|
||||
if (schema.nullable === true)
|
||||
types.push("null");
|
||||
}
|
||||
return types;
|
||||
}
|
||||
exports.getSchemaTypes = getSchemaTypes;
|
||||
function getJSONTypes(ts) {
|
||||
const types = Array.isArray(ts) ? ts : ts ? [ts] : [];
|
||||
if (types.every(rules_1.isJSONType))
|
||||
return types;
|
||||
throw new Error("type must be JSONType or JSONType[]: " + types.join(","));
|
||||
}
|
||||
exports.getJSONTypes = getJSONTypes;
|
||||
function coerceAndCheckDataType(it, types) {
|
||||
const { gen, data, opts } = it;
|
||||
const coerceTo = coerceToTypes(types, opts.coerceTypes);
|
||||
const checkTypes = types.length > 0 &&
|
||||
!(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0]));
|
||||
if (checkTypes) {
|
||||
const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong);
|
||||
gen.if(wrongType, () => {
|
||||
if (coerceTo.length)
|
||||
coerceData(it, types, coerceTo);
|
||||
else
|
||||
reportTypeError(it);
|
||||
});
|
||||
}
|
||||
return checkTypes;
|
||||
}
|
||||
exports.coerceAndCheckDataType = coerceAndCheckDataType;
|
||||
const COERCIBLE = new Set(["string", "number", "integer", "boolean", "null"]);
|
||||
function coerceToTypes(types, coerceTypes) {
|
||||
return coerceTypes
|
||||
? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === "array" && t === "array"))
|
||||
: [];
|
||||
}
|
||||
function coerceData(it, types, coerceTo) {
|
||||
const { gen, data, opts } = it;
|
||||
const dataType = gen.let("dataType", (0, codegen_1._) `typeof ${data}`);
|
||||
const coerced = gen.let("coerced", (0, codegen_1._) `undefined`);
|
||||
if (opts.coerceTypes === "array") {
|
||||
gen.if((0, codegen_1._) `${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen
|
||||
.assign(data, (0, codegen_1._) `${data}[0]`)
|
||||
.assign(dataType, (0, codegen_1._) `typeof ${data}`)
|
||||
.if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data)));
|
||||
}
|
||||
gen.if((0, codegen_1._) `${coerced} !== undefined`);
|
||||
for (const t of coerceTo) {
|
||||
if (COERCIBLE.has(t) || (t === "array" && opts.coerceTypes === "array")) {
|
||||
coerceSpecificType(t);
|
||||
}
|
||||
}
|
||||
gen.else();
|
||||
reportTypeError(it);
|
||||
gen.endIf();
|
||||
gen.if((0, codegen_1._) `${coerced} !== undefined`, () => {
|
||||
gen.assign(data, coerced);
|
||||
assignParentData(it, coerced);
|
||||
});
|
||||
function coerceSpecificType(t) {
|
||||
switch (t) {
|
||||
case "string":
|
||||
gen
|
||||
.elseIf((0, codegen_1._) `${dataType} == "number" || ${dataType} == "boolean"`)
|
||||
.assign(coerced, (0, codegen_1._) `"" + ${data}`)
|
||||
.elseIf((0, codegen_1._) `${data} === null`)
|
||||
.assign(coerced, (0, codegen_1._) `""`);
|
||||
return;
|
||||
case "number":
|
||||
gen
|
||||
.elseIf((0, codegen_1._) `${dataType} == "boolean" || ${data} === null
|
||||
|| (${dataType} == "string" && ${data} && ${data} == +${data})`)
|
||||
.assign(coerced, (0, codegen_1._) `+${data}`);
|
||||
return;
|
||||
case "integer":
|
||||
gen
|
||||
.elseIf((0, codegen_1._) `${dataType} === "boolean" || ${data} === null
|
||||
|| (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`)
|
||||
.assign(coerced, (0, codegen_1._) `+${data}`);
|
||||
return;
|
||||
case "boolean":
|
||||
gen
|
||||
.elseIf((0, codegen_1._) `${data} === "false" || ${data} === 0 || ${data} === null`)
|
||||
.assign(coerced, false)
|
||||
.elseIf((0, codegen_1._) `${data} === "true" || ${data} === 1`)
|
||||
.assign(coerced, true);
|
||||
return;
|
||||
case "null":
|
||||
gen.elseIf((0, codegen_1._) `${data} === "" || ${data} === 0 || ${data} === false`);
|
||||
gen.assign(coerced, null);
|
||||
return;
|
||||
case "array":
|
||||
gen
|
||||
.elseIf((0, codegen_1._) `${dataType} === "string" || ${dataType} === "number"
|
||||
|| ${dataType} === "boolean" || ${data} === null`)
|
||||
.assign(coerced, (0, codegen_1._) `[${data}]`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function assignParentData({ gen, parentData, parentDataProperty }, expr) {
|
||||
// TODO use gen.property
|
||||
gen.if((0, codegen_1._) `${parentData} !== undefined`, () => gen.assign((0, codegen_1._) `${parentData}[${parentDataProperty}]`, expr));
|
||||
}
|
||||
function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
|
||||
const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;
|
||||
let cond;
|
||||
switch (dataType) {
|
||||
case "null":
|
||||
return (0, codegen_1._) `${data} ${EQ} null`;
|
||||
case "array":
|
||||
cond = (0, codegen_1._) `Array.isArray(${data})`;
|
||||
break;
|
||||
case "object":
|
||||
cond = (0, codegen_1._) `${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
|
||||
break;
|
||||
case "integer":
|
||||
cond = numCond((0, codegen_1._) `!(${data} % 1) && !isNaN(${data})`);
|
||||
break;
|
||||
case "number":
|
||||
cond = numCond();
|
||||
break;
|
||||
default:
|
||||
return (0, codegen_1._) `typeof ${data} ${EQ} ${dataType}`;
|
||||
}
|
||||
return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);
|
||||
function numCond(_cond = codegen_1.nil) {
|
||||
return (0, codegen_1.and)((0, codegen_1._) `typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1._) `isFinite(${data})` : codegen_1.nil);
|
||||
}
|
||||
}
|
||||
exports.checkDataType = checkDataType;
|
||||
function checkDataTypes(dataTypes, data, strictNums, correct) {
|
||||
if (dataTypes.length === 1) {
|
||||
return checkDataType(dataTypes[0], data, strictNums, correct);
|
||||
}
|
||||
let cond;
|
||||
const types = (0, util_1.toHash)(dataTypes);
|
||||
if (types.array && types.object) {
|
||||
const notObj = (0, codegen_1._) `typeof ${data} != "object"`;
|
||||
cond = types.null ? notObj : (0, codegen_1._) `!${data} || ${notObj}`;
|
||||
delete types.null;
|
||||
delete types.array;
|
||||
delete types.object;
|
||||
}
|
||||
else {
|
||||
cond = codegen_1.nil;
|
||||
}
|
||||
if (types.number)
|
||||
delete types.integer;
|
||||
for (const t in types)
|
||||
cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct));
|
||||
return cond;
|
||||
}
|
||||
exports.checkDataTypes = checkDataTypes;
|
||||
const typeError = {
|
||||
message: ({ schema }) => `must be ${schema}`,
|
||||
params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1._) `{type: ${schema}}` : (0, codegen_1._) `{type: ${schemaValue}}`,
|
||||
};
|
||||
function reportTypeError(it) {
|
||||
const cxt = getTypeErrorContext(it);
|
||||
(0, errors_1.reportError)(cxt, typeError);
|
||||
}
|
||||
exports.reportTypeError = reportTypeError;
|
||||
function getTypeErrorContext(it) {
|
||||
const { gen, data, schema } = it;
|
||||
const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, "type");
|
||||
return {
|
||||
gen,
|
||||
keyword: "type",
|
||||
data,
|
||||
schema: schema.type,
|
||||
schemaCode,
|
||||
schemaValue: schemaCode,
|
||||
parentSchema: schema,
|
||||
params: {},
|
||||
it,
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=dataType.js.map
|
1
node_modules/ajv/dist/compile/validate/dataType.js.map
generated
vendored
1
node_modules/ajv/dist/compile/validate/dataType.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/ajv/dist/compile/validate/defaults.d.ts
generated
vendored
2
node_modules/ajv/dist/compile/validate/defaults.d.ts
generated
vendored
@ -1,2 +0,0 @@
|
||||
import type { SchemaObjCxt } from "..";
|
||||
export declare function assignDefaults(it: SchemaObjCxt, ty?: string): void;
|
35
node_modules/ajv/dist/compile/validate/defaults.js
generated
vendored
35
node_modules/ajv/dist/compile/validate/defaults.js
generated
vendored
@ -1,35 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.assignDefaults = void 0;
|
||||
const codegen_1 = require("../codegen");
|
||||
const util_1 = require("../util");
|
||||
function assignDefaults(it, ty) {
|
||||
const { properties, items } = it.schema;
|
||||
if (ty === "object" && properties) {
|
||||
for (const key in properties) {
|
||||
assignDefault(it, key, properties[key].default);
|
||||
}
|
||||
}
|
||||
else if (ty === "array" && Array.isArray(items)) {
|
||||
items.forEach((sch, i) => assignDefault(it, i, sch.default));
|
||||
}
|
||||
}
|
||||
exports.assignDefaults = assignDefaults;
|
||||
function assignDefault(it, prop, defaultValue) {
|
||||
const { gen, compositeRule, data, opts } = it;
|
||||
if (defaultValue === undefined)
|
||||
return;
|
||||
const childData = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(prop)}`;
|
||||
if (compositeRule) {
|
||||
(0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`);
|
||||
return;
|
||||
}
|
||||
let condition = (0, codegen_1._) `${childData} === undefined`;
|
||||
if (opts.useDefaults === "empty") {
|
||||
condition = (0, codegen_1._) `${condition} || ${childData} === null || ${childData} === ""`;
|
||||
}
|
||||
// `${childData} === undefined` +
|
||||
// (opts.useDefaults === "empty" ? ` || ${childData} === null || ${childData} === ""` : "")
|
||||
gen.if(condition, (0, codegen_1._) `${childData} = ${(0, codegen_1.stringify)(defaultValue)}`);
|
||||
}
|
||||
//# sourceMappingURL=defaults.js.map
|
1
node_modules/ajv/dist/compile/validate/defaults.js.map
generated
vendored
1
node_modules/ajv/dist/compile/validate/defaults.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../lib/compile/validate/defaults.ts"],"names":[],"mappings":";;;AACA,wCAAoD;AACpD,kCAAuC;AAEvC,SAAgB,cAAc,CAAC,EAAgB,EAAE,EAAW;IAC1D,MAAM,EAAC,UAAU,EAAE,KAAK,EAAC,GAAG,EAAE,CAAC,MAAM,CAAA;IACrC,IAAI,EAAE,KAAK,QAAQ,IAAI,UAAU,EAAE;QACjC,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;YAC5B,aAAa,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAA;SAChD;KACF;SAAM,IAAI,EAAE,KAAK,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAS,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;KACrE;AACH,CAAC;AATD,wCASC;AAED,SAAS,aAAa,CAAC,EAAgB,EAAE,IAAqB,EAAE,YAAqB;IACnF,MAAM,EAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IAC3C,IAAI,YAAY,KAAK,SAAS;QAAE,OAAM;IACtC,MAAM,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,IAAI,CAAC,EAAE,CAAA;IAChD,IAAI,aAAa,EAAE;QACjB,IAAA,sBAAe,EAAC,EAAE,EAAE,2BAA2B,SAAS,EAAE,CAAC,CAAA;QAC3D,OAAM;KACP;IAED,IAAI,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,SAAS,gBAAgB,CAAA;IAC7C,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE;QAChC,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,SAAS,OAAO,SAAS,gBAAgB,SAAS,SAAS,CAAA;KAC5E;IACD,iCAAiC;IACjC,2FAA2F;IAC3F,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,IAAA,WAAC,EAAA,GAAG,SAAS,MAAM,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,CAAA;AACjE,CAAC"}
|
42
node_modules/ajv/dist/compile/validate/index.d.ts
generated
vendored
42
node_modules/ajv/dist/compile/validate/index.d.ts
generated
vendored
@ -1,42 +0,0 @@
|
||||
import type { AddedKeywordDefinition, AnySchemaObject, KeywordErrorCxt, KeywordCxtParams } from "../../types";
|
||||
import type { SchemaCxt, SchemaObjCxt } from "..";
|
||||
import { SubschemaArgs } from "./subschema";
|
||||
import { Code, Name, CodeGen } from "../codegen";
|
||||
import type { JSONType } from "../rules";
|
||||
import { ErrorPaths } from "../errors";
|
||||
export declare function validateFunctionCode(it: SchemaCxt): void;
|
||||
export declare class KeywordCxt implements KeywordErrorCxt {
|
||||
readonly gen: CodeGen;
|
||||
readonly allErrors?: boolean;
|
||||
readonly keyword: string;
|
||||
readonly data: Name;
|
||||
readonly $data?: string | false;
|
||||
schema: any;
|
||||
readonly schemaValue: Code | number | boolean;
|
||||
readonly schemaCode: Code | number | boolean;
|
||||
readonly schemaType: JSONType[];
|
||||
readonly parentSchema: AnySchemaObject;
|
||||
readonly errsCount?: Name;
|
||||
params: KeywordCxtParams;
|
||||
readonly it: SchemaObjCxt;
|
||||
readonly def: AddedKeywordDefinition;
|
||||
constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string);
|
||||
result(condition: Code, successAction?: () => void, failAction?: () => void): void;
|
||||
failResult(condition: Code, successAction?: () => void, failAction?: () => void): void;
|
||||
pass(condition: Code, failAction?: () => void): void;
|
||||
fail(condition?: Code): void;
|
||||
fail$data(condition: Code): void;
|
||||
error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void;
|
||||
private _error;
|
||||
$dataError(): void;
|
||||
reset(): void;
|
||||
ok(cond: Code | boolean): void;
|
||||
setParams(obj: KeywordCxtParams, assign?: true): void;
|
||||
block$data(valid: Name, codeBlock: () => void, $dataValid?: Code): void;
|
||||
check$data(valid?: Name, $dataValid?: Code): void;
|
||||
invalid$data(): Code;
|
||||
subschema(appl: SubschemaArgs, valid: Name): SchemaCxt;
|
||||
mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void;
|
||||
mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void;
|
||||
}
|
||||
export declare function getData($data: string, { dataLevel, dataNames, dataPathArr }: SchemaCxt): Code | number;
|
510
node_modules/ajv/dist/compile/validate/index.js
generated
vendored
510
node_modules/ajv/dist/compile/validate/index.js
generated
vendored
@ -1,510 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getData = exports.KeywordCxt = exports.validateFunctionCode = void 0;
|
||||
const boolSchema_1 = require("./boolSchema");
|
||||
const dataType_1 = require("./dataType");
|
||||
const applicability_1 = require("./applicability");
|
||||
const dataType_2 = require("./dataType");
|
||||
const defaults_1 = require("./defaults");
|
||||
const keyword_1 = require("./keyword");
|
||||
const subschema_1 = require("./subschema");
|
||||
const codegen_1 = require("../codegen");
|
||||
const names_1 = require("../names");
|
||||
const resolve_1 = require("../resolve");
|
||||
const util_1 = require("../util");
|
||||
const errors_1 = require("../errors");
|
||||
// schema compilation - generates validation function, subschemaCode (below) is used for subschemas
|
||||
function validateFunctionCode(it) {
|
||||
if (isSchemaObj(it)) {
|
||||
checkKeywords(it);
|
||||
if (schemaCxtHasRules(it)) {
|
||||
topSchemaObjCode(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
|
||||
}
|
||||
exports.validateFunctionCode = validateFunctionCode;
|
||||
function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) {
|
||||
if (opts.code.es5) {
|
||||
gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
|
||||
gen.code((0, codegen_1._) `"use strict"; ${funcSourceUrl(schema, opts)}`);
|
||||
destructureValCxtES5(gen, opts);
|
||||
gen.code(body);
|
||||
});
|
||||
}
|
||||
else {
|
||||
gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
|
||||
}
|
||||
}
|
||||
function destructureValCxt(opts) {
|
||||
return (0, codegen_1._) `{${names_1.default.instancePath}="", ${names_1.default.parentData}, ${names_1.default.parentDataProperty}, ${names_1.default.rootData}=${names_1.default.data}${opts.dynamicRef ? (0, codegen_1._) `, ${names_1.default.dynamicAnchors}={}` : codegen_1.nil}}={}`;
|
||||
}
|
||||
function destructureValCxtES5(gen, opts) {
|
||||
gen.if(names_1.default.valCxt, () => {
|
||||
gen.var(names_1.default.instancePath, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.instancePath}`);
|
||||
gen.var(names_1.default.parentData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentData}`);
|
||||
gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentDataProperty}`);
|
||||
gen.var(names_1.default.rootData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.rootData}`);
|
||||
if (opts.dynamicRef)
|
||||
gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.dynamicAnchors}`);
|
||||
}, () => {
|
||||
gen.var(names_1.default.instancePath, (0, codegen_1._) `""`);
|
||||
gen.var(names_1.default.parentData, (0, codegen_1._) `undefined`);
|
||||
gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `undefined`);
|
||||
gen.var(names_1.default.rootData, names_1.default.data);
|
||||
if (opts.dynamicRef)
|
||||
gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `{}`);
|
||||
});
|
||||
}
|
||||
function topSchemaObjCode(it) {
|
||||
const { schema, opts, gen } = it;
|
||||
validateFunction(it, () => {
|
||||
if (opts.$comment && schema.$comment)
|
||||
commentKeyword(it);
|
||||
checkNoDefault(it);
|
||||
gen.let(names_1.default.vErrors, null);
|
||||
gen.let(names_1.default.errors, 0);
|
||||
if (opts.unevaluated)
|
||||
resetEvaluated(it);
|
||||
typeAndKeywords(it);
|
||||
returnResults(it);
|
||||
});
|
||||
return;
|
||||
}
|
||||
function resetEvaluated(it) {
|
||||
// TODO maybe some hook to execute it in the end to check whether props/items are Name, as in assignEvaluated
|
||||
const { gen, validateName } = it;
|
||||
it.evaluated = gen.const("evaluated", (0, codegen_1._) `${validateName}.evaluated`);
|
||||
gen.if((0, codegen_1._) `${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._) `${it.evaluated}.props`, (0, codegen_1._) `undefined`));
|
||||
gen.if((0, codegen_1._) `${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._) `${it.evaluated}.items`, (0, codegen_1._) `undefined`));
|
||||
}
|
||||
function funcSourceUrl(schema, opts) {
|
||||
const schId = typeof schema == "object" && schema[opts.schemaId];
|
||||
return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._) `/*# sourceURL=${schId} */` : codegen_1.nil;
|
||||
}
|
||||
// schema compilation - this function is used recursively to generate code for sub-schemas
|
||||
function subschemaCode(it, valid) {
|
||||
if (isSchemaObj(it)) {
|
||||
checkKeywords(it);
|
||||
if (schemaCxtHasRules(it)) {
|
||||
subSchemaObjCode(it, valid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
(0, boolSchema_1.boolOrEmptySchema)(it, valid);
|
||||
}
|
||||
function schemaCxtHasRules({ schema, self }) {
|
||||
if (typeof schema == "boolean")
|
||||
return !schema;
|
||||
for (const key in schema)
|
||||
if (self.RULES.all[key])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
function isSchemaObj(it) {
|
||||
return typeof it.schema != "boolean";
|
||||
}
|
||||
function subSchemaObjCode(it, valid) {
|
||||
const { schema, gen, opts } = it;
|
||||
if (opts.$comment && schema.$comment)
|
||||
commentKeyword(it);
|
||||
updateContext(it);
|
||||
checkAsyncSchema(it);
|
||||
const errsCount = gen.const("_errs", names_1.default.errors);
|
||||
typeAndKeywords(it, errsCount);
|
||||
// TODO var
|
||||
gen.var(valid, (0, codegen_1._) `${errsCount} === ${names_1.default.errors}`);
|
||||
}
|
||||
function checkKeywords(it) {
|
||||
(0, util_1.checkUnknownRules)(it);
|
||||
checkRefsAndKeywords(it);
|
||||
}
|
||||
function typeAndKeywords(it, errsCount) {
|
||||
if (it.opts.jtd)
|
||||
return schemaKeywords(it, [], false, errsCount);
|
||||
const types = (0, dataType_1.getSchemaTypes)(it.schema);
|
||||
const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types);
|
||||
schemaKeywords(it, types, !checkedTypes, errsCount);
|
||||
}
|
||||
function checkRefsAndKeywords(it) {
|
||||
const { schema, errSchemaPath, opts, self } = it;
|
||||
if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema, self.RULES)) {
|
||||
self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
|
||||
}
|
||||
}
|
||||
function checkNoDefault(it) {
|
||||
const { schema, opts } = it;
|
||||
if (schema.default !== undefined && opts.useDefaults && opts.strictSchema) {
|
||||
(0, util_1.checkStrictMode)(it, "default is ignored in the schema root");
|
||||
}
|
||||
}
|
||||
function updateContext(it) {
|
||||
const schId = it.schema[it.opts.schemaId];
|
||||
if (schId)
|
||||
it.baseId = (0, resolve_1.resolveUrl)(it.opts.uriResolver, it.baseId, schId);
|
||||
}
|
||||
function checkAsyncSchema(it) {
|
||||
if (it.schema.$async && !it.schemaEnv.$async)
|
||||
throw new Error("async schema in sync schema");
|
||||
}
|
||||
function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
|
||||
const msg = schema.$comment;
|
||||
if (opts.$comment === true) {
|
||||
gen.code((0, codegen_1._) `${names_1.default.self}.logger.log(${msg})`);
|
||||
}
|
||||
else if (typeof opts.$comment == "function") {
|
||||
const schemaPath = (0, codegen_1.str) `${errSchemaPath}/$comment`;
|
||||
const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
|
||||
gen.code((0, codegen_1._) `${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
|
||||
}
|
||||
}
|
||||
function returnResults(it) {
|
||||
const { gen, schemaEnv, validateName, ValidationError, opts } = it;
|
||||
if (schemaEnv.$async) {
|
||||
// TODO assign unevaluated
|
||||
gen.if((0, codegen_1._) `${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._) `new ${ValidationError}(${names_1.default.vErrors})`));
|
||||
}
|
||||
else {
|
||||
gen.assign((0, codegen_1._) `${validateName}.errors`, names_1.default.vErrors);
|
||||
if (opts.unevaluated)
|
||||
assignEvaluated(it);
|
||||
gen.return((0, codegen_1._) `${names_1.default.errors} === 0`);
|
||||
}
|
||||
}
|
||||
function assignEvaluated({ gen, evaluated, props, items }) {
|
||||
if (props instanceof codegen_1.Name)
|
||||
gen.assign((0, codegen_1._) `${evaluated}.props`, props);
|
||||
if (items instanceof codegen_1.Name)
|
||||
gen.assign((0, codegen_1._) `${evaluated}.items`, items);
|
||||
}
|
||||
function schemaKeywords(it, types, typeErrors, errsCount) {
|
||||
const { gen, schema, data, allErrors, opts, self } = it;
|
||||
const { RULES } = self;
|
||||
if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES))) {
|
||||
gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition)); // TODO typecast
|
||||
return;
|
||||
}
|
||||
if (!opts.jtd)
|
||||
checkStrictTypes(it, types);
|
||||
gen.block(() => {
|
||||
for (const group of RULES.rules)
|
||||
groupKeywords(group);
|
||||
groupKeywords(RULES.post);
|
||||
});
|
||||
function groupKeywords(group) {
|
||||
if (!(0, applicability_1.shouldUseGroup)(schema, group))
|
||||
return;
|
||||
if (group.type) {
|
||||
gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
|
||||
iterateKeywords(it, group);
|
||||
if (types.length === 1 && types[0] === group.type && typeErrors) {
|
||||
gen.else();
|
||||
(0, dataType_2.reportTypeError)(it);
|
||||
}
|
||||
gen.endIf();
|
||||
}
|
||||
else {
|
||||
iterateKeywords(it, group);
|
||||
}
|
||||
// TODO make it "ok" call?
|
||||
if (!allErrors)
|
||||
gen.if((0, codegen_1._) `${names_1.default.errors} === ${errsCount || 0}`);
|
||||
}
|
||||
}
|
||||
function iterateKeywords(it, group) {
|
||||
const { gen, schema, opts: { useDefaults }, } = it;
|
||||
if (useDefaults)
|
||||
(0, defaults_1.assignDefaults)(it, group.type);
|
||||
gen.block(() => {
|
||||
for (const rule of group.rules) {
|
||||
if ((0, applicability_1.shouldUseRule)(schema, rule)) {
|
||||
keywordCode(it, rule.keyword, rule.definition, group.type);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function checkStrictTypes(it, types) {
|
||||
if (it.schemaEnv.meta || !it.opts.strictTypes)
|
||||
return;
|
||||
checkContextTypes(it, types);
|
||||
if (!it.opts.allowUnionTypes)
|
||||
checkMultipleTypes(it, types);
|
||||
checkKeywordTypes(it, it.dataTypes);
|
||||
}
|
||||
function checkContextTypes(it, types) {
|
||||
if (!types.length)
|
||||
return;
|
||||
if (!it.dataTypes.length) {
|
||||
it.dataTypes = types;
|
||||
return;
|
||||
}
|
||||
types.forEach((t) => {
|
||||
if (!includesType(it.dataTypes, t)) {
|
||||
strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
|
||||
}
|
||||
});
|
||||
it.dataTypes = it.dataTypes.filter((t) => includesType(types, t));
|
||||
}
|
||||
function checkMultipleTypes(it, ts) {
|
||||
if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
|
||||
strictTypesError(it, "use allowUnionTypes to allow union type keyword");
|
||||
}
|
||||
}
|
||||
function checkKeywordTypes(it, ts) {
|
||||
const rules = it.self.RULES.all;
|
||||
for (const keyword in rules) {
|
||||
const rule = rules[keyword];
|
||||
if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) {
|
||||
const { type } = rule.definition;
|
||||
if (type.length && !type.some((t) => hasApplicableType(ts, t))) {
|
||||
strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function hasApplicableType(schTs, kwdT) {
|
||||
return schTs.includes(kwdT) || (kwdT === "number" && schTs.includes("integer"));
|
||||
}
|
||||
function includesType(ts, t) {
|
||||
return ts.includes(t) || (t === "integer" && ts.includes("number"));
|
||||
}
|
||||
function strictTypesError(it, msg) {
|
||||
const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
|
||||
msg += ` at "${schemaPath}" (strictTypes)`;
|
||||
(0, util_1.checkStrictMode)(it, msg, it.opts.strictTypes);
|
||||
}
|
||||
class KeywordCxt {
|
||||
constructor(it, def, keyword) {
|
||||
(0, keyword_1.validateKeywordUsage)(it, def, keyword);
|
||||
this.gen = it.gen;
|
||||
this.allErrors = it.allErrors;
|
||||
this.keyword = keyword;
|
||||
this.data = it.data;
|
||||
this.schema = it.schema[keyword];
|
||||
this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data;
|
||||
this.schemaValue = (0, util_1.schemaRefOrVal)(it, this.schema, keyword, this.$data);
|
||||
this.schemaType = def.schemaType;
|
||||
this.parentSchema = it.schema;
|
||||
this.params = {};
|
||||
this.it = it;
|
||||
this.def = def;
|
||||
if (this.$data) {
|
||||
this.schemaCode = it.gen.const("vSchema", getData(this.$data, it));
|
||||
}
|
||||
else {
|
||||
this.schemaCode = this.schemaValue;
|
||||
if (!(0, keyword_1.validSchemaType)(this.schema, def.schemaType, def.allowUndefined)) {
|
||||
throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`);
|
||||
}
|
||||
}
|
||||
if ("code" in def ? def.trackErrors : def.errors !== false) {
|
||||
this.errsCount = it.gen.const("_errs", names_1.default.errors);
|
||||
}
|
||||
}
|
||||
result(condition, successAction, failAction) {
|
||||
this.failResult((0, codegen_1.not)(condition), successAction, failAction);
|
||||
}
|
||||
failResult(condition, successAction, failAction) {
|
||||
this.gen.if(condition);
|
||||
if (failAction)
|
||||
failAction();
|
||||
else
|
||||
this.error();
|
||||
if (successAction) {
|
||||
this.gen.else();
|
||||
successAction();
|
||||
if (this.allErrors)
|
||||
this.gen.endIf();
|
||||
}
|
||||
else {
|
||||
if (this.allErrors)
|
||||
this.gen.endIf();
|
||||
else
|
||||
this.gen.else();
|
||||
}
|
||||
}
|
||||
pass(condition, failAction) {
|
||||
this.failResult((0, codegen_1.not)(condition), undefined, failAction);
|
||||
}
|
||||
fail(condition) {
|
||||
if (condition === undefined) {
|
||||
this.error();
|
||||
if (!this.allErrors)
|
||||
this.gen.if(false); // this branch will be removed by gen.optimize
|
||||
return;
|
||||
}
|
||||
this.gen.if(condition);
|
||||
this.error();
|
||||
if (this.allErrors)
|
||||
this.gen.endIf();
|
||||
else
|
||||
this.gen.else();
|
||||
}
|
||||
fail$data(condition) {
|
||||
if (!this.$data)
|
||||
return this.fail(condition);
|
||||
const { schemaCode } = this;
|
||||
this.fail((0, codegen_1._) `${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition)})`);
|
||||
}
|
||||
error(append, errorParams, errorPaths) {
|
||||
if (errorParams) {
|
||||
this.setParams(errorParams);
|
||||
this._error(append, errorPaths);
|
||||
this.setParams({});
|
||||
return;
|
||||
}
|
||||
this._error(append, errorPaths);
|
||||
}
|
||||
_error(append, errorPaths) {
|
||||
;
|
||||
(append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths);
|
||||
}
|
||||
$dataError() {
|
||||
(0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError);
|
||||
}
|
||||
reset() {
|
||||
if (this.errsCount === undefined)
|
||||
throw new Error('add "trackErrors" to keyword definition');
|
||||
(0, errors_1.resetErrorsCount)(this.gen, this.errsCount);
|
||||
}
|
||||
ok(cond) {
|
||||
if (!this.allErrors)
|
||||
this.gen.if(cond);
|
||||
}
|
||||
setParams(obj, assign) {
|
||||
if (assign)
|
||||
Object.assign(this.params, obj);
|
||||
else
|
||||
this.params = obj;
|
||||
}
|
||||
block$data(valid, codeBlock, $dataValid = codegen_1.nil) {
|
||||
this.gen.block(() => {
|
||||
this.check$data(valid, $dataValid);
|
||||
codeBlock();
|
||||
});
|
||||
}
|
||||
check$data(valid = codegen_1.nil, $dataValid = codegen_1.nil) {
|
||||
if (!this.$data)
|
||||
return;
|
||||
const { gen, schemaCode, schemaType, def } = this;
|
||||
gen.if((0, codegen_1.or)((0, codegen_1._) `${schemaCode} === undefined`, $dataValid));
|
||||
if (valid !== codegen_1.nil)
|
||||
gen.assign(valid, true);
|
||||
if (schemaType.length || def.validateSchema) {
|
||||
gen.elseIf(this.invalid$data());
|
||||
this.$dataError();
|
||||
if (valid !== codegen_1.nil)
|
||||
gen.assign(valid, false);
|
||||
}
|
||||
gen.else();
|
||||
}
|
||||
invalid$data() {
|
||||
const { gen, schemaCode, schemaType, def, it } = this;
|
||||
return (0, codegen_1.or)(wrong$DataType(), invalid$DataSchema());
|
||||
function wrong$DataType() {
|
||||
if (schemaType.length) {
|
||||
/* istanbul ignore if */
|
||||
if (!(schemaCode instanceof codegen_1.Name))
|
||||
throw new Error("ajv implementation error");
|
||||
const st = Array.isArray(schemaType) ? schemaType : [schemaType];
|
||||
return (0, codegen_1._) `${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;
|
||||
}
|
||||
return codegen_1.nil;
|
||||
}
|
||||
function invalid$DataSchema() {
|
||||
if (def.validateSchema) {
|
||||
const validateSchemaRef = gen.scopeValue("validate$data", { ref: def.validateSchema }); // TODO value.code for standalone
|
||||
return (0, codegen_1._) `!${validateSchemaRef}(${schemaCode})`;
|
||||
}
|
||||
return codegen_1.nil;
|
||||
}
|
||||
}
|
||||
subschema(appl, valid) {
|
||||
const subschema = (0, subschema_1.getSubschema)(this.it, appl);
|
||||
(0, subschema_1.extendSubschemaData)(subschema, this.it, appl);
|
||||
(0, subschema_1.extendSubschemaMode)(subschema, appl);
|
||||
const nextContext = { ...this.it, ...subschema, items: undefined, props: undefined };
|
||||
subschemaCode(nextContext, valid);
|
||||
return nextContext;
|
||||
}
|
||||
mergeEvaluated(schemaCxt, toName) {
|
||||
const { it, gen } = this;
|
||||
if (!it.opts.unevaluated)
|
||||
return;
|
||||
if (it.props !== true && schemaCxt.props !== undefined) {
|
||||
it.props = util_1.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);
|
||||
}
|
||||
if (it.items !== true && schemaCxt.items !== undefined) {
|
||||
it.items = util_1.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);
|
||||
}
|
||||
}
|
||||
mergeValidEvaluated(schemaCxt, valid) {
|
||||
const { it, gen } = this;
|
||||
if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {
|
||||
gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1.Name));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.KeywordCxt = KeywordCxt;
|
||||
function keywordCode(it, keyword, def, ruleType) {
|
||||
const cxt = new KeywordCxt(it, def, keyword);
|
||||
if ("code" in def) {
|
||||
def.code(cxt, ruleType);
|
||||
}
|
||||
else if (cxt.$data && def.validate) {
|
||||
(0, keyword_1.funcKeywordCode)(cxt, def);
|
||||
}
|
||||
else if ("macro" in def) {
|
||||
(0, keyword_1.macroKeywordCode)(cxt, def);
|
||||
}
|
||||
else if (def.compile || def.validate) {
|
||||
(0, keyword_1.funcKeywordCode)(cxt, def);
|
||||
}
|
||||
}
|
||||
const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
|
||||
const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
||||
function getData($data, { dataLevel, dataNames, dataPathArr }) {
|
||||
let jsonPointer;
|
||||
let data;
|
||||
if ($data === "")
|
||||
return names_1.default.rootData;
|
||||
if ($data[0] === "/") {
|
||||
if (!JSON_POINTER.test($data))
|
||||
throw new Error(`Invalid JSON-pointer: ${$data}`);
|
||||
jsonPointer = $data;
|
||||
data = names_1.default.rootData;
|
||||
}
|
||||
else {
|
||||
const matches = RELATIVE_JSON_POINTER.exec($data);
|
||||
if (!matches)
|
||||
throw new Error(`Invalid JSON-pointer: ${$data}`);
|
||||
const up = +matches[1];
|
||||
jsonPointer = matches[2];
|
||||
if (jsonPointer === "#") {
|
||||
if (up >= dataLevel)
|
||||
throw new Error(errorMsg("property/index", up));
|
||||
return dataPathArr[dataLevel - up];
|
||||
}
|
||||
if (up > dataLevel)
|
||||
throw new Error(errorMsg("data", up));
|
||||
data = dataNames[dataLevel - up];
|
||||
if (!jsonPointer)
|
||||
return data;
|
||||
}
|
||||
let expr = data;
|
||||
const segments = jsonPointer.split("/");
|
||||
for (const segment of segments) {
|
||||
if (segment) {
|
||||
data = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment))}`;
|
||||
expr = (0, codegen_1._) `${expr} && ${data}`;
|
||||
}
|
||||
}
|
||||
return expr;
|
||||
function errorMsg(pointerType, up) {
|
||||
return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
|
||||
}
|
||||
}
|
||||
exports.getData = getData;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/ajv/dist/compile/validate/index.js.map
generated
vendored
1
node_modules/ajv/dist/compile/validate/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
8
node_modules/ajv/dist/compile/validate/keyword.d.ts
generated
vendored
8
node_modules/ajv/dist/compile/validate/keyword.d.ts
generated
vendored
@ -1,8 +0,0 @@
|
||||
import type { KeywordCxt } from ".";
|
||||
import type { AddedKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition } from "../../types";
|
||||
import type { SchemaObjCxt } from "..";
|
||||
import type { JSONType } from "../rules";
|
||||
export declare function macroKeywordCode(cxt: KeywordCxt, def: MacroKeywordDefinition): void;
|
||||
export declare function funcKeywordCode(cxt: KeywordCxt, def: FuncKeywordDefinition): void;
|
||||
export declare function validSchemaType(schema: unknown, schemaType: JSONType[], allowUndefined?: boolean): boolean;
|
||||
export declare function validateKeywordUsage({ schema, opts, self, errSchemaPath }: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string): void;
|
124
node_modules/ajv/dist/compile/validate/keyword.js
generated
vendored
124
node_modules/ajv/dist/compile/validate/keyword.js
generated
vendored
@ -1,124 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.validateKeywordUsage = exports.validSchemaType = exports.funcKeywordCode = exports.macroKeywordCode = void 0;
|
||||
const codegen_1 = require("../codegen");
|
||||
const names_1 = require("../names");
|
||||
const code_1 = require("../../vocabularies/code");
|
||||
const errors_1 = require("../errors");
|
||||
function macroKeywordCode(cxt, def) {
|
||||
const { gen, keyword, schema, parentSchema, it } = cxt;
|
||||
const macroSchema = def.macro.call(it.self, schema, parentSchema, it);
|
||||
const schemaRef = useKeyword(gen, keyword, macroSchema);
|
||||
if (it.opts.validateSchema !== false)
|
||||
it.self.validateSchema(macroSchema, true);
|
||||
const valid = gen.name("valid");
|
||||
cxt.subschema({
|
||||
schema: macroSchema,
|
||||
schemaPath: codegen_1.nil,
|
||||
errSchemaPath: `${it.errSchemaPath}/${keyword}`,
|
||||
topSchemaRef: schemaRef,
|
||||
compositeRule: true,
|
||||
}, valid);
|
||||
cxt.pass(valid, () => cxt.error(true));
|
||||
}
|
||||
exports.macroKeywordCode = macroKeywordCode;
|
||||
function funcKeywordCode(cxt, def) {
|
||||
var _a;
|
||||
const { gen, keyword, schema, parentSchema, $data, it } = cxt;
|
||||
checkAsyncKeyword(it, def);
|
||||
const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
|
||||
const validateRef = useKeyword(gen, keyword, validate);
|
||||
const valid = gen.let("valid");
|
||||
cxt.block$data(valid, validateKeyword);
|
||||
cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid);
|
||||
function validateKeyword() {
|
||||
if (def.errors === false) {
|
||||
assignValid();
|
||||
if (def.modifying)
|
||||
modifyData(cxt);
|
||||
reportErrs(() => cxt.error());
|
||||
}
|
||||
else {
|
||||
const ruleErrs = def.async ? validateAsync() : validateSync();
|
||||
if (def.modifying)
|
||||
modifyData(cxt);
|
||||
reportErrs(() => addErrs(cxt, ruleErrs));
|
||||
}
|
||||
}
|
||||
function validateAsync() {
|
||||
const ruleErrs = gen.let("ruleErrs", null);
|
||||
gen.try(() => assignValid((0, codegen_1._) `await `), (e) => gen.assign(valid, false).if((0, codegen_1._) `${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1._) `${e}.errors`), () => gen.throw(e)));
|
||||
return ruleErrs;
|
||||
}
|
||||
function validateSync() {
|
||||
const validateErrs = (0, codegen_1._) `${validateRef}.errors`;
|
||||
gen.assign(validateErrs, null);
|
||||
assignValid(codegen_1.nil);
|
||||
return validateErrs;
|
||||
}
|
||||
function assignValid(_await = def.async ? (0, codegen_1._) `await ` : codegen_1.nil) {
|
||||
const passCxt = it.opts.passContext ? names_1.default.this : names_1.default.self;
|
||||
const passSchema = !(("compile" in def && !$data) || def.schema === false);
|
||||
gen.assign(valid, (0, codegen_1._) `${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
|
||||
}
|
||||
function reportErrs(errors) {
|
||||
var _a;
|
||||
gen.if((0, codegen_1.not)((_a = def.valid) !== null && _a !== void 0 ? _a : valid), errors);
|
||||
}
|
||||
}
|
||||
exports.funcKeywordCode = funcKeywordCode;
|
||||
function modifyData(cxt) {
|
||||
const { gen, data, it } = cxt;
|
||||
gen.if(it.parentData, () => gen.assign(data, (0, codegen_1._) `${it.parentData}[${it.parentDataProperty}]`));
|
||||
}
|
||||
function addErrs(cxt, errs) {
|
||||
const { gen } = cxt;
|
||||
gen.if((0, codegen_1._) `Array.isArray(${errs})`, () => {
|
||||
gen
|
||||
.assign(names_1.default.vErrors, (0, codegen_1._) `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`)
|
||||
.assign(names_1.default.errors, (0, codegen_1._) `${names_1.default.vErrors}.length`);
|
||||
(0, errors_1.extendErrors)(cxt);
|
||||
}, () => cxt.error());
|
||||
}
|
||||
function checkAsyncKeyword({ schemaEnv }, def) {
|
||||
if (def.async && !schemaEnv.$async)
|
||||
throw new Error("async keyword in sync schema");
|
||||
}
|
||||
function useKeyword(gen, keyword, result) {
|
||||
if (result === undefined)
|
||||
throw new Error(`keyword "${keyword}" failed to compile`);
|
||||
return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) });
|
||||
}
|
||||
function validSchemaType(schema, schemaType, allowUndefined = false) {
|
||||
// TODO add tests
|
||||
return (!schemaType.length ||
|
||||
schemaType.some((st) => st === "array"
|
||||
? Array.isArray(schema)
|
||||
: st === "object"
|
||||
? schema && typeof schema == "object" && !Array.isArray(schema)
|
||||
: typeof schema == st || (allowUndefined && typeof schema == "undefined")));
|
||||
}
|
||||
exports.validSchemaType = validSchemaType;
|
||||
function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def, keyword) {
|
||||
/* istanbul ignore if */
|
||||
if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) {
|
||||
throw new Error("ajv implementation error");
|
||||
}
|
||||
const deps = def.dependencies;
|
||||
if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) {
|
||||
throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`);
|
||||
}
|
||||
if (def.validateSchema) {
|
||||
const valid = def.validateSchema(schema[keyword]);
|
||||
if (!valid) {
|
||||
const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` +
|
||||
self.errorsText(def.validateSchema.errors);
|
||||
if (opts.validateSchema === "log")
|
||||
self.logger.error(msg);
|
||||
else
|
||||
throw new Error(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.validateKeywordUsage = validateKeywordUsage;
|
||||
//# sourceMappingURL=keyword.js.map
|
1
node_modules/ajv/dist/compile/validate/keyword.js.map
generated
vendored
1
node_modules/ajv/dist/compile/validate/keyword.js.map
generated
vendored
File diff suppressed because one or more lines are too long
47
node_modules/ajv/dist/compile/validate/subschema.d.ts
generated
vendored
47
node_modules/ajv/dist/compile/validate/subschema.d.ts
generated
vendored
@ -1,47 +0,0 @@
|
||||
import type { AnySchema } from "../../types";
|
||||
import type { SchemaObjCxt } from "..";
|
||||
import { Code, Name } from "../codegen";
|
||||
import { Type } from "../util";
|
||||
import type { JSONType } from "../rules";
|
||||
export interface SubschemaContext {
|
||||
schema: AnySchema;
|
||||
schemaPath: Code;
|
||||
errSchemaPath: string;
|
||||
topSchemaRef?: Code;
|
||||
errorPath?: Code;
|
||||
dataLevel?: number;
|
||||
dataTypes?: JSONType[];
|
||||
data?: Name;
|
||||
parentData?: Name;
|
||||
parentDataProperty?: Code | number;
|
||||
dataNames?: Name[];
|
||||
dataPathArr?: (Code | number)[];
|
||||
propertyName?: Name;
|
||||
jtdDiscriminator?: string;
|
||||
jtdMetadata?: boolean;
|
||||
compositeRule?: true;
|
||||
createErrors?: boolean;
|
||||
allErrors?: boolean;
|
||||
}
|
||||
export declare type SubschemaArgs = Partial<{
|
||||
keyword: string;
|
||||
schemaProp: string | number;
|
||||
schema: AnySchema;
|
||||
schemaPath: Code;
|
||||
errSchemaPath: string;
|
||||
topSchemaRef: Code;
|
||||
data: Name | Code;
|
||||
dataProp: Code | string | number;
|
||||
dataTypes: JSONType[];
|
||||
definedProperties: Set<string>;
|
||||
propertyName: Name;
|
||||
dataPropType: Type;
|
||||
jtdDiscriminator: string;
|
||||
jtdMetadata: boolean;
|
||||
compositeRule: true;
|
||||
createErrors: boolean;
|
||||
allErrors: boolean;
|
||||
}>;
|
||||
export declare function getSubschema(it: SchemaObjCxt, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }: SubschemaArgs): SubschemaContext;
|
||||
export declare function extendSubschemaData(subschema: SubschemaContext, it: SchemaObjCxt, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }: SubschemaArgs): void;
|
||||
export declare function extendSubschemaMode(subschema: SubschemaContext, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }: SubschemaArgs): void;
|
81
node_modules/ajv/dist/compile/validate/subschema.js
generated
vendored
81
node_modules/ajv/dist/compile/validate/subschema.js
generated
vendored
@ -1,81 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = void 0;
|
||||
const codegen_1 = require("../codegen");
|
||||
const util_1 = require("../util");
|
||||
function getSubschema(it, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
|
||||
if (keyword !== undefined && schema !== undefined) {
|
||||
throw new Error('both "keyword" and "schema" passed, only one allowed');
|
||||
}
|
||||
if (keyword !== undefined) {
|
||||
const sch = it.schema[keyword];
|
||||
return schemaProp === undefined
|
||||
? {
|
||||
schema: sch,
|
||||
schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}`,
|
||||
errSchemaPath: `${it.errSchemaPath}/${keyword}`,
|
||||
}
|
||||
: {
|
||||
schema: sch[schemaProp],
|
||||
schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}${(0, codegen_1.getProperty)(schemaProp)}`,
|
||||
errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`,
|
||||
};
|
||||
}
|
||||
if (schema !== undefined) {
|
||||
if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) {
|
||||
throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
|
||||
}
|
||||
return {
|
||||
schema,
|
||||
schemaPath,
|
||||
topSchemaRef,
|
||||
errSchemaPath,
|
||||
};
|
||||
}
|
||||
throw new Error('either "keyword" or "schema" must be passed');
|
||||
}
|
||||
exports.getSubschema = getSubschema;
|
||||
function extendSubschemaData(subschema, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) {
|
||||
if (data !== undefined && dataProp !== undefined) {
|
||||
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
||||
}
|
||||
const { gen } = it;
|
||||
if (dataProp !== undefined) {
|
||||
const { errorPath, dataPathArr, opts } = it;
|
||||
const nextData = gen.let("data", (0, codegen_1._) `${it.data}${(0, codegen_1.getProperty)(dataProp)}`, true);
|
||||
dataContextProps(nextData);
|
||||
subschema.errorPath = (0, codegen_1.str) `${errorPath}${(0, util_1.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`;
|
||||
subschema.parentDataProperty = (0, codegen_1._) `${dataProp}`;
|
||||
subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty];
|
||||
}
|
||||
if (data !== undefined) {
|
||||
const nextData = data instanceof codegen_1.Name ? data : gen.let("data", data, true); // replaceable if used once?
|
||||
dataContextProps(nextData);
|
||||
if (propertyName !== undefined)
|
||||
subschema.propertyName = propertyName;
|
||||
// TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr
|
||||
}
|
||||
if (dataTypes)
|
||||
subschema.dataTypes = dataTypes;
|
||||
function dataContextProps(_nextData) {
|
||||
subschema.data = _nextData;
|
||||
subschema.dataLevel = it.dataLevel + 1;
|
||||
subschema.dataTypes = [];
|
||||
it.definedProperties = new Set();
|
||||
subschema.parentData = it.data;
|
||||
subschema.dataNames = [...it.dataNames, _nextData];
|
||||
}
|
||||
}
|
||||
exports.extendSubschemaData = extendSubschemaData;
|
||||
function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) {
|
||||
if (compositeRule !== undefined)
|
||||
subschema.compositeRule = compositeRule;
|
||||
if (createErrors !== undefined)
|
||||
subschema.createErrors = createErrors;
|
||||
if (allErrors !== undefined)
|
||||
subschema.allErrors = allErrors;
|
||||
subschema.jtdDiscriminator = jtdDiscriminator; // not inherited
|
||||
subschema.jtdMetadata = jtdMetadata; // not inherited
|
||||
}
|
||||
exports.extendSubschemaMode = extendSubschemaMode;
|
||||
//# sourceMappingURL=subschema.js.map
|
1
node_modules/ajv/dist/compile/validate/subschema.js.map
generated
vendored
1
node_modules/ajv/dist/compile/validate/subschema.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"subschema.js","sourceRoot":"","sources":["../../../lib/compile/validate/subschema.ts"],"names":[],"mappings":";;;AAEA,wCAA0D;AAC1D,kCAA0D;AA6C1D,SAAgB,YAAY,CAC1B,EAAgB,EAChB,EAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAgB;IAErF,IAAI,OAAO,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE;QACjD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;KACxE;IAED,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,MAAM,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAC9B,OAAO,UAAU,KAAK,SAAS;YAC7B,CAAC,CAAC;gBACE,MAAM,EAAE,GAAG;gBACX,UAAU,EAAE,IAAA,WAAC,EAAA,GAAG,EAAE,CAAC,UAAU,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,EAAE;gBACtD,aAAa,EAAE,GAAG,EAAE,CAAC,aAAa,IAAI,OAAO,EAAE;aAChD;YACH,CAAC,CAAC;gBACE,MAAM,EAAE,GAAG,CAAC,UAAU,CAAC;gBACvB,UAAU,EAAE,IAAA,WAAC,EAAA,GAAG,EAAE,CAAC,UAAU,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,GAAG,IAAA,qBAAW,EAAC,UAAU,CAAC,EAAE;gBAChF,aAAa,EAAE,GAAG,EAAE,CAAC,aAAa,IAAI,OAAO,IAAI,IAAA,qBAAc,EAAC,UAAU,CAAC,EAAE;aAC9E,CAAA;KACN;IAED,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,IAAI,UAAU,KAAK,SAAS,IAAI,aAAa,KAAK,SAAS,IAAI,YAAY,KAAK,SAAS,EAAE;YACzF,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAA;SAC/F;QACD,OAAO;YACL,MAAM;YACN,UAAU;YACV,YAAY;YACZ,aAAa;SACd,CAAA;KACF;IAED,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;AAChE,CAAC;AApCD,oCAoCC;AAED,SAAgB,mBAAmB,CACjC,SAA2B,EAC3B,EAAgB,EAChB,EAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAgB;IAE9E,IAAI,IAAI,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,EAAE;QAChD,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;KACvE;IAED,MAAM,EAAC,GAAG,EAAC,GAAG,EAAE,CAAA;IAEhB,IAAI,QAAQ,KAAK,SAAS,EAAE;QAC1B,MAAM,EAAC,SAAS,EAAE,WAAW,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;QACzC,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAA,WAAC,EAAA,GAAG,EAAE,CAAC,IAAI,GAAG,IAAA,qBAAW,EAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;QAC7E,gBAAgB,CAAC,QAAQ,CAAC,CAAA;QAC1B,SAAS,CAAC,SAAS,GAAG,IAAA,aAAG,EAAA,GAAG,SAAS,GAAG,IAAA,mBAAY,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAA;QAC/F,SAAS,CAAC,kBAAkB,GAAG,IAAA,WAAC,EAAA,GAAG,QAAQ,EAAE,CAAA;QAC7C,SAAS,CAAC,WAAW,GAAG,CAAC,GAAG,WAAW,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAA;KACvE;IAED,IAAI,IAAI,KAAK,SAAS,EAAE;QACtB,MAAM,QAAQ,GAAG,IAAI,YAAY,cAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA,CAAC,4BAA4B;QACvG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;QAC1B,IAAI,YAAY,KAAK,SAAS;YAAE,SAAS,CAAC,YAAY,GAAG,YAAY,CAAA;QACrE,2GAA2G;KAC5G;IAED,IAAI,SAAS;QAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAA;IAE9C,SAAS,gBAAgB,CAAC,SAAe;QACvC,SAAS,CAAC,IAAI,GAAG,SAAS,CAAA;QAC1B,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,GAAG,CAAC,CAAA;QACtC,SAAS,CAAC,SAAS,GAAG,EAAE,CAAA;QACxB,EAAE,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAA;QACxC,SAAS,CAAC,UAAU,GAAG,EAAE,CAAC,IAAI,CAAA;QAC9B,SAAS,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IACpD,CAAC;AACH,CAAC;AArCD,kDAqCC;AAED,SAAgB,mBAAmB,CACjC,SAA2B,EAC3B,EAAC,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAgB;IAEtF,IAAI,aAAa,KAAK,SAAS;QAAE,SAAS,CAAC,aAAa,GAAG,aAAa,CAAA;IACxE,IAAI,YAAY,KAAK,SAAS;QAAE,SAAS,CAAC,YAAY,GAAG,YAAY,CAAA;IACrE,IAAI,SAAS,KAAK,SAAS;QAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5D,SAAS,CAAC,gBAAgB,GAAG,gBAAgB,CAAA,CAAC,gBAAgB;IAC9D,SAAS,CAAC,WAAW,GAAG,WAAW,CAAA,CAAC,gBAAgB;AACtD,CAAC;AATD,kDASC"}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user