diff --git a/README.md b/README.md index 13d0344..2c05664 100644 --- a/README.md +++ b/README.md @@ -64,16 +64,22 @@ const models = { }; ``` -- Merge `fastify` types (as recommended by `fastify`) +- Register `fastify` types ```ts import type { FastifyZod } from "fastify-zod"; +// Global augmentation, as suggested by +// https://www.fastify.io/docs/latest/Reference/TypeScript/#creating-a-typescript-fastify-plugin declare module "fastify" { interface FastifyInstance { readonly zod: FastifyZod; } } + +// Local augmentation +// See below for register() +const f = register(fastify(), { jsonSchemas }); ``` - Register `fastify-zod` with optional config for `fastify-swagger` diff --git a/package-lock.json b/package-lock.json index 22c8ad7..2239638 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,18 @@ { "name": "fastify-zod", - "version": "1.0.0-rc10", + "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "1.0.0-rc10", + "version": "1.0.0", "license": "MIT", "dependencies": { "@fastify/swagger": "^6.1.0", "@openapitools/openapi-generator-cli": "^2.5.1", - "@types/change-case": "^2.3.1", "@types/js-yaml": "^4.0.5", "change-case": "^4.1.2", "fast-deep-equal": "^3.1.3", - "fastify": "^3.29.0", - "fastify-swagger": "^5.2.0", "js-yaml": "^4.1.0", "tslib": "^2.4.0", "typed-jest-expect": "^1.0.0", @@ -36,6 +33,7 @@ "eslint-config-prettier": "^8.5.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.0.0", + "fastify": "^3.29.0", "fastify-zod-test-openapi-client": "file:test-openapi-client", "http-errors": "^2.0.0", "jest": "^28.1.0", @@ -1738,6 +1736,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/@fastify/ajv-compiler/-/ajv-compiler-1.1.0.tgz", "integrity": "sha512-gvCOUNpXsWrIQ3A4aXCLIdblL0tDq42BG/2Xw7oxbil9h11uow10ztS2GuFazNBfjbrsZ5nl+nPl5jDSjj5TSg==", + "dev": true, "dependencies": { "ajv": "^6.12.6" } @@ -1745,7 +1744,8 @@ "node_modules/@fastify/error": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@fastify/error/-/error-2.0.0.tgz", - "integrity": "sha512-wI3fpfDT0t7p8E6dA2eTECzzOd+bZsZCJ2Hcv+Onn2b7ZwK3RwD27uW2QDaMtQhAfWQQP+WNK7nKf0twLsBf9w==" + "integrity": "sha512-wI3fpfDT0t7p8E6dA2eTECzzOd+bZsZCJ2Hcv+Onn2b7ZwK3RwD27uW2QDaMtQhAfWQQP+WNK7nKf0twLsBf9w==", + "dev": true }, "node_modules/@fastify/static": { "version": "5.0.2", @@ -2997,15 +2997,6 @@ "@babel/types": "^7.3.0" } }, - "node_modules/@types/change-case": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/@types/change-case/-/change-case-2.3.1.tgz", - "integrity": "sha1-269O+2OthYariBkXmnkJBMy2qDc=", - "deprecated": "This is a stub types definition for change-case (https://github.com/blakeembrey/change-case). change-case provides its own type definitions, so you don't need @types/change-case installed!", - "dependencies": { - "change-case": "*" - } - }, "node_modules/@types/graceful-fs": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", @@ -3313,7 +3304,8 @@ "node_modules/abstract-logging": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/abstract-logging/-/abstract-logging-2.0.1.tgz", - "integrity": "sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==" + "integrity": "sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==", + "dev": true }, "node_modules/acorn": { "version": "8.7.1", @@ -3340,6 +3332,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -3399,7 +3392,8 @@ "node_modules/archy": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", - "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=" + "integrity": "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==", + "dev": true }, "node_modules/argparse": { "version": "2.0.1", @@ -3488,14 +3482,16 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", + "dev": true, "engines": { "node": ">=8.0.0" } }, "node_modules/avvio": { - "version": "7.2.4", - "resolved": "https://registry.npmjs.org/avvio/-/avvio-7.2.4.tgz", - "integrity": "sha512-m9XMb/6E9P0lV4eiXNxfiJ/uFBW0KFpMrrB26c+ZJeRpYmc8JTOPy/7+lJrlbaqfrAArv9PmzOaFU6TKtKRLGA==", + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/avvio/-/avvio-7.2.5.tgz", + "integrity": "sha512-AOhBxyLVdpOad3TujtC9kL/9r3HnTkxwQ5ggOsYrvvZP1cCFvzHWJd5XxZDFuTn+IN8vkKSG5SEJrd27vCSbeA==", + "dev": true, "dependencies": { "archy": "^1.0.0", "debug": "^4.0.0", @@ -4271,9 +4267,10 @@ } }, "node_modules/cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "dev": true, "engines": { "node": ">= 0.6" } @@ -5276,7 +5273,8 @@ "node_modules/fast-decode-uri-component": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz", - "integrity": "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==" + "integrity": "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==", + "dev": true }, "node_modules/fast-deep-equal": { "version": "3.1.3", @@ -5314,6 +5312,7 @@ "version": "2.7.13", "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-2.7.13.tgz", "integrity": "sha512-ar+hQ4+OIurUGjSJD1anvYSDcUflywhKjfxnsW4TBTD7+u0tJufv6DKRWoQk3vI6YBOWMoz0TQtfbe7dxbQmvA==", + "dev": true, "dependencies": { "ajv": "^6.11.0", "deepmerge": "^4.2.2", @@ -5334,6 +5333,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.1.1.tgz", "integrity": "sha512-odVmjC8x8jNeMZ3C+rPMESzXVSEU8tSWSHv9HFxP2mm89G/1WwqhrerJDQm9Zus8X6aoRgQDThKqptdNA6bt+A==", + "dev": true, "engines": { "node": ">=6" } @@ -5347,6 +5347,7 @@ "version": "3.29.0", "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.29.0.tgz", "integrity": "sha512-zXSiDTdHJCHcmDrSje1f1RfzTmUTjMtHnPhh6cdokgfHhloQ+gy0Du+KlEjwTbcNC3Djj4GAsBzl6KvfI9Ah2g==", + "dev": true, "dependencies": { "@fastify/ajv-compiler": "^1.0.0", "@fastify/error": "^2.0.0", @@ -5370,61 +5371,15 @@ "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.1.tgz", "integrity": "sha512-qKcDXmuZadJqdTm6vlCqioEbyewF60b/0LOFCcYN1B6BIZGlYJumWWOYs70SFYLDAH4YqdE1cxH/RKMG7rFxgA==" }, - "node_modules/fastify-static": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/fastify-static/-/fastify-static-4.7.0.tgz", - "integrity": "sha512-zZhCfJv/hkmud2qhWqpU3K9XVAuy3+IV8Tp9BC5J5U+GyA2XwoB6h8lh9GqpEIqdXOw01WyWQllV7dOWVyAlXg==", - "dependencies": { - "fastify-static-deprecated": "npm:fastify-static@4.6.1", - "process-warning": "^1.0.0" - } - }, - "node_modules/fastify-static-deprecated": { - "name": "fastify-static", - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/fastify-static/-/fastify-static-4.6.1.tgz", - "integrity": "sha512-vy7N28U4AMhuOim12ZZWHulEE6OQKtzZbHgiB8Zj4llUuUQXPka0WHAQI3njm1jTCx4W6fixUHfpITxweMtAIA==", - "dependencies": { - "content-disposition": "^0.5.3", - "encoding-negotiator": "^2.0.1", - "fastify-plugin": "^3.0.0", - "glob": "^7.1.4", - "p-limit": "^3.1.0", - "readable-stream": "^3.4.0", - "send": "^0.17.1" - } - }, - "node_modules/fastify-swagger": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/fastify-swagger/-/fastify-swagger-5.2.0.tgz", - "integrity": "sha512-yKct50Mev9YIrhd2FRO4AChcJM9JwTBCziIjA4C+AI+hV2ystaIklgHVEwHoyqlaeQ+B4gZ1Z5rgOE87i4llLg==", - "dependencies": { - "fastify-swagger-deprecated": "npm:fastify-swagger@5.1.1", - "process-warning": "^1.0.0" - } - }, - "node_modules/fastify-swagger-deprecated": { - "name": "fastify-swagger", - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/fastify-swagger/-/fastify-swagger-5.1.1.tgz", - "integrity": "sha512-7DA0zS8CCV5r+gbLgWdeeKEwLrVbbOxLMJVUfOl1H9+wSildSLD8hok2TLX7s3c28wOjF8+iZRxsz/hBDzfdIw==", - "dependencies": { - "fastify-plugin": "^3.0.0", - "fastify-static": "^4.0.0", - "js-yaml": "^4.0.0", - "json-schema-resolver": "^1.3.0", - "openapi-types": "^10.0.0", - "rfdc": "^1.3.0" - } - }, "node_modules/fastify-zod-test-openapi-client": { "resolved": "test-openapi-client", "link": true }, "node_modules/fastify/node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -5439,6 +5394,7 @@ "version": "1.13.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, "dependencies": { "reusify": "^1.0.4" } @@ -5492,6 +5448,7 @@ "version": "4.5.1", "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-4.5.1.tgz", "integrity": "sha512-kE0u7sGoUFbMXcOG/xpkmz4sRLCklERnBcg7Ftuu1iAxsfEt2S46RLJ3Sq7vshsEy2wJT2hZxE58XZK27qa8kg==", + "dev": true, "dependencies": { "fast-decode-uri-component": "^1.0.1", "fast-deep-equal": "^3.1.3", @@ -5530,7 +5487,8 @@ "node_modules/flatstr": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/flatstr/-/flatstr-1.0.12.tgz", - "integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==" + "integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==", + "dev": true }, "node_modules/flatted": { "version": "3.2.5", @@ -5561,6 +5519,7 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "dev": true, "engines": { "node": ">= 0.6" } @@ -6053,6 +6012,7 @@ "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true, "engines": { "node": ">= 0.10" } @@ -8328,7 +8288,8 @@ "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -8388,20 +8349,22 @@ } }, "node_modules/light-my-request": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/light-my-request/-/light-my-request-4.8.0.tgz", - "integrity": "sha512-C2XESrTRsZnI59NSQigOsS6IuTxpj8OhSBvZS9fhgBMsamBsAuWN1s4hj/nCi8EeZcyAA6xbROhsZy7wKdfckg==", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/light-my-request/-/light-my-request-4.10.1.tgz", + "integrity": "sha512-l+zWk0HXGhGzY7IYTZnYEqIpj3Mpcyk2f8+FkKUyREywvaiWCf2jyQVxpasKRsploY/nVpoqTlxx72CIeQNcIQ==", + "dev": true, "dependencies": { "ajv": "^8.1.0", - "cookie": "^0.4.0", + "cookie": "^0.5.0", "process-warning": "^1.0.0", "set-cookie-parser": "^2.4.1" } }, "node_modules/light-my-request/node_modules/ajv": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", - "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -8416,7 +8379,8 @@ "node_modules/light-my-request/node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true }, "node_modules/lines-and-columns": { "version": "1.2.4", @@ -9143,6 +9107,7 @@ "version": "6.14.0", "resolved": "https://registry.npmjs.org/pino/-/pino-6.14.0.tgz", "integrity": "sha512-iuhEDel3Z3hF9Jfe44DPXR8l07bhjuFY3GMHIXbjnY9XcafbyDDwl2sN2vw2GjMPf5Nkoe+OFao7ffn9SXaKDg==", + "dev": true, "dependencies": { "fast-redact": "^3.0.0", "fast-safe-stringify": "^2.0.8", @@ -9202,7 +9167,8 @@ "node_modules/pino-std-serializers": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz", - "integrity": "sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg==" + "integrity": "sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg==", + "dev": true }, "node_modules/pirates": { "version": "4.0.5", @@ -9344,7 +9310,8 @@ "node_modules/process-warning": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz", - "integrity": "sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==" + "integrity": "sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==", + "dev": true }, "node_modules/prompts": { "version": "2.4.2", @@ -9362,6 +9329,7 @@ "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dev": true, "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" @@ -9392,6 +9360,7 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, "funding": [ { "type": "github", @@ -9410,7 +9379,8 @@ "node_modules/quick-format-unescaped": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", - "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==" + "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", + "dev": true }, "node_modules/range-parser": { "version": "1.2.1", @@ -9558,6 +9528,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -9630,6 +9601,7 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/ret/-/ret-0.2.2.tgz", "integrity": "sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==", + "dev": true, "engines": { "node": ">=4" } @@ -9638,6 +9610,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" @@ -9710,6 +9683,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/safe-regex2/-/safe-regex2-2.0.0.tgz", "integrity": "sha512-PaUSFsUaNNuKwkBijoAPHAK6/eM6VirvyPWlZ7BAQy4D+hCvh4B6lIG+nPdhbFfIbP+gTGBcrdsOaUs0F+ZBOQ==", + "dev": true, "dependencies": { "ret": "~0.2.0" } @@ -9722,7 +9696,8 @@ "node_modules/secure-json-parse": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.4.0.tgz", - "integrity": "sha512-Q5Z/97nbON5t/L/sH6mY2EacfjVGwrCcSi5D3btRO2GZ8pf1K1UN7Z9H5J57hjVU2Qzxr1xO+FmBhOvEkzCMmg==" + "integrity": "sha512-Q5Z/97nbON5t/L/sH6mY2EacfjVGwrCcSi5D3btRO2GZ8pf1K1UN7Z9H5J57hjVU2Qzxr1xO+FmBhOvEkzCMmg==", + "dev": true }, "node_modules/semver": { "version": "6.3.0", @@ -9735,7 +9710,8 @@ "node_modules/semver-store": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/semver-store/-/semver-store-0.3.0.tgz", - "integrity": "sha512-TcZvGMMy9vodEFSse30lWinkj+JgOBvPn8wRItpQRSayhc+4ssDs335uklkfvQQJgL/WvmHLVj4Ycv2s7QCQMg==" + "integrity": "sha512-TcZvGMMy9vodEFSse30lWinkj+JgOBvPn8wRItpQRSayhc+4ssDs335uklkfvQQJgL/WvmHLVj4Ycv2s7QCQMg==", + "dev": true }, "node_modules/send": { "version": "0.17.2", @@ -9820,9 +9796,10 @@ } }, "node_modules/set-cookie-parser": { - "version": "2.4.8", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.8.tgz", - "integrity": "sha512-edRH8mBKEWNVIVMKejNnuJxleqYE/ZSdcT8/Nem9/mmosx12pctd80s2Oy00KNZzrogMZS5mauK2/ymL1bvlvg==" + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.5.0.tgz", + "integrity": "sha512-cHMAtSXilfyBePduZEBVPTCftTQWz6ehWJD5YNUg4mqvRosrrjKbo4WS8JkB0/RxonMoohHm7cOGH60mDkRQ9w==", + "dev": true }, "node_modules/setprototypeof": { "version": "1.2.0", @@ -9894,6 +9871,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", "integrity": "sha512-LRHh/A8tpW7ru89lrlkU4AszXt1dbwSjVWguGrmlxE7tawVmDBlI1PILMkXAxJTwqhgsEeTHzj36D5CmHgQmNg==", + "dev": true, "dependencies": { "atomic-sleep": "^1.0.0", "flatstr": "^1.0.12" @@ -10011,7 +9989,8 @@ "node_modules/string-similarity": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.4.tgz", - "integrity": "sha512-/q/8Q4Bl4ZKAPjj8WerIBJWALKkaPRfrvhfF8k/B23i4nzrlRj2/go1m90In7nG/3XDSbOo0+pu6RvCTM9RGMQ==" + "integrity": "sha512-/q/8Q4Bl4ZKAPjj8WerIBJWALKkaPRfrvhfF8k/B23i4nzrlRj2/go1m90In7nG/3XDSbOo0+pu6RvCTM9RGMQ==", + "dev": true }, "node_modules/string-width": { "version": "4.2.3", @@ -10188,9 +10167,10 @@ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "node_modules/tiny-lru": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/tiny-lru/-/tiny-lru-8.0.1.tgz", - "integrity": "sha512-eBIAYA0BzSjxBedCaO0CSjertD+u+IvNuFkyD7ESf+qjqHKBr5wFqvEYl91+ZQd7jjq2pO6/fBVwFgb6bxvorw==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/tiny-lru/-/tiny-lru-8.0.2.tgz", + "integrity": "sha512-ApGvZ6vVvTNdsmt676grvCkUCGwzG9IqXma5Z07xJgiC5L7akUMof5U8G2JTI9Rz/ovtVhJBlY6mNhEvtjzOIg==", + "dev": true, "engines": { "node": ">=6" } @@ -11845,6 +11825,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/@fastify/ajv-compiler/-/ajv-compiler-1.1.0.tgz", "integrity": "sha512-gvCOUNpXsWrIQ3A4aXCLIdblL0tDq42BG/2Xw7oxbil9h11uow10ztS2GuFazNBfjbrsZ5nl+nPl5jDSjj5TSg==", + "dev": true, "requires": { "ajv": "^6.12.6" } @@ -11852,7 +11833,8 @@ "@fastify/error": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@fastify/error/-/error-2.0.0.tgz", - "integrity": "sha512-wI3fpfDT0t7p8E6dA2eTECzzOd+bZsZCJ2Hcv+Onn2b7ZwK3RwD27uW2QDaMtQhAfWQQP+WNK7nKf0twLsBf9w==" + "integrity": "sha512-wI3fpfDT0t7p8E6dA2eTECzzOd+bZsZCJ2Hcv+Onn2b7ZwK3RwD27uW2QDaMtQhAfWQQP+WNK7nKf0twLsBf9w==", + "dev": true }, "@fastify/static": { "version": "5.0.2", @@ -12774,14 +12756,6 @@ "@babel/types": "^7.3.0" } }, - "@types/change-case": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/@types/change-case/-/change-case-2.3.1.tgz", - "integrity": "sha1-269O+2OthYariBkXmnkJBMy2qDc=", - "requires": { - "change-case": "*" - } - }, "@types/graceful-fs": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", @@ -12992,7 +12966,8 @@ "abstract-logging": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/abstract-logging/-/abstract-logging-2.0.1.tgz", - "integrity": "sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==" + "integrity": "sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==", + "dev": true }, "acorn": { "version": "8.7.1", @@ -13011,6 +12986,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -13051,7 +13027,8 @@ "archy": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", - "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=" + "integrity": "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==", + "dev": true }, "argparse": { "version": "2.0.1", @@ -13117,12 +13094,14 @@ "atomic-sleep": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", - "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==" + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", + "dev": true }, "avvio": { - "version": "7.2.4", - "resolved": "https://registry.npmjs.org/avvio/-/avvio-7.2.4.tgz", - "integrity": "sha512-m9XMb/6E9P0lV4eiXNxfiJ/uFBW0KFpMrrB26c+ZJeRpYmc8JTOPy/7+lJrlbaqfrAArv9PmzOaFU6TKtKRLGA==", + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/avvio/-/avvio-7.2.5.tgz", + "integrity": "sha512-AOhBxyLVdpOad3TujtC9kL/9r3HnTkxwQ5ggOsYrvvZP1cCFvzHWJd5XxZDFuTn+IN8vkKSG5SEJrd27vCSbeA==", + "dev": true, "requires": { "archy": "^1.0.0", "debug": "^4.0.0", @@ -13688,9 +13667,10 @@ } }, "cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==" + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "dev": true }, "core-js-compat": { "version": "3.22.8", @@ -14439,7 +14419,8 @@ "fast-decode-uri-component": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz", - "integrity": "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==" + "integrity": "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==", + "dev": true }, "fast-deep-equal": { "version": "3.1.3", @@ -14474,6 +14455,7 @@ "version": "2.7.13", "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-2.7.13.tgz", "integrity": "sha512-ar+hQ4+OIurUGjSJD1anvYSDcUflywhKjfxnsW4TBTD7+u0tJufv6DKRWoQk3vI6YBOWMoz0TQtfbe7dxbQmvA==", + "dev": true, "requires": { "ajv": "^6.11.0", "deepmerge": "^4.2.2", @@ -14490,7 +14472,8 @@ "fast-redact": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.1.1.tgz", - "integrity": "sha512-odVmjC8x8jNeMZ3C+rPMESzXVSEU8tSWSHv9HFxP2mm89G/1WwqhrerJDQm9Zus8X6aoRgQDThKqptdNA6bt+A==" + "integrity": "sha512-odVmjC8x8jNeMZ3C+rPMESzXVSEU8tSWSHv9HFxP2mm89G/1WwqhrerJDQm9Zus8X6aoRgQDThKqptdNA6bt+A==", + "dev": true }, "fast-safe-stringify": { "version": "2.1.1", @@ -14501,6 +14484,7 @@ "version": "3.29.0", "resolved": "https://registry.npmjs.org/fastify/-/fastify-3.29.0.tgz", "integrity": "sha512-zXSiDTdHJCHcmDrSje1f1RfzTmUTjMtHnPhh6cdokgfHhloQ+gy0Du+KlEjwTbcNC3Djj4GAsBzl6KvfI9Ah2g==", + "dev": true, "requires": { "@fastify/ajv-compiler": "^1.0.0", "@fastify/error": "^2.0.0", @@ -14520,9 +14504,10 @@ }, "dependencies": { "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, "requires": { "lru-cache": "^6.0.0" } @@ -14534,51 +14519,6 @@ "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.1.tgz", "integrity": "sha512-qKcDXmuZadJqdTm6vlCqioEbyewF60b/0LOFCcYN1B6BIZGlYJumWWOYs70SFYLDAH4YqdE1cxH/RKMG7rFxgA==" }, - "fastify-static": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/fastify-static/-/fastify-static-4.7.0.tgz", - "integrity": "sha512-zZhCfJv/hkmud2qhWqpU3K9XVAuy3+IV8Tp9BC5J5U+GyA2XwoB6h8lh9GqpEIqdXOw01WyWQllV7dOWVyAlXg==", - "requires": { - "fastify-static-deprecated": "npm:fastify-static@4.6.1", - "process-warning": "^1.0.0" - } - }, - "fastify-static-deprecated": { - "version": "npm:fastify-static@4.6.1", - "resolved": "https://registry.npmjs.org/fastify-static/-/fastify-static-4.6.1.tgz", - "integrity": "sha512-vy7N28U4AMhuOim12ZZWHulEE6OQKtzZbHgiB8Zj4llUuUQXPka0WHAQI3njm1jTCx4W6fixUHfpITxweMtAIA==", - "requires": { - "content-disposition": "^0.5.3", - "encoding-negotiator": "^2.0.1", - "fastify-plugin": "^3.0.0", - "glob": "^7.1.4", - "p-limit": "^3.1.0", - "readable-stream": "^3.4.0", - "send": "^0.17.1" - } - }, - "fastify-swagger": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/fastify-swagger/-/fastify-swagger-5.2.0.tgz", - "integrity": "sha512-yKct50Mev9YIrhd2FRO4AChcJM9JwTBCziIjA4C+AI+hV2ystaIklgHVEwHoyqlaeQ+B4gZ1Z5rgOE87i4llLg==", - "requires": { - "fastify-swagger-deprecated": "npm:fastify-swagger@5.1.1", - "process-warning": "^1.0.0" - } - }, - "fastify-swagger-deprecated": { - "version": "npm:fastify-swagger@5.1.1", - "resolved": "https://registry.npmjs.org/fastify-swagger/-/fastify-swagger-5.1.1.tgz", - "integrity": "sha512-7DA0zS8CCV5r+gbLgWdeeKEwLrVbbOxLMJVUfOl1H9+wSildSLD8hok2TLX7s3c28wOjF8+iZRxsz/hBDzfdIw==", - "requires": { - "fastify-plugin": "^3.0.0", - "fastify-static": "^4.0.0", - "js-yaml": "^4.0.0", - "json-schema-resolver": "^1.3.0", - "openapi-types": "^10.0.0", - "rfdc": "^1.3.0" - } - }, "fastify-zod-test-openapi-client": { "version": "file:test-openapi-client", "requires": { @@ -14597,6 +14537,7 @@ "version": "1.13.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, "requires": { "reusify": "^1.0.4" } @@ -14638,6 +14579,7 @@ "version": "4.5.1", "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-4.5.1.tgz", "integrity": "sha512-kE0u7sGoUFbMXcOG/xpkmz4sRLCklERnBcg7Ftuu1iAxsfEt2S46RLJ3Sq7vshsEy2wJT2hZxE58XZK27qa8kg==", + "dev": true, "requires": { "fast-decode-uri-component": "^1.0.1", "fast-deep-equal": "^3.1.3", @@ -14667,7 +14609,8 @@ "flatstr": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/flatstr/-/flatstr-1.0.12.tgz", - "integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==" + "integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==", + "dev": true }, "flatted": { "version": "3.2.5", @@ -14683,7 +14626,8 @@ "forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "dev": true }, "fresh": { "version": "0.5.2", @@ -15026,7 +14970,8 @@ "ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true }, "is-arrayish": { "version": "0.2.1", @@ -16651,7 +16596,8 @@ "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -16694,20 +16640,22 @@ } }, "light-my-request": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/light-my-request/-/light-my-request-4.8.0.tgz", - "integrity": "sha512-C2XESrTRsZnI59NSQigOsS6IuTxpj8OhSBvZS9fhgBMsamBsAuWN1s4hj/nCi8EeZcyAA6xbROhsZy7wKdfckg==", + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/light-my-request/-/light-my-request-4.10.1.tgz", + "integrity": "sha512-l+zWk0HXGhGzY7IYTZnYEqIpj3Mpcyk2f8+FkKUyREywvaiWCf2jyQVxpasKRsploY/nVpoqTlxx72CIeQNcIQ==", + "dev": true, "requires": { "ajv": "^8.1.0", - "cookie": "^0.4.0", + "cookie": "^0.5.0", "process-warning": "^1.0.0", "set-cookie-parser": "^2.4.1" }, "dependencies": { "ajv": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", - "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, "requires": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -16718,7 +16666,8 @@ "json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true } } }, @@ -17269,6 +17218,7 @@ "version": "6.14.0", "resolved": "https://registry.npmjs.org/pino/-/pino-6.14.0.tgz", "integrity": "sha512-iuhEDel3Z3hF9Jfe44DPXR8l07bhjuFY3GMHIXbjnY9XcafbyDDwl2sN2vw2GjMPf5Nkoe+OFao7ffn9SXaKDg==", + "dev": true, "requires": { "fast-redact": "^3.0.0", "fast-safe-stringify": "^2.0.8", @@ -17324,7 +17274,8 @@ "pino-std-serializers": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz", - "integrity": "sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg==" + "integrity": "sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg==", + "dev": true }, "pirates": { "version": "4.0.5", @@ -17422,7 +17373,8 @@ "process-warning": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz", - "integrity": "sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==" + "integrity": "sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==", + "dev": true }, "prompts": { "version": "2.4.2", @@ -17437,6 +17389,7 @@ "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dev": true, "requires": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" @@ -17460,12 +17413,14 @@ "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true }, "quick-format-unescaped": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", - "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==" + "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", + "dev": true }, "range-parser": { "version": "1.2.1", @@ -17584,7 +17539,8 @@ "require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true }, "resolve": { "version": "1.22.0", @@ -17634,12 +17590,14 @@ "ret": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/ret/-/ret-0.2.2.tgz", - "integrity": "sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==" + "integrity": "sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==", + "dev": true }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true }, "rfdc": { "version": "1.3.0", @@ -17685,6 +17643,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/safe-regex2/-/safe-regex2-2.0.0.tgz", "integrity": "sha512-PaUSFsUaNNuKwkBijoAPHAK6/eM6VirvyPWlZ7BAQy4D+hCvh4B6lIG+nPdhbFfIbP+gTGBcrdsOaUs0F+ZBOQ==", + "dev": true, "requires": { "ret": "~0.2.0" } @@ -17697,7 +17656,8 @@ "secure-json-parse": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.4.0.tgz", - "integrity": "sha512-Q5Z/97nbON5t/L/sH6mY2EacfjVGwrCcSi5D3btRO2GZ8pf1K1UN7Z9H5J57hjVU2Qzxr1xO+FmBhOvEkzCMmg==" + "integrity": "sha512-Q5Z/97nbON5t/L/sH6mY2EacfjVGwrCcSi5D3btRO2GZ8pf1K1UN7Z9H5J57hjVU2Qzxr1xO+FmBhOvEkzCMmg==", + "dev": true }, "semver": { "version": "6.3.0", @@ -17707,7 +17667,8 @@ "semver-store": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/semver-store/-/semver-store-0.3.0.tgz", - "integrity": "sha512-TcZvGMMy9vodEFSse30lWinkj+JgOBvPn8wRItpQRSayhc+4ssDs335uklkfvQQJgL/WvmHLVj4Ycv2s7QCQMg==" + "integrity": "sha512-TcZvGMMy9vodEFSse30lWinkj+JgOBvPn8wRItpQRSayhc+4ssDs335uklkfvQQJgL/WvmHLVj4Ycv2s7QCQMg==", + "dev": true }, "send": { "version": "0.17.2", @@ -17784,9 +17745,10 @@ } }, "set-cookie-parser": { - "version": "2.4.8", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.4.8.tgz", - "integrity": "sha512-edRH8mBKEWNVIVMKejNnuJxleqYE/ZSdcT8/Nem9/mmosx12pctd80s2Oy00KNZzrogMZS5mauK2/ymL1bvlvg==" + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.5.0.tgz", + "integrity": "sha512-cHMAtSXilfyBePduZEBVPTCftTQWz6ehWJD5YNUg4mqvRosrrjKbo4WS8JkB0/RxonMoohHm7cOGH60mDkRQ9w==", + "dev": true }, "setprototypeof": { "version": "1.2.0", @@ -17846,6 +17808,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", "integrity": "sha512-LRHh/A8tpW7ru89lrlkU4AszXt1dbwSjVWguGrmlxE7tawVmDBlI1PILMkXAxJTwqhgsEeTHzj36D5CmHgQmNg==", + "dev": true, "requires": { "atomic-sleep": "^1.0.0", "flatstr": "^1.0.12" @@ -17935,7 +17898,8 @@ "string-similarity": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.4.tgz", - "integrity": "sha512-/q/8Q4Bl4ZKAPjj8WerIBJWALKkaPRfrvhfF8k/B23i4nzrlRj2/go1m90In7nG/3XDSbOo0+pu6RvCTM9RGMQ==" + "integrity": "sha512-/q/8Q4Bl4ZKAPjj8WerIBJWALKkaPRfrvhfF8k/B23i4nzrlRj2/go1m90In7nG/3XDSbOo0+pu6RvCTM9RGMQ==", + "dev": true }, "string-width": { "version": "4.2.3", @@ -18063,9 +18027,10 @@ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "tiny-lru": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/tiny-lru/-/tiny-lru-8.0.1.tgz", - "integrity": "sha512-eBIAYA0BzSjxBedCaO0CSjertD+u+IvNuFkyD7ESf+qjqHKBr5wFqvEYl91+ZQd7jjq2pO6/fBVwFgb6bxvorw==" + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/tiny-lru/-/tiny-lru-8.0.2.tgz", + "integrity": "sha512-ApGvZ6vVvTNdsmt676grvCkUCGwzG9IqXma5Z07xJgiC5L7akUMof5U8G2JTI9Rz/ovtVhJBlY6mNhEvtjzOIg==", + "dev": true }, "tmp": { "version": "0.0.33", diff --git a/package.json b/package.json index 4220f8b..47f2603 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fastify-zod", - "version": "1.0.0-rc10", + "version": "1.0.0", "description": "Zod integration with Fastify", "main": "build/index.js", "scripts": { @@ -12,7 +12,7 @@ "build:babel": "babel src --out-dir build --extensions '.ts' --source-maps", "build:openapi-spec": "node build/__tests__/generate-spec.fixtures.js", "build:openapi-client": "rm -rf test-openapi-client && openapi-generator-cli generate && cd test-openapi-client && npm i && cd .. && npm i file:./test-openapi-client --save-dev", - "build": "npm run clean && npm run build:types && npm run build:babel && npm run build:openapi-spec && npm run build:openapi-client", + "build": "npm run clean && npm run build:babel && npm run build:openapi-spec && npm run build:openapi-client && npm run build:types", "test": "jest" }, "repository": { @@ -44,6 +44,7 @@ "eslint-config-prettier": "^8.5.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.0.0", + "fastify": "^3.29.0", "fastify-zod-test-openapi-client": "file:test-openapi-client", "http-errors": "^2.0.0", "jest": "^28.1.0", @@ -52,19 +53,19 @@ "prettier": "^2.6.2", "typescript": "^4.7.3" }, + "peerDependencies": { + "fastify": "^3.29.0" + }, "dependencies": { "@fastify/swagger": "^6.1.0", "@openapitools/openapi-generator-cli": "^2.5.1", - "@types/change-case": "^2.3.1", "@types/js-yaml": "^4.0.5", "change-case": "^4.1.2", "fast-deep-equal": "^3.1.3", - "fastify": "^3.29.0", - "fastify-swagger": "^5.2.0", "js-yaml": "^4.1.0", "tslib": "^2.4.0", "typed-jest-expect": "^1.0.0", "zod": "^3.17.3", "zod-to-json-schema": "^3.17.0" } -} +} \ No newline at end of file diff --git a/src/FastifyZod.ts b/src/FastifyZod.ts index d8cabbb..a5dde9e 100644 --- a/src/FastifyZod.ts +++ b/src/FastifyZod.ts @@ -30,18 +30,21 @@ type RouteHandlerParams< M extends Models, Params extends void | SchemaKey, Body extends void | SchemaKey, -> = FastifyRequest & { - readonly params: SchemaTypeOption; - readonly body: SchemaTypeOption; -}; + Querystring extends void | SchemaKey, +> = FastifyRequest<{ + Params: SchemaTypeOption; + Body: SchemaTypeOption; + Querystring: SchemaTypeOption; +}>; type RouteHandler< M extends Models, Params extends void | SchemaKey, Body extends void | SchemaKey, Reply extends void | SchemaKey, + Querystring extends void | SchemaKey, > = ( - params: RouteHandlerParams, + params: RouteHandlerParams, ) => Promise>; type RouteConfig< @@ -50,6 +53,7 @@ type RouteConfig< Params extends void | SchemaKey = void, Body extends void | SchemaKey = void, Reply extends void | SchemaKey = void, + Querystring extends void | SchemaKey = void, > = { readonly url: string; readonly method: Method; @@ -73,7 +77,13 @@ type RouteConfig< readonly description: string; readonly key: Exclude; }; - readonly handler: RouteHandler; + readonly querystring?: + | Exclude + | { + readonly description: string; + readonly key: Exclude; + }; + readonly handler: RouteHandler; } & FastifySchema; export type FastifyZod = { @@ -81,16 +91,21 @@ export type FastifyZod = { Params extends void | SchemaKey = void, Body extends void | SchemaKey = void, Reply extends void | SchemaKey = void, + Querystring extends void | SchemaKey = void, >( url: string, config: Omit< - RouteConfig, + RouteConfig, `url` | `method` | `schema` | `handler` >, - handler: RouteHandler, + handler: RouteHandler, ) => void; }; +export interface FastifyZodInstance extends FastifyInstance { + readonly zod: FastifyZod; +} + export const withRefResolver = ( options: FastifyDynamicSwaggerOptions, ): FastifyDynamicSwaggerOptions => ({ @@ -106,7 +121,7 @@ export const withRefResolver = ( export const register = ( f: FastifyInstance, { jsonSchemas: { schemas, $ref }, swaggerOptions }: RegisterOptions, -): void => { +): FastifyZodInstance => { for (const schema of schemas) { f.addSchema(schema); } @@ -185,6 +200,7 @@ export const register = ( Params extends void | SchemaKey = void, Body extends void | SchemaKey = void, Reply extends void | SchemaKey = void, + Querystring extends void | SchemaKey = void, >({ method, url, @@ -192,13 +208,15 @@ export const register = ( params, body, reply, + querystring, handler, ...fastifySchema - }: RouteConfig): void => { + }: RouteConfig): void => { f[method]<{ Params: SchemaTypeOption; Body: SchemaTypeOption; Reply: SchemaTypeOption; + Querystring: SchemaTypeOption; }>( url, { @@ -208,6 +226,9 @@ export const register = ( ? $ref(params as SchemaKeyOrDescription) : undefined, body: body ? $ref(body as SchemaKeyOrDescription) : undefined, + querystring: querystring + ? $ref(querystring as SchemaKeyOrDescription) + : undefined, response: reply ? { 200: $ref(reply as SchemaKeyOrDescription), @@ -236,4 +257,6 @@ export const register = ( }; f.decorate(`zod`, pluginInstance); + + return f as FastifyZodInstance; }; diff --git a/src/JsonSchema.ts b/src/JsonSchema.ts index 9d3dd62..8439c8f 100644 --- a/src/JsonSchema.ts +++ b/src/JsonSchema.ts @@ -7,18 +7,18 @@ export type BuildJsonSchemasOptions = { readonly target?: `jsonSchema7` | `openApi3`; }; -type $ref = (key: SchemaKeyOrDescription) => { +type $Ref = (key: SchemaKeyOrDescription) => { readonly $ref: string; readonly description?: string; }; -type JsonSchema = { +export type JsonSchema = { readonly $id: string; }; export type BuildJsonSchemasResult = { readonly schemas: JsonSchema[]; - readonly $ref: $ref; + readonly $ref: $Ref; }; /** @@ -48,7 +48,7 @@ export const buildJsonSchemas = ( ...zodJsonSchema, }; - const $ref: $ref = (key) => { + const $ref: $Ref = (key) => { const $ref = `${$id}#/properties/${ typeof key === `string` ? key : key.key }`; diff --git a/src/__tests__/issues.test.ts b/src/__tests__/issues.test.ts new file mode 100644 index 0000000..c95db8f --- /dev/null +++ b/src/__tests__/issues.test.ts @@ -0,0 +1,133 @@ +import fastify from "fastify"; +import { z } from "zod"; + +import { buildJsonSchemas, register } from ".."; + +test(`fix #8`, () => { + const productInput = { + title: z.string(), + price: z.number(), + content: z.string().optional(), + }; + + const productGenerated = { + id: z.number(), + createdAt: z.string(), + updatedAt: z.string(), + }; + + const createProductSchema = z.object({ + ...productInput, + }); + + const productResponseSchema = z.object({ + ...productInput, + ...productGenerated, + }); + + const productsResponseSchema = z.array(productResponseSchema); + + buildJsonSchemas({ + createProductSchema, + productResponseSchema, + productsResponseSchema, + }); + + const userCoreSchema = { + email: z + .string({ + required_error: `Email is required`, + invalid_type_error: `Email must be a string`, + }) + .email(), + name: z.string(), + }; + + const createUserSchema = z.object({ + ...userCoreSchema, + password: z.string({ + required_error: `Password is required`, + invalid_type_error: `Password must be a string`, + }), + }); + + const createUserResponseSchema = z.object({ + ...userCoreSchema, + id: z.number(), + }); + + const loginSchema = z.object({ + email: z + .string({ + required_error: `Email is required`, + invalid_type_error: `Email must be a string`, + }) + .email(), + password: z.string(), + }); + + const loginResponseSchema = z.object({ + accessToken: z.string(), + }); + + buildJsonSchemas({ + createUserSchema, + createUserResponseSchema, + loginSchema, + loginResponseSchema, + }); +}); + +test(`fix #14, #17`, async () => { + const Name = z.object({ + kind: z.literal(`name`), + name: z.string(), + lastName: z.string(), + }); + + const Address = z.object({ + kind: z.literal(`address`), + street: z.string(), + postcode: z.string(), + }); + + const UserDetails = z.union([Name, Address]); + + const Unknown = z.unknown(); + + const jsonSchemas = buildJsonSchemas({ UserDetails, Unknown }, {}); + + const f = register(fastify(), { + jsonSchemas, + }); + + f.zod.get( + `/`, + { + operationId: `getUserDetails`, + querystring: `UserDetails`, + reply: `UserDetails`, + }, + async ({ query }) => query, + ); + + const name = await f + .inject({ method: `get`, url: `/`, query: { kind: `name` } }) + .then((res) => res.json()); + + expect(name).toEqual({ + error: `Bad Request`, + message: `querystring should have required property 'name', querystring.kind should be equal to constant, querystring should match some schema in anyOf`, + statusCode: 400, + }); + + const address = await f + .inject({ method: `get`, url: `/`, query: { kind: `address` } }) + .then((res) => res.json()); + + expect(address).toEqual({ + error: `Bad Request`, + message: `querystring.kind should be equal to constant, querystring should have required property 'street', querystring should match some schema in anyOf`, + statusCode: 400, + }); +}); diff --git a/src/__tests__/server.fixtures.ts b/src/__tests__/server.fixtures.ts index 056cf7d..9994f83 100644 --- a/src/__tests__/server.fixtures.ts +++ b/src/__tests__/server.fixtures.ts @@ -2,17 +2,10 @@ import fastify, { FastifyInstance, FastifyServerOptions } from "fastify"; import { BadRequest, NotFound } from "http-errors"; import { register } from ".."; -import { FastifyZod, RegisterOptions } from "../FastifyZod"; +import { RegisterOptions } from "../FastifyZod"; import { models, TodoItems } from "./models.fixtures"; -// eslint-disable-next-line quotes -declare module "fastify" { - interface FastifyInstance { - readonly zod: FastifyZod; - } -} - export const swaggerOptions: RegisterOptions[`swaggerOptions`] = { routePrefix: `/swagger`, @@ -44,9 +37,7 @@ export const createTestServer = ( fastifyOptions: FastifyServerOptions, registerOptions: RegisterOptions, ): FastifyInstance => { - const f = fastify(fastifyOptions); - - register(f, registerOptions); + const f = register(fastify(fastifyOptions), registerOptions); const state: TodoItems = { todoItems: [], diff --git a/src/index.ts b/src/index.ts index 71484ba..84cf209 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,7 @@ export { buildJsonSchemas, buildJsonSchema } from "./JsonSchema"; export type { BuildJsonSchemasOptions, BuildJsonSchemasResult, + JsonSchema, } from "./JsonSchema"; export { register, withRefResolver } from "./FastifyZod"; export type { FastifyZod, RegisterOptions } from "./FastifyZod";