diff --git a/.eslintrc.yml b/.eslintrc.yml index 673690e7..f88ea021 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,7 +1,6 @@ env: node: true es6: true - mocha: true browser: true plugins: diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 4cc6c5a3..9a387370 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1 +1 @@ -sonar.exclusions=tools/**/* \ No newline at end of file +sonar.exclusions=tools/**/*,test/**/* \ No newline at end of file diff --git a/definitions/3.0.0/Reference.json b/definitions/3.0.0/Reference.json index 78f41b69..41a7f647 100644 --- a/definitions/3.0.0/Reference.json +++ b/definitions/3.0.0/Reference.json @@ -15,4 +15,4 @@ }, "$schema": "http://json-schema.org/draft-07/schema#", "$id": "http://asyncapi.com/definitions/3.0.0/Reference.json" -} \ No newline at end of file +} diff --git a/definitions/3.0.0/info.json b/definitions/3.0.0/info.json index 034eb5ab..252c4a79 100644 --- a/definitions/3.0.0/info.json +++ b/definitions/3.0.0/info.json @@ -1,7 +1,7 @@ { "description": "The object provides metadata about the API. The metadata can be used by the clients if needed.", "allOf": [ - { + { "type": "object", "required": ["version", "title"], "additionalProperties": false, @@ -70,4 +70,4 @@ }, "$schema": "http://json-schema.org/draft-07/schema#", "$id": "http://asyncapi.com/definitions/3.0.0/info.json" -} \ No newline at end of file +} diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 00000000..a108b7fd --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "paths": { + "@extensions/*": ["./extensions/*"], + "@examples/*": ["./examples/*"], + "@definitions/*": ["./definitions/*"], + "@bindings/*": ["./bindings/*"], + "@common/*": ["./common/*"], + "@test/*": ["./test/*"] + } + } +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index cc300df3..f2b27f0e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,10 +14,12 @@ "devDependencies": { "ajv": "^8.12.0", "ajv-draft-04": "^1.0.0", + "ajv-formats": "^3.0.1", "eslint": "^8.56.0", "eslint-plugin-sonarjs": "^0.23.0", - "mocha": "^10.0.0", - "nyc": "^15.1.0" + "nyc": "^15.1.0", + "vite-require": "^0.2.3", + "vitest": "^1.6.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -478,6 +480,374 @@ "node": ">=6.9.0" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz", + "integrity": "sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.2.tgz", + "integrity": "sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz", + "integrity": "sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.2.tgz", + "integrity": "sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz", + "integrity": "sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz", + "integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz", + "integrity": "sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz", + "integrity": "sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz", + "integrity": "sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz", + "integrity": "sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz", + "integrity": "sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz", + "integrity": "sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz", + "integrity": "sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz", + "integrity": "sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz", + "integrity": "sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz", + "integrity": "sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz", + "integrity": "sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz", + "integrity": "sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", + "integrity": "sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz", + "integrity": "sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz", + "integrity": "sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz", + "integrity": "sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz", + "integrity": "sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -759,6 +1129,18 @@ "node": ">=8" } }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", @@ -842,6 +1224,226 @@ "node": ">= 8" } }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz", + "integrity": "sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.18.0.tgz", + "integrity": "sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.18.0.tgz", + "integrity": "sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz", + "integrity": "sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.18.0.tgz", + "integrity": "sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.18.0.tgz", + "integrity": "sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.18.0.tgz", + "integrity": "sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.18.0.tgz", + "integrity": "sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.18.0.tgz", + "integrity": "sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.18.0.tgz", + "integrity": "sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.18.0.tgz", + "integrity": "sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz", + "integrity": "sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.18.0.tgz", + "integrity": "sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.18.0.tgz", + "integrity": "sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.18.0.tgz", + "integrity": "sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz", + "integrity": "sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "dev": true + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -853,10 +1455,106 @@ "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", "dev": true }, + "node_modules/@vitest/expect": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.0.tgz", + "integrity": "sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==", + "dev": true, + "dependencies": { + "@vitest/spy": "1.6.0", + "@vitest/utils": "1.6.0", + "chai": "^4.3.10" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.0.tgz", + "integrity": "sha512-P4xgwPjwesuBiHisAVz/LSSZtDjOTPYZVmNAnpHHSR6ONrf8eCJOFRvUwdHn30F5M1fxhqtl7QZQUk2dprIXAg==", + "dev": true, + "dependencies": { + "@vitest/utils": "1.6.0", + "p-limit": "^5.0.0", + "pathe": "^1.1.1" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner/node_modules/p-limit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-5.0.0.tgz", + "integrity": "sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@vitest/runner/node_modules/yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@vitest/snapshot": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.0.tgz", + "integrity": "sha512-+Hx43f8Chus+DCmygqqfetcAZrDJwvTj0ymqjQq4CvmpKFSTVteEOBzCusu1x2tt4OJcvBflyHUE0DZSLgEMtQ==", + "dev": true, + "dependencies": { + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "pretty-format": "^29.7.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.0.tgz", + "integrity": "sha512-leUTap6B/cqi/bQkXUu6bQV5TZPx7pmMBKBQiI0rJA8c3pB56ZsaTbREnF7CJfmvAS4V2cXIBAh/3rVwrrCYgw==", + "dev": true, + "dependencies": { + "tinyspy": "^2.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.0.tgz", + "integrity": "sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw==", + "dev": true, + "dependencies": { + "diff-sequences": "^29.6.3", + "estree-walker": "^3.0.3", + "loupe": "^2.3.7", + "pretty-format": "^29.7.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, "node_modules/acorn": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", - "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -874,6 +1572,15 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/acorn-walk": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", + "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -917,13 +1624,21 @@ } } }, - "node_modules/ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", "dev": true, - "engines": { - "node": ">=6" + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } } }, "node_modules/ansi-regex": { @@ -950,19 +1665,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/append-transform": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", @@ -987,30 +1689,21 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, "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/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/braces": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", @@ -1023,12 +1716,6 @@ "node": ">=8" } }, - "node_modules/browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, "node_modules/browserslist": { "version": "4.22.2", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", @@ -1058,7 +1745,16 @@ "browserslist": "cli.js" }, "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "engines": { + "node": ">=8" } }, "node_modules/caching-transform": { @@ -1114,6 +1810,24 @@ } ] }, + "node_modules/chai": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", + "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.0.8" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -1142,31 +1856,16 @@ "node": ">=8" } }, - "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" + "get-func-name": "^2.0.2" }, "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" + "node": "*" } }, "node_modules/clean-stack": { @@ -1178,17 +1877,6 @@ "node": ">=6" } }, - "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1219,6 +1907,12 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/confbox": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.7.tgz", + "integrity": "sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==", + "dev": true + }, "node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", @@ -1271,6 +1965,18 @@ "node": ">=0.10.0" } }, + "node_modules/deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -1292,13 +1998,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", "dev": true, "engines": { - "node": ">=0.3.1" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/doctrine": { @@ -1325,12 +2031,56 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "node_modules/es-module-lexer": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.3.tgz", + "integrity": "sha512-i1gCgmR9dCl6Vil6UKPI/trA69s08g/syhiDK9TG0Nf1RJjjFI+AzoWW7sPufzkgYAn861skuCwJa0pIIHYxvg==", + "dev": true + }, "node_modules/es6-error": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, + "node_modules/esbuild": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz", + "integrity": "sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.20.2", + "@esbuild/android-arm": "0.20.2", + "@esbuild/android-arm64": "0.20.2", + "@esbuild/android-x64": "0.20.2", + "@esbuild/darwin-arm64": "0.20.2", + "@esbuild/darwin-x64": "0.20.2", + "@esbuild/freebsd-arm64": "0.20.2", + "@esbuild/freebsd-x64": "0.20.2", + "@esbuild/linux-arm": "0.20.2", + "@esbuild/linux-arm64": "0.20.2", + "@esbuild/linux-ia32": "0.20.2", + "@esbuild/linux-loong64": "0.20.2", + "@esbuild/linux-mips64el": "0.20.2", + "@esbuild/linux-ppc64": "0.20.2", + "@esbuild/linux-riscv64": "0.20.2", + "@esbuild/linux-s390x": "0.20.2", + "@esbuild/linux-x64": "0.20.2", + "@esbuild/netbsd-x64": "0.20.2", + "@esbuild/openbsd-x64": "0.20.2", + "@esbuild/sunos-x64": "0.20.2", + "@esbuild/win32-arm64": "0.20.2", + "@esbuild/win32-ia32": "0.20.2", + "@esbuild/win32-x64": "0.20.2" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -1593,6 +2343,15 @@ "node": ">=4.0" } }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "dependencies": { + "@types/estree": "^1.0.0" + } + }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -1602,12 +2361,75 @@ "node": ">=0.10.0" } }, + "node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/execa/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "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-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -1686,15 +2508,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true, - "bin": { - "flat": "cli.js" - } - }, "node_modules/flat-cache": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", @@ -1786,6 +2599,15 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/get-package-type": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", @@ -1795,6 +2617,18 @@ "node": ">=8.0.0" } }, + "node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -1895,21 +2729,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true, - "bin": { - "he": "bin/he" - } - }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "dev": true, + "engines": { + "node": ">=16.17.0" + } + }, "node_modules/ignore": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", @@ -1978,18 +2812,6 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -2038,15 +2860,6 @@ "node": ">=8" } }, - "node_modules/is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -2065,18 +2878,6 @@ "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", "dev": true }, - "node_modules/is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -2328,6 +3129,22 @@ "node": ">= 0.8.0" } }, + "node_modules/local-pkg": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.0.tgz", + "integrity": "sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==", + "dev": true, + "dependencies": { + "mlly": "^1.4.2", + "pkg-types": "^1.0.3" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -2355,20 +3172,13 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, - "node_modules/log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "node_modules/loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", "dev": true, "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "get-func-name": "^2.0.1" } }, "node_modules/lru-cache": { @@ -2380,6 +3190,15 @@ "yallist": "^3.0.2" } }, + "node_modules/magic-string": { + "version": "0.30.10", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.10.tgz", + "integrity": "sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + } + }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -2395,74 +3214,56 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "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/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", + "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", "dev": true, "dependencies": { - "brace-expansion": "^2.0.1" + "braces": "^3.0.3", + "picomatch": "^2.3.1" }, "engines": { - "node": ">=10" + "node": ">=8.6" } }, - "node_modules/mocha": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", - "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", - "dev": true, - "dependencies": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.4", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.2.0", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "5.0.1", - "ms": "2.1.3", - "nanoid": "3.3.3", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "workerpool": "6.2.1", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha.js" - }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, "engines": { - "node": ">= 14.0.0" + "node": ">=12" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mochajs" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/nanoid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", - "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", + "node_modules/mlly": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.0.tgz", + "integrity": "sha512-U9SDaXGEREBYQgfejV97coK0UL1r+qnF2SyO9A3qcI8MzKnsIFKHNVEkrDyNncQTKQQumsasmeq84eNMdBfsNQ==", "dev": true, - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + "dependencies": { + "acorn": "^8.11.3", + "pathe": "^1.1.2", + "pkg-types": "^1.1.0", + "ufo": "^1.5.3" } }, "node_modules/natural-compare": { @@ -2489,13 +3290,31 @@ "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", "dev": true }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/nyc": { @@ -2666,6 +3485,21 @@ "wrappy": "1" } }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", @@ -2788,6 +3622,21 @@ "node": ">=8" } }, + "node_modules/pathe": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", + "dev": true + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -2849,25 +3698,82 @@ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, "dependencies": { - "p-try": "^2.0.0" + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-types": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.1.1.tgz", + "integrity": "sha512-ko14TjmDuQJ14zsotODv7dBlwxKhUKQEhuhmbqo1uCi9BB0Z2alo/wAXg6q1dTR5TyuqYyWhjtfe/Tsh+X28jQ==", + "dev": true, + "dependencies": { + "confbox": "^0.1.7", + "mlly": "^1.7.0", + "pathe": "^1.1.2" + } + }, + "node_modules/postcss": { + "version": "8.4.38", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", + "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.0", + "source-map-js": "^1.2.0" }, "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^10 || ^12 || >=14" } }, - "node_modules/pkg-dir/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "node_modules/postcss/node_modules/nanoid": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "dev": true, - "dependencies": { - "p-limit": "^2.2.0" + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" }, "engines": { - "node": ">=8" + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, "node_modules/prelude-ls": { @@ -2879,6 +3785,32 @@ "node": ">= 0.8.0" } }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/process-on-spawn": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.0.0.tgz", @@ -2920,26 +3852,11 @@ } ] }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } + "node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true }, "node_modules/release-zalgo": { "version": "1.0.0", @@ -3011,6 +3928,41 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rollup": { + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.18.0.tgz", + "integrity": "sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==", + "dev": true, + "dependencies": { + "@types/estree": "1.0.5" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.18.0", + "@rollup/rollup-android-arm64": "4.18.0", + "@rollup/rollup-darwin-arm64": "4.18.0", + "@rollup/rollup-darwin-x64": "4.18.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.18.0", + "@rollup/rollup-linux-arm-musleabihf": "4.18.0", + "@rollup/rollup-linux-arm64-gnu": "4.18.0", + "@rollup/rollup-linux-arm64-musl": "4.18.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.18.0", + "@rollup/rollup-linux-riscv64-gnu": "4.18.0", + "@rollup/rollup-linux-s390x-gnu": "4.18.0", + "@rollup/rollup-linux-x64-gnu": "4.18.0", + "@rollup/rollup-linux-x64-musl": "4.18.0", + "@rollup/rollup-win32-arm64-msvc": "4.18.0", + "@rollup/rollup-win32-ia32-msvc": "4.18.0", + "@rollup/rollup-win32-x64-msvc": "4.18.0", + "fsevents": "~2.3.2" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -3034,26 +3986,6 @@ "queue-microtask": "^1.2.2" } }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "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/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -3063,15 +3995,6 @@ "semver": "bin/semver.js" } }, - "node_modules/serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, - "dependencies": { - "randombytes": "^2.1.0" - } - }, "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -3099,6 +4022,12 @@ "node": ">=8" } }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -3114,6 +4043,15 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-js": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", + "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/spawn-wrap": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", @@ -3137,6 +4075,18 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true + }, + "node_modules/std-env": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.7.0.tgz", + "integrity": "sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==", + "dev": true + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -3172,6 +4122,18 @@ "node": ">=8" } }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -3184,21 +4146,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "node_modules/strip-literal": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-2.1.0.tgz", + "integrity": "sha512-Op+UycaUt/8FbN/Z2TWPBLge3jWrP3xj10f3fnYxf052bKuS3EKs1ZQcVGjnEMdsNVAM+plXRdmjrZ/KgG3Skw==", "dev": true, "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" + "js-tokens": "^9.0.0" }, "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" + "url": "https://github.com/sponsors/antfu" } }, + "node_modules/strip-literal/node_modules/js-tokens": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.0.tgz", + "integrity": "sha512-WriZw1luRMlmV3LGJaR6QOJjWwgLUTf89OwT2lUOyjX2dJGBwgmIkbcz+7WFZjrZM635JOIR517++e/67CP9dQ==", + "dev": true + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -3241,6 +4206,30 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, + "node_modules/tinybench": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.8.0.tgz", + "integrity": "sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==", + "dev": true + }, + "node_modules/tinypool": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.8.4.tgz", + "integrity": "sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.1.tgz", + "integrity": "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -3274,6 +4263,15 @@ "node": ">= 0.8.0" } }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/type-fest": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", @@ -3292,6 +4290,12 @@ "is-typedarray": "^1.0.0" } }, + "node_modules/ufo": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.3.tgz", + "integrity": "sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==", + "dev": true + }, "node_modules/update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", @@ -3340,6 +4344,170 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/vite": { + "version": "5.2.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz", + "integrity": "sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ==", + "dev": true, + "dependencies": { + "esbuild": "^0.20.1", + "postcss": "^8.4.38", + "rollup": "^4.13.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.0.tgz", + "integrity": "sha512-de6HJgzC+TFzOu0NTC4RAIsyf/DY/ibWDYQUcuEA84EMHhcefTUGkjFHKKEJhQN4A+6I0u++kr3l36ZF2d7XRw==", + "dev": true, + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^5.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vite-plugin-dynamic-import": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/vite-plugin-dynamic-import/-/vite-plugin-dynamic-import-1.5.0.tgz", + "integrity": "sha512-Qp85c+AVJmLa8MLni74U4BDiWpUeFNx7NJqbGZyR2XJOU7mgW0cb7nwlAMucFyM4arEd92Nfxp4j44xPi6Fu7g==", + "dev": true, + "dependencies": { + "acorn": "^8.8.2", + "es-module-lexer": "^1.2.1", + "fast-glob": "^3.2.12", + "magic-string": "^0.30.1" + } + }, + "node_modules/vite-require": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/vite-require/-/vite-require-0.2.3.tgz", + "integrity": "sha512-Lpeg5mxXiLAVrylKK9FMF8d6yxLBm6YtHXmtWpJSDSWBdl12tBsMGHOBC/fsLzATj+Zp9FHjqwzE1JayOPi9dQ==", + "dev": true, + "dependencies": { + "fast-glob": "^3.2.11", + "vite-plugin-dynamic-import": "^1.1.1" + } + }, + "node_modules/vitest": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.0.tgz", + "integrity": "sha512-H5r/dN06swuFnzNFhq/dnz37bPXnq8xB2xB5JOVk8K09rUtoeNN+LHWkoQ0A/i3hvbUKKcCei9KpbxqHMLhLLA==", + "dev": true, + "dependencies": { + "@vitest/expect": "1.6.0", + "@vitest/runner": "1.6.0", + "@vitest/snapshot": "1.6.0", + "@vitest/spy": "1.6.0", + "@vitest/utils": "1.6.0", + "acorn-walk": "^8.3.2", + "chai": "^4.3.10", + "debug": "^4.3.4", + "execa": "^8.0.1", + "local-pkg": "^0.5.0", + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "std-env": "^3.5.0", + "strip-literal": "^2.0.0", + "tinybench": "^2.5.1", + "tinypool": "^0.8.3", + "vite": "^5.0.0", + "vite-node": "1.6.0", + "why-is-node-running": "^2.2.2" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/node": "^18.0.0 || >=20.0.0", + "@vitest/browser": "1.6.0", + "@vitest/ui": "1.6.0", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -3361,27 +4529,20 @@ "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", "dev": true }, - "node_modules/workerpool": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", - "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", - "dev": true - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "node_modules/why-is-node-running": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", + "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", "dev": true, "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" + "siginfo": "^2.0.0", + "stackback": "0.0.2" }, - "engines": { - "node": ">=10" + "bin": { + "why-is-node-running": "cli.js" }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + "engines": { + "node": ">=8" } }, "node_modules/wrappy": { @@ -3402,87 +4563,12 @@ "typedarray-to-buffer": "^3.1.5" } }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true }, - "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "dependencies": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-unparser/node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yargs-unparser/node_modules/decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 7e987b8d..e221d962 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "types": "index.d.ts", "scripts": { - "test": "npm run build && nyc mocha && npm run validate:schemas", + "test": "npm run build && vitest run && npm run validate:schemas", "build": "npm run bundle", "generate:assets": "npm run build", "prepublishOnly": "npm run build", @@ -41,10 +41,12 @@ "devDependencies": { "ajv": "^8.12.0", "ajv-draft-04": "^1.0.0", + "ajv-formats": "^3.0.1", "eslint": "^8.56.0", "eslint-plugin-sonarjs": "^0.23.0", - "mocha": "^10.0.0", - "nyc": "^15.1.0" + "nyc": "^15.1.0", + "vite-require": "^0.2.3", + "vitest": "^1.6.0" }, "dependencies": { "@types/json-schema": "^7.0.11" diff --git a/test/ajv-schemes.js b/test/ajv-schemes.js new file mode 100644 index 00000000..8b2d79ad --- /dev/null +++ b/test/ajv-schemes.js @@ -0,0 +1,144 @@ +module.exports = schemesV3_0_0; + +function bindingSchemes(ajv) { + ajv.addSchema(require('@bindings/amqp/0.2.0/channel.json')); + ajv.addSchema(require('@bindings/amqp/0.2.0/message.json')); + ajv.addSchema(require('@bindings/amqp/0.2.0/operation.json')); + ajv.addSchema(require('@bindings/amqp/0.3.0/channel.json')); + ajv.addSchema(require('@bindings/amqp/0.3.0/message.json')); + ajv.addSchema(require('@bindings/amqp/0.3.0/operation.json')); + + ajv.addSchema(require('@bindings/anypointmq/0.0.1/channel.json')); + ajv.addSchema(require('@bindings/anypointmq/0.0.1/message.json')); + + ajv.addSchema(require('@bindings/googlepubsub/0.1.0/channel.json')); + ajv.addSchema(require('@bindings/googlepubsub/0.1.0/message.json')); + ajv.addSchema(require('@bindings/googlepubsub/0.2.0/channel.json')); + ajv.addSchema(require('@bindings/googlepubsub/0.2.0/message.json')); + + ajv.addSchema(require('@bindings/http/0.1.0/message.json')); + ajv.addSchema(require('@bindings/http/0.1.0/operation.json')); + ajv.addSchema(require('@bindings/http/0.2.0/message.json')); + ajv.addSchema(require('@bindings/http/0.2.0/operation.json')); + ajv.addSchema(require('@bindings/http/0.3.0/message.json')); + ajv.addSchema(require('@bindings/http/0.3.0/operation.json')); + + ajv.addSchema(require('@bindings/ibmmq/0.1.0/channel.json')); + ajv.addSchema(require('@bindings/ibmmq/0.1.0/message.json')); + ajv.addSchema(require('@bindings/ibmmq/0.1.0/server.json')); + + ajv.addSchema(require('@bindings/jms/0.0.1/channel.json')); + ajv.addSchema(require('@bindings/jms/0.0.1/message.json')); + ajv.addSchema(require('@bindings/jms/0.0.1/server.json')); + + ajv.addSchema(require('@bindings/kafka/0.1.0/message.json')); + ajv.addSchema(require('@bindings/kafka/0.1.0/operation.json')); + ajv.addSchema(require('@bindings/kafka/0.3.0/channel.json')); + ajv.addSchema(require('@bindings/kafka/0.3.0/message.json')); + ajv.addSchema(require('@bindings/kafka/0.3.0/operation.json')); + ajv.addSchema(require('@bindings/kafka/0.3.0/server.json')); + ajv.addSchema(require('@bindings/kafka/0.4.0/channel.json')); + ajv.addSchema(require('@bindings/kafka/0.4.0/message.json')); + ajv.addSchema(require('@bindings/kafka/0.4.0/operation.json')); + ajv.addSchema(require('@bindings/kafka/0.4.0/server.json')); + ajv.addSchema(require('@bindings/kafka/0.5.0/channel.json')); + ajv.addSchema(require('@bindings/kafka/0.5.0/message.json')); + ajv.addSchema(require('@bindings/kafka/0.5.0/operation.json')); + ajv.addSchema(require('@bindings/kafka/0.5.0/server.json')); + + ajv.addSchema(require('@bindings/mqtt/0.1.0/message.json')); + ajv.addSchema(require('@bindings/mqtt/0.1.0/operation.json')); + ajv.addSchema(require('@bindings/mqtt/0.1.0/server.json')); + ajv.addSchema(require('@bindings/mqtt/0.2.0/message.json')); + ajv.addSchema(require('@bindings/mqtt/0.2.0/operation.json')); + ajv.addSchema(require('@bindings/mqtt/0.2.0/server.json')); + + ajv.addSchema(require('@bindings/nats/0.1.0/operation.json')); + + ajv.addSchema(require('@bindings/pulsar/0.1.0/channel.json')); + ajv.addSchema(require('@bindings/pulsar/0.1.0/server.json')); + + ajv.addSchema(require('@bindings/sns/0.1.0/channel.json')); + ajv.addSchema(require('@bindings/sns/0.1.0/operation.json')); + + ajv.addSchema(require('@bindings/solace/0.2.0/operation.json')); + ajv.addSchema(require('@bindings/solace/0.2.0/server.json')); + ajv.addSchema(require('@bindings/solace/0.3.0/operation.json')); + ajv.addSchema(require('@bindings/solace/0.3.0/server.json')); + ajv.addSchema(require('@bindings/solace/0.4.0/operation.json')); + ajv.addSchema(require('@bindings/solace/0.4.0/server.json')); + + ajv.addSchema(require('@bindings/sqs/0.2.0/channel.json')); + ajv.addSchema(require('@bindings/sqs/0.2.0/operation.json')); + + ajv.addSchema(require('@bindings/websockets/0.1.0/channel.json')); + + return ajv; +} + +function schemesV3_0_0(ajv) { + ajv.addSchema(require('@definitions/3.0.0/anySchema.json')); + ajv.addSchema(require('@definitions/3.0.0/apiKey.json')); + ajv.addSchema(require('@definitions/3.0.0/APIKeyHTTPSecurityScheme.json')); + ajv.addSchema(require('@definitions/3.0.0/asymmetricEncryption.json')); + ajv.addSchema(require('@definitions/3.0.0/asyncapi.json')); + ajv.addSchema(require('@definitions/3.0.0/BearerHTTPSecurityScheme.json')); + ajv.addSchema(require('@definitions/3.0.0/channel.json')); + ajv.addSchema(require('@definitions/3.0.0/channelBindingsObject.json')); + ajv.addSchema(require('@definitions/3.0.0/channelMessages.json')); + ajv.addSchema(require('@definitions/3.0.0/channels.json')); + ajv.addSchema(require('@definitions/3.0.0/components.json')); + ajv.addSchema(require('@definitions/3.0.0/contact.json')); + ajv.addSchema(require('@definitions/3.0.0/correlationId.json')); + ajv.addSchema(require('@definitions/3.0.0/externalDocs.json')); + ajv.addSchema(require('@definitions/3.0.0/HTTPSecurityScheme.json')); + ajv.addSchema(require('@definitions/3.0.0/info.json')); + ajv.addSchema(require('@definitions/3.0.0/infoExtensions.json')); + ajv.addSchema(require('@definitions/3.0.0/license.json')); + ajv.addSchema(require('@definitions/3.0.0/messageBindingsObject.json')); + ajv.addSchema(require('@definitions/3.0.0/messageExampleObject.json')); + ajv.addSchema(require('@definitions/3.0.0/messageObject.json')); + ajv.addSchema(require('@definitions/3.0.0/messages.json')); + ajv.addSchema(require('@definitions/3.0.0/messageTrait.json')); + ajv.addSchema(require('@definitions/3.0.0/multiFormatSchema.json')); + ajv.addSchema(require('@definitions/3.0.0/NonBearerHTTPSecurityScheme.json')); + ajv.addSchema(require('@definitions/3.0.0/oauth2Flow.json')); + ajv.addSchema(require('@definitions/3.0.0/oauth2Flows.json')); + ajv.addSchema(require('@definitions/3.0.0/oauth2Scopes.json')); + ajv.addSchema(require('@definitions/3.0.0/openIdConnect.json')); + ajv.addSchema(require('@definitions/3.0.0/operationBindingsObject.json')); + ajv.addSchema(require('@definitions/3.0.0/operationReply.json')); + ajv.addSchema(require('@definitions/3.0.0/operationReplyAddress.json')); + ajv.addSchema(require('@definitions/3.0.0/operation.json')); + ajv.addSchema(require('@definitions/3.0.0/operations.json')); + ajv.addSchema(require('@definitions/3.0.0/operationTrait.json')); + ajv.addSchema(require('@definitions/3.0.0/parameter.json')); + ajv.addSchema(require('@definitions/3.0.0/parameters.json')); + ajv.addSchema(require('@definitions/3.0.0/Reference.json')); + ajv.addSchema(require('@definitions/3.0.0/ReferenceObject.json')); + ajv.addSchema(require('@definitions/3.0.0/SaslGssapiSecurityScheme.json')); + ajv.addSchema(require('@definitions/3.0.0/SaslPlainSecurityScheme.json')); + ajv.addSchema(require('@definitions/3.0.0/SaslSecurityScheme.json')); + ajv.addSchema(require('@definitions/3.0.0/SaslScramSecurityScheme.json')); + ajv.addSchema(require('@definitions/3.0.0/schema.json')); + ajv.addSchema(require('@definitions/3.0.0/securityRequirements.json')); + ajv.addSchema(require('@definitions/3.0.0/SecurityScheme.json')); + ajv.addSchema(require('@definitions/3.0.0/server.json')); + ajv.addSchema(require('@definitions/3.0.0/serverBindingsObject.json')); + ajv.addSchema(require('@definitions/3.0.0/servers.json')); + ajv.addSchema(require('@definitions/3.0.0/serverVariable.json')); + ajv.addSchema(require('@definitions/3.0.0/serverVariables.json')); + ajv.addSchema(require('@definitions/3.0.0/specificationExtension.json')); + ajv.addSchema(require('@definitions/3.0.0/symmetricEncryption.json')); + ajv.addSchema(require('@definitions/3.0.0/tag.json')); + ajv.addSchema(require('@definitions/3.0.0/userPassword.json')); + ajv.addSchema(require('@definitions/3.0.0/X509.json')); + + ajv.addSchema(require('@common/avroSchema_v1.json')); + ajv.addSchema(require('@common/openapiSchema_3_0.json')); + + ajv.addSchema(require('@extensions/x/0.1.0/schema.json')); + ajv.addSchema(require('@extensions/linkedin/0.1.0/schema.json')); + + return bindingSchemes(ajv); +} diff --git a/test/bindings/amqp/amqp channel binding.test.mjs b/test/bindings/amqp/amqp channel binding.test.mjs new file mode 100644 index 00000000..74173ef9 --- /dev/null +++ b/test/bindings/amqp/amqp channel binding.test.mjs @@ -0,0 +1,171 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'exchange\'', + 'must have required property \'queue\'', + 'must match exactly one schema in oneOf' + ], + true, + [] +); + +let data = { + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/amqp/0.2.0/channel.json`), + [ + { + "is": "queue", + "queue": { + "name": "my-queue-name", + "durable": true, + "exclusive": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.2.0" + }, + { + "is": "routingKey", + "exchange": { + "name": "myExchange", + "type": "topic", + "durable": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.2.0" + } + ], + { + "is": "queue", + "queue": { + "name": "my-queue-name", + "durable": true, + "exclusive": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.2.0" + }, + { + "bindingVersion": "0.2.0" + }, + { + "is": "queue", + "queue": { + "name": "my-queue-name", + "durable": true, + "exclusive": true, + "autoDelete": false, + "vhost": "/" + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "is": "queue", + "queue": { + "name": "my-queue-name", + "durable": true, + "exclusive": true, + "autoDelete": false, + "vhost": "/" + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/amqp/0.3.0/channel.json`), + [ + { + "is": "queue", + "queue": { + "name": "my-queue-name", + "durable": true, + "exclusive": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.3.0" + }, + { + "is": "routingKey", + "exchange": { + "name": "myExchange", + "type": "topic", + "durable": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.3.0" + } + ], + { + "is": "queue", + "queue": { + "name": "my-queue-name", + "durable": true, + "exclusive": true, + "autoDelete": false, + "vhost": "/" + }, + "bindingVersion": "0.3.0" + }, + { + "bindingVersion": "0.3.0" + }, + { + "is": "queue", + "queue": { + "name": "my-queue-name", + "durable": true, + "exclusive": true, + "autoDelete": false, + "vhost": "/" + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "is": "queue", + "queue": { + "name": "my-queue-name", + "durable": true, + "exclusive": true, + "autoDelete": false, + "vhost": "/" + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ) +} + +describe.each([ + '0.2.0', + '0.3.0' +])('AMQP channel binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/amqp/amqp message binding.test.mjs b/test/bindings/amqp/amqp message binding.test.mjs new file mode 100644 index 00000000..ffbcc3a5 --- /dev/null +++ b/test/bindings/amqp/amqp message binding.test.mjs @@ -0,0 +1,77 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/amqp/0.2.0/message.json`), + [ + { + "contentEncoding": "gzip", + "messageType": "user.signup", + "bindingVersion": "0.2.0" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/amqp/0.3.0/message.json`), + [ + { + "contentEncoding": "gzip", + "messageType": "user.signup", + "bindingVersion": "0.3.0" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ) +} + +describe.each([ + '0.2.0', + '0.3.0' +])('AMQP message binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/amqp/amqp operation binding.test.mjs b/test/bindings/amqp/amqp operation binding.test.mjs new file mode 100644 index 00000000..b5882714 --- /dev/null +++ b/test/bindings/amqp/amqp operation binding.test.mjs @@ -0,0 +1,99 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/amqp/0.2.0/operation.json`), + [ + { + "expiration": 100000, + "userId": "guest", + "cc": [ + "user.logs" + ], + "priority": 10, + "deliveryMode": 2, + "mandatory": false, + "bcc": [ + "external.audit" + ], + "timestamp": true, + "ack": false, + "bindingVersion": "0.2.0" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/amqp/0.3.0/operation.json`), + [ + { + "expiration": 100000, + "userId": "guest", + "cc": [ + "user.logs" + ], + "priority": 10, + "deliveryMode": 2, + "mandatory": false, + "bcc": [ + "external.audit" + ], + "timestamp": true, + "ack": false, + "bindingVersion": "0.3.0" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ) +} + +describe.each([ + '0.2.0', + '0.3.0' +])('AMQP operation binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/anypointmq/anypointmq channel binding.test.mjs b/test/bindings/anypointmq/anypointmq channel binding.test.mjs new file mode 100644 index 00000000..c1a882f4 --- /dev/null +++ b/test/bindings/anypointmq/anypointmq channel binding.test.mjs @@ -0,0 +1,49 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.0.1": new JsonSchemaTestSuiteData( + require(`@bindings/anypointmq/0.0.1/channel.json`), + [ + { + "destination": "user-signup-exchg", + "destinationType": "exchange", + "bindingVersion": "0.0.1" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.0.1', +])('Anypoint MQ channel binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/anypointmq/anypointmq message binding.test.mjs b/test/bindings/anypointmq/anypointmq message binding.test.mjs new file mode 100644 index 00000000..c3c9a811 --- /dev/null +++ b/test/bindings/anypointmq/anypointmq message binding.test.mjs @@ -0,0 +1,56 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.0.1": new JsonSchemaTestSuiteData( + require(`@bindings/anypointmq/0.0.1/message.json`), + [ + { + "headers": { + "type": "object", + "properties": { + "correlationId": { + "description": "Correlation ID set by application", + "type": "string" + } + } + }, + "bindingVersion": "0.0.1" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.0.1', +])('Anypoint MQ message binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/googlepubsub/googlepubsub channel binding.test.mjs b/test/bindings/googlepubsub/googlepubsub channel binding.test.mjs new file mode 100644 index 00000000..71ec6a4e --- /dev/null +++ b/test/bindings/googlepubsub/googlepubsub channel binding.test.mjs @@ -0,0 +1,191 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = { + "0.1.0": new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'schemaSettings\'', + 'must have required property \'topic\'' + ], + true, + [] + ), + "0.2.0": new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'schemaSettings\'', + ], + true, + [] + ) +}; + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/googlepubsub/0.1.0/channel.json`), + [ + { + "topic": "projects/your-project/topics/topic-proto-schema", + "messageRetentionDuration": "86400s", + "messageStoragePolicy": { + "allowedPersistenceRegions": [ + "us-central1", + "us-central2", + "us-east1", + "us-east4", + "us-east5", + "us-east7", + "us-south1", + "us-west1", + "us-west2", + "us-west3", + "us-west4" + ] + }, + "schemaSettings": { + "encoding": "binary", + "name": "projects/your-project/schemas/message-proto" + }, + "bindingVersion": "0.1.0" + } + ], + { + "topic": "projects/your-project/topics/topic-proto-schema", + "schemaSettings": { + "encoding": "binary", + "name": "projects/your-project/schemas/message-proto" + }, + "bindingVersion": "0.1.0" + }, + { + "messageRetentionDuration": "86400s", + "messageStoragePolicy": { + "allowedPersistenceRegions": [ + "us-central1", + "us-central2", + "us-east1", + "us-east4", + "us-east5", + "us-east7", + "us-south1", + "us-west1", + "us-west2", + "us-west3", + "us-west4" + ] + }, + "bindingVersion": "0.1.0" + }, + { + "topic": "projects/your-project/topics/topic-proto-schema", + "schemaSettings": { + "encoding": "binary", + "name": "projects/your-project/schemas/message-proto" + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "topic": "projects/your-project/topics/topic-proto-schema", + "schemaSettings": { + "encoding": "binary", + "name": "projects/your-project/schemas/message-proto" + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/googlepubsub/0.2.0/channel.json`), + [ + { + "messageRetentionDuration": "86400s", + "messageStoragePolicy": { + "allowedPersistenceRegions": [ + "us-central1", + "us-central2", + "us-east1", + "us-east4", + "us-east5", + "us-east7", + "us-south1", + "us-west1", + "us-west2", + "us-west3", + "us-west4" + ] + }, + "schemaSettings": { + "encoding": "binary", + "name": "projects/your-project/schemas/message-proto" + } + } + ], + { + "schemaSettings": { + "encoding": "binary", + "name": "projects/your-project/schemas/message-proto" + } + }, + { + "messageRetentionDuration": "86400s", + "messageStoragePolicy": { + "allowedPersistenceRegions": [ + "us-central1", + "us-central2", + "us-east1", + "us-east4", + "us-east5", + "us-east7", + "us-south1", + "us-west1", + "us-west2", + "us-west3", + "us-west4" + ] + } + }, + { + "schemaSettings": { + "encoding": "binary", + "name": "projects/your-project/schemas/message-proto" + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "schemaSettings": { + "encoding": "binary", + "name": "projects/your-project/schemas/message-proto" + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', + '0.2.0', +])('Google Pub/Sub channel binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config[bindingVersion]).testSuite() +}) diff --git a/test/bindings/googlepubsub/googlepubsub message binding.test.mjs b/test/bindings/googlepubsub/googlepubsub message binding.test.mjs new file mode 100644 index 00000000..3bd03ecb --- /dev/null +++ b/test/bindings/googlepubsub/googlepubsub message binding.test.mjs @@ -0,0 +1,79 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/googlepubsub/0.1.0/message.json`), + [ + { + "schema": { + "name": "projects/your-project/schemas/message-avro", + "type": "avro" + }, + "bindingVersion": "0.1.0" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/googlepubsub/0.2.0/message.json`), + [ + { + "schema": { + "name": "projects/your-project/schemas/message-avro" + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', + '0.2.0', +])('Google Pub/Sub message binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config[bindingVersion]).testSuite() +}) diff --git a/test/bindings/http/http message binding.test.mjs b/test/bindings/http/http message binding.test.mjs new file mode 100644 index 00000000..4ef2bdae --- /dev/null +++ b/test/bindings/http/http message binding.test.mjs @@ -0,0 +1,130 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/http/0.1.0/message.json`), + [ + { + "headers": { + "type": "object", + "properties": { + "Content-Type": { + "type": "string", + "enum": [ + "application/json" + ] + } + } + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/http/0.2.0/message.json`), + [ + { + "headers": { + "type": "object", + "properties": { + "Content-Type": { + "type": "string", + "enum": [ + "application/json" + ] + } + } + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/http/0.3.0/message.json`), + [ + { + "headers": { + "type": "object", + "properties": { + "Content-Type": { + "type": "string", + "enum": [ + "application/json" + ] + } + } + }, + "statusCode": 200 + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ) +} + +describe.each([ + '0.1.0', + '0.2.0', + '0.3.0', +])('HTTP message binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config[bindingVersion]).testSuite() +}) diff --git a/test/bindings/http/http operation binding.test.mjs b/test/bindings/http/http operation binding.test.mjs new file mode 100644 index 00000000..f96c5dab --- /dev/null +++ b/test/bindings/http/http operation binding.test.mjs @@ -0,0 +1,162 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = { + "0.1.0": new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'type\'' + ], + true, + [] + ), + "0.2.0": new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] + ), + "0.3.0": new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] + ) +} + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/http/0.1.0/operation.json`), + [ + { + "type": "request", + "method": "GET", + "query": { + "type": "object", + "required": [ + "companyId" + ], + "properties": { + "companyId": { + "type": "number", + "minimum": 1, + "description": "The Id of the company." + } + }, + "additionalProperties": false + } + } + ], + { + "type": "request", + }, + {}, + { + "type": "request", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "type": "request", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/http/0.2.0/operation.json`), + [ + { + "method": "GET", + "query": { + "type": "object", + "required": [ + "companyId" + ], + "properties": { + "companyId": { + "type": "number", + "minimum": 1, + "description": "The Id of the company." + } + }, + "additionalProperties": false + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/http/0.3.0/operation.json`), + [ + { + "method": "GET", + "query": { + "type": "object", + "required": [ + "companyId" + ], + "properties": { + "companyId": { + "type": "number", + "minimum": 1, + "description": "The Id of the company." + } + }, + "additionalProperties": false + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ) +} + +describe.each([ + '0.1.0', + '0.2.0', + '0.3.0', +])('HTTP message binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config[bindingVersion]).testSuite() +}) diff --git a/test/bindings/ibmmq/ibmmq channel binding.test.mjs b/test/bindings/ibmmq/ibmmq channel binding.test.mjs new file mode 100644 index 00000000..6fddce25 --- /dev/null +++ b/test/bindings/ibmmq/ibmmq channel binding.test.mjs @@ -0,0 +1,63 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/ibmmq/0.1.0/channel.json`), + [ + { + "destinationType": "queue", + "queue": { + "objectName": "message", + "isPartitioned": false, + "exclusive": true + }, + "maxMsgLength": 1024 + }, + { + "destinationType": "topic", + "topic": { + "string": "messages", + "objectName": "message", + "durablePermitted": true, + "lastMsgRetained": true + }, + "maxMsgLength": 1024 + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', +])('IBM MQ channel binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/ibmmq/ibmmq message binding.test.mjs b/test/bindings/ibmmq/ibmmq message binding.test.mjs new file mode 100644 index 00000000..2737b03b --- /dev/null +++ b/test/bindings/ibmmq/ibmmq message binding.test.mjs @@ -0,0 +1,58 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must match exactly one schema in oneOf' + ], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/ibmmq/0.1.0/message.json`), + [ + { + "type": "jms", + "description": "JMS stream message", + "expiry": 0 + } + ], + { + "type": "jms", + "description": "JMS stream message", + }, + {}, + { + "type": "jms", + "description": "JMS stream message", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "type": "jms", + "description": "JMS stream message", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', +])('IBM MQ message binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/ibmmq/ibmmq server binding.test.mjs b/test/bindings/ibmmq/ibmmq server binding.test.mjs new file mode 100644 index 00000000..e6d2cacc --- /dev/null +++ b/test/bindings/ibmmq/ibmmq server binding.test.mjs @@ -0,0 +1,51 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/ibmmq/0.1.0/server.json`), + [ + { + "groupId": "PRODCLSTR1", + "ccdtQueueManagerName": "*", + "multiEndpointServer": false, + "heartBeatInterval": 300, + "cipherSpec": "ANY_TLS12_OR_HIGHER" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', +])('IBM MQ server binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/jms/jms channel binding.test.mjs b/test/bindings/jms/jms channel binding.test.mjs new file mode 100644 index 00000000..8ec95d36 --- /dev/null +++ b/test/bindings/jms/jms channel binding.test.mjs @@ -0,0 +1,48 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.0.1": new JsonSchemaTestSuiteData( + require(`@bindings/jms/0.0.1/channel.json`), + [ + { + "destination": "user-signed-up", + "destinationType": "fifo-queue" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.0.1', +])('JMS channel binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/jms/jms message binding.test.mjs b/test/bindings/jms/jms message binding.test.mjs new file mode 100644 index 00000000..5556afdc --- /dev/null +++ b/test/bindings/jms/jms message binding.test.mjs @@ -0,0 +1,87 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.0.1": new JsonSchemaTestSuiteData( + require(`@bindings/jms/0.0.1/message.json`), + [ + { + "headers": { + "type": "object", + "required": ["JMSMessageID"], + "properties": { + "JMSMessageID": { + "type": ["string", "null"], + "description": "A unique message identifier. This may be set by your JMS Provider on your behalf." + }, + "JMSTimestamp": { + "type": "integer", + "description": "The time the message was sent. This may be set by your JMS Provider on your behalf. The time the message was sent. The value of the timestamp is the amount of time, measured in milliseconds, that has elapsed since midnight, January 1, 1970, UTC." + }, + "JMSDeliveryMode": { + "type": "string", + "enum": ["PERSISTENT", "NON_PERSISTENT"], + "default": "PERSISTENT", + "description": "Denotes the delivery mode for the message. This may be set by your JMS Provider on your behalf." + }, + "JMSPriority": { + "type": "integer", + "default": 4, + "description": "The priority of the message. This may be set by your JMS Provider on your behalf." + }, + "JMSExpires": { + "type": "integer", + "description": "The time at which the message expires. This may be set by your JMS Provider on your behalf. A value of zero means that the message does not expire. Any non-zero value is the amount of time, measured in milliseconds, that has elapsed since midnight, January 1, 1970, UTC, at which the message will expire." + }, + "JMSType": { + "type": ["string", "null"], + "description": "The type of message. Some JMS providers use a message repository that contains the definitions of messages sent by applications. The 'JMSType' header field may reference a message's definition in the provider's repository. The JMS API does not define a standard message definition repository, nor does it define a naming policy for the definitions it contains. Some messaging systems require that a message type definition for each application message be created and that each message specify its type. In order to work with such JMS providers, JMS clients should assign a value to 'JMSType', whether the application makes use of it or not. This ensures that the field is properly set for those providers that require it." + }, + "JMSCorrelationID": { + "type": ["string", "null"], + "description": "The correlation identifier of the message. A client can use the 'JMSCorrelationID' header field to link one message with another. A typical use is to link a response message with its request message. Since each message sent by a JMS provider is assigned a message ID value, it is convenient to link messages via message ID, such message ID values must start with the 'ID:' prefix. Conversely, application-specified values must not start with the 'ID:' prefix; this is reserved for provider-generated message ID values." + }, + "JMSReplyTo": { + "type": "string", + "description": "The queue or topic that the message sender expects replies to." + } + } + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.0.1', +])('JMS message binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/jms/jms server binding.test.mjs b/test/bindings/jms/jms server binding.test.mjs new file mode 100644 index 00000000..e4aab720 --- /dev/null +++ b/test/bindings/jms/jms server binding.test.mjs @@ -0,0 +1,60 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'jmsConnectionFactory\'', + ], + true, + [] +); + +let data = { + "0.0.1": new JsonSchemaTestSuiteData( + require(`@bindings/jms/0.0.1/server.json`), + [ + { + "jmsConnectionFactory": "org.apache.activemq.ActiveMQConnectionFactory", + "properties": [ + { + "name": "disableTimeStampsByDefault", + "value": false + } + ], + "clientID": "my-application-1" + } + ], + { + "jmsConnectionFactory": "org.apache.activemq.ActiveMQConnectionFactory" + }, + {}, + { + "jmsConnectionFactory": "org.apache.activemq.ActiveMQConnectionFactory", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "jmsConnectionFactory": "org.apache.activemq.ActiveMQConnectionFactory", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.0.1', +])('JMS server binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/kafka/kafka channel binding.test.mjs b/test/bindings/kafka/kafka channel binding.test.mjs new file mode 100644 index 00000000..cf3126bf --- /dev/null +++ b/test/bindings/kafka/kafka channel binding.test.mjs @@ -0,0 +1,125 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.3.0/channel.json`), + [ + { + "topic": "my-specific-topic", + "partitions": 20, + "replicas": 3 + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.4.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.4.0/channel.json`), + [ + { + "topic": "my-specific-topic-name", + "partitions": 20, + "replicas": 3, + "topicConfiguration": { + "cleanup.policy": [ + "delete", + "compact" + ], + "retention.ms": 604800000, + "retention.bytes": 1000000000, + "delete.retention.ms": 86400000, + "max.message.bytes": 1048588 + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.5.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.5.0/channel.json`), + [ + { + "topic": "my-specific-topic-name", + "partitions": 20, + "replicas": 3, + "topicConfiguration": { + "cleanup.policy": [ + "delete", + "compact" + ], + "retention.ms": 604800000, + "retention.bytes": 1000000000, + "delete.retention.ms": 86400000, + "max.message.bytes": 1048588 + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.3.0', + '0.4.0', + '0.5.0', +])('Kafka channel binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/kafka/kafka message binding.test.mjs b/test/bindings/kafka/kafka message binding.test.mjs new file mode 100644 index 00000000..083f3411 --- /dev/null +++ b/test/bindings/kafka/kafka message binding.test.mjs @@ -0,0 +1,154 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.1.0/message.json`), + [ + { + "key": { + "type": "string", + "enum": [ + "myKey" + ] + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.3.0/message.json`), + [ + { + "key": { + "type": "string", + "enum": [ + "myKey" + ] + }, + "schemaIdLocation": "payload", + "schemaIdPayloadEncoding": "apicurio-new", + "schemaLookupStrategy": "TopicIdStrategy" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.4.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.4.0/message.json`), + [ + { + "key": { + "type": "string", + "enum": [ + "myKey" + ] + }, + "schemaIdLocation": "payload", + "schemaIdPayloadEncoding": "apicurio-new", + "schemaLookupStrategy": "TopicIdStrategy" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.5.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.5.0/message.json`), + [ + { + "key": { + "type": "string", + "enum": [ + "myKey" + ] + }, + "schemaIdLocation": "payload", + "schemaIdPayloadEncoding": "apicurio-new", + "schemaLookupStrategy": "TopicIdStrategy" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', + '0.3.0', + '0.4.0', + '0.5.0', +])('Kafka message binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/kafka/kafka operation binding.test.mjs b/test/bindings/kafka/kafka operation binding.test.mjs new file mode 100644 index 00000000..0dc031e3 --- /dev/null +++ b/test/bindings/kafka/kafka operation binding.test.mjs @@ -0,0 +1,169 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.1.0/operation.json`), + [ + { + "groupId": { + "type": "string", + "enum": [ + "myGroupId" + ] + }, + "clientId": { + "type": "string", + "enum": [ + "myClientId" + ] + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.3.0/operation.json`), + [ + { + "groupId": { + "type": "string", + "enum": [ + "myGroupId" + ] + }, + "clientId": { + "type": "string", + "enum": [ + "myClientId" + ] + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.4.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.4.0/operation.json`), + [ + { + "groupId": { + "type": "string", + "enum": [ + "myGroupId" + ] + }, + "clientId": { + "type": "string", + "enum": [ + "myClientId" + ] + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.5.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.5.0/operation.json`), + [ + { + "groupId": { + "type": "string", + "enum": [ + "myGroupId" + ] + }, + "clientId": { + "type": "string", + "enum": [ + "myClientId" + ] + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', + '0.3.0', + '0.4.0', + '0.5.0', +])('Kafka operation binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/kafka/kafka server binding.test.mjs b/test/bindings/kafka/kafka server binding.test.mjs new file mode 100644 index 00000000..6e59a3ea --- /dev/null +++ b/test/bindings/kafka/kafka server binding.test.mjs @@ -0,0 +1,102 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.3.0/server.json`), + [ + { + "schemaRegistryUrl": "https://my-schema-registry.com", + "schemaRegistryVendor": "confluent" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.4.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.4.0/server.json`), + [ + { + "schemaRegistryUrl": "https://my-schema-registry.com", + "schemaRegistryVendor": "confluent" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.5.0": new JsonSchemaTestSuiteData( + require(`@bindings/kafka/0.5.0/server.json`), + [ + { + "schemaRegistryUrl": "https://my-schema-registry.com", + "schemaRegistryVendor": "confluent" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.3.0', + '0.4.0', + '0.5.0', +])('Kafka operation binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/mqtt/mqtt message binding.test.mjs b/test/bindings/mqtt/mqtt message binding.test.mjs new file mode 100644 index 00000000..ef791fc3 --- /dev/null +++ b/test/bindings/mqtt/mqtt message binding.test.mjs @@ -0,0 +1,77 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/mqtt/0.1.0/message.json`), + [ + {} + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/mqtt/0.2.0/message.json`), + [ + { + "contentType": "application/json", + "correlationData": { + "type": "string", + "format": "uuid" + }, + "responseTopic": "application/responses", + "bindingVersion": "0.2.0" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', + '0.2.0', +])('MQTT message binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/mqtt/mqtt operation binding.test.mjs b/test/bindings/mqtt/mqtt operation binding.test.mjs new file mode 100644 index 00000000..921196e5 --- /dev/null +++ b/test/bindings/mqtt/mqtt operation binding.test.mjs @@ -0,0 +1,76 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/mqtt/0.1.0/operation.json`), + [ + { + "qos": 2, + "retain": true + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/mqtt/0.2.0/operation.json`), + [ + { + "qos": 2, + "retain": true, + "messageExpiryInterval": 60 + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', + '0.2.0', +])('MQTT operation binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/mqtt/mqtt server binding.test.mjs b/test/bindings/mqtt/mqtt server binding.test.mjs new file mode 100644 index 00000000..4cb89151 --- /dev/null +++ b/test/bindings/mqtt/mqtt server binding.test.mjs @@ -0,0 +1,91 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/mqtt/0.1.0/server.json`), + [ + { + "clientId": "guest", + "cleanSession": true, + "lastWill": { + "topic": "/last-wills", + "qos": 2, + "message": "Guest gone offline.", + "retain": false + }, + "keepAlive": 60 + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/mqtt/0.2.0/server.json`), + [ + { + "clientId": "guest", + "cleanSession": true, + "lastWill": { + "topic": "/last-wills", + "qos": 2, + "message": "Guest gone offline.", + "retain": false + }, + "keepAlive": 60, + "sessionExpiryInterval": 120, + "maximumPacketSize": 1024 + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', + '0.2.0', +])('MQTT server binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/nats/nats operation binding.test.mjs b/test/bindings/nats/nats operation binding.test.mjs new file mode 100644 index 00000000..5c801a61 --- /dev/null +++ b/test/bindings/nats/nats operation binding.test.mjs @@ -0,0 +1,47 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/nats/0.1.0/operation.json`), + [ + { + "queue": "messages" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', +])('NATS operation binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/pulsar/pulsar channel binding.test.mjs b/test/bindings/pulsar/pulsar channel binding.test.mjs new file mode 100644 index 00000000..22cbb356 --- /dev/null +++ b/test/bindings/pulsar/pulsar channel binding.test.mjs @@ -0,0 +1,69 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'namespace\'', + 'must have required property \'persistence\'', + ], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/pulsar/0.1.0/channel.json`), + [ + { + "namespace": "staging", + "persistence": "persistent", + "compaction": 1000, + "geo-replication": [ + "us-east1", + "us-west1" + ], + "retention": { + "time": 7, + "size": 1000 + }, + "ttl": 360, + "deduplication": false + } + ], + { + "namespace": "staging", + "persistence": "persistent" + }, + {}, + { + "namespace": "staging", + "persistence": "persistent", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "namespace": "staging", + "persistence": "persistent", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', +])('Pulsar channel binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/pulsar/pulsar server binding.test.mjs b/test/bindings/pulsar/pulsar server binding.test.mjs new file mode 100644 index 00000000..94083769 --- /dev/null +++ b/test/bindings/pulsar/pulsar server binding.test.mjs @@ -0,0 +1,47 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/pulsar/0.1.0/server.json`), + [ + { + "tenant": "contoso" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', +])('Pulsar server binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/sns/sns channel binding.test.mjs b/test/bindings/sns/sns channel binding.test.mjs new file mode 100644 index 00000000..dfe0447f --- /dev/null +++ b/test/bindings/sns/sns channel binding.test.mjs @@ -0,0 +1,62 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'name\'', + ], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/sns/0.1.0/channel.json`), + [ + { + "name": "my-sns-topic", + "policy": { + "statements": [ + { + "effect": "Allow", + "principal": "*", + "action": "SNS:Publish" + } + ] + } + } + ], + { + "name": "my-sns-topic" + }, + {}, + { + "name": "my-sns-topic", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "name": "my-sns-topic", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', +])('Amazon SNS channel binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/sns/sns operation binding.test.mjs b/test/bindings/sns/sns operation binding.test.mjs new file mode 100644 index 00000000..b33dec22 --- /dev/null +++ b/test/bindings/sns/sns operation binding.test.mjs @@ -0,0 +1,108 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'consumers\'', + ], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/sns/0.1.0/operation.json`), + [ + { + "topic": { + "name": "someTopic" + }, + "consumers": [ + { + "protocol": "sqs", + "endpoint": { + "name": "someQueue" + }, + "filterPolicyScope": "MessageAttributes", + "rawMessageDelivery": false, + "redrivePolicy": { + "deadLetterQueue": { + "arn": "arn:aws:SQS:eu-west-1:0000000:123456789" + }, + "maxReceiveCount": 25 + }, + "deliveryPolicy": { + "minDelayTarget": 10, + "maxDelayTarget": 100, + "numRetries": 5, + "numNoDelayRetries": 2, + "numMinDelayRetries": 3, + "numMaxDelayRetries": 5, + "backoffFunction": "linear", + "maxReceivesPerSecond": 2 + } + } + ] + } + ], + { + "consumers": [ + { + "protocol": "sqs", + "endpoint": { + "name": "someQueue" + }, + "filterPolicyScope": "MessageAttributes", + "rawMessageDelivery": false, + } + ] + }, + {}, + { + "consumers": [ + { + "protocol": "sqs", + "endpoint": { + "name": "someQueue" + }, + "filterPolicyScope": "MessageAttributes", + "rawMessageDelivery": false, + } + ], + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "consumers": [ + { + "protocol": "sqs", + "endpoint": { + "name": "someQueue" + }, + "filterPolicyScope": "MessageAttributes", + "rawMessageDelivery": false, + } + ], + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', +])('Amazon SNS operation binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/solace/solace operation binding.test.mjs b/test/bindings/solace/solace operation binding.test.mjs new file mode 100644 index 00000000..fa0fbb42 --- /dev/null +++ b/test/bindings/solace/solace operation binding.test.mjs @@ -0,0 +1,152 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + false, // TODO: enable after schema patch + [] +); + +let data = { + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/solace/0.2.0/operation.json`), + [ + { + "destinations": [ + { + "destinationType": "queue", + "queue": { + "name": "CreatedHREvents", + "topicSubscriptions": [ + "person/*/created" + ], + "accessType": "exclusive" + } + }, + { + "destinationType": "topic", + "topicSubscriptions": [ + "person/*/updated" + ] + } + ] + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/solace/0.3.0/operation.json`), + [ + { + "destinations": [ + { + "destinationType": "queue", + "queue": { + "name": "CreatedHREvents", + "topicSubscriptions": [ + "person/*/created" + ], + "accessType": "exclusive", + "maxMsgSpoolSize": "1,500", + "maxTtl": "60" + } + }, + { + "destinationType": "topic", + "topicSubscriptions": [ + "person/*/updated" + ] + } + ] + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.4.0": new JsonSchemaTestSuiteData( + require(`@bindings/solace/0.4.0/operation.json`), + [ + { + "destinations": [ + { + "destinationType": "queue", + "queue": { + "name": "sampleQueue", + "topicSubscriptions": [ + "samples/*" + ], + "accessType": "nonexclusive" + } + }, + { + "destinationType": "topic", + "topicSubscriptions": [ + "samples/*" + ] + } + ] + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.2.0', + '0.3.0', + '0.4.0', +])('Solace operation binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/solace/solace server binding.test.mjs b/test/bindings/solace/solace server binding.test.mjs new file mode 100644 index 00000000..24652ad6 --- /dev/null +++ b/test/bindings/solace/solace server binding.test.mjs @@ -0,0 +1,100 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/solace/0.2.0/server.json`), + [ + { + "msvVpn": "solace.private.net" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.3.0": new JsonSchemaTestSuiteData( + require(`@bindings/solace/0.3.0/server.json`), + [ + { + "msgVpn": "solace.private.net" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), + "0.4.0": new JsonSchemaTestSuiteData( + require(`@bindings/solace/0.4.0/server.json`), + [ + { + "clientName": "transactions-broker", + "msgVpn": "ProdVPN" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.2.0', + '0.3.0', + '0.4.0', +])('Solace server binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/sqs/sqs channel binding.test.mjs b/test/bindings/sqs/sqs channel binding.test.mjs new file mode 100644 index 00000000..929a4370 --- /dev/null +++ b/test/bindings/sqs/sqs channel binding.test.mjs @@ -0,0 +1,101 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'queue\'', + ], + true, + [] +); + +let data = { + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/sqs/0.2.0/channel.json`), + [ + { + "queue": { + "name": "myQueue", + "fifoQueue": true, + "deduplicationScope": "messageGroup", + "fifoThroughputLimit": "perMessageGroupId", + "deliveryDelay": 15, + "visibilityTimeout": 60, + "receiveMessageWaitTime": 0, + "messageRetentionPeriod": 86400, + "redrivePolicy": { + "deadLetterQueue": { + "arn": "arn:aws:SQS:eu-west-1:0000000:123456789" + }, + "maxReceiveCount": 15 + }, + "policy": { + "statements": [ + { + "effect": "Deny", + "principal": "arn:aws:iam::123456789012:user/dec.kolakowski", + "action": [ + "sqs:SendMessage", + "sqs:ReceiveMessage" + ] + } + ] + }, + "tags": { + "owner": "AsyncAPI.NET", + "platform": "AsyncAPIOrg" + } + }, + "deadLetterQueue": { + "name": "myQueue_error", + "fifoQueue": false, + "deliveryDelay": 0, + "visibilityTimeout": 0, + "receiveMessageWaitTime": 0, + "messageRetentionPeriod": 604800 + } + } + ], + { + "queue": { + "name": "myQueue", + "fifoQueue": true + } + }, + {}, + { + "queue": { + "name": "myQueue", + "fifoQueue": true + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "queue": { + "name": "myQueue", + "fifoQueue": true + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.2.0', +])('Amazon SQS channel binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/sqs/sqs operation binding.test.mjs b/test/bindings/sqs/sqs operation binding.test.mjs new file mode 100644 index 00000000..9a420e63 --- /dev/null +++ b/test/bindings/sqs/sqs operation binding.test.mjs @@ -0,0 +1,98 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'queues\'', + ], + true, + [] +); + +let data = { + "0.2.0": new JsonSchemaTestSuiteData( + require(`@bindings/sqs/0.2.0/operation.json`), + [ + { + "queues": [ + { + "name": "myQueue", + "fifoQueue": true, + "deduplicationScope": "messageGroup", + "fifoThroughputLimit": "perMessageGroupId", + "deliveryDelay": 10, + "redrivePolicy": { + "deadLetterQueue": { + "name": "myQueue_error" + }, + "maxReceiveCount": 15 + }, + "policy": { + "statements": [ + { + "effect": "Deny", + "principal": "arn:aws:iam::123456789012:user/dec.kolakowski", + "action": [ + "sqs:SendMessage", + "sqs:ReceiveMessage" + ] + } + ] + } + }, + { + "name": "myQueue_error", + "deliveryDelay": 10 + } + ] + } + ], + { + "queues": [ + { + "name": "myQueue_error", + "deliveryDelay": 10 + } + ] + }, + {}, + { + "queues": [ + { + "name": "myQueue_error", + "deliveryDelay": 10 + } + ], + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "queues": [ + { + "name": "myQueue_error", + "deliveryDelay": 10 + } + ], + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.2.0', +])('Amazon SNS operation binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/bindings/websockets/websockets channel binding.test.mjs b/test/bindings/websockets/websockets channel binding.test.mjs new file mode 100644 index 00000000..b0e7d317 --- /dev/null +++ b/test/bindings/websockets/websockets channel binding.test.mjs @@ -0,0 +1,65 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +let data = { + "0.1.0": new JsonSchemaTestSuiteData( + require(`@bindings/websockets/0.1.0/channel.json`), + [ + { + "method": "GET", + "query": { + "type": "object", + "properties": { + "ref": { + "type": "string", + "description": "Referral." + } + } + }, + "headers": { + "type": "object", + "properties": { + "Authentication": { + "type": "string", + "description": "Authentication token" + } + } + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + ), +} + +describe.each([ + '0.1.0', +])('WebSockets channel binding v%s', (bindingVersion) => { + new JsonSchemaTestSuite(data[bindingVersion], config).testSuite() +}) diff --git a/test/index.js b/test/bundler.test.mjs similarity index 85% rename from test/index.js rename to test/bundler.test.mjs index 5d174716..e34df344 100644 --- a/test/index.js +++ b/test/bundler.test.mjs @@ -1,8 +1,10 @@ +import {describe, it, suite, test} from 'vitest'; + const assert = require('assert'); const fs = require('fs'); const path = require('path'); -describe('AsyncAPI', () => { +describe('AsyncAPI: Bundler', () => { it('should return an object', () => { const asyncapi = require('..'); assert(typeof asyncapi === 'object', 'Returned value is not an object.'); @@ -13,21 +15,21 @@ describe('AsyncAPI', () => { const files = fs.readdirSync('schemas'); files.forEach(file => { const fileName = path.parse(file).name; - + if (skipFiles.includes(fileName)) return; const asyncapi = require('..'); if (fileName.includes('-without-$id')) { const schemaName = fileName.replace('-without-$id', ''); - assert(typeof asyncapi.schemasWithoutId[schemaName] === 'object', `Returned object does not contain ${schemaName}.`); + assert(typeof asyncapi.schemasWithoutId[schemaName] === 'object', `Returned object does not contain ${schemaName}.`); const asyncapiVersion = require('..').schemasWithoutId[schemaName]; const asyncapiSchema = require(`../schemas/${fileName}.json`); - assert.deepStrictEqual(asyncapiVersion, asyncapiSchema, `Returned object is not schema version ${schemaName}.`); + assert.deepStrictEqual(asyncapiVersion, asyncapiSchema, `Returned object is not schema version ${schemaName}.`); } else { assert(typeof asyncapi.schemas[fileName] === 'object', `Returned object does not contain ${fileName}.`); const asyncapiVersion = require('..').schemas[fileName]; const asyncapiSchema = require(`../schemas/${fileName}.json`); - assert.deepStrictEqual(asyncapiVersion, asyncapiSchema, `Returned object is not schema version ${fileName}.`); + assert.deepStrictEqual(asyncapiVersion, asyncapiSchema, `Returned object is not schema version ${fileName}.`); } }); }); diff --git a/test/definitions/3.0.0/models/channel/channel parameter.test.mjs b/test/definitions/3.0.0/models/channel/channel parameter.test.mjs new file mode 100644 index 00000000..09491146 --- /dev/null +++ b/test/definitions/3.0.0/models/channel/channel parameter.test.mjs @@ -0,0 +1,59 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/parameter.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "description": "Id of the user.", + "default": "0e822ca6-5311-4d4c-b409-993a1820e689", + "enum": [ + "0e822ca6-5311-4d4c-b409-993a1820e689", + "381f5ddc-75c6-4c21-9ec1-3919ed345be9", + "70559d88-31a5-4ef2-8c34-7fbd04057ed5", + "c6dc0047-a90d-4efa-95e3-a272282934e0" + ], + "examples": [ + "0e822ca6-5311-4d4c-b409-993a1820e689", + "381f5ddc-75c6-4c21-9ec1-3919ed345be9", + "70559d88-31a5-4ef2-8c34-7fbd04057ed5", + "c6dc0047-a90d-4efa-95e3-a272282934e0" + ], + "location": "$message.payload#/user/id" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('Channel Parameter', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/models/channel/channel.test.mjs b/test/definitions/3.0.0/models/channel/channel.test.mjs new file mode 100644 index 00000000..d121772d --- /dev/null +++ b/test/definitions/3.0.0/models/channel/channel.test.mjs @@ -0,0 +1,82 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/channel.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "address": "users.{userId}", + "title": "Users channel", + "description": "This channel is used to exchange messages about user events.", + "messages": { + "userSignedUp": { + "$ref": "#/components/messages/userSignedUp" + }, + "userCompletedOrder": { + "$ref": "#/components/messages/userCompletedOrder" + } + }, + "parameters": { + "userId": { + "$ref": "#/components/parameters/userId" + } + }, + "servers": [ + { "$ref": "#/servers/rabbitmqInProd" }, + { "$ref": "#/servers/rabbitmqInStaging" } + ], + "bindings": { + "amqp": { + "is": "queue", + "queue": { + "exclusive": true + } + } + }, + "tags": [ + { + "name": "user", + "description": "User-related messages" + } + ], + "externalDocs": { + "description": "Find more info here", + "url": "https://example.com" + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('Channel', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/models/channel/message correlation id.test.mjs b/test/definitions/3.0.0/models/channel/message correlation id.test.mjs new file mode 100644 index 00000000..e983f034 --- /dev/null +++ b/test/definitions/3.0.0/models/channel/message correlation id.test.mjs @@ -0,0 +1,52 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/correlationId.json'); + +const config = new JsonSchemaTestSuiteConfig( + true, + ['must have required property \'location\''], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "description": "Default Correlation ID", + "location": "$message.header#/correlationId" + } + ], + { + "location": "$message.header#/correlationId" + }, + { + "description": "Default Correlation ID", + }, + { + "location": "$message.header#/correlationId", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "location": "$message.header#/correlationId", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('Channel Correlation ID', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/models/channel/message example.test.mjs b/test/definitions/3.0.0/models/channel/message example.test.mjs new file mode 100644 index 00000000..bbf7fa29 --- /dev/null +++ b/test/definitions/3.0.0/models/channel/message example.test.mjs @@ -0,0 +1,83 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/messageExampleObject.json'); + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'payload\'', + 'must have required property \'headers\'', + 'must match a schema in anyOf' + ], + false, // TODO: enable after schema patch + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "name": "SimpleSignup", + "summary": "A simple UserSignup example message", + "headers": { + "correlationId": "my-correlation-id", + "applicationInstanceId": "myInstanceId" + }, + "payload": { + "user": { + "someUserKey": "someUserValue" + }, + "signup": { + "someSignupKey": "someSignupValue" + } + } + } + ], + { + "headers": { + "correlationId": "my-correlation-id", + "applicationInstanceId": "myInstanceId" + } + }, + {}, + { + "payload": { + "user": { + "someUserKey": "someUserValue" + }, + "signup": { + "someSignupKey": "someSignupValue" + } + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "payload": { + "user": { + "someUserKey": "someUserValue" + }, + "signup": { + "someSignupKey": "someSignupValue" + } + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('Channel Message Example', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/models/channel/message trait.test.mjs b/test/definitions/3.0.0/models/channel/message trait.test.mjs new file mode 100644 index 00000000..52078507 --- /dev/null +++ b/test/definitions/3.0.0/models/channel/message trait.test.mjs @@ -0,0 +1,45 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/messageTrait.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "contentType": "application/json" + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('Channel Message Trait', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/models/channel/message.test.mjs b/test/definitions/3.0.0/models/channel/message.test.mjs new file mode 100644 index 00000000..99426546 --- /dev/null +++ b/test/definitions/3.0.0/models/channel/message.test.mjs @@ -0,0 +1,97 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/messageObject.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "name": "UserSignup", + "title": "User signup", + "summary": "Action to sign a user up.", + "description": "A longer description", + "contentType": "application/json", + "tags": [{ "name": "user" }, { "name": "signup" }, { "name": "register" }], + "headers": { + "type": "object", + "properties": { + "correlationId": { + "description": "Correlation ID set by application", + "type": "string" + }, + "applicationInstanceId": { + "description": "Unique identifier for a given instance of the publishing application", + "type": "string" + } + } + }, + "payload": { + "type": "object", + "properties": { + "user": { + "$ref": "#/components/schemas/userCreate" + }, + "signup": { + "$ref": "#/components/schemas/signup" + } + } + }, + "correlationId": { + "description": "Default Correlation ID", + "location": "$message.header#/correlationId" + }, + "traits": [{ "$ref": "#/components/messageTraits/commonHeaders" }], + "examples": [ + { + "name": "SimpleSignup", + "summary": "A simple UserSignup example message", + "headers": { + "correlationId": "my-correlation-id", + "applicationInstanceId": "myInstanceId" + }, + "payload": { + "user": { + "someUserKey": "someUserValue" + }, + "signup": { + "someSignupKey": "someSignupValue" + } + } + } + ] + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('Channel Message', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/models/info/contact.test.mjs b/test/definitions/3.0.0/models/info/contact.test.mjs new file mode 100644 index 00000000..c57244a9 --- /dev/null +++ b/test/definitions/3.0.0/models/info/contact.test.mjs @@ -0,0 +1,61 @@ +import {describe} from 'vitest'; +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; + +const example = { + "name": "AsyncApi", + "url": "https://www.asyncapi.com", + "email": "java@asyncapi.com" +} + +const onlyRequiredProperties = {} + +const withoutRequiredProperties = {} + +const extended = { + "name": "AsyncAPI", + "url": "https://www.asyncapi.com", + "email": "java@asyncapi.com", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } +} + +const wronglyExtended = { + "name": "AsyncAPI", + "url": "https://www.asyncapi.com", + "email": "java@asyncapi.com", + "x-number": 0, + "x-string": "", + "x-object": { + "property" : { } + }, + "ext-number": 1 +} + +const jsonSchema = require('@definitions/3.0.0/contact.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [example], + onlyRequiredProperties, + withoutRequiredProperties, + extended, + wronglyExtended +); + +describe('Contact', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); \ No newline at end of file diff --git a/test/definitions/3.0.0/models/info/info extensions.test.mjs b/test/definitions/3.0.0/models/info/info extensions.test.mjs new file mode 100644 index 00000000..8e47cbb7 --- /dev/null +++ b/test/definitions/3.0.0/models/info/info extensions.test.mjs @@ -0,0 +1,58 @@ +import {describe} from 'vitest'; +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; + +const example = { + "x-x": "PBodiachevskii", + "x-linkedin": "https://www.linkedin.com/company/asyncapi/" +} + +const onlyRequiredProperties = {} + +const withoutRequiredProperties = {} + +const extended = { + "x-number" : 0, + "x-string" : "", + "x-object" : { + "property" : { } + }, + "x-x": "PBodiachevskii", + "x-linkedin": "https://www.linkedin.com/company/asyncapi/" +} + +const wronglyExtended = { + "ext-number": 1, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "x-x": "PBodiachevskii", + "x-linkedin": "https://www.linkedin.com/company/asyncapi/" +} + +const jsonSchema = require('@definitions/3.0.0/infoExtensions.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + false, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [example], + onlyRequiredProperties, + withoutRequiredProperties, + extended, + wronglyExtended +); + +describe('Info Extensions', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/models/info/info properties/contact.mjs b/test/definitions/3.0.0/models/info/info properties/contact.mjs new file mode 100644 index 00000000..42d29468 --- /dev/null +++ b/test/definitions/3.0.0/models/info/info properties/contact.mjs @@ -0,0 +1,80 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper.mjs'; + +const jsonSchema = require('@definitions/3.0.0/info.json'); + +describe('Info: contact', () => { + it(`${TestHelper.propertyIsNotValidWhenIsTestName} null`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "contact": null + }, + ['must be object'] + )); + + it(`${TestHelper.propertyIsValidWhenIsTestName} empty`, () => TestHelper.objectIsValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "contact": {} + }, + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} string`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "contact": "short description" + }, + ['must be object'] + )); + + it(`${TestHelper.propertyIsValidWhenIsTestName} object`, () => TestHelper.objectIsValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "contact": { + "name": "AsyncAPI", + "url": "https://www.asyncapi.com", + "email": "java@asyncapi.com" + } + }, + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} array`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "contact": [ + null, [], "", {}, false, 123 + ] + }, + ['must be object'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} number`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "contact": 123 + }, + ['must be object'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} boolean`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "contact": false + }, + ['must be object'] + )); +}); diff --git a/test/definitions/3.0.0/models/info/info properties/description.mjs b/test/definitions/3.0.0/models/info/info properties/description.mjs new file mode 100644 index 00000000..7949530a --- /dev/null +++ b/test/definitions/3.0.0/models/info/info properties/description.mjs @@ -0,0 +1,79 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper.mjs'; + +const jsonSchema = require('@definitions/3.0.0/info.json'); + +describe('Info: description', () => { + it(`${TestHelper.propertyIsNotValidWhenIsTestName} null`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "description": null + }, + ['must be string'] + )); + + it(`${TestHelper.propertyIsValidWhenIsTestName} empty`, () => TestHelper.objectIsValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "description": "" + }, + )); + + it(`${TestHelper.propertyIsValidWhenIsTestName} string`, () => TestHelper.objectIsValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "description": "short description" + }, + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} object`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "description": { + "longVariant": "", + "shortVariant": "" + } + }, + ['must be string'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} array`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "description": [ + null, [], "", {}, false, 123 + ] + }, + ['must be string'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} number`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "description": 123 + }, + ['must be string'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} boolean`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "description": false + }, + ['must be string'] + )); +}); diff --git a/test/definitions/3.0.0/models/info/info properties/externalDocs.mjs b/test/definitions/3.0.0/models/info/info properties/externalDocs.mjs new file mode 100644 index 00000000..14d0ede9 --- /dev/null +++ b/test/definitions/3.0.0/models/info/info properties/externalDocs.mjs @@ -0,0 +1,104 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper.mjs'; + +const jsonSchema = require('@definitions/3.0.0/info.json'); + +describe('Info: externalDocs', () => { + it(`${TestHelper.propertyIsNotValidWhenIsTestName} null`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "externalDocs": null + }, + [ + 'must be object', + 'must be object', + 'must match exactly one schema in oneOf' + ] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} empty`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "externalDocs": {} + }, + [ + 'must have required property \'$ref\'', + 'must have required property \'url\'', + 'must match exactly one schema in oneOf' + ] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} string`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "externalDocs": "short description" + }, + [ + 'must be object', + 'must be object', + 'must match exactly one schema in oneOf' + ] + )); + + it(`${TestHelper.propertyIsValidWhenIsTestName} object`, () => TestHelper.objectIsValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "externalDocs": { + "description" : "Find more info here", + "url" : "https://example.com" + } + }, + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} array`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "externalDocs": [ + null, [], "", {}, false, 123 + ] + }, + [ + 'must be object', + 'must be object', + 'must match exactly one schema in oneOf' + ] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} number`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "externalDocs": 123 + }, + [ + 'must be object', + 'must be object', + 'must match exactly one schema in oneOf' + ] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} boolean`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "externalDocs": false + }, + [ + 'must be object', + 'must be object', + 'must match exactly one schema in oneOf' + ] + )); +}); diff --git a/test/definitions/3.0.0/models/info/info properties/license.mjs b/test/definitions/3.0.0/models/info/info properties/license.mjs new file mode 100644 index 00000000..91442a7b --- /dev/null +++ b/test/definitions/3.0.0/models/info/info properties/license.mjs @@ -0,0 +1,80 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper.mjs'; + +const jsonSchema = require('@definitions/3.0.0/info.json'); + +describe('Info: license', () => { + it(`${TestHelper.propertyIsNotValidWhenIsTestName} null`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "license": null + }, + ['must be object'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} empty`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "license": {} + }, + ['must have required property \'name\''] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} string`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "license": "short description" + }, + ['must be object'] + )); + + it(`${TestHelper.propertyIsValidWhenIsTestName} object`, () => TestHelper.objectIsValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "license": { + "name": "Apache License 2.0", + "url": "http://www.apache.org/licenses/" + } + }, + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} array`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "license": [ + null, [], "", {}, false, 123 + ] + }, + ['must be object'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} number`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "license": 123 + }, + ['must be object'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} boolean`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "license": false + }, + ['must be object'] + )); +}); diff --git a/test/definitions/3.0.0/models/info/info properties/tags.mjs b/test/definitions/3.0.0/models/info/info properties/tags.mjs new file mode 100644 index 00000000..6b4cc458 --- /dev/null +++ b/test/definitions/3.0.0/models/info/info properties/tags.mjs @@ -0,0 +1,141 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper.mjs'; + +const jsonSchema = require('@definitions/3.0.0/info.json'); + +describe('Info: tags', () => { + it(`${TestHelper.propertyIsNotValidWhenIsTestName} null`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "tags": null + }, + ['must be array'] + )); + + it(`${TestHelper.propertyIsValidWhenIsTestName} empty`, () => TestHelper.objectIsValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "tags": [] + }, + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} string`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "tags": "short description" + }, + ['must be array'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} object`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "tags": {} + }, + ['must be array'] + )); + + it(`${TestHelper.propertyIsValidWhenIsTestName} array of tags`, () => TestHelper.objectIsValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "tags": [ + { + "$ref": "#/components/tags" + }, + { + "name": "user", + "description": "User-related messages", + } + ] + }, + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} array of duplicated tags`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "tags": [ + { + "$ref": "#/components/tags" + }, + { + "$ref": "#/components/tags" + }, + { + "name": "user", + "description": "User-related messages", + } + ] + }, + ['must NOT have duplicate items (items ## 0 and 1 are identical)'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} not array of tags`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "tags": [ + null, [], "", {}, false, 123 + ] + }, + // 6 properties to check + [ + // null + 'must be object', + 'must be object', + 'must match exactly one schema in oneOf', + // [] + 'must be object', + 'must be object', + 'must match exactly one schema in oneOf', + // "" + 'must be object', + 'must be object', + 'must match exactly one schema in oneOf', + // {} + 'must have required property \'$ref\'', + 'must have required property \'name\'', + 'must match exactly one schema in oneOf', + // false + 'must be object', + 'must be object', + 'must match exactly one schema in oneOf', + // 123 + 'must be object', + 'must be object', + 'must match exactly one schema in oneOf', + ] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} number`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "tags": 123 + }, + ['must be array'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} boolean`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "tags": false + }, + ['must be array'] + )); +}); diff --git a/test/definitions/3.0.0/models/info/info properties/termsOfService.mjs b/test/definitions/3.0.0/models/info/info properties/termsOfService.mjs new file mode 100644 index 00000000..54fcf8e6 --- /dev/null +++ b/test/definitions/3.0.0/models/info/info properties/termsOfService.mjs @@ -0,0 +1,90 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper.mjs'; + +const jsonSchema = require('@definitions/3.0.0/info.json'); + +describe('Info: termsOfService', () => { + it(`${TestHelper.propertyIsValidWhenIsTestName} URI`, () => TestHelper.objectIsValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "termsOfService": "https://stage.lo/terms-of-service" + }, + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} null`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "termsOfService": null + }, + ['must be string'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} empty`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "termsOfService": "" + }, + ['must match format "uri"'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} string`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "termsOfService": "terms of service" + }, + ['must match format "uri"'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} object`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "termsOfService": { + "longVariant": "", + "shortVariant": "" + } + }, + ['must be string'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} array`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "termsOfService": [ + null, [], "", {}, false, 123 + ] + }, + ['must be string'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} number`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "termsOfService": 123 + }, + ['must be string'] + )); + + it(`${TestHelper.propertyIsNotValidWhenIsTestName} boolean`, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "title": "AsyncApi sample", + "version": "2.0", + "termsOfService": false + }, + ['must be string'] + )); +}); diff --git a/test/definitions/3.0.0/models/info/info.test.mjs b/test/definitions/3.0.0/models/info/info.test.mjs new file mode 100644 index 00000000..b9398ec5 --- /dev/null +++ b/test/definitions/3.0.0/models/info/info.test.mjs @@ -0,0 +1,178 @@ +import {describe} from 'vitest'; +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; + +const example = { + "title": "AsyncAPI sample", + "version": "2.0", + "description": "short description", + "termsOfService": "https://www.asyncapi.com/about/", + "contact": { + "name": "AsyncApi", + "url": "https://www.asyncapi.com", + "email": "java@asyncapi.com" + }, + "license": { + "name": "Apache License 2.0", + "url": "https://www.apache.org/licenses/" + }, + "tags": [ + { + "name": "user", + "description": "User-related messages", + "externalDocs": { + "description" : "Find more info here", + "url" : "https://example.com" + } + } + ], + "externalDocs": { + "description": "Find more info here", + "url": "https://example.com" + } +} + +const onlyRequiredProperties = { + "title": "AsyncApi sample", + "version": "1.2.34" +} + +const withoutRequiredProperties = { + "description": "Short description", + "termsOfService": "https://www.asyncapi.com/about/", + "contact": { + "name": "AsyncApi", + "url": "https://www.asyncapi.com", + "email": "java@asyncapi.com" + }, + "license": { + "name": "Apache License 2.0", + "url": "https://www.apache.org/licenses/" + }, + "tags": [ + { + "name": "user", + "description": "User-related messages", + "externalDocs": { + "description": "Find more info here", + "url": "https://example.com" + } + } + ], + "externalDocs": { + "description": "Find more info here", + "url": "https://example.com" + } +} + +const extended = { + "title": "AsyncApi sample", + "version": "1.2.34", + "description": "Short description", + "termsOfService": "https://www.asyncapi.com/about/", + "contact": { + "name": "AsyncApi", + "url": "https://www.asyncapi.com", + "email": "java@asyncapi.com" + }, + "license": { + "name": "Apache License 2.0", + "url": "https://www.apache.org/licenses/" + }, + "tags": [ + { + "name": "user", + "description": "User-related messages", + "externalDocs": { + "description": "Find more info here", + "url": "https://example.com" + } + } + ], + "externalDocs": { + "description": "Find more info here", + "url": "https://example.com" + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "x-x": "PBodiachevskii", + "x-linkedin": "https://www.linkedin.com/company/asyncapi/" +} + +const wronglyExtended = { + "title": "AsyncApi sample", + "version": "1.2.34", + "description": "Short description", + "termsOfService": "https://www.asyncapi.com/about/", + "contact": { + "name": "AsyncApi", + "url": "https://www.asyncapi.com", + "email": "java@asyncapi.com" + }, + "license": { + "name": "Apache License 2.0", + "url": "https://www.apache.org/licenses/" + }, + "tags": [ + { + "name": "user", + "description": "User-related messages", + "externalDocs": { + "description": "Find more info here", + "url": "https://example.com" + } + } + ], + "externalDocs": { + "description": "Find more info here", + "url": "https://example.com" + }, + "ext-number": 1, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "x-x": "PBodiachevskii", + "x-linkedin": "https://www.linkedin.com/company/asyncapi/" +} + +const jsonSchema = require('@definitions/3.0.0/info.json'); + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'version\'', + 'must have required property \'title\'' + ], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [example], + onlyRequiredProperties, + withoutRequiredProperties, + extended, + wronglyExtended +); + +describe('Info', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); + +describe('Info Properties', async () => { + await import('@test/definitions/3.0.0/models/info/info properties/description.mjs'); + await import('@test/definitions/3.0.0/models/info/info properties/termsOfService.mjs'); + await import('@test/definitions/3.0.0/models/info/info properties/contact.mjs'); + await import('@test/definitions/3.0.0/models/info/info properties/license.mjs'); + await import('@test/definitions/3.0.0/models/info/info properties/tags.mjs'); + await import('@test/definitions/3.0.0/models/info/info properties/externalDocs.mjs'); +}); diff --git a/test/definitions/3.0.0/models/info/licence.test.mjs b/test/definitions/3.0.0/models/info/licence.test.mjs new file mode 100644 index 00000000..944e8b91 --- /dev/null +++ b/test/definitions/3.0.0/models/info/licence.test.mjs @@ -0,0 +1,67 @@ +import {describe} from 'vitest'; +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; + +const example = { + "name": "Apache License 2.0", + "url": "https://www.apache.org/licenses/" +} + +const onlyRequiredProperties = { + "name": "Apache License 2.0" +} + +const withoutRequiredProperties = { + "url": "https://www.apache.org/licenses/", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } +} + +const extended = { + "name": "Apache License 2.0", + "url": "https://www.apache.org/licenses/", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } +} + +const wronglyExtended = { + "name": "Apache License 2.0", + "url": "https://www.apache.org/licenses/", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 +} + +const jsonSchema = require('@definitions/3.0.0/license.json'); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [example], + onlyRequiredProperties, + withoutRequiredProperties, + extended, + wronglyExtended +); + +const config = new JsonSchemaTestSuiteConfig( + true, + ['must have required property \'name\''], + false, + [] +); + +describe('License', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); \ No newline at end of file diff --git a/test/definitions/3.0.0/models/operation/operation reply address.test.mjs b/test/definitions/3.0.0/models/operation/operation reply address.test.mjs new file mode 100644 index 00000000..49dca587 --- /dev/null +++ b/test/definitions/3.0.0/models/operation/operation reply address.test.mjs @@ -0,0 +1,52 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/operationReplyAddress.json'); + +const config = new JsonSchemaTestSuiteConfig( + true, + ['must have required property \'location\''], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "description" : "Consumer inbox", + "location" : "$message.header#/replyTo" + } + ], + { + "location" : "$message.header#/replyTo" + }, + { + "description" : "Consumer inbox" + }, + { + "location" : "$message.header#/replyTo", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "location" : "$message.header#/replyTo", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('Operation Reply Address', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/models/operation/operation reply.test.mjs b/test/definitions/3.0.0/models/operation/operation reply.test.mjs new file mode 100644 index 00000000..19444b98 --- /dev/null +++ b/test/definitions/3.0.0/models/operation/operation reply.test.mjs @@ -0,0 +1,97 @@ +// TODO: enable after reference patch +import {describe, it} from 'vitest'; + +describe.skip('Operation Reply: enable after reference patch', () => { + +}); + +/* +Validation error: + +[ + { + instancePath: '/messages/0/$ref', + schemaPath: 'http://asyncapi.com/definitions/3.0.0/ReferenceObject.json/format', + keyword: 'format', + params: { format: 'uri-reference' }, + message: 'must match format "uri-reference"' + }, + { + instancePath: '/messages/1/$ref', + schemaPath: 'http://asyncapi.com/definitions/3.0.0/ReferenceObject.json/format', + keyword: 'format', + params: { format: 'uri-reference' }, + message: 'must match format "uri-reference"' + }, + { + instancePath: '/messages/2/$ref', + schemaPath: 'http://asyncapi.com/definitions/3.0.0/ReferenceObject.json/format', + keyword: 'format', + params: { format: 'uri-reference' }, + message: 'must match format "uri-reference"' + } +] + */ + +// import { +// JsonSchemaTestSuite, +// JsonSchemaTestSuiteConfig, +// JsonSchemaTestSuiteData +// } from '@test/definitions/base-schema-test.mjs'; +// import {describe} from 'vitest'; +// +// const jsonSchema = require('@definitions/3.0.0/operationReply.json'); +// +// const config = new JsonSchemaTestSuiteConfig( +// false, +// [], +// true, +// [] +// ); +// +// const data = new JsonSchemaTestSuiteData( +// jsonSchema, +// [ +// { +// "address": { +// "description": "Consumer inbox", +// "location": "$message.header#/replyTo" +// }, +// "channel": { +// "$ref": "#/components/channels/channel" +// }, +// "messages": [ +// { +// "$ref": "#/components/messages/message 1" +// }, +// { +// "$ref": "#/components/messages/message 2" +// }, +// { +// "$ref": "#/components/messages/message 3" +// } +// ] +// } +// ], +// {}, +// {}, +// { +// "x-number": 0, +// "x-string": "", +// "x-object": { +// "property": {} +// } +// }, +// { +// "x-number": 0, +// "x-string": "", +// "x-object": { +// "property": {} +// }, +// "ext-number": 1 +// } +// ); +// +// describe('Operation Reply', () => { +// new JsonSchemaTestSuite(data, config).testSuite() +// }); diff --git a/test/definitions/3.0.0/models/operation/operation trait.test.mjs b/test/definitions/3.0.0/models/operation/operation trait.test.mjs new file mode 100644 index 00000000..a53c344e --- /dev/null +++ b/test/definitions/3.0.0/models/operation/operation trait.test.mjs @@ -0,0 +1,83 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/operationTrait.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "title": "Send message operation", + "summary": "Send message", + "description": "Send message to remote server", + "security": [ + { + "type": "apiKey", + "description": "apiKey", + "in": "user" + }, + { + "$ref": "#/components/security/plain" + } + ], + "tags": [ + { + "$ref": "#/components/tags/tag" + } + ], + "externalDocs": { + "$ref": "#/components/externalDocs" + }, + "bindings": { + "amqp":{ + "expiration": 100000, + "userId": "guest", + "cc": [ + "user.logs" + ], + "priority": 10, + "deliveryMode": 2, + "mandatory": false, + "bcc": [ + "external.audit" + ], + "timestamp": true, + "ack": false, + "bindingVersion": "0.3.0" + } + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('Operation Trait', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/models/operation/operation.test.mjs b/test/definitions/3.0.0/models/operation/operation.test.mjs new file mode 100644 index 00000000..f670c49a --- /dev/null +++ b/test/definitions/3.0.0/models/operation/operation.test.mjs @@ -0,0 +1,84 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/operation.json'); + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'action\'', + 'must have required property \'channel\'' + ], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "title": "User sign up", + "summary": "Action to sign a user up.", + "description": "A longer description", + "channel": { + "$ref": "#/channels/userSignup" + }, + "action": "send", + "tags": [{ "name": "user" }, { "name": "signup" }, { "name": "register" }], + "bindings": { + "amqp": { + "ack": false + } + }, + "traits": [{ "$ref": "#/components/operationTraits/kafka" }] + } + ], + { + "channel": { + "$ref": "#/channels/userSignup" + }, + "action": "send" + }, + { + "title": "User sign up", + "summary": "Action to sign a user up.", + "description": "A longer description", + "bindings": { + "amqp": { + "ack": false + } + }, + "traits": [{ "$ref": "#/components/operationTraits/kafka" }] + }, + { + "channel": { + "$ref": "#/channels/userSignup" + }, + "action": "send", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "channel": { + "$ref": "#/channels/userSignup" + }, + "action": "send", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('Operation', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/models/reference/reference object.test.mjs b/test/definitions/3.0.0/models/reference/reference object.test.mjs new file mode 100644 index 00000000..f672a9f5 --- /dev/null +++ b/test/definitions/3.0.0/models/reference/reference object.test.mjs @@ -0,0 +1,77 @@ +import TestHelper from '@test/test-helper.mjs'; + +const jsonSchema = require('@definitions/3.0.0/Reference.json'); + +describe('Reference Object', () => { + it('$ref may be empty', () => TestHelper.objectIsValid( + jsonSchema, + { + "$ref": "" + }, + )); + + it('$ref cannot be number', () => TestHelper.objectIsNotValid( + jsonSchema, + { + "$ref": 1234 + }, + ['must be string'] + )); + + it('$ref cannot be object', () => TestHelper.objectIsNotValid( + jsonSchema, + { + "$ref": { + "$ref": "#/components/schemas/user" + } + }, + ['must be string'] + )); + + it('$ref cannot be plain string', () => TestHelper.objectIsNotValid( + jsonSchema, + { + "$ref": "string value" + }, + ['must match format "uri-reference"'] + )); + + it('$ref cannot be boolean', () => TestHelper.objectIsNotValid( + jsonSchema, + { + "$ref": true + }, + ['must be string'] + )); + + it('$ref cannot be null', () => TestHelper.objectIsNotValid( + jsonSchema, + { + "$ref": null + }, + ['must be string'] + )); + + it('$ref cannot be array', () => TestHelper.objectIsNotValid( + jsonSchema, + { + "$ref": [ + 1, + null, + false, + "#/components/schemas/user", + { + "$ref": "#/components/schemas/user" + } + ] + }, + ['must be string'] + )); + + it('$ref MUST be URI', () => TestHelper.objectIsValid( + jsonSchema, + { + "$ref": "#/components/schemas/user" + }, + )); +}); diff --git a/test/definitions/3.0.0/models/reference/reference.test.mjs b/test/definitions/3.0.0/models/reference/reference.test.mjs new file mode 100644 index 00000000..7e01f1de --- /dev/null +++ b/test/definitions/3.0.0/models/reference/reference.test.mjs @@ -0,0 +1,49 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/Reference.json'); + +const config = new JsonSchemaTestSuiteConfig( + true, + ['must have required property \'$ref\''], + false, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "$ref": "#/components/schemas/user" + } + ], + { + "$ref": "#/components/schemas/user" + }, + {}, + { + "$ref": "#/components/schemas/user", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "$ref": "#/components/schemas/user", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('Reference', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/models/server/server variable.test.mjs b/test/definitions/3.0.0/models/server/server variable.test.mjs new file mode 100644 index 00000000..2fcbde63 --- /dev/null +++ b/test/definitions/3.0.0/models/server/server variable.test.mjs @@ -0,0 +1,75 @@ +import {describe} from 'vitest'; +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; + +const jsonSchema = require('@definitions/3.0.0/serverVariable.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "enum": [ + "8883", + "8884" + ], + "default": "8883", + "description": "To which port connect", + "examples": [ + "8883", + "8884" + ] + } + ], + {}, + { + "enum": [ + "8883", + "8884" + ], + "default": "8883", + "description": "To which port connect", + "examples": [ + "8883", + "8884" + ] + }, + { + "enum": [ + "8883", + "8884" + ], + "default": "8883", + "description": "To which port connect", + "examples": [ + "8883", + "8884" + ], + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('Server Variable', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); \ No newline at end of file diff --git a/test/definitions/3.0.0/models/server/server.test.mjs b/test/definitions/3.0.0/models/server/server.test.mjs new file mode 100644 index 00000000..c064e0ac --- /dev/null +++ b/test/definitions/3.0.0/models/server/server.test.mjs @@ -0,0 +1,61 @@ +import {describe} from 'vitest'; +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; + +const jsonSchema = require('@definitions/3.0.0/server.json'); + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'host\'', + 'must have required property \'protocol\'' + ], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "host": "rabbitmq.in.mycompany.com:5672", + "pathname": "/production", + "protocol": "amqp", + "description": "Production RabbitMQ broker (uses the `production` vhost)." + } + ], + { + "host": "rabbitmq.in.mycompany.com:5672", + "protocol": "amqp", + }, + { + "pathname": "/production", + "description": "Production RabbitMQ broker (uses the `production` vhost)." + }, + { + "host": "rabbitmq.in.mycompany.com:5672", + "protocol": "amqp", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "host": "rabbitmq.in.mycompany.com:5672", + "protocol": "amqp", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('Server', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); \ No newline at end of file diff --git a/test/definitions/3.0.0/models/tag/tag.test.mjs b/test/definitions/3.0.0/models/tag/tag.test.mjs new file mode 100644 index 00000000..b4ba0fd5 --- /dev/null +++ b/test/definitions/3.0.0/models/tag/tag.test.mjs @@ -0,0 +1,60 @@ +import {describe} from 'vitest'; +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; + +const jsonSchema = require('@definitions/3.0.0/tag.json'); + +const config = new JsonSchemaTestSuiteConfig( + true, + ['must have required property \'name\''], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "name": "user", + "description": "User-related messages", + "externalDocs": { + "description" : "Find more info here", + "url" : "https://example.com" + } + } + ], + { + "name": "user" + }, + { + "description": "User-related messages", + "externalDocs": { + "description" : "Find more info here", + "url" : "https://example.com" + } + }, + { + "name": "user", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "name": "user", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('Tag', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); \ No newline at end of file diff --git a/test/definitions/3.0.0/security/apiKey.test.mjs b/test/definitions/3.0.0/security/apiKey.test.mjs new file mode 100644 index 00000000..339a901e --- /dev/null +++ b/test/definitions/3.0.0/security/apiKey.test.mjs @@ -0,0 +1,72 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper.mjs'; + +const jsonSchema = require('@definitions/3.0.0/apiKey.json'); + +describe('API Key', () => { + it(TestHelper.exampleIsValidTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": "apiKey", + "description": "apiKey", + "in": "user" + }, + )); + + it(TestHelper.cannotBeEmptyTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + {}, + [ + 'must have required property \'type\'', + 'must have required property \'in\'' + ] + )); + + it(TestHelper.isNotValidWithoutRequiredPropertiesTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "description": "apiKey" + }, + [ + 'must have required property \'type\'', + 'must have required property \'in\'' + ] + )); + + it(TestHelper.isValidWithOnlyRequiredPropertiesTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": "apiKey", + "in": "user" + }, + )); + + it(TestHelper.isValidWhenIsExtendedTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": "apiKey", + "description": "apiKey", + "in": "user", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + )); + + it(TestHelper.isNotValidWhenIsWronglyExtendedTestName, () => TestHelper.wronglyExtended( + jsonSchema, + { + "type": "apiKey", + "description": "apiKey", + "in": "user", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } + )); +}); diff --git a/test/definitions/3.0.0/security/default-implementation.test.mjs b/test/definitions/3.0.0/security/default-implementation.test.mjs new file mode 100644 index 00000000..e7b272ff --- /dev/null +++ b/test/definitions/3.0.0/security/default-implementation.test.mjs @@ -0,0 +1,117 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper.mjs'; + +describe.each([ + { + name: 'X509', + type: 'X509', + description: 'X509 example', + schema: 'X509', + }, + { + name: 'userPassword', + type: 'userPassword', + description: 'userPassword example', + schema: 'userPassword', + }, + { + name: 'symmetricEncryption', + type: 'symmetricEncryption', + description: 'symmetricEncryption example', + schema: 'symmetricEncryption', + }, + { + name: 'asymmetricEncryption', + type: 'asymmetricEncryption', + description: 'asymmetricEncryption example', + schema: 'asymmetricEncryption', + }, + { + name: 'SASL: plain', + type: 'plain', + description: 'SASL plain example', + schema: 'SaslPlainSecurityScheme', + }, + { + name: 'SASL: GSS-API', + type: 'gssapi', + description: 'SASL GSS-API example', + schema: 'SaslGssapiSecurityScheme', + }, + { + name: 'SASL: SCRAM-SHA-256', + type: 'scramSha256', + description: 'SASL SCRAM-SHA-256 example', + schema: 'SaslScramSecurityScheme', + }, + { + name: 'SASL: SCRAM-SHA-512', + type: 'scramSha512', + description: 'SASL SCRAM-SHA-512 example', + schema: 'SaslScramSecurityScheme', + }, +])('$name', async (params) => { + + const jsonSchema = await import(`@definitions/3.0.0/${params.schema}.json`); + + it(TestHelper.exampleIsValidTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": params.type, + "description": params.description, + }, + )); + + it(TestHelper.cannotBeEmptyTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + {}, + [ + 'must have required property \'type\'' + ] + )); + + it(TestHelper.isNotValidWithoutRequiredPropertiesTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "description": params.description, + }, + [ + 'must have required property \'type\'' + ] + )); + + it(TestHelper.isValidWithOnlyRequiredPropertiesTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": params.type, + }, + )); + + it(TestHelper.isValidWhenIsExtendedTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": params.type, + "description": params.description, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + )); + + it(TestHelper.isNotValidWhenIsWronglyExtendedTestName, () => TestHelper.wronglyExtended( + jsonSchema, + { + "type": params.type, + "description": params.description, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + }, + )); + +}) \ No newline at end of file diff --git a/test/definitions/3.0.0/security/http/http.test.mjs b/test/definitions/3.0.0/security/http/http.test.mjs new file mode 100644 index 00000000..d9c9c25b --- /dev/null +++ b/test/definitions/3.0.0/security/http/http.test.mjs @@ -0,0 +1,116 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper'; +import path from 'path'; + +describe('HTTP Security Scheme', async (httpSecurity) => { + const httpSecurityScheme = await import('@definitions/3.0.0/HTTPSecurityScheme.json'); + + it.each([ + { + name: 'API key', + json: { + "type": "httpApiKey", + "description": "httpApiKey", + "name": "api_key", + "in": "header" + } + }, + { + name: 'Basic', + json: { + "type": "http", + "description": "http", + "scheme": "basic" + } + }, + { + name: 'Bearer', + json: { + "type": "http", + "description": "http", + "scheme": "bearer", + "bearerFormat": "JWT" + } + } + ])('oneOf recognize: $name', (httpSecurity) => TestHelper.objectIsValid( + httpSecurityScheme, + httpSecurity.json, + )); +}); + +describe.each([ + { + name: 'API Key', + schema: 'APIKeyHTTPSecurityScheme', + resources: 'httpApiKey', + expectedErrors: [ + 'must have required property \'type\'', + 'must have required property \'name\'', + 'must have required property \'in\'' + ] + }, + { + name: 'Basic', + schema: 'NonBearerHTTPSecurityScheme', + resources: 'httpBasic', + expectedErrors: [ + 'must NOT be valid', + 'must have required property \'scheme\'', + 'must have required property \'type\'' + ] + }, + { + name: 'Bearer', + schema: 'BearerHTTPSecurityScheme', + resources: 'httpBearer', + expectedErrors: [ + 'must have required property \'type\'', + 'must have required property \'scheme\'' + ] + }, + { + name: 'Security Scheme', + schema: 'BearerHTTPSecurityScheme', + resources: 'httpBearer', + expectedErrors: [ + 'must have required property \'type\'', + 'must have required property \'scheme\'' + ] + } +])('HTTP security: $name', async (params) => { + + const jsonSchema = await import(`@definitions/3.0.0/${params.schema}.json`); + + it(TestHelper.exampleIsValidTestName, () => TestHelper.objectIsValid( + jsonSchema, + path.resolve(__dirname, `./${params.resources}/example.json`), + )); + + it(TestHelper.cannotBeEmptyTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + {}, + params.expectedErrors + )); + + it(TestHelper.isNotValidWithoutRequiredPropertiesTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + path.resolve(__dirname, `./${params.resources}/without required properties.json`), + params.expectedErrors + )); + + it(TestHelper.isValidWithOnlyRequiredPropertiesTestName, () => TestHelper.objectIsValid( + jsonSchema, + path.resolve(__dirname, `./${params.resources}/only required properties.json`), + )); + + it(TestHelper.isValidWhenIsExtendedTestName, () => TestHelper.objectIsValid( + jsonSchema, + path.resolve(__dirname, `./${params.resources}/extended.json`), + )); + + it(TestHelper.isNotValidWhenIsWronglyExtendedTestName, () => TestHelper.wronglyExtended( + jsonSchema, + path.resolve(__dirname, `./${params.resources}/wrongly extended.json`), + )); + +}) \ No newline at end of file diff --git a/test/definitions/3.0.0/security/http/httpApiKey/example.json b/test/definitions/3.0.0/security/http/httpApiKey/example.json new file mode 100644 index 00000000..467469f5 --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpApiKey/example.json @@ -0,0 +1,6 @@ +{ + "type": "httpApiKey", + "description": "httpApiKey", + "name": "api_key", + "in": "header" +} diff --git a/test/definitions/3.0.0/security/http/httpApiKey/extended.json b/test/definitions/3.0.0/security/http/httpApiKey/extended.json new file mode 100644 index 00000000..add1d4b3 --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpApiKey/extended.json @@ -0,0 +1,11 @@ +{ + "type": "httpApiKey", + "description": "httpApiKey", + "name": "api_key", + "in": "header", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } +} diff --git a/test/definitions/3.0.0/security/http/httpApiKey/only required properties.json b/test/definitions/3.0.0/security/http/httpApiKey/only required properties.json new file mode 100644 index 00000000..4a976d82 --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpApiKey/only required properties.json @@ -0,0 +1,5 @@ +{ + "type": "httpApiKey", + "name": "api_key", + "in": "header" +} diff --git a/test/definitions/3.0.0/security/http/httpApiKey/without required properties.json b/test/definitions/3.0.0/security/http/httpApiKey/without required properties.json new file mode 100644 index 00000000..7a4b2979 --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpApiKey/without required properties.json @@ -0,0 +1,3 @@ +{ + "description": "httpApiKey" +} diff --git a/test/definitions/3.0.0/security/http/httpApiKey/wrongly extended.json b/test/definitions/3.0.0/security/http/httpApiKey/wrongly extended.json new file mode 100644 index 00000000..767730b1 --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpApiKey/wrongly extended.json @@ -0,0 +1,12 @@ +{ + "type": "httpApiKey", + "description": "httpApiKey", + "name": "api_key", + "in": "header", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 +} diff --git a/test/definitions/3.0.0/security/http/httpBasic/example.json b/test/definitions/3.0.0/security/http/httpBasic/example.json new file mode 100644 index 00000000..38f712e1 --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpBasic/example.json @@ -0,0 +1,5 @@ +{ + "type": "http", + "description": "http", + "scheme": "basic" +} diff --git a/test/definitions/3.0.0/security/http/httpBasic/extended.json b/test/definitions/3.0.0/security/http/httpBasic/extended.json new file mode 100644 index 00000000..eab81f69 --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpBasic/extended.json @@ -0,0 +1,10 @@ +{ + "type": "http", + "description": "http", + "scheme": "basic", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } +} diff --git a/test/definitions/3.0.0/security/http/httpBasic/only required properties.json b/test/definitions/3.0.0/security/http/httpBasic/only required properties.json new file mode 100644 index 00000000..f71d7320 --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpBasic/only required properties.json @@ -0,0 +1,4 @@ +{ + "type": "http", + "scheme": "basic" +} diff --git a/test/definitions/3.0.0/security/http/httpBasic/without required properties.json b/test/definitions/3.0.0/security/http/httpBasic/without required properties.json new file mode 100644 index 00000000..7b1a52e7 --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpBasic/without required properties.json @@ -0,0 +1,3 @@ +{ + "description": "http" +} diff --git a/test/definitions/3.0.0/security/http/httpBasic/wrongly extended.json b/test/definitions/3.0.0/security/http/httpBasic/wrongly extended.json new file mode 100644 index 00000000..5c4e3887 --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpBasic/wrongly extended.json @@ -0,0 +1,11 @@ +{ + "type": "http", + "description": "http", + "scheme": "basic", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 +} diff --git a/test/definitions/3.0.0/security/http/httpBearer/example.json b/test/definitions/3.0.0/security/http/httpBearer/example.json new file mode 100644 index 00000000..68da22ef --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpBearer/example.json @@ -0,0 +1,6 @@ +{ + "type": "http", + "description": "http", + "scheme": "bearer", + "bearerFormat": "JWT" +} diff --git a/test/definitions/3.0.0/security/http/httpBearer/extended.json b/test/definitions/3.0.0/security/http/httpBearer/extended.json new file mode 100644 index 00000000..71d2f77c --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpBearer/extended.json @@ -0,0 +1,11 @@ +{ + "type": "http", + "description": "http", + "scheme": "bearer", + "bearerFormat": "JWT", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } +} diff --git a/test/definitions/3.0.0/security/http/httpBearer/only required properties.json b/test/definitions/3.0.0/security/http/httpBearer/only required properties.json new file mode 100644 index 00000000..ab7f1d39 --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpBearer/only required properties.json @@ -0,0 +1,4 @@ +{ + "type": "http", + "scheme": "bearer" +} diff --git a/test/definitions/3.0.0/security/http/httpBearer/without required properties.json b/test/definitions/3.0.0/security/http/httpBearer/without required properties.json new file mode 100644 index 00000000..244901f6 --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpBearer/without required properties.json @@ -0,0 +1,4 @@ +{ + "description": "http", + "bearerFormat": "JWT" +} diff --git a/test/definitions/3.0.0/security/http/httpBearer/wrongly extended.json b/test/definitions/3.0.0/security/http/httpBearer/wrongly extended.json new file mode 100644 index 00000000..cfdc83f2 --- /dev/null +++ b/test/definitions/3.0.0/security/http/httpBearer/wrongly extended.json @@ -0,0 +1,12 @@ +{ + "type": "http", + "description": "http", + "scheme": "bearer", + "bearerFormat": "JWT", + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 +} diff --git a/test/definitions/3.0.0/security/oauth2/oauth2 authorization code flow.test.mjs b/test/definitions/3.0.0/security/oauth2/oauth2 authorization code flow.test.mjs new file mode 100644 index 00000000..0096f0fb --- /dev/null +++ b/test/definitions/3.0.0/security/oauth2/oauth2 authorization code flow.test.mjs @@ -0,0 +1,51 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/oauth2Flow.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('OAuth2 Authorization Code Flow', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/security/oauth2/oauth2 client credentials flow.test.mjs b/test/definitions/3.0.0/security/oauth2/oauth2 client credentials flow.test.mjs new file mode 100644 index 00000000..7c021d3f --- /dev/null +++ b/test/definitions/3.0.0/security/oauth2/oauth2 client credentials flow.test.mjs @@ -0,0 +1,50 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/oauth2Flow.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('OAuth2 Client Credentials Flow', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/security/oauth2/oauth2 flows.test.mjs b/test/definitions/3.0.0/security/oauth2/oauth2 flows.test.mjs new file mode 100644 index 00000000..5d6e9ce0 --- /dev/null +++ b/test/definitions/3.0.0/security/oauth2/oauth2 flows.test.mjs @@ -0,0 +1,147 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/oauth2Flows.json'); + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'type\'', + 'must have required property \'flows\'' + ], + false, // TODO: enable after schema patch + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "type": "oauth2", + "description": "oauth2", + "flows": { + "authorizationCode": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "clientCredentials": { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "implicit": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "password": { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + }, + "scopes": [ "write:pets", "read:pets" ] + } + ], + { + "type": "oauth2", + "flows": { + "authorizationCode": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "clientCredentials": { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "implicit": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "password": { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } + }, + { + "description": "oauth2", + "scopes": [ "write:pets", "read:pets" ] + }, + { + "type": "oauth2", + "flows":{ + "password": { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "type": "oauth2", + "flows":{ + "password": { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('OAuth2 Flows', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/security/oauth2/oauth2 implicit flow.test.mjs b/test/definitions/3.0.0/security/oauth2/oauth2 implicit flow.test.mjs new file mode 100644 index 00000000..f7150785 --- /dev/null +++ b/test/definitions/3.0.0/security/oauth2/oauth2 implicit flow.test.mjs @@ -0,0 +1,50 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/oauth2Flow.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('OAuth2 Implicit Flow', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/security/oauth2/oauth2 password flow.test.mjs b/test/definitions/3.0.0/security/oauth2/oauth2 password flow.test.mjs new file mode 100644 index 00000000..ac363998 --- /dev/null +++ b/test/definitions/3.0.0/security/oauth2/oauth2 password flow.test.mjs @@ -0,0 +1,50 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/oauth2Flow.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('OAuth2 Password Flow', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/security/openIdconnect.test.mjs b/test/definitions/3.0.0/security/openIdconnect.test.mjs new file mode 100644 index 00000000..14e9e0aa --- /dev/null +++ b/test/definitions/3.0.0/security/openIdconnect.test.mjs @@ -0,0 +1,84 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper.mjs'; + +const jsonSchema = require('@definitions/3.0.0/openIdConnect.json'); + +describe('OpenID Connect', () => { + it(TestHelper.exampleIsValidTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": "openIdConnect", + "description": "openIdConnect", + "openIdConnectUrl": "https://server.com/.well-known/openid-configuration", + "scopes": [ + "write:pets", + "read:pets" + ] + }, + )); + + it(TestHelper.cannotBeEmptyTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + {}, + [ + 'must have required property \'type\'', + 'must have required property \'openIdConnectUrl\'' + ] + )); + + it(TestHelper.isNotValidWithoutRequiredPropertiesTestName, () => TestHelper.objectIsNotValid( + jsonSchema, + { + "description": "openIdConnect" + }, + [ + 'must have required property \'type\'', + 'must have required property \'openIdConnectUrl\'' + ] + )); + + it(TestHelper.isValidWithOnlyRequiredPropertiesTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": "openIdConnect", + "openIdConnectUrl": "https://server.com/.well-known/openid-configuration" + }, + )); + + it(TestHelper.isValidWhenIsExtendedTestName, () => TestHelper.objectIsValid( + jsonSchema, + { + "type": "openIdConnect", + "description": "openIdConnect", + "openIdConnectUrl": "https://server.com/.well-known/openid-configuration", + "scopes": [ + "write:pets", + "read:pets" + ], + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + )); + + it(TestHelper.isNotValidWhenIsWronglyExtendedTestName, () => TestHelper.wronglyExtended( + jsonSchema, + { + "type": "openIdConnect", + "description": "openIdConnect", + "openIdConnectUrl": "https://server.com/.well-known/openid-configuration", + "scopes": [ + "write:pets", + "read:pets" + ], + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + }, + )); +}); diff --git a/test/definitions/3.0.0/security/saslSecurityScheme.test.mjs b/test/definitions/3.0.0/security/saslSecurityScheme.test.mjs new file mode 100644 index 00000000..3ecc5c47 --- /dev/null +++ b/test/definitions/3.0.0/security/saslSecurityScheme.test.mjs @@ -0,0 +1,40 @@ +import {describe, it} from 'vitest'; +import TestHelper from '@test/test-helper'; + +describe('SASL Security Scheme', async (httpSecurity) => { + const httpSecurityScheme = await import('@definitions/3.0.0/SaslSecurityScheme.json'); + + it.each([ + { + name: 'gssapi', + json: { + "type": "gssapi", + "description": "gssapi" + } + }, + { + name: 'plain', + json: { + "type": "plain", + "description": "plain" + } + }, + { + name: 'scramSha256', + json: { + "type": "scramSha256", + "description": "scramSha256" + } + }, + { + name: 'scramSha512', + json: { + "type": "scramSha512", + "description": "scramSha512" + } + } + ])('oneOf recognize: $name', (httpSecurity) => TestHelper.objectIsValid( + httpSecurityScheme, + httpSecurity.json, + )); +}); \ No newline at end of file diff --git a/test/definitions/base-schema-test.mjs b/test/definitions/base-schema-test.mjs new file mode 100644 index 00000000..2270a874 --- /dev/null +++ b/test/definitions/base-schema-test.mjs @@ -0,0 +1,113 @@ +import {it} from 'vitest'; +import TestHelper from '@test/test-helper'; + +export class JsonSchemaTestSuiteData { + + constructor( + jsonSchema, + examples, + onlyRequiredProperties, + withoutRequiredProperties, + extended, + wronglyExtended + ) { + this.jsonSchema = jsonSchema; + this.examples = examples; + this.onlyRequiredProperties = onlyRequiredProperties; + this.withoutRequiredProperties = withoutRequiredProperties; + this.extended = extended; + this.wronglyExtended = wronglyExtended; + } + +} + +export class JsonSchemaTestSuiteConfig { + + constructor( + hasRequiredProperties= false, + expectedErrorsWhenIsWithoutRequiredProperties= [], + canBeExtended = true, + expectedErrorsWhenIsWronglyExtended= [], + ) { + this.hasRequiredProperties = hasRequiredProperties; + this.expectedErrorsWhenIsWithoutRequiredProperties = expectedErrorsWhenIsWithoutRequiredProperties; + this.canBeExtended = canBeExtended; + this.expectedErrorsWhenIsWronglyExtended = expectedErrorsWhenIsWronglyExtended; + } + +} + +export class JsonSchemaTestSuite { + + data; + config; + + /** + * Basic JsonSchema Test Suite. + * + * @param data test data + * @param config test suite config + */ + constructor(data, config = new JsonSchemaTestSuiteConfig()) { + this.data = data; + this.config = config; + } + + testSuite() { + + for (const example of this.data.examples) { + it(TestHelper.exampleIsValidTestName, () => TestHelper.objectIsValid( + this.data.jsonSchema, + example, + )); + } + + if (this.config.hasRequiredProperties) { + + it(TestHelper.cannotBeEmptyTestName, () => TestHelper.objectIsNotValid( + this.data.jsonSchema, + {}, + this.config.expectedErrorsWhenIsWithoutRequiredProperties, + )); + + it(TestHelper.isNotValidWithoutRequiredPropertiesTestName, () => TestHelper.objectIsNotValid( + this.data.jsonSchema, + this.data.withoutRequiredProperties, + this.config.expectedErrorsWhenIsWithoutRequiredProperties + )); + + } else { + + it(TestHelper.canBeEmptyTestName, () => TestHelper.objectIsValid( + this.data.jsonSchema, + {}, + )); + + it(TestHelper.isValidWithoutRequiredPropertiesTestName, () => TestHelper.objectIsValid( + this.data.jsonSchema, + this.data.withoutRequiredProperties, + )); + + } + + it(TestHelper.isValidWithOnlyRequiredPropertiesTestName, () => TestHelper.objectIsValid( + this.data.jsonSchema, + this.data.onlyRequiredProperties, + )); + + // TODO: Remove after schemas patch + if (this.config.canBeExtended) { + it(TestHelper.isValidWhenIsExtendedTestName, () => TestHelper.objectIsValid( + this.data.jsonSchema, + this.data.extended, + )); + + it(TestHelper.isNotValidWhenIsWronglyExtendedTestName, () => TestHelper.wronglyExtended( + this.data.jsonSchema, + this.data.wronglyExtended, + )); + } + + } + +} \ No newline at end of file diff --git a/test/schemas.js b/test/schemas.test.mjs similarity index 90% rename from test/schemas.js rename to test/schemas.test.mjs index 787490cf..7f551ab6 100644 --- a/test/schemas.js +++ b/test/schemas.test.mjs @@ -1,3 +1,5 @@ +import {describe, it} from 'vitest'; + const assert = require('assert'); const fs = require('fs'); const path = require('path'); @@ -8,7 +10,6 @@ const versionsToTest = [ } ]; describe('Should be able to validate', function () { - this.timeout(30000); it('all valid documents', () => { const asyncapi = require('..'); for (const versionToTest of versionsToTest) { @@ -26,12 +27,12 @@ describe('Should be able to validate', function () { }); const documentPaths = fs.readdirSync(path.resolve(__dirname, `./docs/${version}`)).map((pathToDoc) => {return path.resolve(__dirname, `./docs/${version}/${pathToDoc}`);}); for (const documentPath of documentPaths) { - const document = require(documentPath); + const document = JSON.parse(fs.readFileSync(documentPath, 'utf-8')); const validate = ajv.compile(schema); const valid = validate(document); assert(valid === true, `Document ${ documentPath } must be validated correctly: ${ JSON.stringify(validate.errors, null, 4)}`); } } } - }); + }, 30000); }); \ No newline at end of file diff --git a/test/test-helper.mjs b/test/test-helper.mjs new file mode 100644 index 00000000..c0ffe1eb --- /dev/null +++ b/test/test-helper.mjs @@ -0,0 +1,129 @@ +import schemesV3_0_0 from '@test/ajv-schemes'; + +const Ajv = require('ajv'); +const addFormats = require('ajv-formats'); + +const assert = require('assert'); +const fs = require('fs'); + +export default class TestHelper { + + static get exampleIsValidTestName() { + return 'example is valid'; + } + + static get canBeEmptyTestName() { + return 'can be empty'; + } + + static get cannotBeEmptyTestName() { + return 'cannot be empty'; + } + + static get isValidWithoutRequiredPropertiesTestName() { + return 'is valid without required properties'; + } + + static get isNotValidWithoutRequiredPropertiesTestName() { + return 'is not valid without required properties'; + } + + static get isValidWithOnlyRequiredPropertiesTestName() { + return 'is valid with only required properties'; + } + + static get isValidWhenIsExtendedTestName() { + return 'is valid when is extended'; + } + + static get isNotValidWhenIsWronglyExtendedTestName() { + return 'is not valid when is wrongly extended'; + } + + static get propertyIsValidWhenIsTestName() { + return 'property is valid when is'; + } + + static get propertyIsNotValidWhenIsTestName() { + return 'property is not valid when is'; + } + + static validator(jsonSchema) { + const ajv = new Ajv({ + jsonPointers: true, + allErrors: true, + schemaId: '$id', + logger: false, + validateFormats: true, + strict: false, + }); + addFormats(ajv); + + return schemesV3_0_0(ajv).compile(jsonSchema); + } + + /** + * Expects that given json is valid against given Json Schema. + * + * @param jsonSchemaPath is a path to required Json Schema + * @param json is a path to Json file or is as raw Json + */ + static objectIsValid(jsonSchemaPath, json) { + const validator = this.validator(jsonSchemaPath); + const model = (typeof json === 'string') + ? JSON.parse(fs.readFileSync(json, 'utf-8')) + : json + ; + + const validationResult = validator(model); + assert(validationResult === true, `Object MUST be valid`); + } + + /** + * Expects that given json is not valid against given Json Schema. + * + * @param jsonSchemaPath is a path to required Json Schema + * @param json is a path to Json file or is as raw Json + * @param expectedValidationErrorMessages list of expected error messages + */ + static objectIsNotValid(jsonSchemaPath, json, expectedValidationErrorMessages) { + const validator = this.validator(jsonSchemaPath); + const model = (typeof json === 'string') + ? JSON.parse(fs.readFileSync(json, 'utf-8')) + : json + ; + + const validationResult = validator(model); + assert(validationResult === false, `Object MUST NOT be valid`); + for (let [index, expectedValidationErrorMessage] of expectedValidationErrorMessages.entries()) { + assert(validator.errors[index].message === expectedValidationErrorMessage); + } + assert(validator.errors.length === expectedValidationErrorMessages.length); + } + + static wronglyExtended(jsonSchemaPath, objectFilePath) { + const validator = this.validator(jsonSchemaPath); + const model = (typeof objectFilePath === 'string') + ? JSON.parse(fs.readFileSync(objectFilePath, 'utf-8')) + : objectFilePath + ; + + const validationResult = validator(model); + assert(validationResult === false, 'Object is not valid when was wrongly extended'); + assert(validator.errors[0].message === 'must NOT have additional properties'); + assert(validator.errors[0].params.additionalProperty === 'ext-number'); + assert(validator.errors.length === 1); + } + + static cantBeExtended(jsonSchemaPath, objectFilePath, unexpectedProperties) { + const validator = this.validator(jsonSchemaPath); + const model = JSON.parse(fs.readFileSync(objectFilePath, 'utf-8')); + + const validationResult = validator(model); + assert(validationResult === false, `Object can't be extended`); + for (let [index, unexpectedProperty] of unexpectedProperties.entries()) { + assert(validator.errors[index].params.additionalProperty === unexpectedProperty); + } + assert(validator.errors.length === unexpectedProperties.length); + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..a108b7fd --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "paths": { + "@extensions/*": ["./extensions/*"], + "@examples/*": ["./examples/*"], + "@definitions/*": ["./definitions/*"], + "@bindings/*": ["./bindings/*"], + "@common/*": ["./common/*"], + "@test/*": ["./test/*"] + } + } +} \ No newline at end of file diff --git a/vite.config.mts b/vite.config.mts new file mode 100644 index 00000000..31a29109 --- /dev/null +++ b/vite.config.mts @@ -0,0 +1,35 @@ +import { viteRequire } from 'vite-require'; +import { defineConfig } from 'vitest/config'; +import * as path from "node:path"; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [viteRequire()], + test: { + globals: true, + include: [ + '**/test/*.test.mjs', + '**/test/index.test.mjs', + '**/test/bindings/**/*.test.mjs', + '**/test/definitions/**/*.test.mjs', + '**/test/definitions/3.0.0/definitions.suite.mjs', + ], + reporters: ['verbose'] // https://vitest.dev/guide/reporters#custom-reporters + }, + resolve: { + alias: { + // @ts-ignore + '@extensions': path.resolve(__dirname, './extensions'), + // @ts-ignore + '@examples': path.resolve(__dirname, './examples'), + // @ts-ignore + '@definitions': path.resolve(__dirname, './definitions'), + // @ts-ignore + '@bindings': path.resolve(__dirname, './bindings'), + // @ts-ignore + '@common': path.resolve(__dirname, './common'), + // @ts-ignore + '@test': path.resolve(__dirname, './test'), + }, + }, +})