fix(ajv): Build @lowdefy/ajv with swc and update dep ajv to v8.6.3.

This commit is contained in:
Sam Tolmay 2021-11-07 17:50:41 +02:00
parent a009071532
commit f231fcb321
No known key found for this signature in database
GPG Key ID: D004126FCD1A6DF0
30 changed files with 520 additions and 63 deletions

246
.pnp.cjs generated
View File

@ -4788,13 +4788,12 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
"packageLocation": "./packages/ajv/",
"packageDependencies": [
["@lowdefy/ajv", "workspace:packages/ajv"],
["@babel/cli", "virtual:4a7337632ff6e9ee5a1c45a62a9ff4cc325a9367b21424babda93e269fe01b671e885bc41bdeebafb83c81f2a8eebbf0102043354a4e58905f61c8c3387cda1e#npm:7.15.7"],
["@babel/core", "npm:7.15.8"],
["@babel/preset-env", "virtual:4a7337632ff6e9ee5a1c45a62a9ff4cc325a9367b21424babda93e269fe01b671e885bc41bdeebafb83c81f2a8eebbf0102043354a4e58905f61c8c3387cda1e#npm:7.15.8"],
["@lowdefy/nunjucks", "workspace:packages/nunjucks"],
["ajv", "npm:6.12.6"],
["ajv-errors", "virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:1.0.1"],
["babel-jest", "virtual:4a7337632ff6e9ee5a1c45a62a9ff4cc325a9367b21424babda93e269fe01b671e885bc41bdeebafb83c81f2a8eebbf0102043354a4e58905f61c8c3387cda1e#npm:27.3.1"],
["@swc/cli", "virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:0.1.51"],
["@swc/core", "npm:1.2.107"],
["@swc/jest", "virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:0.2.5"],
["ajv", "npm:8.6.3"],
["ajv-errors", "virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:3.0.0"],
["jest", "virtual:4a7337632ff6e9ee5a1c45a62a9ff4cc325a9367b21424babda93e269fe01b671e885bc41bdeebafb83c81f2a8eebbf0102043354a4e58905f61c8c3387cda1e#npm:27.3.1"],
["jest-diff", "npm:27.3.1"]
],
@ -4842,8 +4841,8 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@testing-library/dom", "npm:8.10.1"],
["@testing-library/react", "virtual:22157ea722f8d6428f1fcf0a6f7f6c7d6b902d9c785256c60a65fe6cd0db76ebccc7c1457ee047df0ba6909ff018e300c4f4957a60f5b670089810dfc417af9b#npm:12.1.2"],
["@testing-library/user-event", "virtual:ef041dcfb1a84323e84b33f148b44908e40798740b13580fd51cdd5f1fad53f80b7752a65dee444bedf9ec3a7529b8e94c59a28878b8dfe27a045663ef6ef0a9#npm:13.5.0"],
["ajv", "npm:6.12.6"],
["ajv-errors", "virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:1.0.1"],
["ajv", "npm:8.6.3"],
["ajv-errors", "virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:3.0.0"],
["babel-jest", "virtual:4a7337632ff6e9ee5a1c45a62a9ff4cc325a9367b21424babda93e269fe01b671e885bc41bdeebafb83c81f2a8eebbf0102043354a4e58905f61c8c3387cda1e#npm:27.3.1"],
["jest", "virtual:4a7337632ff6e9ee5a1c45a62a9ff4cc325a9367b21424babda93e269fe01b671e885bc41bdeebafb83c81f2a8eebbf0102043354a4e58905f61c8c3387cda1e#npm:27.3.1"],
["jest-serializer-html", "npm:7.1.0"],
@ -5111,7 +5110,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@lowdefy/helpers", "workspace:packages/helpers"],
["@lowdefy/node-utils", "workspace:packages/nodeUtils"],
["@lowdefy/nunjucks", "workspace:packages/nunjucks"],
["ajv", "npm:6.12.6"],
["ajv", "npm:8.6.3"],
["axios", "npm:0.23.0"],
["babel-jest", "virtual:4a7337632ff6e9ee5a1c45a62a9ff4cc325a9367b21424babda93e269fe01b671e885bc41bdeebafb83c81f2a8eebbf0102043354a4e58905f61c8c3387cda1e#npm:27.3.1"],
["babel-loader", "virtual:aad21d373d6721af7549b2798c35c4ea25d83c122770abeaa0a4343ba20d55700fd9e3c5fa3289a7e6f591d09e8790df14d525c719ca4729b178b8644cca082a#npm:8.2.3"],
@ -5396,7 +5395,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
["@lowdefy/operators", "workspace:packages/operators"],
["@sendgrid/mail", "npm:7.4.4"],
["ajv", "npm:6.12.6"],
["ajv-errors", "virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:1.0.1"],
["ajv-errors", "virtual:8ceddc5bfe3cb2f4adf24cfb20077ce69c2ee6908a8b88fdd4a2acb267293f976396218df97147ca37a660ee32f37302641453b14d40d241ca1c2b86c00c377c#npm:1.0.1"],
["apollo-server", "virtual:8ceddc5bfe3cb2f4adf24cfb20077ce69c2ee6908a8b88fdd4a2acb267293f976396218df97147ca37a660ee32f37302641453b14d40d241ca1c2b86c00c377c#npm:2.25.0"],
["aws-sdk", "npm:2.918.0"],
["axios", "npm:0.21.4"],
@ -5747,6 +5746,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
"linkType": "SOFT",
}]
]],
["@napi-rs/triples", [
["npm:1.0.3", {
"packageLocation": "./.yarn/cache/@napi-rs-triples-npm-1.0.3-b45eecb594-c83a4cc55f.zip/node_modules/@napi-rs/triples/",
"packageDependencies": [
["@napi-rs/triples", "npm:1.0.3"]
],
"linkType": "HARD",
}]
]],
["@nicolo-ribaudo/chokidar-2", [
["npm:2.1.8-no-fsevents.3", {
"packageLocation": "./.yarn/cache/@nicolo-ribaudo-chokidar-2-npm-2.1.8-no-fsevents.3-79ca8bfcef-ee55cc9241.zip/node_modules/@nicolo-ribaudo/chokidar-2/",
@ -5756,6 +5764,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
"linkType": "HARD",
}]
]],
["@node-rs/helper", [
["npm:1.2.1", {
"packageLocation": "./.yarn/cache/@node-rs-helper-npm-1.2.1-e25ffdc5ac-c7b96e46df.zip/node_modules/@node-rs/helper/",
"packageDependencies": [
["@node-rs/helper", "npm:1.2.1"],
["@napi-rs/triples", "npm:1.0.3"]
],
"linkType": "HARD",
}]
]],
["@nodelib/fs.scandir", [
["npm:2.1.5", {
"packageLocation": "./.yarn/cache/@nodelib-fs.scandir-npm-2.1.5-89c67370dd-a970d595bd.zip/node_modules/@nodelib/fs.scandir/",
@ -6302,6 +6320,188 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
"linkType": "HARD",
}]
]],
["@swc/cli", [
["npm:0.1.51", {
"packageLocation": "./.yarn/cache/@swc-cli-npm-0.1.51-a93f90901e-348bf0aee8.zip/node_modules/@swc/cli/",
"packageDependencies": [
["@swc/cli", "npm:0.1.51"]
],
"linkType": "SOFT",
}],
["virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:0.1.51", {
"packageLocation": "./.yarn/__virtual__/@swc-cli-virtual-d9f9df8663/0/cache/@swc-cli-npm-0.1.51-a93f90901e-348bf0aee8.zip/node_modules/@swc/cli/",
"packageDependencies": [
["@swc/cli", "virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:0.1.51"],
["@swc/core", "npm:1.2.107"],
["@types/chokidar", null],
["@types/swc__core", null],
["chokidar", null],
["commander", "npm:7.2.0"],
["fast-glob", "npm:3.2.7"],
["slash", "npm:3.0.0"],
["source-map", "npm:0.7.3"]
],
"packagePeers": [
"@swc/core",
"@types/chokidar",
"@types/swc__core",
"chokidar"
],
"linkType": "HARD",
}]
]],
["@swc/core", [
["npm:1.2.107", {
"packageLocation": "./.yarn/cache/@swc-core-npm-1.2.107-8b144c1b65-452fd087c7.zip/node_modules/@swc/core/",
"packageDependencies": [
["@swc/core", "npm:1.2.107"],
["@node-rs/helper", "npm:1.2.1"],
["@swc/core-android-arm64", "npm:1.2.107"],
["@swc/core-darwin-arm64", "npm:1.2.107"],
["@swc/core-darwin-x64", "npm:1.2.107"],
["@swc/core-freebsd-x64", "npm:1.2.107"],
["@swc/core-linux-arm-gnueabihf", "npm:1.2.107"],
["@swc/core-linux-arm64-gnu", "npm:1.2.107"],
["@swc/core-linux-arm64-musl", "npm:1.2.107"],
["@swc/core-linux-x64-gnu", "npm:1.2.107"],
["@swc/core-linux-x64-musl", "npm:1.2.107"],
["@swc/core-win32-arm64-msvc", "npm:1.2.107"],
["@swc/core-win32-ia32-msvc", "npm:1.2.107"],
["@swc/core-win32-x64-msvc", "npm:1.2.107"]
],
"linkType": "HARD",
}]
]],
["@swc/core-android-arm64", [
["npm:1.2.107", {
"packageLocation": "./.yarn/unplugged/@swc-core-android-arm64-npm-1.2.107-1e49c4bdf1/node_modules/@swc/core-android-arm64/",
"packageDependencies": [
["@swc/core-android-arm64", "npm:1.2.107"]
],
"linkType": "HARD",
}]
]],
["@swc/core-darwin-arm64", [
["npm:1.2.107", {
"packageLocation": "./.yarn/unplugged/@swc-core-darwin-arm64-npm-1.2.107-6488aaca2a/node_modules/@swc/core-darwin-arm64/",
"packageDependencies": [
["@swc/core-darwin-arm64", "npm:1.2.107"]
],
"linkType": "HARD",
}]
]],
["@swc/core-darwin-x64", [
["npm:1.2.107", {
"packageLocation": "./.yarn/unplugged/@swc-core-darwin-x64-npm-1.2.107-8f06e42bd6/node_modules/@swc/core-darwin-x64/",
"packageDependencies": [
["@swc/core-darwin-x64", "npm:1.2.107"]
],
"linkType": "HARD",
}]
]],
["@swc/core-freebsd-x64", [
["npm:1.2.107", {
"packageLocation": "./.yarn/unplugged/@swc-core-freebsd-x64-npm-1.2.107-62c1eb2c67/node_modules/@swc/core-freebsd-x64/",
"packageDependencies": [
["@swc/core-freebsd-x64", "npm:1.2.107"]
],
"linkType": "HARD",
}]
]],
["@swc/core-linux-arm-gnueabihf", [
["npm:1.2.107", {
"packageLocation": "./.yarn/unplugged/@swc-core-linux-arm-gnueabihf-npm-1.2.107-e92218639a/node_modules/@swc/core-linux-arm-gnueabihf/",
"packageDependencies": [
["@swc/core-linux-arm-gnueabihf", "npm:1.2.107"]
],
"linkType": "HARD",
}]
]],
["@swc/core-linux-arm64-gnu", [
["npm:1.2.107", {
"packageLocation": "./.yarn/unplugged/@swc-core-linux-arm64-gnu-npm-1.2.107-d6acea63d0/node_modules/@swc/core-linux-arm64-gnu/",
"packageDependencies": [
["@swc/core-linux-arm64-gnu", "npm:1.2.107"]
],
"linkType": "HARD",
}]
]],
["@swc/core-linux-arm64-musl", [
["npm:1.2.107", {
"packageLocation": "./.yarn/unplugged/@swc-core-linux-arm64-musl-npm-1.2.107-3f286d73a4/node_modules/@swc/core-linux-arm64-musl/",
"packageDependencies": [
["@swc/core-linux-arm64-musl", "npm:1.2.107"]
],
"linkType": "HARD",
}]
]],
["@swc/core-linux-x64-gnu", [
["npm:1.2.107", {
"packageLocation": "./.yarn/unplugged/@swc-core-linux-x64-gnu-npm-1.2.107-87c22052be/node_modules/@swc/core-linux-x64-gnu/",
"packageDependencies": [
["@swc/core-linux-x64-gnu", "npm:1.2.107"]
],
"linkType": "HARD",
}]
]],
["@swc/core-linux-x64-musl", [
["npm:1.2.107", {
"packageLocation": "./.yarn/unplugged/@swc-core-linux-x64-musl-npm-1.2.107-72bd353476/node_modules/@swc/core-linux-x64-musl/",
"packageDependencies": [
["@swc/core-linux-x64-musl", "npm:1.2.107"]
],
"linkType": "HARD",
}]
]],
["@swc/core-win32-arm64-msvc", [
["npm:1.2.107", {
"packageLocation": "./.yarn/unplugged/@swc-core-win32-arm64-msvc-npm-1.2.107-8f1d14df5b/node_modules/@swc/core-win32-arm64-msvc/",
"packageDependencies": [
["@swc/core-win32-arm64-msvc", "npm:1.2.107"]
],
"linkType": "HARD",
}]
]],
["@swc/core-win32-ia32-msvc", [
["npm:1.2.107", {
"packageLocation": "./.yarn/unplugged/@swc-core-win32-ia32-msvc-npm-1.2.107-68b8748208/node_modules/@swc/core-win32-ia32-msvc/",
"packageDependencies": [
["@swc/core-win32-ia32-msvc", "npm:1.2.107"]
],
"linkType": "HARD",
}]
]],
["@swc/core-win32-x64-msvc", [
["npm:1.2.107", {
"packageLocation": "./.yarn/unplugged/@swc-core-win32-x64-msvc-npm-1.2.107-a4f9ed6a1a/node_modules/@swc/core-win32-x64-msvc/",
"packageDependencies": [
["@swc/core-win32-x64-msvc", "npm:1.2.107"]
],
"linkType": "HARD",
}]
]],
["@swc/jest", [
["npm:0.2.5", {
"packageLocation": "./.yarn/cache/@swc-jest-npm-0.2.5-2355da0fa9-3a1b271762.zip/node_modules/@swc/jest/",
"packageDependencies": [
["@swc/jest", "npm:0.2.5"]
],
"linkType": "SOFT",
}],
["virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:0.2.5", {
"packageLocation": "./.yarn/__virtual__/@swc-jest-virtual-eacfbb2a10/0/cache/@swc-jest-npm-0.2.5-2355da0fa9-3a1b271762.zip/node_modules/@swc/jest/",
"packageDependencies": [
["@swc/jest", "virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:0.2.5"],
["@swc/core", "npm:1.2.107"],
["@types/swc__core", null]
],
"packagePeers": [
"@swc/core",
"@types/swc__core"
],
"linkType": "HARD",
}]
]],
["@szmarczak/http-timer", [
["npm:1.1.2", {
"packageLocation": "./.yarn/cache/@szmarczak-http-timer-npm-1.1.2-ea82ca2d55-4d9158061c.zip/node_modules/@szmarczak/http-timer/",
@ -8340,10 +8540,30 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
],
"linkType": "SOFT",
}],
["virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:1.0.1", {
"packageLocation": "./.yarn/__virtual__/ajv-errors-virtual-6c363fa7a9/0/cache/ajv-errors-npm-1.0.1-32cd0b19f8-2c9fc02cf5.zip/node_modules/ajv-errors/",
["npm:3.0.0", {
"packageLocation": "./.yarn/cache/ajv-errors-npm-3.0.0-cbd6be5a29-f3d1610a10.zip/node_modules/ajv-errors/",
"packageDependencies": [
["ajv-errors", "virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:1.0.1"],
["ajv-errors", "npm:3.0.0"]
],
"linkType": "SOFT",
}],
["virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:3.0.0", {
"packageLocation": "./.yarn/__virtual__/ajv-errors-virtual-7d09613e40/0/cache/ajv-errors-npm-3.0.0-cbd6be5a29-f3d1610a10.zip/node_modules/ajv-errors/",
"packageDependencies": [
["ajv-errors", "virtual:09ba37edd9db25b7821b7d2b2d2055c41a6ed7b7590f4f31cb08f11ca472be4a006b49e750b63bf1615697d9f5fdbcda49d5e649e3491c0b6490a9dc0dbedfa2#npm:3.0.0"],
["@types/ajv", null],
["ajv", "npm:8.6.3"]
],
"packagePeers": [
"@types/ajv",
"ajv"
],
"linkType": "HARD",
}],
["virtual:8ceddc5bfe3cb2f4adf24cfb20077ce69c2ee6908a8b88fdd4a2acb267293f976396218df97147ca37a660ee32f37302641453b14d40d241ca1c2b86c00c377c#npm:1.0.1", {
"packageLocation": "./.yarn/__virtual__/ajv-errors-virtual-10b0627ffa/0/cache/ajv-errors-npm-1.0.1-32cd0b19f8-2c9fc02cf5.zip/node_modules/ajv-errors/",
"packageDependencies": [
["ajv-errors", "virtual:8ceddc5bfe3cb2f4adf24cfb20077ce69c2ee6908a8b88fdd4a2acb267293f976396218df97147ca37a660ee32f37302641453b14d40d241ca1c2b86c00c377c#npm:1.0.1"],
["@types/ajv", null],
["ajv", "npm:6.12.6"]
],

16
.swcrc Normal file
View File

@ -0,0 +1,16 @@
{
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": true,
"dynamicImport": true
},
"target": "es2018",
"keepClassNames": true
},
"module": {
"type": "es6",
"noInterop": true,
"ignoreDynamic": true
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

17
packages/ajv/.swcrc Normal file
View File

@ -0,0 +1,17 @@
{
"exclude": [".*.test.js$"],
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": true,
"dynamicImport": true
},
"target": "es2018",
"keepClassNames": true
},
"module": {
"type": "es6",
"noInterop": true,
"ignoreDynamic": true
}
}

16
packages/ajv/.swcrc.test Normal file
View File

@ -0,0 +1,16 @@
{
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": true,
"dynamicImport": true
},
"target": "es2018",
"keepClassNames": true
},
"module": {
"type": "es6",
"noInterop": true,
"ignoreDynamic": true
}
}

View File

@ -3,9 +3,12 @@ module.exports = {
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/test/'],
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/index.js'],
coverageReporters: [['lcov', { projectRoot: '../..' }], 'text', 'clover'],
errorOnDeprecated: true,
testEnvironment: 'node',
testPathIgnorePatterns: ['<rootDir>/dist/'],
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '.swcrc.test' }],
},
};

View File

@ -27,26 +27,27 @@
"type": "git",
"url": "https://github.com/lowdefy/lowdefy.git"
},
"main": "dist/index.js",
"type": "module",
"exports": "./dist/index.js",
"files": [
"dist/*"
],
"scripts": {
"build": "babel src --out-dir dist",
"build": "yarn clean && yarn swc",
"clean": "rm -rf dist",
"test": "jest --coverage",
"prepare": "yarn build"
"prepare": "yarn build",
"swc": "swc src --out-dir dist"
},
"dependencies": {
"@lowdefy/nunjucks": "3.22.0",
"ajv": "6.12.6",
"ajv-errors": "1.0.1"
"ajv": "8.6.3",
"ajv-errors": "3.0.0"
},
"devDependencies": {
"@babel/cli": "7.15.7",
"@babel/core": "7.15.8",
"@babel/preset-env": "7.15.8",
"babel-jest": "27.3.1",
"@swc/cli": "0.1.51",
"@swc/core": "1.2.107",
"@swc/jest": "0.2.5",
"jest": "27.3.1",
"jest-diff": "27.3.1"
},

View File

@ -20,7 +20,6 @@ import createErrorMessage from './createErrorMessage';
const ajv = new Ajv({
allErrors: true,
jsonPointers: true,
});
ajvErrors(ajv);

View File

@ -43,7 +43,7 @@ test('Object does not match schema, one error', () => {
const data = {
string: 7,
};
expect(() => validate({ schema, data })).toThrow('should be string');
expect(() => validate({ schema, data })).toThrow('must be string');
});
test('Object does not match schema, two errors', () => {
@ -62,7 +62,7 @@ test('Object does not match schema, two errors', () => {
string: 7,
number: '7',
};
expect(() => validate({ schema, data })).toThrow('should be string; should be number');
expect(() => validate({ schema, data })).toThrow('must be string; must be number');
});
test('Object does not match schema, three errors', () => {
@ -85,7 +85,7 @@ test('Object does not match schema, three errors', () => {
number: '7',
boolean: 7,
};
expect(() => validate({ schema, data })).toThrow('should be string; should be boolean');
expect(() => validate({ schema, data })).toThrow('must be string; must be boolean');
});
test('Object does not match schema, one error, error message', () => {
@ -170,7 +170,7 @@ test('Nunjucks template in error message', () => {
string: {
type: 'string',
errorMessage: {
type: '{{ keyword }}:{{ dataPath }}:{{ schemaPath }}:{{ message }}',
type: '{{ keyword }}:{{ instancePath }}:{{ schemaPath }}:{{ message }}',
},
},
},
@ -179,7 +179,7 @@ test('Nunjucks template in error message', () => {
string: 7,
};
expect(() => validate({ schema, data })).toThrow(
'errorMessage:/string:#/properties/string/errorMessage:{{ keyword }}:{{ dataPath }}:{{ schemaPath }}:{{ message }}'
'errorMessage:/string:#/properties/string/errorMessage:{{ keyword }}:{{ instancePath }}:{{ schemaPath }}:{{ message }}'
);
});
@ -190,13 +190,13 @@ test('Nunjucks template in error message', () => {
string: {
type: 'string',
errorMessage: {
type: '{{ keyword }}:{{ dataPath }}:{{ schemaPath }}:{{ message }}',
type: '{{ keyword }}:{{ instancePath }}:{{ schemaPath }}:{{ message }}',
},
},
number: {
type: 'number',
errorMessage: {
type: '{{ keyword }}:{{ dataPath }}:{{ schemaPath }}:{{ message }}',
type: '{{ keyword }}:{{ instancePath }}:{{ schemaPath }}:{{ message }}',
},
},
},
@ -206,7 +206,7 @@ test('Nunjucks template in error message', () => {
number: '7',
};
expect(() => validate({ schema, data })).toThrow(
'errorMessage:/string:#/properties/string/errorMessage:{{ keyword }}:{{ dataPath }}:{{ schemaPath }}:{{ message }}; errorMessage:/number:#/properties/number/errorMessage:{{ keyword }}:{{ dataPath }}:{{ schemaPath }}:{{ message }}'
'errorMessage:/string:#/properties/string/errorMessage:{{ keyword }}:{{ instancePath }}:{{ schemaPath }}:{{ message }}; errorMessage:/number:#/properties/number/errorMessage:{{ keyword }}:{{ instancePath }}:{{ schemaPath }}:{{ message }}'
);
});
@ -225,9 +225,9 @@ test('Object does not match schema, one error, returnErrors true', () => {
expect(validate({ schema, data, returnErrors: true })).toEqual({
errors: [
{
dataPath: '/string',
instancePath: '/string',
keyword: 'type',
message: 'should be string',
message: 'must be string',
params: {
type: 'string',
},
@ -261,27 +261,27 @@ test('Object does not match schema, three errors, returnErrors true', () => {
expect(validate({ schema, data, returnErrors: true })).toEqual({
errors: [
{
dataPath: '/string',
instancePath: '/string',
keyword: 'type',
message: 'should be string',
message: 'must be string',
params: {
type: 'string',
},
schemaPath: '#/properties/string/type',
},
{
dataPath: '/number',
instancePath: '/number',
keyword: 'type',
message: 'should be number',
message: 'must be number',
params: {
type: 'number',
},
schemaPath: '#/properties/number/type',
},
{
dataPath: '/boolean',
instancePath: '/boolean',
keyword: 'type',
message: 'should be boolean',
message: 'must be boolean',
params: {
type: 'boolean',
},
@ -310,15 +310,16 @@ test('Object does not match schema, one error, error message, returnErrors true'
expect(validate({ schema, data, returnErrors: true })).toEqual({
errors: [
{
dataPath: '/string',
instancePath: '/string',
keyword: 'errorMessage',
message: 'Custom error message.',
params: {
errors: [
{
dataPath: '/string',
emUsed: true,
instancePath: '/string',
keyword: 'type',
message: 'should be string',
message: 'must be string',
params: {
type: 'string',
},

View File

@ -42,8 +42,8 @@
"@testing-library/dom": "8.10.1",
"@testing-library/react": "12.1.2",
"@testing-library/user-event": "13.5.0",
"ajv": "6.12.6",
"ajv-errors": "1.0.1",
"ajv": "8.6.3",
"ajv-errors": "3.0.0",
"jest": "27.3.1",
"jest-serializer-html": "7.1.0",
"jest-transform-yaml": "0.1.2",

View File

@ -41,7 +41,7 @@
"@lowdefy/helpers": "3.22.0",
"@lowdefy/node-utils": "3.22.0",
"@lowdefy/nunjucks": "3.22.0",
"ajv": "6.12.6",
"ajv": "8.6.3",
"axios": "0.23.0",
"js-yaml": "4.1.0",
"json5": "2.2.0",

218
yarn.lock
View File

@ -3201,13 +3201,12 @@ __metadata:
version: 0.0.0-use.local
resolution: "@lowdefy/ajv@workspace:packages/ajv"
dependencies:
"@babel/cli": 7.15.7
"@babel/core": 7.15.8
"@babel/preset-env": 7.15.8
"@lowdefy/nunjucks": 3.22.0
ajv: 6.12.6
ajv-errors: 1.0.1
babel-jest: 27.3.1
"@swc/cli": 0.1.51
"@swc/core": 1.2.107
"@swc/jest": 0.2.5
ajv: 8.6.3
ajv-errors: 3.0.0
jest: 27.3.1
jest-diff: 27.3.1
languageName: unknown
@ -3251,8 +3250,8 @@ __metadata:
"@testing-library/dom": 8.10.1
"@testing-library/react": 12.1.2
"@testing-library/user-event": 13.5.0
ajv: 6.12.6
ajv-errors: 1.0.1
ajv: 8.6.3
ajv-errors: 3.0.0
babel-jest: 27.3.1
jest: 27.3.1
jest-serializer-html: 7.1.0
@ -3506,7 +3505,7 @@ __metadata:
"@lowdefy/helpers": 3.22.0
"@lowdefy/node-utils": 3.22.0
"@lowdefy/nunjucks": 3.22.0
ajv: 6.12.6
ajv: 8.6.3
axios: 0.23.0
babel-jest: 27.3.1
babel-loader: 8.2.3
@ -4085,6 +4084,13 @@ __metadata:
languageName: unknown
linkType: soft
"@napi-rs/triples@npm:^1.0.3":
version: 1.0.3
resolution: "@napi-rs/triples@npm:1.0.3"
checksum: c83a4cc55f69115bf4ce1d5924efce7f5faf2dc79fd52257385559f668ce91a03c5d7d004df01ebba56028a9b663955eb97f31b65ac0acff7a93c143f0d809af
languageName: node
linkType: hard
"@nicolo-ribaudo/chokidar-2@npm:2.1.8-no-fsevents.3":
version: 2.1.8-no-fsevents.3
resolution: "@nicolo-ribaudo/chokidar-2@npm:2.1.8-no-fsevents.3"
@ -4092,6 +4098,15 @@ __metadata:
languageName: node
linkType: hard
"@node-rs/helper@npm:^1.0.0":
version: 1.2.1
resolution: "@node-rs/helper@npm:1.2.1"
dependencies:
"@napi-rs/triples": ^1.0.3
checksum: c7b96e46df8a4195e62e51b6f60ed05aff398653c270dc9cffaed749303a4c428215d5826de8511b57cf66f2b0165fb3544fb2aec2aaf385c13ac3b9468bb000
languageName: node
linkType: hard
"@nodelib/fs.scandir@npm:2.1.5":
version: 2.1.5
resolution: "@nodelib/fs.scandir@npm:2.1.5"
@ -4539,6 +4554,166 @@ __metadata:
languageName: node
linkType: hard
"@swc/cli@npm:0.1.51":
version: 0.1.51
resolution: "@swc/cli@npm:0.1.51"
dependencies:
commander: ^7.1.0
fast-glob: ^3.2.5
slash: 3.0.0
source-map: ^0.7.3
peerDependencies:
"@swc/core": ^1.2.66
chokidar: ^3.5.1
peerDependenciesMeta:
chokidar:
optional: true
bin:
spack: bin/spack.js
swc: bin/swc.js
checksum: 348bf0aee8e0cab567b75061f71ccbeff4964d9d6af03760f06641dbdb3f753865d2f0806d9adf805f19b9449a9665fdc4260d907246ab045156f427fa6a1ecd
languageName: node
linkType: hard
"@swc/core-android-arm64@npm:^1.2.107":
version: 1.2.107
resolution: "@swc/core-android-arm64@npm:1.2.107"
checksum: a9588937181d177f48c4c3c061cc77a31871dd370e53e0baf8ec652c9e5f005b227e2e4f7978f3466c209d74946e514dc550a5f34c441edc4fa2c0f9fefa4cfa
languageName: node
linkType: hard
"@swc/core-darwin-arm64@npm:^1.2.107":
version: 1.2.107
resolution: "@swc/core-darwin-arm64@npm:1.2.107"
checksum: 7db65a8c21478c86c5e93d6ca5db16fcdc2bdecd3e62e2962907fc51935937fc8ce867af0869efa1dc17f7d85aa95312a027ebb6919ff7a3951509554610aa1c
languageName: node
linkType: hard
"@swc/core-darwin-x64@npm:^1.2.107":
version: 1.2.107
resolution: "@swc/core-darwin-x64@npm:1.2.107"
checksum: 055bdc095dfc3138eb11efb758a8c4f50ab4abebae7fdfcfc8dd6ef25492b74e8b4a58265c640db9d90752049a1f55d611196342a762a6a29dbdfa2df60ae56b
languageName: node
linkType: hard
"@swc/core-freebsd-x64@npm:^1.2.107":
version: 1.2.107
resolution: "@swc/core-freebsd-x64@npm:1.2.107"
checksum: 073921a6d5ea2bd02779d932ee51b246ae37bcb3917f9d07fbc24e9a10d291a8ad50a6d4e8726b08dd65bf9530416cc59c4ae0ab8aa5b20016c9b227e5939116
languageName: node
linkType: hard
"@swc/core-linux-arm-gnueabihf@npm:^1.2.107":
version: 1.2.107
resolution: "@swc/core-linux-arm-gnueabihf@npm:1.2.107"
checksum: 7fb04edde2ef32ea599c1a04736a5d63e7d9ac800531effee110241bb8ad4df2c7898b39c02ac614ad6752b92608ae9e99e023365af2d9ce9314efe590c9978e
languageName: node
linkType: hard
"@swc/core-linux-arm64-gnu@npm:^1.2.107":
version: 1.2.107
resolution: "@swc/core-linux-arm64-gnu@npm:1.2.107"
checksum: cbfe4d5973948d60cb71c0faf95c935cfcef1cab9b4b3a577e0325f869adf3de487025c5d39ba6b67185fb268e1d6ccaed9d07950329fbf5c438f8003948134f
languageName: node
linkType: hard
"@swc/core-linux-arm64-musl@npm:^1.2.107":
version: 1.2.107
resolution: "@swc/core-linux-arm64-musl@npm:1.2.107"
checksum: c345e0dba1b890fa03df21037a2dc8313aab9243f755b138f3015e5231139b33729f08c1f0f68634cdd80b5f70606c889b43767c8c39ea84bcd8de63b58b9559
languageName: node
linkType: hard
"@swc/core-linux-x64-gnu@npm:^1.2.107":
version: 1.2.107
resolution: "@swc/core-linux-x64-gnu@npm:1.2.107"
checksum: 1f815379f2fa3e7514b67c41680db8c759a2ec991b8f923df02d5265a9b73e712e00aaa092f2fa389413a3b180ef428fcc9acd776634c50f9fc5fac497f169e8
languageName: node
linkType: hard
"@swc/core-linux-x64-musl@npm:^1.2.107":
version: 1.2.107
resolution: "@swc/core-linux-x64-musl@npm:1.2.107"
checksum: 2d5d3e594f23cd1da0abf988944265cb919cb312872a70e9d28a9eeb0e950ccb3dc113c331285062e1b4819d2f3104d0bae132fbea72ac6f07a5940cc9ed873c
languageName: node
linkType: hard
"@swc/core-win32-arm64-msvc@npm:^1.2.107":
version: 1.2.107
resolution: "@swc/core-win32-arm64-msvc@npm:1.2.107"
checksum: afc81079d1f9137831d3975bc553c51cbc2851fd9bc375d115f49704df258acc69586354240a691109750dbd77ff986b6e4ca74b7a29c21fc5a787fe70df5351
languageName: node
linkType: hard
"@swc/core-win32-ia32-msvc@npm:^1.2.107":
version: 1.2.107
resolution: "@swc/core-win32-ia32-msvc@npm:1.2.107"
checksum: 62533c010f1a8d77d7f2175afa0063e0671f1435adf70cc07bc575de4e31df4e7c07829cd52c84cc9344e154e25e8d45e5eb4035d293d021d161fb0970647aba
languageName: node
linkType: hard
"@swc/core-win32-x64-msvc@npm:^1.2.107":
version: 1.2.107
resolution: "@swc/core-win32-x64-msvc@npm:1.2.107"
checksum: 95b731e92ba9ac8de0d4e8ec1d9226eacd8bea41d2ddcf6d4d180a1adb083d96683fc04809c1a1f7aad56815f71c942e102aeda972af9996455d098b7bc53941
languageName: node
linkType: hard
"@swc/core@npm:1.2.107":
version: 1.2.107
resolution: "@swc/core@npm:1.2.107"
dependencies:
"@node-rs/helper": ^1.0.0
"@swc/core-android-arm64": ^1.2.107
"@swc/core-darwin-arm64": ^1.2.107
"@swc/core-darwin-x64": ^1.2.107
"@swc/core-freebsd-x64": ^1.2.107
"@swc/core-linux-arm-gnueabihf": ^1.2.107
"@swc/core-linux-arm64-gnu": ^1.2.107
"@swc/core-linux-arm64-musl": ^1.2.107
"@swc/core-linux-x64-gnu": ^1.2.107
"@swc/core-linux-x64-musl": ^1.2.107
"@swc/core-win32-arm64-msvc": ^1.2.107
"@swc/core-win32-ia32-msvc": ^1.2.107
"@swc/core-win32-x64-msvc": ^1.2.107
dependenciesMeta:
"@swc/core-android-arm64":
optional: true
"@swc/core-darwin-arm64":
optional: true
"@swc/core-darwin-x64":
optional: true
"@swc/core-freebsd-x64":
optional: true
"@swc/core-linux-arm-gnueabihf":
optional: true
"@swc/core-linux-arm64-gnu":
optional: true
"@swc/core-linux-arm64-musl":
optional: true
"@swc/core-linux-x64-gnu":
optional: true
"@swc/core-linux-x64-musl":
optional: true
"@swc/core-win32-arm64-msvc":
optional: true
"@swc/core-win32-ia32-msvc":
optional: true
"@swc/core-win32-x64-msvc":
optional: true
checksum: 452fd087c7c16caa1bb51c48847b43e5ec57f44dad24b1d5ca64849d050343caeb0942db126296f799778eaf455274a5a25e4b0a9334bf49657ed758babaa846
languageName: node
linkType: hard
"@swc/jest@npm:0.2.5":
version: 0.2.5
resolution: "@swc/jest@npm:0.2.5"
peerDependencies:
"@swc/core": "*"
checksum: 3a1b2717623a1419f0f3fc04bc7e2cd112a084e1763a33d9df06bda9431b6dd67bff8dba358162b23f1911f9a0e67422f09afd0983c77b4dc6f9fbde7a712bd8
languageName: node
linkType: hard
"@szmarczak/http-timer@npm:^1.1.2":
version: 1.1.2
resolution: "@szmarczak/http-timer@npm:1.1.2"
@ -5727,6 +5902,15 @@ __metadata:
languageName: node
linkType: hard
"ajv-errors@npm:3.0.0":
version: 3.0.0
resolution: "ajv-errors@npm:3.0.0"
peerDependencies:
ajv: ^8.0.1
checksum: f3d1610a104fa776c2f90534acbe2113842a40d5ee446062da9e956ae6de6959afc997da1e3948c47316faa225255fc2d9d97aacd0803f47998fb38156d3d03c
languageName: node
linkType: hard
"ajv-keywords@npm:^3.5.2":
version: 3.5.2
resolution: "ajv-keywords@npm:3.5.2"
@ -5748,7 +5932,7 @@ __metadata:
languageName: node
linkType: hard
"ajv@npm:^8.1.0":
"ajv@npm:8.6.3, ajv@npm:^8.1.0":
version: 8.6.3
resolution: "ajv@npm:8.6.3"
dependencies:
@ -19581,6 +19765,13 @@ resolve@^2.0.0-next.3:
languageName: node
linkType: hard
"slash@npm:3.0.0, slash@npm:^3.0.0":
version: 3.0.0
resolution: "slash@npm:3.0.0"
checksum: 94a93fff615f25a999ad4b83c9d5e257a7280c90a32a7cb8b4a87996e4babf322e469c42b7f649fd5796edd8687652f3fb452a86dc97a816f01113183393f11c
languageName: node
linkType: hard
"slash@npm:^2.0.0":
version: 2.0.0
resolution: "slash@npm:2.0.0"
@ -19588,13 +19779,6 @@ resolve@^2.0.0-next.3:
languageName: node
linkType: hard
"slash@npm:^3.0.0":
version: 3.0.0
resolution: "slash@npm:3.0.0"
checksum: 94a93fff615f25a999ad4b83c9d5e257a7280c90a32a7cb8b4a87996e4babf322e469c42b7f649fd5796edd8687652f3fb452a86dc97a816f01113183393f11c
languageName: node
linkType: hard
"slide@npm:^1.1.6":
version: 1.1.6
resolution: "slide@npm:1.1.6"