From 72a5938314ab8e83bf0ed438b67b6142a2c2cad8 Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Tue, 1 Mar 2022 11:03:39 -0800 Subject: [PATCH 1/5] chore(deps): upgrading typescript to v4.6 --- package-lock.json | 30 ++++++++++++++---------------- packages/api/package-lock.json | 18 +++++++++--------- packages/api/package.json | 2 +- packages/cli/.gitignore | 2 +- packages/cli/package-lock.json | 24 +++++++++++------------- packages/cli/package.json | 6 +++--- packages/core/package-lock.json | 14 +++++++------- packages/core/package.json | 2 +- 8 files changed, 47 insertions(+), 51 deletions(-) diff --git a/package-lock.json b/package-lock.json index 89934e9c..d3a6da9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11536,10 +11536,9 @@ } }, "node_modules/typescript": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", - "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", - "dev": true, + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -12496,7 +12495,7 @@ "nock": "^13.2.4", "nyc": "^15.1.0", "prettier": "^2.5.1", - "typescript": "^4.5.5", + "typescript": "^4.6.2", "unique-temp-dir": "^1.0.0" }, "engines": { @@ -12516,7 +12515,8 @@ "fetch-har": "^6.1.0", "js-yaml": "^4.1.0", "json-schema-to-typescript": "^10.1.5", - "oas": "^17.7.3" + "oas": "^17.7.3", + "typescript": "^4.6.2" }, "devDependencies": { "@oclif/test": "^2.1.0", @@ -12534,8 +12534,7 @@ "prettier": "^2.5.1", "shx": "^0.3.3", "ts-node": "^10.5.0", - "tslib": "^2.3.1", - "typescript": "^4.5.5" + "tslib": "^2.3.1" }, "engines": { "node": "^14 || ^16" @@ -12568,7 +12567,7 @@ "nock": "^13.2.4", "nyc": "^15.1.0", "prettier": "^2.5.1", - "typescript": "^4.5.5" + "typescript": "^4.6.2" }, "engines": { "node": "^14 || ^16" @@ -13918,7 +13917,7 @@ "shx": "^0.3.3", "ts-node": "^10.5.0", "tslib": "^2.3.1", - "typescript": "^4.5.5" + "typescript": "^4.6.2" } }, "@readme/api-core": { @@ -13944,7 +13943,7 @@ "nyc": "^15.1.0", "oas": "^17.7.3", "prettier": "^2.5.1", - "typescript": "^4.5.5" + "typescript": "^4.6.2" }, "dependencies": { "json-schema-traverse": { @@ -14510,7 +14509,7 @@ "nyc": "^15.1.0", "oas": "^17.7.3", "prettier": "^2.5.1", - "typescript": "^4.5.5", + "typescript": "^4.6.2", "unique-temp-dir": "^1.0.0" } }, @@ -21490,10 +21489,9 @@ } }, "typescript": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", - "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", - "dev": true + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==" }, "uid2": { "version": "0.0.3", diff --git a/packages/api/package-lock.json b/packages/api/package-lock.json index 198b32db..38d93643 100644 --- a/packages/api/package-lock.json +++ b/packages/api/package-lock.json @@ -33,7 +33,7 @@ "nock": "^13.2.4", "nyc": "^15.1.0", "prettier": "^2.5.1", - "typescript": "^4.5.5", + "typescript": "^4.6.2", "unique-temp-dir": "^1.0.0" }, "engines": { @@ -67,7 +67,7 @@ "nock": "^13.2.4", "nyc": "^15.1.0", "prettier": "^2.5.1", - "typescript": "^4.5.5" + "typescript": "^4.6.2" }, "engines": { "node": "^14 || ^16" @@ -7244,9 +7244,9 @@ } }, "node_modules/typescript": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", - "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -8048,7 +8048,7 @@ "nyc": "^15.1.0", "oas": "^17.7.3", "prettier": "^2.5.1", - "typescript": "^4.5.5" + "typescript": "^4.6.2" } }, "@readme/better-ajv-errors": { @@ -12929,9 +12929,9 @@ } }, "typescript": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", - "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", "dev": true }, "uid2": { diff --git a/packages/api/package.json b/packages/api/package.json index fac6515a..bfab0989 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -53,7 +53,7 @@ "nock": "^13.2.4", "nyc": "^15.1.0", "prettier": "^2.5.1", - "typescript": "^4.5.5", + "typescript": "^4.6.2", "unique-temp-dir": "^1.0.0" }, "prettier": "@readme/eslint-config/prettier", diff --git a/packages/cli/.gitignore b/packages/cli/.gitignore index 6dd30047..ebbb8ac9 100644 --- a/packages/cli/.gitignore +++ b/packages/cli/.gitignore @@ -3,7 +3,7 @@ *.tsbuildinfo .nyc_output/ dist/ -lib/ +./lib/ node_modules/ tmp/ oclif.manifest.json diff --git a/packages/cli/package-lock.json b/packages/cli/package-lock.json index 11362819..eb6e7fa6 100644 --- a/packages/cli/package-lock.json +++ b/packages/cli/package-lock.json @@ -17,7 +17,8 @@ "fetch-har": "^6.1.0", "js-yaml": "^4.1.0", "json-schema-to-typescript": "^10.1.5", - "oas": "^17.7.3" + "oas": "^17.7.3", + "typescript": "^4.6.2" }, "devDependencies": { "@oclif/test": "^2.1.0", @@ -35,8 +36,7 @@ "prettier": "^2.5.1", "shx": "^0.3.3", "ts-node": "^10.5.0", - "tslib": "^2.3.1", - "typescript": "^4.5.5" + "tslib": "^2.3.1" }, "engines": { "node": "^14 || ^16" @@ -69,7 +69,7 @@ "nock": "^13.2.4", "nyc": "^15.1.0", "prettier": "^2.5.1", - "typescript": "^4.5.5" + "typescript": "^4.6.2" }, "engines": { "node": "^14 || ^16" @@ -9389,10 +9389,9 @@ } }, "node_modules/typescript": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", - "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", - "dev": true, + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -11047,7 +11046,7 @@ "nyc": "^15.1.0", "oas": "^17.7.3", "prettier": "^2.5.1", - "typescript": "^4.5.5" + "typescript": "^4.6.2" } }, "@readme/better-ajv-errors": { @@ -17471,10 +17470,9 @@ } }, "typescript": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", - "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", - "dev": true + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==" }, "unbox-primitive": { "version": "1.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 5b499c2c..ba776ff9 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -42,7 +42,8 @@ "fetch-har": "^6.1.0", "js-yaml": "^4.1.0", "json-schema-to-typescript": "^10.1.5", - "oas": "^17.7.3" + "oas": "^17.7.3", + "typescript": "^4.6.2" }, "devDependencies": { "@oclif/test": "^2.1.0", @@ -60,8 +61,7 @@ "prettier": "^2.5.1", "shx": "^0.3.3", "ts-node": "^10.5.0", - "tslib": "^2.3.1", - "typescript": "^4.5.5" + "tslib": "^2.3.1" }, "prettier": "@readme/eslint-config/prettier", "oclif": { diff --git a/packages/core/package-lock.json b/packages/core/package-lock.json index 702c5e85..dff0cf0b 100644 --- a/packages/core/package-lock.json +++ b/packages/core/package-lock.json @@ -31,7 +31,7 @@ "nock": "^13.2.4", "nyc": "^15.1.0", "prettier": "^2.5.1", - "typescript": "^4.5.5" + "typescript": "^4.6.2" }, "engines": { "node": "^14 || ^16" @@ -6893,9 +6893,9 @@ } }, "node_modules/typescript": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", - "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -12281,9 +12281,9 @@ } }, "typescript": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", - "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", "dev": true }, "unbox-primitive": { diff --git a/packages/core/package.json b/packages/core/package.json index 69e3b420..239f2ebb 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -49,7 +49,7 @@ "nock": "^13.2.4", "nyc": "^15.1.0", "prettier": "^2.5.1", - "typescript": "^4.5.5" + "typescript": "^4.6.2" }, "prettier": "@readme/eslint-config/prettier", "nyc": { From 58771f839e42251857dd2eda1f1a53a56f198bd2 Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Tue, 1 Mar 2022 12:06:47 -0800 Subject: [PATCH 2/5] chore(deps-dev): upgrading @readme/eslint-config to the latest --- package-lock.json | 214 +++---- packages/api/package-lock.json | 522 ++++++------------ packages/api/package.json | 3 +- packages/cli/package-lock.json | 202 +++---- packages/cli/package.json | 2 +- packages/core/package-lock.json | 359 +++++------- packages/core/package.json | 3 +- .../httpsnippet-client-api/package-lock.json | 312 +++++------ packages/httpsnippet-client-api/package.json | 2 +- 9 files changed, 693 insertions(+), 926 deletions(-) diff --git a/package-lock.json b/package-lock.json index d3a6da9d..531a4261 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1625,13 +1625,13 @@ } }, "node_modules/@readme/eslint-config": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.2.tgz", - "integrity": "sha512-o9p3aho6wV6/DMsZ1yBz0PAyhLLlIYa60kxNxl03puVSJGRrcx9+Zc3NPzkaZblLMGH3DI6MZFK5hTkWLtYbhw==", + "version": "8.4.4", + "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.4.tgz", + "integrity": "sha512-WBdGwOzh3N1ez3tRjIJXiKOkjZeaHEzShlbT1UYJyCVd3AO+PXVXQg42zpkrQNy9rJad1mRXjA7/Hm6oa2RAkw==", "dev": true, "dependencies": { - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", + "@typescript-eslint/eslint-plugin": "^5.13.0", + "@typescript-eslint/parser": "^5.13.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.1.0", "eslint-import-resolver-typescript": "^2.4.0", @@ -1650,7 +1650,7 @@ "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-testing-library": "^5.0.0", - "eslint-plugin-unicorn": "^40.0.0", + "eslint-plugin-unicorn": "^41.0.0", "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0" }, "engines": { @@ -1967,14 +1967,14 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.0.tgz", - "integrity": "sha512-fwCMkDimwHVeIOKeBHiZhRUfJXU8n6xW1FL9diDxAyGAFvKcH4csy0v7twivOQdQdA0KC8TDr7GGRd3L4Lv0rQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz", + "integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.12.0", - "@typescript-eslint/type-utils": "5.12.0", - "@typescript-eslint/utils": "5.12.0", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/type-utils": "5.13.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -2000,14 +2000,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.12.0.tgz", - "integrity": "sha512-MfSwg9JMBojMUoGjUmX+D2stoQj1CBYTCP0qnnVtu9A+YQXVKNtLjasYh+jozOcrb/wau8TCfWOkQTiOAruBog==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz", + "integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.12.0", - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/typescript-estree": "5.12.0", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "debug": "^4.3.2" }, "engines": { @@ -2027,13 +2027,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz", - "integrity": "sha512-GAMobtIJI8FGf1sLlUWNUm2IOkIjvn7laFWyRx7CLrv6nLBI7su+B7lbStqVlK5NdLvHRFiJo2HhiDF7Ki01WQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/visitor-keys": "5.12.0" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -2044,12 +2044,12 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.12.0.tgz", - "integrity": "sha512-9j9rli3zEBV+ae7rlbBOotJcI6zfc6SHFMdKI9M3Nc0sy458LJ79Os+TPWeBBL96J9/e36rdJOfCuyRSgFAA0Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz", + "integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==", "dev": true, "dependencies": { - "@typescript-eslint/utils": "5.12.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "tsutils": "^3.21.0" }, @@ -2070,9 +2070,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.12.0.tgz", - "integrity": "sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -2083,13 +2083,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz", - "integrity": "sha512-Dd9gVeOqt38QHR0BEA8oRaT65WYqPYbIc5tRFQPkfLquVEFPD1HAtbZT98TLBkEcCkvwDYOAvuSvAD9DnQhMfQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/visitor-keys": "5.12.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -2110,15 +2110,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.12.0.tgz", - "integrity": "sha512-k4J2WovnMPGI4PzKgDtQdNrCnmBHpMUFy21qjX2CoPdoBcSBIMvVBr9P2YDP8jOqZOeK3ThOL6VO/sy6jtnvzw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz", + "integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.12.0", - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/typescript-estree": "5.12.0", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -2134,12 +2134,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.0.tgz", - "integrity": "sha512-cFwTlgnMV6TgezQynx2c/4/tx9Tufbuo9LPzmWqyRC3QC4qTGkAG1C6pBr0/4I10PAI/FlYunI3vJjIcu+ZHMg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.12.0", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -4764,9 +4764,9 @@ } }, "node_modules/eslint-plugin-unicorn": { - "version": "40.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-40.1.0.tgz", - "integrity": "sha512-y5doK2DF9Sr5AqKEHbHxjFllJ167nKDRU01HDcWyv4Tnmaoe9iNxMrBnaybZvWZUaE3OC5Unu0lNIevYamloig==", + "version": "41.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-41.0.0.tgz", + "integrity": "sha512-xoJCaRc1uy5REg9DkVga1BkZV57jJxoqOcrU28QHZB89Lk5LdSqdVyTIt9JQVfHNKaiyJ7X+3iLlIn+VEHWEzA==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.15.7", @@ -4791,7 +4791,7 @@ "url": "https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1" }, "peerDependencies": { - "eslint": ">=7.32.0" + "eslint": ">=8.8.0" } }, "node_modules/eslint-plugin-you-dont-need-lodash-underscore": { @@ -12474,14 +12474,13 @@ "@readme/api-core": "file:../core", "@readme/openapi-parser": "^2.0.0", "find-cache-dir": "^3.3.1", - "formdata-node": "^4.3.2", "isomorphic-fetch": "^3.0.0", "js-yaml": "^4.1.0", "make-dir": "^3.1.0", "oas": "^17.7.3" }, "devDependencies": { - "@readme/eslint-config": "^8.4.2", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@types/chai": "^4.3.0", "@types/find-cache-dir": "^3.2.1", @@ -12520,7 +12519,7 @@ }, "devDependencies": { "@oclif/test": "^2.1.0", - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@types/chai": "^4.3.0", "@types/js-yaml": "^4.0.5", @@ -12549,6 +12548,7 @@ "datauri": "^4.1.0", "fetch-har": "^6.1.0", "form-data-encoder": "^1.7.1", + "formdata-node": "^4.3.2", "get-stream": "^6.0.0", "isomorphic-fetch": "^3.0.0", "json-schema-traverse": "^1.0.0", @@ -12556,7 +12556,7 @@ "oas": "^17.7.3" }, "devDependencies": { - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@types/chai": "^4.3.0", "@types/lodash.merge": "^4.6.6", @@ -12587,7 +12587,7 @@ "stringify-object": "^3.3.0" }, "devDependencies": { - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "chai": "^4.3.6", "eslint": "^8.8.0", @@ -13897,7 +13897,7 @@ "@oclif/plugin-plugins": "^2.0.1", "@oclif/test": "^2.1.0", "@readme/api-core": "file:../core", - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@readme/openapi-parser": "^2.0.2", "@types/chai": "^4.3.0", @@ -13923,7 +13923,7 @@ "@readme/api-core": { "version": "file:packages/core", "requires": { - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@readme/oas-to-har": "^15.0.0", "@types/chai": "^4.3.0", @@ -13934,6 +13934,7 @@ "eslint": "^8.8.0", "fetch-har": "^6.1.0", "form-data-encoder": "^1.7.1", + "formdata-node": "^4.3.2", "get-stream": "^6.0.0", "isomorphic-fetch": "^3.0.0", "json-schema-traverse": "^1.0.0", @@ -13968,13 +13969,13 @@ } }, "@readme/eslint-config": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.2.tgz", - "integrity": "sha512-o9p3aho6wV6/DMsZ1yBz0PAyhLLlIYa60kxNxl03puVSJGRrcx9+Zc3NPzkaZblLMGH3DI6MZFK5hTkWLtYbhw==", + "version": "8.4.4", + "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.4.tgz", + "integrity": "sha512-WBdGwOzh3N1ez3tRjIJXiKOkjZeaHEzShlbT1UYJyCVd3AO+PXVXQg42zpkrQNy9rJad1mRXjA7/Hm6oa2RAkw==", "dev": true, "requires": { - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", + "@typescript-eslint/eslint-plugin": "^5.13.0", + "@typescript-eslint/parser": "^5.13.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.1.0", "eslint-import-resolver-typescript": "^2.4.0", @@ -13993,7 +13994,7 @@ "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-testing-library": "^5.0.0", - "eslint-plugin-unicorn": "^40.0.0", + "eslint-plugin-unicorn": "^41.0.0", "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0" } }, @@ -14270,14 +14271,14 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.0.tgz", - "integrity": "sha512-fwCMkDimwHVeIOKeBHiZhRUfJXU8n6xW1FL9diDxAyGAFvKcH4csy0v7twivOQdQdA0KC8TDr7GGRd3L4Lv0rQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz", + "integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.12.0", - "@typescript-eslint/type-utils": "5.12.0", - "@typescript-eslint/utils": "5.12.0", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/type-utils": "5.13.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -14287,52 +14288,52 @@ } }, "@typescript-eslint/parser": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.12.0.tgz", - "integrity": "sha512-MfSwg9JMBojMUoGjUmX+D2stoQj1CBYTCP0qnnVtu9A+YQXVKNtLjasYh+jozOcrb/wau8TCfWOkQTiOAruBog==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz", + "integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.12.0", - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/typescript-estree": "5.12.0", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "debug": "^4.3.2" } }, "@typescript-eslint/scope-manager": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz", - "integrity": "sha512-GAMobtIJI8FGf1sLlUWNUm2IOkIjvn7laFWyRx7CLrv6nLBI7su+B7lbStqVlK5NdLvHRFiJo2HhiDF7Ki01WQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/visitor-keys": "5.12.0" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" } }, "@typescript-eslint/type-utils": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.12.0.tgz", - "integrity": "sha512-9j9rli3zEBV+ae7rlbBOotJcI6zfc6SHFMdKI9M3Nc0sy458LJ79Os+TPWeBBL96J9/e36rdJOfCuyRSgFAA0Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz", + "integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==", "dev": true, "requires": { - "@typescript-eslint/utils": "5.12.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.12.0.tgz", - "integrity": "sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz", - "integrity": "sha512-Dd9gVeOqt38QHR0BEA8oRaT65WYqPYbIc5tRFQPkfLquVEFPD1HAtbZT98TLBkEcCkvwDYOAvuSvAD9DnQhMfQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/visitor-keys": "5.12.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -14341,26 +14342,26 @@ } }, "@typescript-eslint/utils": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.12.0.tgz", - "integrity": "sha512-k4J2WovnMPGI4PzKgDtQdNrCnmBHpMUFy21qjX2CoPdoBcSBIMvVBr9P2YDP8jOqZOeK3ThOL6VO/sy6jtnvzw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz", + "integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.12.0", - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/typescript-estree": "5.12.0", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" } }, "@typescript-eslint/visitor-keys": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.0.tgz", - "integrity": "sha512-cFwTlgnMV6TgezQynx2c/4/tx9Tufbuo9LPzmWqyRC3QC4qTGkAG1C6pBr0/4I10PAI/FlYunI3vJjIcu+ZHMg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "requires": { - "@typescript-eslint/types": "5.12.0", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -14488,7 +14489,7 @@ "version": "file:packages/api", "requires": { "@readme/api-core": "file:../core", - "@readme/eslint-config": "^8.4.2", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@readme/openapi-parser": "^2.0.0", "@types/chai": "^4.3.0", @@ -14499,7 +14500,6 @@ "datauri": "^4.1.0", "eslint": "^8.9.0", "find-cache-dir": "^3.3.1", - "formdata-node": "^4.3.2", "isomorphic-fetch": "^3.0.0", "js-yaml": "^4.1.0", "make-dir": "^3.1.0", @@ -16381,9 +16381,9 @@ } }, "eslint-plugin-unicorn": { - "version": "40.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-40.1.0.tgz", - "integrity": "sha512-y5doK2DF9Sr5AqKEHbHxjFllJ167nKDRU01HDcWyv4Tnmaoe9iNxMrBnaybZvWZUaE3OC5Unu0lNIevYamloig==", + "version": "41.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-41.0.0.tgz", + "integrity": "sha512-xoJCaRc1uy5REg9DkVga1BkZV57jJxoqOcrU28QHZB89Lk5LdSqdVyTIt9JQVfHNKaiyJ7X+3iLlIn+VEHWEzA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.15.7", @@ -17263,7 +17263,7 @@ "httpsnippet-client-api": { "version": "file:packages/httpsnippet-client-api", "requires": { - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "chai": "^4.3.6", "content-type": "^1.0.4", diff --git a/packages/api/package-lock.json b/packages/api/package-lock.json index 38d93643..fb07fba3 100644 --- a/packages/api/package-lock.json +++ b/packages/api/package-lock.json @@ -12,14 +12,13 @@ "@readme/api-core": "file:../core", "@readme/openapi-parser": "^2.0.0", "find-cache-dir": "^3.3.1", - "formdata-node": "^4.3.2", "isomorphic-fetch": "^3.0.0", "js-yaml": "^4.1.0", "make-dir": "^3.1.0", "oas": "^17.7.3" }, "devDependencies": { - "@readme/eslint-config": "^8.4.2", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@types/chai": "^4.3.0", "@types/find-cache-dir": "^3.2.1", @@ -49,6 +48,7 @@ "datauri": "^4.1.0", "fetch-har": "^6.1.0", "form-data-encoder": "^1.7.1", + "formdata-node": "^4.3.2", "get-stream": "^6.0.0", "isomorphic-fetch": "^3.0.0", "json-schema-traverse": "^1.0.0", @@ -56,7 +56,7 @@ "oas": "^17.7.3" }, "devDependencies": { - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@types/chai": "^4.3.0", "@types/lodash.merge": "^4.6.6", @@ -707,13 +707,13 @@ } }, "node_modules/@readme/eslint-config": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.2.tgz", - "integrity": "sha512-o9p3aho6wV6/DMsZ1yBz0PAyhLLlIYa60kxNxl03puVSJGRrcx9+Zc3NPzkaZblLMGH3DI6MZFK5hTkWLtYbhw==", + "version": "8.4.4", + "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.4.tgz", + "integrity": "sha512-WBdGwOzh3N1ez3tRjIJXiKOkjZeaHEzShlbT1UYJyCVd3AO+PXVXQg42zpkrQNy9rJad1mRXjA7/Hm6oa2RAkw==", "dev": true, "dependencies": { - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", + "@typescript-eslint/eslint-plugin": "^5.13.0", + "@typescript-eslint/parser": "^5.13.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.1.0", "eslint-import-resolver-typescript": "^2.4.0", @@ -732,7 +732,7 @@ "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-testing-library": "^5.0.0", - "eslint-plugin-unicorn": "^40.0.0", + "eslint-plugin-unicorn": "^41.0.0", "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0" }, "engines": { @@ -955,14 +955,14 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.2.tgz", - "integrity": "sha512-4W/9lLuE+v27O/oe7hXJKjNtBLnZE8tQAFpapdxwSVHqtmIoPB1gph3+ahNwVuNL37BX7YQHyGF9Xv6XCnIX2Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz", + "integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.10.2", - "@typescript-eslint/type-utils": "5.10.2", - "@typescript-eslint/utils": "5.10.2", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/type-utils": "5.13.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -988,13 +988,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.2.tgz", - "integrity": "sha512-39Tm6f4RoZoVUWBYr3ekS75TYgpr5Y+X0xLZxXqcZNDWZdJdYbKd3q2IR4V9y5NxxiPu/jxJ8XP7EgHiEQtFnw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1005,9 +1005,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.2.tgz", - "integrity": "sha512-Qfp0qk/5j2Rz3p3/WhWgu4S1JtMcPgFLnmAKAW061uXxKSa7VWKZsDXVaMXh2N60CX9h6YLaBoy9PJAfCOjk3w==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1018,12 +1018,12 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.2.tgz", - "integrity": "sha512-zHIhYGGGrFJvvyfwHk5M08C5B5K4bewkm+rrvNTKk1/S15YHR+SA/QUF8ZWscXSfEaB8Nn2puZj+iHcoxVOD/Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -1049,21 +1049,6 @@ "node": ">=10" } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } - }, "node_modules/@typescript-eslint/experimental-utils": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.5.0.tgz", @@ -1089,14 +1074,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.10.2.tgz", - "integrity": "sha512-JaNYGkaQVhP6HNF+lkdOr2cAs2wdSZBoalE22uYWq8IEv/OVH0RksSGydk+sW8cLoSeYmC+OHvRyv2i4AQ7Czg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz", + "integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.10.2", - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/typescript-estree": "5.10.2", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "debug": "^4.3.2" }, "engines": { @@ -1116,13 +1101,13 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.2.tgz", - "integrity": "sha512-39Tm6f4RoZoVUWBYr3ekS75TYgpr5Y+X0xLZxXqcZNDWZdJdYbKd3q2IR4V9y5NxxiPu/jxJ8XP7EgHiEQtFnw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1133,9 +1118,9 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.2.tgz", - "integrity": "sha512-Qfp0qk/5j2Rz3p3/WhWgu4S1JtMcPgFLnmAKAW061uXxKSa7VWKZsDXVaMXh2N60CX9h6YLaBoy9PJAfCOjk3w==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1146,13 +1131,13 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.2.tgz", - "integrity": "sha512-WHHw6a9vvZls6JkTgGljwCsMkv8wu8XU8WaYKeYhxhWXH/atZeiMW6uDFPLZOvzNOGmuSMvHtZKd6AuC8PrwKQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -1173,12 +1158,12 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.2.tgz", - "integrity": "sha512-zHIhYGGGrFJvvyfwHk5M08C5B5K4bewkm+rrvNTKk1/S15YHR+SA/QUF8ZWscXSfEaB8Nn2puZj+iHcoxVOD/Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -1204,21 +1189,6 @@ "node": ">=10" } }, - "node_modules/@typescript-eslint/parser/node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } - }, "node_modules/@typescript-eslint/scope-manager": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.5.0.tgz", @@ -1237,12 +1207,12 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.10.2.tgz", - "integrity": "sha512-uRKSvw/Ccs5FYEoXW04Z5VfzF2iiZcx8Fu7DGIB7RHozuP0VbKNzP1KfZkHBTM75pCpsWxIthEH1B33dmGBKHw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz", + "integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==", "dev": true, "dependencies": { - "@typescript-eslint/utils": "5.10.2", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "tsutils": "^3.21.0" }, @@ -1262,21 +1232,6 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } - }, "node_modules/@typescript-eslint/types": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.5.0.tgz", @@ -1332,31 +1287,16 @@ "node": ">=10" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } - }, "node_modules/@typescript-eslint/utils": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.10.2.tgz", - "integrity": "sha512-vuJaBeig1NnBRkf7q9tgMLREiYD7zsMrsN1DA3wcoMDvr3BTFiIpKjGiYZoKPllfEwN7spUjv7ZqD+JhbVjEPg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz", + "integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.10.2", - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/typescript-estree": "5.10.2", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -1372,13 +1312,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.2.tgz", - "integrity": "sha512-39Tm6f4RoZoVUWBYr3ekS75TYgpr5Y+X0xLZxXqcZNDWZdJdYbKd3q2IR4V9y5NxxiPu/jxJ8XP7EgHiEQtFnw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1389,9 +1329,9 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.2.tgz", - "integrity": "sha512-Qfp0qk/5j2Rz3p3/WhWgu4S1JtMcPgFLnmAKAW061uXxKSa7VWKZsDXVaMXh2N60CX9h6YLaBoy9PJAfCOjk3w==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1402,13 +1342,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.2.tgz", - "integrity": "sha512-WHHw6a9vvZls6JkTgGljwCsMkv8wu8XU8WaYKeYhxhWXH/atZeiMW6uDFPLZOvzNOGmuSMvHtZKd6AuC8PrwKQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -1429,12 +1369,12 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.2.tgz", - "integrity": "sha512-zHIhYGGGrFJvvyfwHk5M08C5B5K4bewkm+rrvNTKk1/S15YHR+SA/QUF8ZWscXSfEaB8Nn2puZj+iHcoxVOD/Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -1460,21 +1400,6 @@ "node": ">=10" } }, - "node_modules/@typescript-eslint/utils/node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } - }, "node_modules/@typescript-eslint/visitor-keys": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.5.0.tgz", @@ -3218,9 +3143,9 @@ } }, "node_modules/eslint-plugin-unicorn": { - "version": "40.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-40.1.0.tgz", - "integrity": "sha512-y5doK2DF9Sr5AqKEHbHxjFllJ167nKDRU01HDcWyv4Tnmaoe9iNxMrBnaybZvWZUaE3OC5Unu0lNIevYamloig==", + "version": "41.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-41.0.0.tgz", + "integrity": "sha512-xoJCaRc1uy5REg9DkVga1BkZV57jJxoqOcrU28QHZB89Lk5LdSqdVyTIt9JQVfHNKaiyJ7X+3iLlIn+VEHWEzA==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.15.7", @@ -3245,7 +3170,7 @@ "url": "https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1" }, "peerDependencies": { - "eslint": ">=7.32.0" + "eslint": ">=8.8.0" } }, "node_modules/eslint-plugin-unicorn/node_modules/semver": { @@ -3700,18 +3625,6 @@ "node": ">=8.0.0" } }, - "node_modules/formdata-node": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.3.2.tgz", - "integrity": "sha512-k7lYJyzDOSL6h917favP8j1L0/wNyylzU+x+1w4p5haGVHNlP58dbpdJhiCUsDbWsa9HwEtLp89obQgXl2e0qg==", - "dependencies": { - "node-domexception": "1.0.0", - "web-streams-polyfill": "4.0.0-beta.1" - }, - "engines": { - "node": ">= 12.20" - } - }, "node_modules/fromentries": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", @@ -5393,24 +5306,6 @@ "node": ">= 10.13" } }, - "node_modules/node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "github", - "url": "https://paypal.me/jimmywarting" - } - ], - "engines": { - "node": ">=10.5.0" - } - }, "node_modules/node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -7196,6 +7091,21 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, "node_modules/type": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", @@ -7369,14 +7279,6 @@ "defaults": "^1.0.3" } }, - "node_modules/web-streams-polyfill": { - "version": "4.0.0-beta.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.1.tgz", - "integrity": "sha512-3ux37gEX670UUphBF9AMCq8XM6iQ8Ac6A+DSRRjDoRBm1ufCkaCDdNVbaqq60PsEkdNlLKrGtv/YBP4EJXqNtQ==", - "engines": { - "node": ">= 12" - } - }, "node_modules/whatwg-fetch": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", @@ -8028,7 +7930,7 @@ "@readme/api-core": { "version": "file:../core", "requires": { - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@readme/oas-to-har": "^15.0.0", "@types/chai": "^4.3.0", @@ -8039,6 +7941,7 @@ "eslint": "^8.8.0", "fetch-har": "^6.1.0", "form-data-encoder": "^1.7.1", + "formdata-node": "^4.3.2", "get-stream": "^6.0.0", "isomorphic-fetch": "^3.0.0", "json-schema-traverse": "^1.0.0", @@ -8111,13 +8014,13 @@ } }, "@readme/eslint-config": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.2.tgz", - "integrity": "sha512-o9p3aho6wV6/DMsZ1yBz0PAyhLLlIYa60kxNxl03puVSJGRrcx9+Zc3NPzkaZblLMGH3DI6MZFK5hTkWLtYbhw==", + "version": "8.4.4", + "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.4.tgz", + "integrity": "sha512-WBdGwOzh3N1ez3tRjIJXiKOkjZeaHEzShlbT1UYJyCVd3AO+PXVXQg42zpkrQNy9rJad1mRXjA7/Hm6oa2RAkw==", "dev": true, "requires": { - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", + "@typescript-eslint/eslint-plugin": "^5.13.0", + "@typescript-eslint/parser": "^5.13.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.1.0", "eslint-import-resolver-typescript": "^2.4.0", @@ -8136,7 +8039,7 @@ "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-testing-library": "^5.0.0", - "eslint-plugin-unicorn": "^40.0.0", + "eslint-plugin-unicorn": "^41.0.0", "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0" } }, @@ -8312,14 +8215,14 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.2.tgz", - "integrity": "sha512-4W/9lLuE+v27O/oe7hXJKjNtBLnZE8tQAFpapdxwSVHqtmIoPB1gph3+ahNwVuNL37BX7YQHyGF9Xv6XCnIX2Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz", + "integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.10.2", - "@typescript-eslint/type-utils": "5.10.2", - "@typescript-eslint/utils": "5.10.2", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/type-utils": "5.13.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -8329,28 +8232,28 @@ }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.2.tgz", - "integrity": "sha512-39Tm6f4RoZoVUWBYr3ekS75TYgpr5Y+X0xLZxXqcZNDWZdJdYbKd3q2IR4V9y5NxxiPu/jxJ8XP7EgHiEQtFnw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" } }, "@typescript-eslint/types": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.2.tgz", - "integrity": "sha512-Qfp0qk/5j2Rz3p3/WhWgu4S1JtMcPgFLnmAKAW061uXxKSa7VWKZsDXVaMXh2N60CX9h6YLaBoy9PJAfCOjk3w==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true }, "@typescript-eslint/visitor-keys": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.2.tgz", - "integrity": "sha512-zHIhYGGGrFJvvyfwHk5M08C5B5K4bewkm+rrvNTKk1/S15YHR+SA/QUF8ZWscXSfEaB8Nn2puZj+iHcoxVOD/Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -8362,15 +8265,6 @@ "requires": { "lru-cache": "^6.0.0" } - }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } } } }, @@ -8389,41 +8283,41 @@ } }, "@typescript-eslint/parser": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.10.2.tgz", - "integrity": "sha512-JaNYGkaQVhP6HNF+lkdOr2cAs2wdSZBoalE22uYWq8IEv/OVH0RksSGydk+sW8cLoSeYmC+OHvRyv2i4AQ7Czg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz", + "integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.10.2", - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/typescript-estree": "5.10.2", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "debug": "^4.3.2" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.2.tgz", - "integrity": "sha512-39Tm6f4RoZoVUWBYr3ekS75TYgpr5Y+X0xLZxXqcZNDWZdJdYbKd3q2IR4V9y5NxxiPu/jxJ8XP7EgHiEQtFnw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" } }, "@typescript-eslint/types": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.2.tgz", - "integrity": "sha512-Qfp0qk/5j2Rz3p3/WhWgu4S1JtMcPgFLnmAKAW061uXxKSa7VWKZsDXVaMXh2N60CX9h6YLaBoy9PJAfCOjk3w==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.2.tgz", - "integrity": "sha512-WHHw6a9vvZls6JkTgGljwCsMkv8wu8XU8WaYKeYhxhWXH/atZeiMW6uDFPLZOvzNOGmuSMvHtZKd6AuC8PrwKQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -8432,12 +8326,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.2.tgz", - "integrity": "sha512-zHIhYGGGrFJvvyfwHk5M08C5B5K4bewkm+rrvNTKk1/S15YHR+SA/QUF8ZWscXSfEaB8Nn2puZj+iHcoxVOD/Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -8449,15 +8343,6 @@ "requires": { "lru-cache": "^6.0.0" } - }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } } } }, @@ -8472,25 +8357,14 @@ } }, "@typescript-eslint/type-utils": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.10.2.tgz", - "integrity": "sha512-uRKSvw/Ccs5FYEoXW04Z5VfzF2iiZcx8Fu7DGIB7RHozuP0VbKNzP1KfZkHBTM75pCpsWxIthEH1B33dmGBKHw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz", + "integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==", "dev": true, "requires": { - "@typescript-eslint/utils": "5.10.2", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "tsutils": "^3.21.0" - }, - "dependencies": { - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - } } }, "@typescript-eslint/types": { @@ -8522,56 +8396,47 @@ "requires": { "lru-cache": "^6.0.0" } - }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } } } }, "@typescript-eslint/utils": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.10.2.tgz", - "integrity": "sha512-vuJaBeig1NnBRkf7q9tgMLREiYD7zsMrsN1DA3wcoMDvr3BTFiIpKjGiYZoKPllfEwN7spUjv7ZqD+JhbVjEPg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz", + "integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.10.2", - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/typescript-estree": "5.10.2", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.2.tgz", - "integrity": "sha512-39Tm6f4RoZoVUWBYr3ekS75TYgpr5Y+X0xLZxXqcZNDWZdJdYbKd3q2IR4V9y5NxxiPu/jxJ8XP7EgHiEQtFnw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" } }, "@typescript-eslint/types": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.2.tgz", - "integrity": "sha512-Qfp0qk/5j2Rz3p3/WhWgu4S1JtMcPgFLnmAKAW061uXxKSa7VWKZsDXVaMXh2N60CX9h6YLaBoy9PJAfCOjk3w==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.2.tgz", - "integrity": "sha512-WHHw6a9vvZls6JkTgGljwCsMkv8wu8XU8WaYKeYhxhWXH/atZeiMW6uDFPLZOvzNOGmuSMvHtZKd6AuC8PrwKQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -8580,12 +8445,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.2.tgz", - "integrity": "sha512-zHIhYGGGrFJvvyfwHk5M08C5B5K4bewkm+rrvNTKk1/S15YHR+SA/QUF8ZWscXSfEaB8Nn2puZj+iHcoxVOD/Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -8597,15 +8462,6 @@ "requires": { "lru-cache": "^6.0.0" } - }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } } } }, @@ -9980,9 +9836,9 @@ } }, "eslint-plugin-unicorn": { - "version": "40.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-40.1.0.tgz", - "integrity": "sha512-y5doK2DF9Sr5AqKEHbHxjFllJ167nKDRU01HDcWyv4Tnmaoe9iNxMrBnaybZvWZUaE3OC5Unu0lNIevYamloig==", + "version": "41.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-41.0.0.tgz", + "integrity": "sha512-xoJCaRc1uy5REg9DkVga1BkZV57jJxoqOcrU28QHZB89Lk5LdSqdVyTIt9JQVfHNKaiyJ7X+3iLlIn+VEHWEzA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.15.7", @@ -10266,15 +10122,6 @@ "signal-exit": "^3.0.2" } }, - "formdata-node": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.3.2.tgz", - "integrity": "sha512-k7lYJyzDOSL6h917favP8j1L0/wNyylzU+x+1w4p5haGVHNlP58dbpdJhiCUsDbWsa9HwEtLp89obQgXl2e0qg==", - "requires": { - "node-domexception": "1.0.0", - "web-streams-polyfill": "4.0.0-beta.1" - } - }, "fromentries": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", @@ -11488,11 +11335,6 @@ "propagate": "^2.0.0" } }, - "node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" - }, "node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -12893,6 +12735,15 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, "type": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", @@ -13037,11 +12888,6 @@ "defaults": "^1.0.3" } }, - "web-streams-polyfill": { - "version": "4.0.0-beta.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.1.tgz", - "integrity": "sha512-3ux37gEX670UUphBF9AMCq8XM6iQ8Ac6A+DSRRjDoRBm1ufCkaCDdNVbaqq60PsEkdNlLKrGtv/YBP4EJXqNtQ==" - }, "whatwg-fetch": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", diff --git a/packages/api/package.json b/packages/api/package.json index bfab0989..55d98c89 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -32,14 +32,13 @@ "@readme/api-core": "file:../core", "@readme/openapi-parser": "^2.0.0", "find-cache-dir": "^3.3.1", - "formdata-node": "^4.3.2", "isomorphic-fetch": "^3.0.0", "js-yaml": "^4.1.0", "make-dir": "^3.1.0", "oas": "^17.7.3" }, "devDependencies": { - "@readme/eslint-config": "^8.4.2", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@types/chai": "^4.3.0", "@types/find-cache-dir": "^3.2.1", diff --git a/packages/cli/package-lock.json b/packages/cli/package-lock.json index eb6e7fa6..92c58f55 100644 --- a/packages/cli/package-lock.json +++ b/packages/cli/package-lock.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@oclif/test": "^2.1.0", - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@types/chai": "^4.3.0", "@types/js-yaml": "^4.0.5", @@ -51,6 +51,7 @@ "datauri": "^4.1.0", "fetch-har": "^6.1.0", "form-data-encoder": "^1.7.1", + "formdata-node": "^4.3.2", "get-stream": "^6.0.0", "isomorphic-fetch": "^3.0.0", "json-schema-traverse": "^1.0.0", @@ -58,7 +59,7 @@ "oas": "^17.7.3" }, "devDependencies": { - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@types/chai": "^4.3.0", "@types/lodash.merge": "^4.6.6", @@ -903,13 +904,13 @@ } }, "node_modules/@readme/eslint-config": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.2.tgz", - "integrity": "sha512-o9p3aho6wV6/DMsZ1yBz0PAyhLLlIYa60kxNxl03puVSJGRrcx9+Zc3NPzkaZblLMGH3DI6MZFK5hTkWLtYbhw==", + "version": "8.4.4", + "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.4.tgz", + "integrity": "sha512-WBdGwOzh3N1ez3tRjIJXiKOkjZeaHEzShlbT1UYJyCVd3AO+PXVXQg42zpkrQNy9rJad1mRXjA7/Hm6oa2RAkw==", "dev": true, "dependencies": { - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", + "@typescript-eslint/eslint-plugin": "^5.13.0", + "@typescript-eslint/parser": "^5.13.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.1.0", "eslint-import-resolver-typescript": "^2.4.0", @@ -928,7 +929,7 @@ "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-testing-library": "^5.0.0", - "eslint-plugin-unicorn": "^40.0.0", + "eslint-plugin-unicorn": "^41.0.0", "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0" }, "engines": { @@ -1131,14 +1132,14 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.1.tgz", - "integrity": "sha512-M499lqa8rnNK7mUv74lSFFttuUsubIRdAbHcVaP93oFcKkEmHmLqy2n7jM9C8DVmFMYK61ExrZU6dLYhQZmUpw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz", + "integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.12.1", - "@typescript-eslint/type-utils": "5.12.1", - "@typescript-eslint/utils": "5.12.1", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/type-utils": "5.13.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -1164,14 +1165,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.12.1.tgz", - "integrity": "sha512-6LuVUbe7oSdHxUWoX/m40Ni8gsZMKCi31rlawBHt7VtW15iHzjbpj2WLiToG2758KjtCCiLRKZqfrOdl3cNKuw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz", + "integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.12.1", - "@typescript-eslint/types": "5.12.1", - "@typescript-eslint/typescript-estree": "5.12.1", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "debug": "^4.3.2" }, "engines": { @@ -1191,13 +1192,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.12.1.tgz", - "integrity": "sha512-J0Wrh5xS6XNkd4TkOosxdpObzlYfXjAFIm9QxYLCPOcHVv1FyyFCPom66uIh8uBr0sZCrtS+n19tzufhwab8ZQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.12.1", - "@typescript-eslint/visitor-keys": "5.12.1" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1208,12 +1209,12 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.12.1.tgz", - "integrity": "sha512-Gh8feEhsNLeCz6aYqynh61Vsdy+tiNNkQtc+bN3IvQvRqHkXGUhYkUi+ePKzP0Mb42se7FDb+y2SypTbpbR/Sg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz", + "integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==", "dev": true, "dependencies": { - "@typescript-eslint/utils": "5.12.1", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "tsutils": "^3.21.0" }, @@ -1234,9 +1235,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.12.1.tgz", - "integrity": "sha512-hfcbq4qVOHV1YRdhkDldhV9NpmmAu2vp6wuFODL71Y0Ixak+FLeEU4rnPxgmZMnGreGEghlEucs9UZn5KOfHJA==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1247,13 +1248,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.1.tgz", - "integrity": "sha512-ahOdkIY9Mgbza7L9sIi205Pe1inCkZWAHE1TV1bpxlU4RZNPtXaDZfiiFWcL9jdxvW1hDYZJXrFm+vlMkXRbBw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.12.1", - "@typescript-eslint/visitor-keys": "5.12.1", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -1274,15 +1275,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.12.1.tgz", - "integrity": "sha512-Qq9FIuU0EVEsi8fS6pG+uurbhNTtoYr4fq8tKjBupsK5Bgbk2I32UGm0Sh+WOyjOPgo/5URbxxSNV6HYsxV4MQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz", + "integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.12.1", - "@typescript-eslint/types": "5.12.1", - "@typescript-eslint/typescript-estree": "5.12.1", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -1298,12 +1299,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.1.tgz", - "integrity": "sha512-l1KSLfupuwrXx6wc0AuOmC7Ko5g14ZOQ86wJJqRbdLbXLK02pK/DPiDDqCc7BqqiiA04/eAA6ayL0bgOrAkH7A==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.12.1", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -3525,9 +3526,9 @@ } }, "node_modules/eslint-plugin-unicorn": { - "version": "40.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-40.1.0.tgz", - "integrity": "sha512-y5doK2DF9Sr5AqKEHbHxjFllJ167nKDRU01HDcWyv4Tnmaoe9iNxMrBnaybZvWZUaE3OC5Unu0lNIevYamloig==", + "version": "41.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-41.0.0.tgz", + "integrity": "sha512-xoJCaRc1uy5REg9DkVga1BkZV57jJxoqOcrU28QHZB89Lk5LdSqdVyTIt9JQVfHNKaiyJ7X+3iLlIn+VEHWEzA==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.15.7", @@ -3552,7 +3553,7 @@ "url": "https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1" }, "peerDependencies": { - "eslint": ">=7.32.0" + "eslint": ">=8.8.0" } }, "node_modules/eslint-plugin-you-dont-need-lodash-underscore": { @@ -11026,7 +11027,7 @@ "@readme/api-core": { "version": "file:../core", "requires": { - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@readme/oas-to-har": "^15.0.0", "@types/chai": "^4.3.0", @@ -11037,6 +11038,7 @@ "eslint": "^8.8.0", "fetch-har": "^6.1.0", "form-data-encoder": "^1.7.1", + "formdata-node": "^4.3.2", "get-stream": "^6.0.0", "isomorphic-fetch": "^3.0.0", "json-schema-traverse": "^1.0.0", @@ -11064,13 +11066,13 @@ } }, "@readme/eslint-config": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.2.tgz", - "integrity": "sha512-o9p3aho6wV6/DMsZ1yBz0PAyhLLlIYa60kxNxl03puVSJGRrcx9+Zc3NPzkaZblLMGH3DI6MZFK5hTkWLtYbhw==", + "version": "8.4.4", + "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.4.tgz", + "integrity": "sha512-WBdGwOzh3N1ez3tRjIJXiKOkjZeaHEzShlbT1UYJyCVd3AO+PXVXQg42zpkrQNy9rJad1mRXjA7/Hm6oa2RAkw==", "dev": true, "requires": { - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", + "@typescript-eslint/eslint-plugin": "^5.13.0", + "@typescript-eslint/parser": "^5.13.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.1.0", "eslint-import-resolver-typescript": "^2.4.0", @@ -11089,7 +11091,7 @@ "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-testing-library": "^5.0.0", - "eslint-plugin-unicorn": "^40.0.0", + "eslint-plugin-unicorn": "^41.0.0", "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0" } }, @@ -11273,14 +11275,14 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.1.tgz", - "integrity": "sha512-M499lqa8rnNK7mUv74lSFFttuUsubIRdAbHcVaP93oFcKkEmHmLqy2n7jM9C8DVmFMYK61ExrZU6dLYhQZmUpw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz", + "integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.12.1", - "@typescript-eslint/type-utils": "5.12.1", - "@typescript-eslint/utils": "5.12.1", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/type-utils": "5.13.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -11290,52 +11292,52 @@ } }, "@typescript-eslint/parser": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.12.1.tgz", - "integrity": "sha512-6LuVUbe7oSdHxUWoX/m40Ni8gsZMKCi31rlawBHt7VtW15iHzjbpj2WLiToG2758KjtCCiLRKZqfrOdl3cNKuw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz", + "integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.12.1", - "@typescript-eslint/types": "5.12.1", - "@typescript-eslint/typescript-estree": "5.12.1", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "debug": "^4.3.2" } }, "@typescript-eslint/scope-manager": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.12.1.tgz", - "integrity": "sha512-J0Wrh5xS6XNkd4TkOosxdpObzlYfXjAFIm9QxYLCPOcHVv1FyyFCPom66uIh8uBr0sZCrtS+n19tzufhwab8ZQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.12.1", - "@typescript-eslint/visitor-keys": "5.12.1" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" } }, "@typescript-eslint/type-utils": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.12.1.tgz", - "integrity": "sha512-Gh8feEhsNLeCz6aYqynh61Vsdy+tiNNkQtc+bN3IvQvRqHkXGUhYkUi+ePKzP0Mb42se7FDb+y2SypTbpbR/Sg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz", + "integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==", "dev": true, "requires": { - "@typescript-eslint/utils": "5.12.1", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.12.1.tgz", - "integrity": "sha512-hfcbq4qVOHV1YRdhkDldhV9NpmmAu2vp6wuFODL71Y0Ixak+FLeEU4rnPxgmZMnGreGEghlEucs9UZn5KOfHJA==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.1.tgz", - "integrity": "sha512-ahOdkIY9Mgbza7L9sIi205Pe1inCkZWAHE1TV1bpxlU4RZNPtXaDZfiiFWcL9jdxvW1hDYZJXrFm+vlMkXRbBw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.12.1", - "@typescript-eslint/visitor-keys": "5.12.1", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -11344,26 +11346,26 @@ } }, "@typescript-eslint/utils": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.12.1.tgz", - "integrity": "sha512-Qq9FIuU0EVEsi8fS6pG+uurbhNTtoYr4fq8tKjBupsK5Bgbk2I32UGm0Sh+WOyjOPgo/5URbxxSNV6HYsxV4MQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz", + "integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.12.1", - "@typescript-eslint/types": "5.12.1", - "@typescript-eslint/typescript-estree": "5.12.1", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" } }, "@typescript-eslint/visitor-keys": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.1.tgz", - "integrity": "sha512-l1KSLfupuwrXx6wc0AuOmC7Ko5g14ZOQ86wJJqRbdLbXLK02pK/DPiDDqCc7BqqiiA04/eAA6ayL0bgOrAkH7A==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "requires": { - "@typescript-eslint/types": "5.12.1", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -13069,9 +13071,9 @@ } }, "eslint-plugin-unicorn": { - "version": "40.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-40.1.0.tgz", - "integrity": "sha512-y5doK2DF9Sr5AqKEHbHxjFllJ167nKDRU01HDcWyv4Tnmaoe9iNxMrBnaybZvWZUaE3OC5Unu0lNIevYamloig==", + "version": "41.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-41.0.0.tgz", + "integrity": "sha512-xoJCaRc1uy5REg9DkVga1BkZV57jJxoqOcrU28QHZB89Lk5LdSqdVyTIt9JQVfHNKaiyJ7X+3iLlIn+VEHWEzA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.15.7", diff --git a/packages/cli/package.json b/packages/cli/package.json index ba776ff9..eae588cd 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -47,7 +47,7 @@ }, "devDependencies": { "@oclif/test": "^2.1.0", - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@types/chai": "^4.3.0", "@types/js-yaml": "^4.0.5", diff --git a/packages/core/package-lock.json b/packages/core/package-lock.json index dff0cf0b..edce6c03 100644 --- a/packages/core/package-lock.json +++ b/packages/core/package-lock.json @@ -13,6 +13,7 @@ "datauri": "^4.1.0", "fetch-har": "^6.1.0", "form-data-encoder": "^1.7.1", + "formdata-node": "^4.3.2", "get-stream": "^6.0.0", "isomorphic-fetch": "^3.0.0", "json-schema-traverse": "^1.0.0", @@ -20,7 +21,7 @@ "oas": "^17.7.3" }, "devDependencies": { - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@types/chai": "^4.3.0", "@types/lodash.merge": "^4.6.6", @@ -786,13 +787,13 @@ } }, "node_modules/@readme/eslint-config": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.2.tgz", - "integrity": "sha512-o9p3aho6wV6/DMsZ1yBz0PAyhLLlIYa60kxNxl03puVSJGRrcx9+Zc3NPzkaZblLMGH3DI6MZFK5hTkWLtYbhw==", + "version": "8.4.4", + "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.4.tgz", + "integrity": "sha512-WBdGwOzh3N1ez3tRjIJXiKOkjZeaHEzShlbT1UYJyCVd3AO+PXVXQg42zpkrQNy9rJad1mRXjA7/Hm6oa2RAkw==", "dev": true, "dependencies": { - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", + "@typescript-eslint/eslint-plugin": "^5.13.0", + "@typescript-eslint/parser": "^5.13.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.1.0", "eslint-import-resolver-typescript": "^2.4.0", @@ -811,7 +812,7 @@ "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-testing-library": "^5.0.0", - "eslint-plugin-unicorn": "^40.0.0", + "eslint-plugin-unicorn": "^41.0.0", "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0" }, "engines": { @@ -954,14 +955,14 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.0.tgz", - "integrity": "sha512-fwCMkDimwHVeIOKeBHiZhRUfJXU8n6xW1FL9diDxAyGAFvKcH4csy0v7twivOQdQdA0KC8TDr7GGRd3L4Lv0rQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz", + "integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.12.0", - "@typescript-eslint/type-utils": "5.12.0", - "@typescript-eslint/utils": "5.12.0", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/type-utils": "5.13.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -986,36 +987,15 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } - }, "node_modules/@typescript-eslint/parser": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.12.0.tgz", - "integrity": "sha512-MfSwg9JMBojMUoGjUmX+D2stoQj1CBYTCP0qnnVtu9A+YQXVKNtLjasYh+jozOcrb/wau8TCfWOkQTiOAruBog==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz", + "integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.12.0", - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/typescript-estree": "5.12.0", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "debug": "^4.3.2" }, "engines": { @@ -1035,13 +1015,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz", - "integrity": "sha512-GAMobtIJI8FGf1sLlUWNUm2IOkIjvn7laFWyRx7CLrv6nLBI7su+B7lbStqVlK5NdLvHRFiJo2HhiDF7Ki01WQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/visitor-keys": "5.12.0" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1052,12 +1032,12 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.12.0.tgz", - "integrity": "sha512-9j9rli3zEBV+ae7rlbBOotJcI6zfc6SHFMdKI9M3Nc0sy458LJ79Os+TPWeBBL96J9/e36rdJOfCuyRSgFAA0Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz", + "integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==", "dev": true, "dependencies": { - "@typescript-eslint/utils": "5.12.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "tsutils": "^3.21.0" }, @@ -1077,31 +1057,10 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "node_modules/@typescript-eslint/type-utils/node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } - }, "node_modules/@typescript-eslint/types": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.12.0.tgz", - "integrity": "sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1112,13 +1071,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz", - "integrity": "sha512-Dd9gVeOqt38QHR0BEA8oRaT65WYqPYbIc5tRFQPkfLquVEFPD1HAtbZT98TLBkEcCkvwDYOAvuSvAD9DnQhMfQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/visitor-keys": "5.12.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -1138,37 +1097,16 @@ } } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } - }, "node_modules/@typescript-eslint/utils": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.12.0.tgz", - "integrity": "sha512-k4J2WovnMPGI4PzKgDtQdNrCnmBHpMUFy21qjX2CoPdoBcSBIMvVBr9P2YDP8jOqZOeK3ThOL6VO/sy6jtnvzw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz", + "integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.12.0", - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/typescript-estree": "5.12.0", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -1184,12 +1122,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.0.tgz", - "integrity": "sha512-cFwTlgnMV6TgezQynx2c/4/tx9Tufbuo9LPzmWqyRC3QC4qTGkAG1C6pBr0/4I10PAI/FlYunI3vJjIcu+ZHMg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.12.0", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -2900,9 +2838,9 @@ } }, "node_modules/eslint-plugin-unicorn": { - "version": "40.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-40.1.0.tgz", - "integrity": "sha512-y5doK2DF9Sr5AqKEHbHxjFllJ167nKDRU01HDcWyv4Tnmaoe9iNxMrBnaybZvWZUaE3OC5Unu0lNIevYamloig==", + "version": "41.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-41.0.0.tgz", + "integrity": "sha512-xoJCaRc1uy5REg9DkVga1BkZV57jJxoqOcrU28QHZB89Lk5LdSqdVyTIt9JQVfHNKaiyJ7X+3iLlIn+VEHWEzA==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.15.7", @@ -2927,7 +2865,7 @@ "url": "https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1" }, "peerDependencies": { - "eslint": ">=7.32.0" + "eslint": ">=8.8.0" } }, "node_modules/eslint-plugin-you-dont-need-lodash-underscore": { @@ -3339,7 +3277,6 @@ "version": "4.3.2", "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.3.2.tgz", "integrity": "sha512-k7lYJyzDOSL6h917favP8j1L0/wNyylzU+x+1w4p5haGVHNlP58dbpdJhiCUsDbWsa9HwEtLp89obQgXl2e0qg==", - "optional": true, "dependencies": { "node-domexception": "1.0.0", "web-streams-polyfill": "4.0.0-beta.1" @@ -4900,7 +4837,6 @@ "url": "https://paypal.me/jimmywarting" } ], - "optional": true, "engines": { "node": ">=10.5.0" } @@ -6845,6 +6781,27 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/tsutils/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, "node_modules/type": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", @@ -7010,7 +6967,6 @@ "version": "4.0.0-beta.1", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.1.tgz", "integrity": "sha512-3ux37gEX670UUphBF9AMCq8XM6iQ8Ac6A+DSRRjDoRBm1ufCkaCDdNVbaqq60PsEkdNlLKrGtv/YBP4EJXqNtQ==", - "optional": true, "engines": { "node": ">= 12" } @@ -7788,13 +7744,13 @@ } }, "@readme/eslint-config": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.2.tgz", - "integrity": "sha512-o9p3aho6wV6/DMsZ1yBz0PAyhLLlIYa60kxNxl03puVSJGRrcx9+Zc3NPzkaZblLMGH3DI6MZFK5hTkWLtYbhw==", + "version": "8.4.4", + "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.4.tgz", + "integrity": "sha512-WBdGwOzh3N1ez3tRjIJXiKOkjZeaHEzShlbT1UYJyCVd3AO+PXVXQg42zpkrQNy9rJad1mRXjA7/Hm6oa2RAkw==", "dev": true, "requires": { - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", + "@typescript-eslint/eslint-plugin": "^5.13.0", + "@typescript-eslint/parser": "^5.13.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.1.0", "eslint-import-resolver-typescript": "^2.4.0", @@ -7813,7 +7769,7 @@ "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-testing-library": "^5.0.0", - "eslint-plugin-unicorn": "^40.0.0", + "eslint-plugin-unicorn": "^41.0.0", "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0" } }, @@ -7932,148 +7888,97 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.12.0.tgz", - "integrity": "sha512-fwCMkDimwHVeIOKeBHiZhRUfJXU8n6xW1FL9diDxAyGAFvKcH4csy0v7twivOQdQdA0KC8TDr7GGRd3L4Lv0rQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz", + "integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.12.0", - "@typescript-eslint/type-utils": "5.12.0", - "@typescript-eslint/utils": "5.12.0", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/type-utils": "5.13.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", "regexpp": "^3.2.0", "semver": "^7.3.5", "tsutils": "^3.21.0" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - } } }, "@typescript-eslint/parser": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.12.0.tgz", - "integrity": "sha512-MfSwg9JMBojMUoGjUmX+D2stoQj1CBYTCP0qnnVtu9A+YQXVKNtLjasYh+jozOcrb/wau8TCfWOkQTiOAruBog==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz", + "integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.12.0", - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/typescript-estree": "5.12.0", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "debug": "^4.3.2" } }, "@typescript-eslint/scope-manager": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.12.0.tgz", - "integrity": "sha512-GAMobtIJI8FGf1sLlUWNUm2IOkIjvn7laFWyRx7CLrv6nLBI7su+B7lbStqVlK5NdLvHRFiJo2HhiDF7Ki01WQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/visitor-keys": "5.12.0" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" } }, "@typescript-eslint/type-utils": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.12.0.tgz", - "integrity": "sha512-9j9rli3zEBV+ae7rlbBOotJcI6zfc6SHFMdKI9M3Nc0sy458LJ79Os+TPWeBBL96J9/e36rdJOfCuyRSgFAA0Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz", + "integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==", "dev": true, "requires": { - "@typescript-eslint/utils": "5.12.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "tsutils": "^3.21.0" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - } } }, "@typescript-eslint/types": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.12.0.tgz", - "integrity": "sha512-JowqbwPf93nvf8fZn5XrPGFBdIK8+yx5UEGs2QFAYFI8IWYfrzz+6zqlurGr2ctShMaJxqwsqmra3WXWjH1nRQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.12.0.tgz", - "integrity": "sha512-Dd9gVeOqt38QHR0BEA8oRaT65WYqPYbIc5tRFQPkfLquVEFPD1HAtbZT98TLBkEcCkvwDYOAvuSvAD9DnQhMfQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/visitor-keys": "5.12.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", "semver": "^7.3.5", "tsutils": "^3.21.0" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - } } }, "@typescript-eslint/utils": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.12.0.tgz", - "integrity": "sha512-k4J2WovnMPGI4PzKgDtQdNrCnmBHpMUFy21qjX2CoPdoBcSBIMvVBr9P2YDP8jOqZOeK3ThOL6VO/sy6jtnvzw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz", + "integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.12.0", - "@typescript-eslint/types": "5.12.0", - "@typescript-eslint/typescript-estree": "5.12.0", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" } }, "@typescript-eslint/visitor-keys": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.12.0.tgz", - "integrity": "sha512-cFwTlgnMV6TgezQynx2c/4/tx9Tufbuo9LPzmWqyRC3QC4qTGkAG1C6pBr0/4I10PAI/FlYunI3vJjIcu+ZHMg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "requires": { - "@typescript-eslint/types": "5.12.0", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -9355,9 +9260,9 @@ } }, "eslint-plugin-unicorn": { - "version": "40.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-40.1.0.tgz", - "integrity": "sha512-y5doK2DF9Sr5AqKEHbHxjFllJ167nKDRU01HDcWyv4Tnmaoe9iNxMrBnaybZvWZUaE3OC5Unu0lNIevYamloig==", + "version": "41.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-41.0.0.tgz", + "integrity": "sha512-xoJCaRc1uy5REg9DkVga1BkZV57jJxoqOcrU28QHZB89Lk5LdSqdVyTIt9JQVfHNKaiyJ7X+3iLlIn+VEHWEzA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.15.7", @@ -9667,7 +9572,6 @@ "version": "4.3.2", "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.3.2.tgz", "integrity": "sha512-k7lYJyzDOSL6h917favP8j1L0/wNyylzU+x+1w4p5haGVHNlP58dbpdJhiCUsDbWsa9HwEtLp89obQgXl2e0qg==", - "optional": true, "requires": { "node-domexception": "1.0.0", "web-streams-polyfill": "4.0.0-beta.1" @@ -10773,8 +10677,7 @@ "node-domexception": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "optional": true + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" }, "node-fetch": { "version": "2.6.7", @@ -12245,6 +12148,23 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + } + } + }, "type": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", @@ -12380,8 +12300,7 @@ "web-streams-polyfill": { "version": "4.0.0-beta.1", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.1.tgz", - "integrity": "sha512-3ux37gEX670UUphBF9AMCq8XM6iQ8Ac6A+DSRRjDoRBm1ufCkaCDdNVbaqq60PsEkdNlLKrGtv/YBP4EJXqNtQ==", - "optional": true + "integrity": "sha512-3ux37gEX670UUphBF9AMCq8XM6iQ8Ac6A+DSRRjDoRBm1ufCkaCDdNVbaqq60PsEkdNlLKrGtv/YBP4EJXqNtQ==" }, "whatwg-fetch": { "version": "3.6.2", diff --git a/packages/core/package.json b/packages/core/package.json index 239f2ebb..4af76561 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -31,6 +31,7 @@ "datauri": "^4.1.0", "fetch-har": "^6.1.0", "form-data-encoder": "^1.7.1", + "formdata-node": "^4.3.2", "get-stream": "^6.0.0", "isomorphic-fetch": "^3.0.0", "json-schema-traverse": "^1.0.0", @@ -38,7 +39,7 @@ "oas": "^17.7.3" }, "devDependencies": { - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "@types/chai": "^4.3.0", "@types/lodash.merge": "^4.6.6", diff --git a/packages/httpsnippet-client-api/package-lock.json b/packages/httpsnippet-client-api/package-lock.json index c0e22dbd..0468b59d 100644 --- a/packages/httpsnippet-client-api/package-lock.json +++ b/packages/httpsnippet-client-api/package-lock.json @@ -14,7 +14,7 @@ "stringify-object": "^3.3.0" }, "devDependencies": { - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "chai": "^4.3.6", "eslint": "^8.8.0", @@ -770,13 +770,13 @@ } }, "node_modules/@readme/eslint-config": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.1.tgz", - "integrity": "sha512-QVkbUfnezEhiUllfzPCJUa0Sm09on7TZtTqa/e91EoXiF1QL8HOuN9jF6T0TuKgGoqu+sHvDDTYtdprB7tM5RA==", + "version": "8.4.4", + "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.4.tgz", + "integrity": "sha512-WBdGwOzh3N1ez3tRjIJXiKOkjZeaHEzShlbT1UYJyCVd3AO+PXVXQg42zpkrQNy9rJad1mRXjA7/Hm6oa2RAkw==", "dev": true, "dependencies": { - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", + "@typescript-eslint/eslint-plugin": "^5.13.0", + "@typescript-eslint/parser": "^5.13.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.1.0", "eslint-import-resolver-typescript": "^2.4.0", @@ -795,7 +795,7 @@ "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-testing-library": "^5.0.0", - "eslint-plugin-unicorn": "^40.0.0", + "eslint-plugin-unicorn": "^41.0.0", "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0" }, "engines": { @@ -1049,14 +1049,14 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.2.tgz", - "integrity": "sha512-4W/9lLuE+v27O/oe7hXJKjNtBLnZE8tQAFpapdxwSVHqtmIoPB1gph3+ahNwVuNL37BX7YQHyGF9Xv6XCnIX2Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz", + "integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.10.2", - "@typescript-eslint/type-utils": "5.10.2", - "@typescript-eslint/utils": "5.10.2", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/type-utils": "5.13.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -1082,13 +1082,13 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.2.tgz", - "integrity": "sha512-39Tm6f4RoZoVUWBYr3ekS75TYgpr5Y+X0xLZxXqcZNDWZdJdYbKd3q2IR4V9y5NxxiPu/jxJ8XP7EgHiEQtFnw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1099,9 +1099,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.2.tgz", - "integrity": "sha512-Qfp0qk/5j2Rz3p3/WhWgu4S1JtMcPgFLnmAKAW061uXxKSa7VWKZsDXVaMXh2N60CX9h6YLaBoy9PJAfCOjk3w==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1112,12 +1112,12 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.2.tgz", - "integrity": "sha512-zHIhYGGGrFJvvyfwHk5M08C5B5K4bewkm+rrvNTKk1/S15YHR+SA/QUF8ZWscXSfEaB8Nn2puZj+iHcoxVOD/Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -1153,14 +1153,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.10.2.tgz", - "integrity": "sha512-JaNYGkaQVhP6HNF+lkdOr2cAs2wdSZBoalE22uYWq8IEv/OVH0RksSGydk+sW8cLoSeYmC+OHvRyv2i4AQ7Czg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz", + "integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.10.2", - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/typescript-estree": "5.10.2", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "debug": "^4.3.2" }, "engines": { @@ -1180,13 +1180,13 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.2.tgz", - "integrity": "sha512-39Tm6f4RoZoVUWBYr3ekS75TYgpr5Y+X0xLZxXqcZNDWZdJdYbKd3q2IR4V9y5NxxiPu/jxJ8XP7EgHiEQtFnw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1197,9 +1197,9 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.2.tgz", - "integrity": "sha512-Qfp0qk/5j2Rz3p3/WhWgu4S1JtMcPgFLnmAKAW061uXxKSa7VWKZsDXVaMXh2N60CX9h6YLaBoy9PJAfCOjk3w==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1210,13 +1210,13 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.2.tgz", - "integrity": "sha512-WHHw6a9vvZls6JkTgGljwCsMkv8wu8XU8WaYKeYhxhWXH/atZeiMW6uDFPLZOvzNOGmuSMvHtZKd6AuC8PrwKQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -1237,12 +1237,12 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.2.tgz", - "integrity": "sha512-zHIhYGGGrFJvvyfwHk5M08C5B5K4bewkm+rrvNTKk1/S15YHR+SA/QUF8ZWscXSfEaB8Nn2puZj+iHcoxVOD/Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -1271,12 +1271,12 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.10.2.tgz", - "integrity": "sha512-uRKSvw/Ccs5FYEoXW04Z5VfzF2iiZcx8Fu7DGIB7RHozuP0VbKNzP1KfZkHBTM75pCpsWxIthEH1B33dmGBKHw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz", + "integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==", "dev": true, "dependencies": { - "@typescript-eslint/utils": "5.10.2", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "tsutils": "^3.21.0" }, @@ -1337,15 +1337,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.10.2.tgz", - "integrity": "sha512-vuJaBeig1NnBRkf7q9tgMLREiYD7zsMrsN1DA3wcoMDvr3BTFiIpKjGiYZoKPllfEwN7spUjv7ZqD+JhbVjEPg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz", + "integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.10.2", - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/typescript-estree": "5.10.2", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -1361,13 +1361,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.2.tgz", - "integrity": "sha512-39Tm6f4RoZoVUWBYr3ekS75TYgpr5Y+X0xLZxXqcZNDWZdJdYbKd3q2IR4V9y5NxxiPu/jxJ8XP7EgHiEQtFnw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1378,9 +1378,9 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.2.tgz", - "integrity": "sha512-Qfp0qk/5j2Rz3p3/WhWgu4S1JtMcPgFLnmAKAW061uXxKSa7VWKZsDXVaMXh2N60CX9h6YLaBoy9PJAfCOjk3w==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1391,13 +1391,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.2.tgz", - "integrity": "sha512-WHHw6a9vvZls6JkTgGljwCsMkv8wu8XU8WaYKeYhxhWXH/atZeiMW6uDFPLZOvzNOGmuSMvHtZKd6AuC8PrwKQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -1418,12 +1418,12 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.2.tgz", - "integrity": "sha512-zHIhYGGGrFJvvyfwHk5M08C5B5K4bewkm+rrvNTKk1/S15YHR+SA/QUF8ZWscXSfEaB8Nn2puZj+iHcoxVOD/Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.10.2", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -3164,9 +3164,9 @@ } }, "node_modules/eslint-plugin-unicorn": { - "version": "40.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-40.1.0.tgz", - "integrity": "sha512-y5doK2DF9Sr5AqKEHbHxjFllJ167nKDRU01HDcWyv4Tnmaoe9iNxMrBnaybZvWZUaE3OC5Unu0lNIevYamloig==", + "version": "41.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-41.0.0.tgz", + "integrity": "sha512-xoJCaRc1uy5REg9DkVga1BkZV57jJxoqOcrU28QHZB89Lk5LdSqdVyTIt9JQVfHNKaiyJ7X+3iLlIn+VEHWEzA==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.15.7", @@ -3191,7 +3191,7 @@ "url": "https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1" }, "peerDependencies": { - "eslint": ">=7.32.0" + "eslint": ">=8.8.0" } }, "node_modules/eslint-plugin-you-dont-need-lodash-underscore": { @@ -8433,13 +8433,13 @@ } }, "@readme/eslint-config": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.1.tgz", - "integrity": "sha512-QVkbUfnezEhiUllfzPCJUa0Sm09on7TZtTqa/e91EoXiF1QL8HOuN9jF6T0TuKgGoqu+sHvDDTYtdprB7tM5RA==", + "version": "8.4.4", + "resolved": "https://registry.npmjs.org/@readme/eslint-config/-/eslint-config-8.4.4.tgz", + "integrity": "sha512-WBdGwOzh3N1ez3tRjIJXiKOkjZeaHEzShlbT1UYJyCVd3AO+PXVXQg42zpkrQNy9rJad1mRXjA7/Hm6oa2RAkw==", "dev": true, "requires": { - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", + "@typescript-eslint/eslint-plugin": "^5.13.0", + "@typescript-eslint/parser": "^5.13.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.1.0", "eslint-import-resolver-typescript": "^2.4.0", @@ -8458,7 +8458,7 @@ "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-testing-library": "^5.0.0", - "eslint-plugin-unicorn": "^40.0.0", + "eslint-plugin-unicorn": "^41.0.0", "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0" } }, @@ -8655,14 +8655,14 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.2.tgz", - "integrity": "sha512-4W/9lLuE+v27O/oe7hXJKjNtBLnZE8tQAFpapdxwSVHqtmIoPB1gph3+ahNwVuNL37BX7YQHyGF9Xv6XCnIX2Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.13.0.tgz", + "integrity": "sha512-vLktb2Uec81fxm/cfz2Hd6QaWOs8qdmVAZXLdOBX6JFJDhf6oDZpMzZ4/LZ6SFM/5DgDcxIMIvy3F+O9yZBuiQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.10.2", - "@typescript-eslint/type-utils": "5.10.2", - "@typescript-eslint/utils": "5.10.2", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/type-utils": "5.13.0", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -8672,28 +8672,28 @@ }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.2.tgz", - "integrity": "sha512-39Tm6f4RoZoVUWBYr3ekS75TYgpr5Y+X0xLZxXqcZNDWZdJdYbKd3q2IR4V9y5NxxiPu/jxJ8XP7EgHiEQtFnw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" } }, "@typescript-eslint/types": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.2.tgz", - "integrity": "sha512-Qfp0qk/5j2Rz3p3/WhWgu4S1JtMcPgFLnmAKAW061uXxKSa7VWKZsDXVaMXh2N60CX9h6YLaBoy9PJAfCOjk3w==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true }, "@typescript-eslint/visitor-keys": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.2.tgz", - "integrity": "sha512-zHIhYGGGrFJvvyfwHk5M08C5B5K4bewkm+rrvNTKk1/S15YHR+SA/QUF8ZWscXSfEaB8Nn2puZj+iHcoxVOD/Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" } } @@ -8714,41 +8714,41 @@ } }, "@typescript-eslint/parser": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.10.2.tgz", - "integrity": "sha512-JaNYGkaQVhP6HNF+lkdOr2cAs2wdSZBoalE22uYWq8IEv/OVH0RksSGydk+sW8cLoSeYmC+OHvRyv2i4AQ7Czg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.13.0.tgz", + "integrity": "sha512-GdrU4GvBE29tm2RqWOM0P5QfCtgCyN4hXICj/X9ibKED16136l9ZpoJvCL5pSKtmJzA+NRDzQ312wWMejCVVfg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.10.2", - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/typescript-estree": "5.10.2", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "debug": "^4.3.2" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.2.tgz", - "integrity": "sha512-39Tm6f4RoZoVUWBYr3ekS75TYgpr5Y+X0xLZxXqcZNDWZdJdYbKd3q2IR4V9y5NxxiPu/jxJ8XP7EgHiEQtFnw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" } }, "@typescript-eslint/types": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.2.tgz", - "integrity": "sha512-Qfp0qk/5j2Rz3p3/WhWgu4S1JtMcPgFLnmAKAW061uXxKSa7VWKZsDXVaMXh2N60CX9h6YLaBoy9PJAfCOjk3w==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.2.tgz", - "integrity": "sha512-WHHw6a9vvZls6JkTgGljwCsMkv8wu8XU8WaYKeYhxhWXH/atZeiMW6uDFPLZOvzNOGmuSMvHtZKd6AuC8PrwKQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -8757,12 +8757,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.2.tgz", - "integrity": "sha512-zHIhYGGGrFJvvyfwHk5M08C5B5K4bewkm+rrvNTKk1/S15YHR+SA/QUF8ZWscXSfEaB8Nn2puZj+iHcoxVOD/Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" } } @@ -8779,12 +8779,12 @@ } }, "@typescript-eslint/type-utils": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.10.2.tgz", - "integrity": "sha512-uRKSvw/Ccs5FYEoXW04Z5VfzF2iiZcx8Fu7DGIB7RHozuP0VbKNzP1KfZkHBTM75pCpsWxIthEH1B33dmGBKHw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.13.0.tgz", + "integrity": "sha512-/nz7qFizaBM1SuqAKb7GLkcNn2buRdDgZraXlkhz+vUGiN1NZ9LzkA595tHHeduAiS2MsHqMNhE2zNzGdw43Yg==", "dev": true, "requires": { - "@typescript-eslint/utils": "5.10.2", + "@typescript-eslint/utils": "5.13.0", "debug": "^4.3.2", "tsutils": "^3.21.0" } @@ -8811,43 +8811,43 @@ } }, "@typescript-eslint/utils": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.10.2.tgz", - "integrity": "sha512-vuJaBeig1NnBRkf7q9tgMLREiYD7zsMrsN1DA3wcoMDvr3BTFiIpKjGiYZoKPllfEwN7spUjv7ZqD+JhbVjEPg==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.13.0.tgz", + "integrity": "sha512-+9oHlPWYNl6AwwoEt5TQryEHwiKRVjz7Vk6kaBeD3/kwHE5YqTGHtm/JZY8Bo9ITOeKutFaXnBlMgSATMJALUQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.10.2", - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/typescript-estree": "5.10.2", + "@typescript-eslint/scope-manager": "5.13.0", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/typescript-estree": "5.13.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.2.tgz", - "integrity": "sha512-39Tm6f4RoZoVUWBYr3ekS75TYgpr5Y+X0xLZxXqcZNDWZdJdYbKd3q2IR4V9y5NxxiPu/jxJ8XP7EgHiEQtFnw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.13.0.tgz", + "integrity": "sha512-T4N8UvKYDSfVYdmJq7g2IPJYCRzwtp74KyDZytkR4OL3NRupvswvmJQJ4CX5tDSurW2cvCc1Ia1qM7d0jpa7IA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2" + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0" } }, "@typescript-eslint/types": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.2.tgz", - "integrity": "sha512-Qfp0qk/5j2Rz3p3/WhWgu4S1JtMcPgFLnmAKAW061uXxKSa7VWKZsDXVaMXh2N60CX9h6YLaBoy9PJAfCOjk3w==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.13.0.tgz", + "integrity": "sha512-LmE/KO6DUy0nFY/OoQU0XelnmDt+V8lPQhh8MOVa7Y5k2gGRd6U9Kp3wAjhB4OHg57tUO0nOnwYQhRRyEAyOyg==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.2.tgz", - "integrity": "sha512-WHHw6a9vvZls6JkTgGljwCsMkv8wu8XU8WaYKeYhxhWXH/atZeiMW6uDFPLZOvzNOGmuSMvHtZKd6AuC8PrwKQ==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.13.0.tgz", + "integrity": "sha512-Q9cQow0DeLjnp5DuEDjLZ6JIkwGx3oYZe+BfcNuw/POhtpcxMTy18Icl6BJqTSd+3ftsrfuVb7mNHRZf7xiaNA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", - "@typescript-eslint/visitor-keys": "5.10.2", + "@typescript-eslint/types": "5.13.0", + "@typescript-eslint/visitor-keys": "5.13.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -8856,12 +8856,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.2.tgz", - "integrity": "sha512-zHIhYGGGrFJvvyfwHk5M08C5B5K4bewkm+rrvNTKk1/S15YHR+SA/QUF8ZWscXSfEaB8Nn2puZj+iHcoxVOD/Q==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.13.0.tgz", + "integrity": "sha512-HLKEAS/qA1V7d9EzcpLFykTePmOQqOFim8oCvhY3pZgQ8Hi38hYpHd9e5GN6nQBFQNecNhws5wkS9Y5XIO0s/g==", "dev": true, "requires": { - "@typescript-eslint/types": "5.10.2", + "@typescript-eslint/types": "5.13.0", "eslint-visitor-keys": "^3.0.0" } } @@ -10237,9 +10237,9 @@ } }, "eslint-plugin-unicorn": { - "version": "40.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-40.1.0.tgz", - "integrity": "sha512-y5doK2DF9Sr5AqKEHbHxjFllJ167nKDRU01HDcWyv4Tnmaoe9iNxMrBnaybZvWZUaE3OC5Unu0lNIevYamloig==", + "version": "41.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-41.0.0.tgz", + "integrity": "sha512-xoJCaRc1uy5REg9DkVga1BkZV57jJxoqOcrU28QHZB89Lk5LdSqdVyTIt9JQVfHNKaiyJ7X+3iLlIn+VEHWEzA==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.15.7", diff --git a/packages/httpsnippet-client-api/package.json b/packages/httpsnippet-client-api/package.json index 0e1db5aa..d1f1148b 100644 --- a/packages/httpsnippet-client-api/package.json +++ b/packages/httpsnippet-client-api/package.json @@ -32,7 +32,7 @@ "oas": "^17.1.0" }, "devDependencies": { - "@readme/eslint-config": "^8.4.1", + "@readme/eslint-config": "^8.4.4", "@readme/oas-examples": "^4.4.0", "chai": "^4.3.6", "eslint": "^8.8.0", From d4038723ed3ddc5ceff30d8092d63fd559367854 Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Tue, 1 Mar 2022 15:52:10 -0800 Subject: [PATCH 3/5] feat: pulling in chunks of oazapfts to workwith --- package-lock.json | 2 + packages/api/src/index.ts | 1 - packages/cli/package-lock.json | 1 + packages/cli/package.json | 1 + .../cli/src/generator/typescript/index.ts | 169 +++++ .../src/generator/typescript/oaz/APIStub.ts | 16 + .../src/generator/typescript/oaz/generate.ts | 717 ++++++++++++++++++ .../src/generator/typescript/oaz/tscodegen.ts | 434 +++++++++++ packages/cli/test/fixtures/simple.oas.json | 287 +++++++ .../cli/test/generator/typescript.test.ts | 38 + packages/cli/test/tsconfig.json | 3 +- packages/cli/tsconfig.json | 1 + 12 files changed, 1668 insertions(+), 2 deletions(-) create mode 100644 packages/cli/src/generator/typescript/index.ts create mode 100644 packages/cli/src/generator/typescript/oaz/APIStub.ts create mode 100644 packages/cli/src/generator/typescript/oaz/generate.ts create mode 100644 packages/cli/src/generator/typescript/oaz/tscodegen.ts create mode 100644 packages/cli/test/fixtures/simple.oas.json create mode 100644 packages/cli/test/generator/typescript.test.ts diff --git a/package-lock.json b/package-lock.json index 531a4261..bba74bb1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12514,6 +12514,7 @@ "fetch-har": "^6.1.0", "js-yaml": "^4.1.0", "json-schema-to-typescript": "^10.1.5", + "lodash": "^4.17.21", "oas": "^17.7.3", "typescript": "^4.6.2" }, @@ -13910,6 +13911,7 @@ "globby": "^11.1.0", "js-yaml": "^4.1.0", "json-schema-to-typescript": "^10.1.5", + "lodash": "^4.17.21", "mocha": "^9.2.0", "oas": "^17.7.3", "oclif": "^2.4.4", diff --git a/packages/api/src/index.ts b/packages/api/src/index.ts index 0fad6687..89e102f2 100644 --- a/packages/api/src/index.ts +++ b/packages/api/src/index.ts @@ -3,7 +3,6 @@ import type { OASDocument } from './types'; import type { HttpMethods } from 'oas/@types/rmoas.types'; import type { ConfigOptions } from '@readme/api-core'; -import 'isomorphic-fetch'; import Oas from 'oas'; import APICore from '@readme/api-core'; import Cache from './cache'; diff --git a/packages/cli/package-lock.json b/packages/cli/package-lock.json index 92c58f55..8562fea9 100644 --- a/packages/cli/package-lock.json +++ b/packages/cli/package-lock.json @@ -17,6 +17,7 @@ "fetch-har": "^6.1.0", "js-yaml": "^4.1.0", "json-schema-to-typescript": "^10.1.5", + "lodash": "^4.17.21", "oas": "^17.7.3", "typescript": "^4.6.2" }, diff --git a/packages/cli/package.json b/packages/cli/package.json index eae588cd..e5ace673 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -42,6 +42,7 @@ "fetch-har": "^6.1.0", "js-yaml": "^4.1.0", "json-schema-to-typescript": "^10.1.5", + "lodash": "^4.17.21", "oas": "^17.7.3", "typescript": "^4.6.2" }, diff --git a/packages/cli/src/generator/typescript/index.ts b/packages/cli/src/generator/typescript/index.ts new file mode 100644 index 00000000..f8c623d6 --- /dev/null +++ b/packages/cli/src/generator/typescript/index.ts @@ -0,0 +1,169 @@ +/* eslint-disable prettier/prettier */ +import type Oas from 'oas'; +import type { Operation } from 'oas'; +import type { JSONSchema, SchemaObject } from 'oas/@types/rmoas.types'; +// import type { SchemaWrapper } from 'oas/@types/operation/get-parameters-as-json-schema'; + +import * as ts from 'typescript'; +import { compile } from 'json-schema-to-typescript'; + +import { OpenAPIV3 } from 'openapi-types'; +import * as cg from './oaz/tscodegen'; +import ApiGenerator from './oaz/generate'; + +type ResponseJsonSchema = { + type: string | string[]; + schema: SchemaObject; + label: string; + description?: string; +}; + +async function convertJSONSchemaToTypescript(schema: JSONSchema, name: string) { + // Though our JSON Schema type exposes JSONSchema4, which `json-schema-to-typescript`, it won't + // accept our custom type. + const interfaceCode = await compile(schema as any, name, { + bannerComment: '', + }); + + // Because the `name` that we're passing to `json-schema-to-typescript` gets run through some + // internal logic there and won't always be what we supply it we need to parse the TS that that + // library creates so we can grab the interface name for use in our own autogenerated code. + const sourceFile = ts.createSourceFile(`${name}.d.ts`, interfaceCode, ts.ScriptTarget.Latest); + + let typeName; + await ts.forEachChild(sourceFile, node => { + if (node.kind === ts.SyntaxKind.EndOfFileToken) { + return; + } + + if (ts.isInterfaceDeclaration(node)) { + // The Node `name` property, an `IdentifierObject`, is not formally exposed in the TS types + // and there aren't any accessors for this either. + typeName = node.name.text; + } else if (ts.isTypeAliasDeclaration(node)) { + typeName = node.name.text; + } + }); + + return { + typeName, + type: interfaceCode, + }; +} + +async function loadOperationsAndMethods(spec: Oas) { + const operations: Record< + /* operationId */ string, + { types: { params: any; responses?: any }; operation: Operation } + > = {}; + + const methods: Record< + /* method */ string, + Record + > = {}; + + await Promise.all( + Object.entries(spec.getPaths()).map(async ([path, ops]) => { + await Promise.all( + Object.entries(ops).map(async ([method, operation]) => { + // if (!(method in methods)) { + // methods[method] = {}; + // } + + const operationId = operation.getOperationId(); + + let params; + // @todo we should be smarter about how we're compiling json schema for these so we bundle all metadata types together under one `allOf` type -- it's dumb to have 3+ types be present with a union on a single method param + const paramSchemas = operation.getParametersAsJsonSchema(); + if (paramSchemas) { + params = await Promise.resolve(paramSchemas.map(param => ({ [param.type]: param.schema }))) + .then(res => res.reduce((prev, next) => Object.assign(prev, next))) + .then(res => { + return Promise.all( + Object.entries(res).map(async ([paramType, schema]) => { + // @todo add tests for when schema is `{ type: string }` + return { + [paramType]: { + schema, + ts: await convertJSONSchemaToTypescript( + schema as JSONSchema, + `${operationId}_${paramType}_param` + ), + } + }; + }) + ); + }); + } + + // @todo what does this do for a spec that has no responses? + let responses; + // const responses = await Promise.resolve( + // operation + // .getResponseStatusCodes() + // .map(status => { + // const schema = operation.getResponseAsJsonSchema(status); + // if (!schema) { + // return false; + // } + + // return { + // [status]: schema.shift() as ResponseJsonSchema, + // }; + // }) + // .reduce((prev, next) => Object.assign(prev, next)) + // ).then(res => { + // return Promise.all( + // Object.entries(res as Record).map(async ([status, jsonSchema]) => { + // return { + // [status]: await convertJSONSchemaToTypescript( + // jsonSchema.schema as JSONSchema, + // `${operationId}_Response_${status}` + // ), + // }; + // }) + // ); + // }); + + // methods[method][path] = { types: { params, responses }, operation }; + if (operation.hasOperationId()) { + operations[operation.getOperationId()] = { + types: { params, responses }, + operation, + }; + } + }) + ); + }) + ); + + return [operations, methods]; +} + +export default async function generator(spec: Oas) { + // const [operations, methods] = await loadOperationsAndMethods(spec); + + // type Opts = { + // include?: string[]; + // exclude?: string[]; + // optimistic?: boolean; + // }; + + const ast = new ApiGenerator(spec.api as OpenAPIV3.Document).generateApi(); + const src = cg.printFile(ast); + + console.log(src) + + + + + // Object.entries(operations).forEach(([op, data]) => { + // console.log(op) + // console.log(data) + // }); + + // console.log(operations) + + + // return operations; +} diff --git a/packages/cli/src/generator/typescript/oaz/APIStub.ts b/packages/cli/src/generator/typescript/oaz/APIStub.ts new file mode 100644 index 00000000..4f5b2a53 --- /dev/null +++ b/packages/cli/src/generator/typescript/oaz/APIStub.ts @@ -0,0 +1,16 @@ +/** + * DO NOT MODIFY - This file has been generated using oazapfts. + * See https://www.npmjs.com/package/oazapfts + */ + +import APICore from '@readme/api-core'; +import * as Oazapfts from "oazapfts/lib/runtime"; +import * as QS from "oazapfts/lib/runtime/query"; + +export const defaults: Oazapfts.RequestOpts = { + baseUrl: "/", +}; + +const oazapfts = Oazapfts.runtime(defaults); + +export const servers = {}; diff --git a/packages/cli/src/generator/typescript/oaz/generate.ts b/packages/cli/src/generator/typescript/oaz/generate.ts new file mode 100644 index 00000000..a43ea1f7 --- /dev/null +++ b/packages/cli/src/generator/typescript/oaz/generate.ts @@ -0,0 +1,717 @@ +/* eslint-disable no-restricted-imports */ +/* eslint-disable unicorn/no-useless-spread */ +/* eslint-disable @typescript-eslint/consistent-indexed-object-style */ +/* eslint-disable eqeqeq */ +/* eslint-disable no-else-return */ +/* eslint-disable no-plusplus */ +/* eslint-disable class-methods-use-this */ +/* eslint-disable no-multi-assign */ +/* eslint-disable spaced-comment */ +/* eslint-disable unicorn/prefer-type-error */ +/* eslint-disable no-shadow */ +/* eslint-disable consistent-return */ +/* eslint-disable no-param-reassign */ +import type { OpenAPIV3 } from 'openapi-types'; +import type { OASDocument } from 'oas/@types/rmoas.types'; + +import _ from 'lodash'; +import ts, { factory } from 'typescript'; +import path from 'path'; + +import * as cg from './tscodegen'; + +export const verbs = ['GET', 'PUT', 'POST', 'DELETE','OPTIONS', 'HEAD', 'PATCH', 'TRACE']; + +type ContentType = 'json' | 'form' | 'multipart'; + +export const contentTypes: Record = { + '*/*': 'json', + 'application/json': 'json', + 'application/hal+json': 'json', + 'application/x-www-form-urlencoded': 'form', + 'multipart/form-data': 'multipart', +}; + +/** + * Get the name of a formatter function for a given parameter. + */ +export function getFormatter({ style, explode }: OpenAPIV3.ParameterObject) { + if (style === 'spaceDelimited') return 'space'; + if (style === 'pipeDelimited') return 'pipe'; + if (style === 'deepObject') return 'deep'; + return explode ? 'explode' : 'form'; +} + +export function getOperationIdentifier(id?: string) { + if (!id) return; + if (id.match(/[^\w\s]/)) return; + id = _.camelCase(id); + if (cg.isValidIdentifier(id)) return id; +} + +/** + * Create a method name for a given operation, either from its operationId or + * the HTTP verb and path. + */ +export function getOperationName(verb: string, path: string, operationId?: string) { + const id = getOperationIdentifier(operationId); + if (id) return id; + path = path.replace(/\{(.+?)\}/, 'by $1').replace(/\{(.+?)\}/, 'and $1'); + return _.camelCase(`${verb} ${path}`); +} + +export function isNullable(schema: any) { + return !!(schema && schema.nullable); +} + +export function isReference(obj: any): obj is OpenAPIV3.ReferenceObject { + return obj && '$ref' in obj; +} + +//See https://swagger.io/docs/specification/using-ref/ +export function getReference(spec: any, ref: string) { + const path = ref + .slice(2) + .split('/') + .map(s => unescape(s.replace(/~1/g, '/').replace(/~0/g, '~'))); + + const ret = _.get(spec, path); + if (typeof ret === 'undefined') { + throw new Error(`Can't find ${path}`); + } + return ret; +} +/** + * If the given object is a ReferenceObject, return the last part of its path. + */ +export function getReferenceName(obj: any) { + if (isReference(obj)) { + return _.camelCase(obj.$ref.split('/').slice(-1)[0]); + } +} + +/** + * Create a template string literal from the given OpenAPI urlTemplate. + * Curly braces in the path are turned into identifier expressions, + * which are read from the local scope during runtime. + */ +export function createUrlExpression(path: string, qs?: ts.Expression) { + const spans: { expression: ts.Expression; literal: string }[] = []; + // Use a replacer function to collect spans as a side effect: + const head = path.replace(/(.*?)\{(.+?)\}(.*?)(?=\{|$)/g, (_substr, head, name, literal) => { + const expression = _.camelCase(name); + spans.push({ expression: factory.createIdentifier(expression), literal }); + return head; + }); + + if (qs) { + // add the query string as last span + spans.push({ expression: qs, literal: '' }); + } + + return cg.createTemplateString(head, spans); +} + +/** + * Create a call expression for one of the QS runtime functions. + */ +export function callQsFunction(name: string, args: ts.Expression[]) { + return cg.createCall(factory.createPropertyAccessExpression(factory.createIdentifier('QS'), name), { args }); +} + +/** + * Create a call expression for one of the oazapfts runtime functions. + */ +export function callOazapftsFunction(name: string, args: ts.Expression[], typeArgs?: ts.TypeNode[]) { + return cg.createCall(factory.createPropertyAccessExpression(factory.createIdentifier('oazapfts'), name), { + args, + typeArgs, + }); +} + +/** + * Despite its name, OpenApi's `deepObject` serialization does not support + * deeply nested objects. As a workaround we detect parameters that contain + * square brackets and merge them into a single object. + */ +export function supportDeepObjects(params: OpenAPIV3.ParameterObject[]) { + const res: OpenAPIV3.ParameterObject[] = []; + const merged: any = {}; + params.forEach(p => { + const m = /^(.+?)\[(.*?)\]/.exec(p.name); + if (!m) { + res.push(p); + return; + } + const [, name, prop] = m; + let obj = merged[name]; + if (!obj) { + obj = merged[name] = { + name, + in: p.in, + style: 'deepObject', + schema: { + type: 'object', + properties: {}, + }, + }; + res.push(obj); + } + obj.schema.properties[prop] = p.schema; + }); + + return res; +} + +/** + * Main entry point that generates TypeScript code from a given API spec. + */ +export default class ApiGenerator { + public readonly spec: OpenAPIV3.Document; + + constructor(spec: OpenAPIV3.Document) { + this.spec = spec; + } + + aliases: ts.TypeAliasDeclaration[] = []; + + // Collect the types of all referenced schemas so we can export them later + refs: Record = {}; + + // Keep track of already used type aliases + typeAliases: Record = {}; + + reset() { + this.aliases = []; + this.refs = {}; + this.typeAliases = {}; + } + + resolve(obj: T | OpenAPIV3.ReferenceObject) { + if (!isReference(obj)) return obj; + const ref = obj.$ref; + if (!ref.startsWith('#/')) { + throw new Error(`External refs are not supported (${ref}). Make sure to call SwaggerParser.bundle() first.`); + } + return getReference(this.spec, ref) as T; + } + + resolveArray(array?: (T | OpenAPIV3.ReferenceObject)[]) { + return array ? array.map(el => this.resolve(el)) : []; + } + + getUniqueAlias(name: string) { + let used = this.typeAliases[name] || 0; + if (used) { + this.typeAliases[name] = ++used; + name += used; + } + this.typeAliases[name] = 1; + return name; + } + + getRefBasename(ref: string): string { + return ref.replace(/.+\//, ''); + } + + /** + * Create a type alias for the schema referenced by the given ReferenceObject + */ + getRefAlias(obj: OpenAPIV3.ReferenceObject) { + const { $ref } = obj; + let ref = this.refs[$ref]; + if (!ref) { + const schema = this.resolve(obj); + const name = this.getUniqueAlias(_.upperFirst(_.camelCase(schema.title || this.getRefBasename($ref)))); + + ref = this.refs[$ref] = factory.createTypeReferenceNode(name, undefined); + + const type = this.getTypeFromSchema(schema); + this.aliases.push( + cg.createTypeAliasDeclaration({ + modifiers: [cg.modifier.export], + name, + type, + }) + ); + } + return ref; + } + + getUnionType( + variants: (OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject)[], + discriminator?: OpenAPIV3.DiscriminatorObject + ): ts.TypeNode { + if (discriminator) { + // oneOf + discriminator -> tagged union (polymorphism) + if (discriminator.propertyName === undefined) { + throw new Error('Discriminators require a propertyName'); + } + + // By default, the last component of the ref name (i.e., after the last trailing slash) is + // used as the discriminator value for each variant. This can be overridden using the + // discriminator.mapping property. + const mappedValues = new Set(Object.values(discriminator.mapping || {}).map(ref => this.getRefBasename(ref))); + + return factory.createUnionTypeNode( + ( + [ + ...Object.entries(discriminator.mapping || {}).map(([discriminatorValue, variantRef]) => [ + discriminatorValue, + { $ref: variantRef }, + ]), + ...variants + .filter(variant => { + if (!isReference(variant)) { + // From the Swagger spec: "When using the discriminator, inline schemas will not be + // considered." + throw new Error('Discriminators require references, not inline schemas'); + } + return !mappedValues.has(this.getRefBasename(variant.$ref)); + }) + .map(schema => [this.getRefBasename((schema as OpenAPIV3.ReferenceObject).$ref), schema]), + ] as [string, OpenAPIV3.ReferenceObject][] + ).map(([discriminatorValue, variant]) => + // Yields: { [discriminator.propertyName]: discriminatorValue } & variant + factory.createIntersectionTypeNode([ + factory.createTypeLiteralNode([ + cg.createPropertySignature({ + name: discriminator.propertyName, + type: factory.createLiteralTypeNode(factory.createStringLiteral(discriminatorValue)), + }), + ]), + this.getTypeFromSchema(variant), + ]) + ) + ); + } + + // oneOf -> untagged union + return factory.createUnionTypeNode(variants.map(schema => this.getTypeFromSchema(schema))); + } + + /** + * Creates a type node from a given schema. + * Delegates to getBaseTypeFromSchema internally and + * optionally adds a union with null. + */ + getTypeFromSchema(schema?: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject): ts.TypeNode { + const type = this.getBaseTypeFromSchema(schema); + return isNullable(schema) ? factory.createUnionTypeNode([type, cg.keywordType.null]) : type; + } + + /** + * This is the very core of the OpenAPI to TS conversion - it takes a + * schema and returns the appropriate type. + */ + getBaseTypeFromSchema(schema?: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject): ts.TypeNode { + if (!schema) return cg.keywordType.any; + if (isReference(schema)) { + return this.getRefAlias(schema); + } + + if (schema.oneOf) { + // oneOf -> union + return this.getUnionType(schema.oneOf, schema.discriminator); + } + + if (schema.anyOf) { + // anyOf -> union + return factory.createUnionTypeNode(schema.anyOf.map(schema => this.getTypeFromSchema(schema))); + } + + if (schema.allOf) { + // allOf -> intersection + return factory.createIntersectionTypeNode(schema.allOf.map(schema => this.getTypeFromSchema(schema))); + } + + if ('items' in schema) { + // items -> array + return factory.createArrayTypeNode(this.getTypeFromSchema(schema.items)); + } + + if (schema.properties || schema.additionalProperties) { + // properties -> literal type + return this.getTypeFromProperties(schema.properties || {}, schema.required, schema.additionalProperties); + } + + if (schema.enum) { + // enum -> union of literal types + const types = schema.enum.map(s => { + if (s === null) return cg.keywordType.null; + if (typeof s === 'boolean') { + return s + ? factory.createLiteralTypeNode(ts.factory.createToken(ts.SyntaxKind.TrueKeyword)) + : factory.createLiteralTypeNode(ts.factory.createToken(ts.SyntaxKind.FalseKeyword)); + } + if (typeof s === 'number') { + return factory.createLiteralTypeNode(factory.createNumericLiteral(s)); + } + return factory.createLiteralTypeNode(factory.createStringLiteral(s)); + }); + return types.length > 1 ? factory.createUnionTypeNode(types) : types[0]; + } + + if (schema.format == 'binary') { + return factory.createTypeReferenceNode('Blob', []); + } + + if (schema.type) { + // string, boolean, null, number + if (schema.type in cg.keywordType) return cg.keywordType[schema.type]; + if (schema.type === 'integer') return cg.keywordType.number; + } + + return cg.keywordType.any; + } + + /** + * Recursively creates a type literal with the given props. + */ + getTypeFromProperties( + props: { + [prop: string]: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject; + }, + required?: string[], + additionalProperties?: boolean | OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject + ) { + const members: ts.TypeElement[] = Object.keys(props).map(name => { + const schema = props[name]; + const isRequired = required && required.includes(name); + return cg.createPropertySignature({ + questionToken: !isRequired, + name, + type: this.getTypeFromSchema(schema), + }); + }); + + if (additionalProperties) { + const type = additionalProperties === true ? cg.keywordType.any : this.getTypeFromSchema(additionalProperties); + + members.push(cg.createIndexSignature(type)); + } + + return factory.createTypeLiteralNode(members); + } + + getTypeFromResponses(responses: OpenAPIV3.ResponsesObject) { + return factory.createUnionTypeNode( + Object.entries(responses).map(([code, res]) => { + const statusType = + code === 'default' + ? cg.keywordType.number + : factory.createLiteralTypeNode(factory.createNumericLiteral(code)); + + const props = [ + cg.createPropertySignature({ + name: 'status', + type: statusType, + }), + ]; + + const dataType = this.getTypeFromResponse(res); + if (dataType !== cg.keywordType.void) { + props.push( + cg.createPropertySignature({ + name: 'data', + type: dataType, + }) + ); + } + return factory.createTypeLiteralNode(props); + }) + ); + } + + getTypeFromResponse(resOrRef: OpenAPIV3.ResponseObject | OpenAPIV3.ReferenceObject) { + const res = this.resolve(resOrRef); + if (!res || !res.content) return cg.keywordType.void; + return this.getTypeFromSchema(this.getSchemaFromContent(res.content)); + } + + getResponseType(responses?: OpenAPIV3.ResponsesObject): 'json' | 'text' | 'blob' { + // backwards-compatibility + if (!responses) return 'text'; + + const resolvedResponses = Object.values(responses).map(response => this.resolve(response)); + + // if no content is specified, assume `text` (backwards-compatibility) + if (!resolvedResponses.some(res => Object.keys(res.content ?? []).length > 0)) { + return 'text'; + } + + const isJson = resolvedResponses.some(response => { + const responseMimeTypes = Object.keys(response.content ?? {}); + return responseMimeTypes.some(mimeType => contentTypes[mimeType] === 'json'); + }); + + // if there’s `application/json` or `*/*`, assume `json` + if (isJson) { + return 'json'; + } + + // if there’s `text/*`, assume `text` + if (resolvedResponses.some(res => Object.keys(res.content ?? []).some(type => type.startsWith('text/')))) { + return 'text'; + } + + // for the rest, assume `blob` + return 'blob'; + } + + getSchemaFromContent(content: any) { + const contentType = Object.keys(contentTypes).find(t => t in content); + let schema; + if (contentType) { + schema = _.get(content, [contentType, 'schema']); + } + if (schema) { + return schema; + } + + // if no content is specified -> string + // `text/*` -> string + if (Object.keys(content).length === 0 || Object.keys(content).some(type => type.startsWith('text/'))) { + return { type: 'string' }; + } + + // rest (e.g. `application/octet-stream`, `application/gzip`, …) -> binary + return { type: 'string', format: 'binary' }; + } + + wrapResult(ex: ts.Expression) { + return ex; + // return this.opts?.optimistic ? callOazapftsFunction('ok', [ex]) : ex; + } + + generateApi() { + this.reset(); + + // Parse ApiStub.ts so that we don't have to generate everything manually + const stub = cg.parseFile(path.resolve(__dirname, './ApiStub.ts')); + + // ApiStub contains `const servers = {}`, find it ... + // const servers = cg.findFirstVariableDeclaration(stub.statements, 'servers'); + // servers.initializer is readonly, this might break in a future TS version, but works fine for now. + // Object.assign(servers, { + // initializer: generateServers(this.spec.servers || []), + // }); + + const { initializer } = cg.findFirstVariableDeclaration(stub.statements, 'defaults'); + if (!initializer || !ts.isObjectLiteralExpression(initializer)) { + throw new Error('No object literal: defaults'); + } + + // cg.changePropertyValue( + // initializer, + // 'baseUrl', + // defaultBaseUrl(this.spec.servers || []), + // ); + + // Collect class functions to be added... + const functions: ts.FunctionDeclaration[] = []; + + // Keep track of names to detect duplicates + const names: Record = {}; + + Object.keys(this.spec.paths).forEach(path => { + const item = this.spec.paths[path]; + + if (!item) { + return; + } + + Object.keys(this.resolve(item)).forEach(verb => { + const method = verb.toUpperCase(); + // skip summary/description/parameters etc... + if (!verbs.includes(method)) return; + + const op: OpenAPIV3.OperationObject = (item as any)[verb]; + const { + operationId, + requestBody, + responses, + summary, + description, + // tags, + } = op; + + let name = getOperationName(verb, path, operationId); + const count = (names[name] = (names[name] || 0) + 1); + if (count > 1) { + // The name is already taken, which means that the spec is probably + // invalid as operationIds must be unique. Since this is quite common + // nevertheless we append a counter: + name += count; + } + + // merge item and op parameters + const resolvedParameters = [...this.resolveArray(item.parameters), ...this.resolveArray(op.parameters)]; + + // expand older OpenAPI parameters into deepObject style where needed + // const parameters = this.isConverted ? supportDeepObjects(resolvedParameters) : resolvedParameters; + const parameters = resolvedParameters; + + // split into required/optional + const [required, optional] = _.partition(parameters, 'required'); + + // convert parameter names to argument names ... + const argNames: any = {}; + parameters + .map(p => p.name) + .sort((a, b) => a.length - b.length) + .forEach(name => { + argNames[name] = _.camelCase(name); + }); + + // build the method signature - first all the required parameters + const methodParams = required.map(p => + cg.createParameter(argNames[this.resolve(p).name], { + type: this.getTypeFromSchema(isReference(p) ? p : p.schema), + }) + ); + + let body: any; + let bodyVar; + + // add body if present + if (requestBody) { + body = this.resolve(requestBody); + const schema = this.getSchemaFromContent(body.content); + const type = this.getTypeFromSchema(schema); + bodyVar = _.camelCase((type as any).name || getReferenceName(schema) || 'body'); + methodParams.push( + cg.createParameter(bodyVar, { + type, + questionToken: !body.required, + }) + ); + } + + // add an object with all optional parameters + if (optional.length) { + methodParams.push( + cg.createParameter( + cg.createObjectBinding( + optional.map(param => this.resolve(param)).map(({ name }) => ({ name: argNames[name] })) + ), + { + initializer: factory.createObjectLiteralExpression(), + type: factory.createTypeLiteralNode( + optional.map(p => + cg.createPropertySignature({ + name: argNames[this.resolve(p).name], + questionToken: true, + type: this.getTypeFromSchema(isReference(p) ? p : p.schema), + }) + ) + ), + } + ) + ); + } + + methodParams.push( + cg.createParameter('opts', { + type: factory.createTypeReferenceNode('Oazapfts.RequestOpts', undefined), + questionToken: true, + }) + ); + + // Next, build the method body... + + const returnType = this.getResponseType(responses); + const query = parameters.filter(p => p.in === 'query'); + const header = parameters.filter(p => p.in === 'header').map(p => p.name); + let qs; + if (query.length) { + const paramsByFormatter = _.groupBy(query, getFormatter); + qs = callQsFunction( + 'query', + Object.entries(paramsByFormatter).map(([format, params]) => { + //const [allowReserved, encodeReserved] = _.partition(params, "allowReserved"); + return callQsFunction(format, [cg.createObjectLiteral(params.map(p => [p.name, argNames[p.name]]))]); + }) + ); + } + + const url = createUrlExpression(path, qs); + const init: ts.ObjectLiteralElementLike[] = [factory.createSpreadAssignment(factory.createIdentifier('opts'))]; + + if (method !== 'GET') { + init.push(factory.createPropertyAssignment('method', factory.createStringLiteral(method))); + } + + if (bodyVar) { + init.push(cg.createPropertyAssignment('body', factory.createIdentifier(bodyVar))); + } + + if (header.length) { + init.push( + factory.createPropertyAssignment( + 'headers', + factory.createObjectLiteralExpression( + [ + factory.createSpreadAssignment( + factory.createLogicalAnd( + factory.createIdentifier('opts'), + factory.createPropertyAccessExpression(factory.createIdentifier('opts'), 'headers') + ) + ), + ...header.map(name => cg.createPropertyAssignment(name, factory.createIdentifier(argNames[name]))), + ], + true + ) + ) + ); + } + + const args: ts.Expression[] = [url]; + + if (init.length) { + const m = Object.entries(contentTypes).find(([type]) => { + return !!_.get(body, ['content', type]); + }); + const initObj = factory.createObjectLiteralExpression(init, true); + args.push(m ? callOazapftsFunction(m[1], [initObj]) : initObj); // json, form, multipart + } + + functions.push( + cg.addComment( + cg.createFunctionDeclaration( + name, + { + modifiers: [cg.modifier.export], + }, + methodParams, + cg.block( + factory.createReturnStatement( + this.wrapResult( + callOazapftsFunction( + { + json: 'fetchJson', + text: 'fetchText', + blob: 'fetchBlob', + }[returnType], + args, + returnType === 'json' || returnType === 'blob' + ? [this.getTypeFromResponses(responses!) || ts.SyntaxKind.AnyKeyword] + : undefined + ) + ) + ) + ) + ), + summary || description + ) + ); + }); + }); + + Object.assign(stub, { + statements: cg.appendNodes(stub.statements, ...[...this.aliases, ...functions]), + }); + + return stub; + } +} diff --git a/packages/cli/src/generator/typescript/oaz/tscodegen.ts b/packages/cli/src/generator/typescript/oaz/tscodegen.ts new file mode 100644 index 00000000..bbbb676a --- /dev/null +++ b/packages/cli/src/generator/typescript/oaz/tscodegen.ts @@ -0,0 +1,434 @@ +/* eslint-disable no-shadow */ +/* eslint-disable no-use-before-define */ +/* eslint-disable @typescript-eslint/consistent-indexed-object-style */ +/* eslint-disable default-case */ +/* eslint-disable consistent-return */ +/* eslint-disable no-unused-expressions */ +import fs from 'fs'; +import ts, { factory } from 'typescript'; + +ts.parseIsolatedEntityName; +type KeywordTypeName = 'any' | 'number' | 'object' | 'string' | 'boolean' | 'undefined' | 'null'; + +export const questionToken = factory.createToken(ts.SyntaxKind.QuestionToken); + +export function createQuestionToken(token?: boolean | ts.QuestionToken) { + if (!token) return undefined; + if (token === true) return questionToken; + return token; +} + +export function createKeywordType(type: KeywordTypeName) { + switch (type) { + case 'any': + return factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword); + case 'number': + return factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword); + case 'object': + return factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword); + case 'string': + return factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword); + case 'boolean': + return factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword); + case 'undefined': + return factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword); + case 'null': + return factory.createLiteralTypeNode(ts.factory.createToken(ts.SyntaxKind.NullKeyword)); + } +} + +export const keywordType: { + [type: string]: ts.KeywordTypeNode | ts.LiteralTypeNode; +} = { + any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword), + number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword), + object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword), + string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), + boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword), + undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword), + null: factory.createLiteralTypeNode(ts.factory.createToken(ts.SyntaxKind.NullKeyword)), +}; + +export const modifier = { + async: factory.createModifier(ts.SyntaxKind.AsyncKeyword), + export: factory.createModifier(ts.SyntaxKind.ExportKeyword), +}; + +export function createTypeAliasDeclaration({ + decorators, + modifiers, + name, + typeParameters, + type, +}: { + decorators?: ts.Decorator[]; + modifiers?: ts.Modifier[]; + name: string | ts.Identifier; + typeParameters?: ts.TypeParameterDeclaration[]; + type: ts.TypeNode; +}) { + return factory.createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type); +} + +export function toExpression(ex: ts.Expression | string) { + if (typeof ex === 'string') return factory.createIdentifier(ex); + return ex; +} + +export function createCall( + expression: ts.Expression | string, + { + typeArgs, + args, + }: { + typeArgs?: ts.TypeNode[]; + args?: ts.Expression[]; + } = {} +) { + return factory.createCallExpression(toExpression(expression), typeArgs, args); +} + +export function createMethodCall( + method: string, + opts: { + typeArgs?: ts.TypeNode[]; + args?: ts.Expression[]; + } +) { + return createCall(factory.createPropertyAccessExpression(factory.createThis(), method), opts); +} + +export function createObjectLiteral(props: [string, string | ts.Expression][]) { + return factory.createObjectLiteralExpression( + props.map(([name, identifier]) => createPropertyAssignment(name, toExpression(identifier))), + true + ); +} + +export function createPropertyAssignment(name: string, expression: ts.Expression) { + if (ts.isIdentifier(expression)) { + if (expression.text === name) { + return factory.createShorthandPropertyAssignment(name); + } + } + return factory.createPropertyAssignment(propertyName(name), expression); +} + +export function block(...statements: ts.Statement[]) { + return factory.createBlock(statements, true); +} + +export function createArrowFunction( + parameters: ts.ParameterDeclaration[], + body: ts.ConciseBody, + { + modifiers, + typeParameters, + type, + equalsGreaterThanToken, + }: { + modifiers?: ts.Modifier[]; + typeParameters?: ts.TypeParameterDeclaration[]; + type?: ts.TypeNode; + equalsGreaterThanToken?: ts.EqualsGreaterThanToken; + } = {} +) { + return factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body); +} + +export function createFunctionDeclaration( + name: string | ts.Identifier | undefined, + { + decorators, + modifiers, + asteriskToken, + typeParameters, + type, + }: { + decorators?: ts.Decorator[]; + modifiers?: ts.Modifier[]; + asteriskToken?: ts.AsteriskToken; + typeParameters?: ts.TypeParameterDeclaration[]; + type?: ts.TypeNode; + }, + parameters: ts.ParameterDeclaration[], + body?: ts.Block +): ts.FunctionDeclaration { + return factory.createFunctionDeclaration( + decorators, + modifiers, + asteriskToken, + name, + typeParameters, + parameters, + type, + body + ); +} + +export function createClassDeclaration({ + decorators, + modifiers, + name, + typeParameters, + heritageClauses, + members, +}: { + decorators?: ts.Decorator[]; + modifiers?: ts.Modifier[]; + name?: string | ts.Identifier; + typeParameters?: ts.TypeParameterDeclaration[]; + heritageClauses?: ts.HeritageClause[]; + members: ts.ClassElement[]; +}) { + return factory.createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members); +} + +export function createConstructor({ + decorators, + modifiers, + parameters, + body, +}: { + decorators?: ts.Decorator[]; + modifiers?: ts.Modifier[]; + parameters: ts.ParameterDeclaration[]; + body?: ts.Block; +}) { + return factory.createConstructorDeclaration(decorators, modifiers, parameters, body); +} + +export function createMethod( + name: string | ts.Identifier | ts.StringLiteral | ts.NumericLiteral | ts.ComputedPropertyName, + { + decorators, + modifiers, + asteriskToken, + questionToken, + typeParameters, + type, + }: { + decorators?: ts.Decorator[]; + modifiers?: ts.Modifier[]; + asteriskToken?: ts.AsteriskToken; + questionToken?: ts.QuestionToken | boolean; + typeParameters?: ts.TypeParameterDeclaration[]; + type?: ts.TypeNode; + } = {}, + parameters: ts.ParameterDeclaration[] = [], + body?: ts.Block +): ts.MethodDeclaration { + return factory.createMethodDeclaration( + decorators, + modifiers, + asteriskToken, + name, + createQuestionToken(questionToken), + typeParameters, + parameters, + type, + body + ); +} + +export function createParameter( + name: string | ts.BindingName, + { + decorators, + modifiers, + dotDotDotToken, + questionToken, + type, + initializer, + }: { + decorators?: ts.Decorator[]; + modifiers?: ts.Modifier[]; + dotDotDotToken?: ts.DotDotDotToken; + questionToken?: ts.QuestionToken | boolean; + type?: ts.TypeNode; + initializer?: ts.Expression; + } +): ts.ParameterDeclaration { + return factory.createParameterDeclaration( + decorators, + modifiers, + dotDotDotToken, + name, + createQuestionToken(questionToken), + type, + initializer + ); +} + +function propertyName(name: string | ts.PropertyName): ts.PropertyName { + if (typeof name === 'string') { + return isValidIdentifier(name) ? factory.createIdentifier(name) : factory.createStringLiteral(name); + } + return name; +} + +export function createPropertySignature({ + modifiers, + name, + questionToken, + type, +}: { + modifiers?: ts.Modifier[]; + name: ts.PropertyName | string; + questionToken?: ts.QuestionToken | boolean; + type?: ts.TypeNode; +}) { + return factory.createPropertySignature(modifiers, propertyName(name), createQuestionToken(questionToken), type); +} + +export function createIndexSignature( + type: ts.TypeNode, + { + decorators, + modifiers, + indexName = 'key', + indexType = keywordType.string, + }: { + indexName?: string; + indexType?: ts.TypeNode; + decorators?: ts.Decorator[]; + modifiers?: ts.Modifier[]; + } = {} +) { + return factory.createIndexSignature(decorators, modifiers, [createParameter(indexName, { type: indexType })], type); +} + +export function createObjectBinding( + elements: { + name: string | ts.BindingName; + dotDotDotToken?: ts.DotDotDotToken; + propertyName?: string | ts.PropertyName; + initializer?: ts.Expression; + }[] +) { + return factory.createObjectBindingPattern( + elements.map(({ dotDotDotToken, propertyName, name, initializer }) => + factory.createBindingElement(dotDotDotToken, propertyName, name, initializer) + ) + ); +} + +export function createTemplateString(head: string, spans: { literal: string; expression: ts.Expression }[]) { + if (!spans.length) return factory.createStringLiteral(head); + return factory.createTemplateExpression( + factory.createTemplateHead(head), + spans.map(({ expression, literal }, i) => + factory.createTemplateSpan( + expression, + i === spans.length - 1 ? factory.createTemplateTail(literal) : factory.createTemplateMiddle(literal) + ) + ) + ); +} + +export function findNode( + nodes: ts.NodeArray, + kind: T extends { kind: infer K } ? K : never, + test?: (node: T) => boolean | undefined +): T { + const node = nodes.find(s => s.kind === kind && (!test || test(s as T))) as T; + if (!node) throw new Error(`Node not found: ${kind}`); + return node; +} + +export function getName(name: ts.Node) { + if (ts.isIdentifier(name)) { + return name.escapedText; + } + if (ts.isLiteralExpression(name)) { + return name.text; + } + return ''; +} + +export function getFirstDeclarationName(n: ts.VariableStatement) { + const name = ts.getNameOfDeclaration(n.declarationList.declarations[0]); + return name ? getName(name) : ''; +} + +export function findFirstVariableDeclaration(nodes: ts.NodeArray, name: string) { + const statement = findNode( + nodes, + ts.SyntaxKind.VariableStatement, + n => getFirstDeclarationName(n) === name + ); + const [first] = statement.declarationList.declarations; + if (!first) throw new Error('Missing declaration'); + return first; +} + +export function changePropertyValue(o: ts.ObjectLiteralExpression, property: string, value: ts.Expression) { + const p = o.properties.find(p => ts.isPropertyAssignment(p) && getName(p.name) === property); + if (p && ts.isPropertyAssignment(p)) { + // p.initializer is readonly, this might break in a future TS version, but works fine for now. + Object.assign(p, { initializer: value }); + } else { + throw new Error(`No such property: ${property}`); + } +} + +export function appendNodes(array: ts.NodeArray, ...nodes: T[]) { + return factory.createNodeArray([...array, ...nodes]); +} + +export function addComment(node: T, comment?: string) { + if (!comment) return node; + return ts.addSyntheticLeadingComment( + node, + ts.SyntaxKind.MultiLineCommentTrivia, + `*\n * ${comment.replace(/\n/g, '\n * ')}\n `, + true + ); +} + +export function parseFile(file: string) { + return ts.createSourceFile( + file, + fs.readFileSync(file, 'utf8'), + ts.ScriptTarget.Latest, + /* setParentNodes */ false, + ts.ScriptKind.TS + ); +} + +const printer = ts.createPrinter({ + newLine: ts.NewLineKind.LineFeed, +}); + +export function printNode(node: ts.Node) { + const file = ts.createSourceFile( + 'someFileName.ts', + '', + ts.ScriptTarget.Latest, + /* setParentNodes */ false, + ts.ScriptKind.TS + ); + return printer.printNode(ts.EmitHint.Unspecified, node, file); +} + +export function printNodes(nodes: ts.Node[]) { + const file = ts.createSourceFile( + 'someFileName.ts', + '', + ts.ScriptTarget.Latest, + /* setParentNodes */ false, + ts.ScriptKind.TS + ); + + return nodes.map(node => printer.printNode(ts.EmitHint.Unspecified, node, file)).join('\n'); +} + +export function printFile(sourceFile: ts.SourceFile) { + return printer.printFile(sourceFile); +} + +export function isValidIdentifier(str: string) { + if (!str.length || str.trim() !== str) return false; + const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest); + return !!node && node.kind === ts.SyntaxKind.Identifier && node.originalKeywordKind === undefined; +} diff --git a/packages/cli/test/fixtures/simple.oas.json b/packages/cli/test/fixtures/simple.oas.json new file mode 100644 index 00000000..6fc36bec --- /dev/null +++ b/packages/cli/test/fixtures/simple.oas.json @@ -0,0 +1,287 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "1.0.0", + "title": "Swagger Petstore" + }, + "servers": [ + { + "url": "http://petstore.swagger.io/v2" + } + ], + "paths": { + "/pet/findByStatus": { + "get": { + "tags": ["pet"], + "summary": "Finds Pets by status", + "description": "Multiple status values can be provided with comma separated strings", + "operationId": "findPetsByStatus", + "parameters": [ + { + "name": "status", + "in": "query", + "description": "Status values that need to be considered for filter", + "required": true, + "explode": true, + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": ["available", "pending", "sold"], + "default": "available" + } + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/xml": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Pet" + } + } + }, + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + }, + "400": { + "description": "Invalid status value" + } + }, + "security": [ + { + "petstore_auth": ["write:pets", "read:pets"] + } + ] + } + } + }, + "components": { + "requestBodies": { + "Pet": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + }, + "application/xml": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + }, + "description": "Pet object that needs to be added to the store", + "required": true + }, + "UserArray": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/User" + } + } + } + }, + "description": "List of user object", + "required": true + } + }, + "securitySchemes": { + "petstore_auth": { + "type": "oauth2", + "flows": { + "implicit": { + "authorizationUrl": "http://petstore.swagger.io/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } + }, + "api_key": { + "type": "apiKey", + "name": "api_key", + "in": "header" + } + }, + "schemas": { + "Order": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "petId": { + "type": "integer", + "format": "int64" + }, + "quantity": { + "type": "integer", + "format": "int32" + }, + "shipDate": { + "type": "string", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Order Status", + "enum": ["placed", "approved", "delivered"] + }, + "complete": { + "type": "boolean", + "default": false + } + }, + "xml": { + "name": "Order" + } + }, + "Category": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + }, + "xml": { + "name": "Category" + } + }, + "User": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "username": { + "type": "string" + }, + "firstName": { + "type": "string" + }, + "lastName": { + "type": "string" + }, + "email": { + "type": "string" + }, + "password": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "userStatus": { + "type": "integer", + "format": "int32", + "description": "User Status" + } + }, + "xml": { + "name": "User" + } + }, + "Tag": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + }, + "xml": { + "name": "Tag" + } + }, + "Pet": { + "type": "object", + "required": ["name", "photoUrls"], + "properties": { + "id": { + "type": "integer", + "format": "int64", + "readOnly": true, + "default": 40, + "example": 25 + }, + "category": { + "$ref": "#/components/schemas/Category" + }, + "name": { + "type": "string", + "example": "doggie" + }, + "photoUrls": { + "type": "array", + "xml": { + "name": "photoUrl", + "wrapped": true + }, + "items": { + "type": "string", + "example": "https://example.com/photo.png" + } + }, + "tags": { + "type": "array", + "xml": { + "name": "tag", + "wrapped": true + }, + "items": { + "$ref": "#/components/schemas/Tag" + } + }, + "status": { + "type": "string", + "description": "pet status in the store", + "enum": ["available", "pending", "sold"] + } + }, + "xml": { + "name": "Pet" + } + }, + "ApiResponse": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "type": { + "type": "string" + }, + "message": { + "type": "string" + } + } + } + } + } +} diff --git a/packages/cli/test/generator/typescript.test.ts b/packages/cli/test/generator/typescript.test.ts new file mode 100644 index 00000000..2e2a9499 --- /dev/null +++ b/packages/cli/test/generator/typescript.test.ts @@ -0,0 +1,38 @@ +import Oas from 'oas'; +import typescriptGenerator from '../../src/generator/typescript'; + +// import uspto from '@readme/oas-examples/3.0/json/uspto.json'; + +// //////////////////////////////////////////////////////// +import { inspect } from 'util'; + +declare global { + interface Console { + logx: any; + } +} + +console.logx = (obj: any) => { + console.log(inspect(obj, false, null, true)); +}; +// //////////////////////////////////////////////////////// + +describe('typescript generator', function () { + let petstore: Oas; + + beforeEach(async function () { + petstore = await import('../fixtures/simple.oas.json').then(Oas.init); + await petstore.dereference({ preserveRefAsJSONSchemaTitle: true }); + }); + + it('should generate typescript code', async function () { + await typescriptGenerator(petstore); + // const gen = await typescriptGenerator(petstore); + // console.log(gen) + + // console.log(ast); + + + // console.log(petstore) + }); +}); diff --git a/packages/cli/test/tsconfig.json b/packages/cli/test/tsconfig.json index 95898fce..a0f0f689 100644 --- a/packages/cli/test/tsconfig.json +++ b/packages/cli/test/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../tsconfig", "compilerOptions": { - "noEmit": true + "noEmit": true, + "resolveJsonModule": true }, "references": [ {"path": ".."} diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 34727dbc..e98929e4 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "declaration": true, + "esModuleInterop": true, // We need this to to be able to load `typescript` in the TS generator. "importHelpers": true, "module": "commonjs", "outDir": "dist", From d217a06878ee3164f6f00ff3727a6024720124ac Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Mon, 7 Mar 2022 13:29:35 -0800 Subject: [PATCH 4/5] feat: migrating codegen over to using ts-morph --- package-lock.json | 88 ++- packages/cli/package-lock.json | 68 +- packages/cli/package.json | 2 +- .../cli/src/generator/typescript/index.ts | 232 ++++-- .../src/generator/typescript/oaz/APIStub.ts | 16 - .../src/generator/typescript/oaz/generate.ts | 717 ------------------ .../src/generator/typescript/oaz/tscodegen.ts | 434 ----------- 7 files changed, 338 insertions(+), 1219 deletions(-) delete mode 100644 packages/cli/src/generator/typescript/oaz/APIStub.ts delete mode 100644 packages/cli/src/generator/typescript/oaz/generate.ts delete mode 100644 packages/cli/src/generator/typescript/oaz/tscodegen.ts diff --git a/package-lock.json b/package-lock.json index bba74bb1..4153268d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1814,6 +1814,28 @@ "node": ">= 6" } }, + "node_modules/@ts-morph/common": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.12.3.tgz", + "integrity": "sha512-4tUmeLyXJnJWvTFOKtcNJ1yh0a3SsTLi2MUoyj8iUNznFRN1ZquaNe7Oukqrnki2FzZkm0J9adCNLDZxUzvj+w==", + "dependencies": { + "fast-glob": "^3.2.7", + "minimatch": "^3.0.4", + "mkdirp": "^1.0.4", + "path-browserify": "^1.0.1" + } + }, + "node_modules/@ts-morph/common/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", @@ -3214,6 +3236,14 @@ "node": ">=10" } }, + "node_modules/code-block-writer": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-11.0.0.tgz", + "integrity": "sha512-GEqWvEWWsOvER+g9keO4ohFoD3ymwyCnqY3hoTr7GZipYFwEhMHJw+TtV0rfgRhNImM6QWZGO2XYjlJVyYT62w==", + "dependencies": { + "tslib": "2.3.1" + } + }, "node_modules/code-error-fragment": { "version": "0.0.230", "resolved": "https://registry.npmjs.org/code-error-fragment/-/code-error-fragment-0.0.230.tgz", @@ -9233,6 +9263,11 @@ "which": "bin/which" } }, + "node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -11367,6 +11402,15 @@ "node": ">=8" } }, + "node_modules/ts-morph": { + "version": "13.0.3", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-13.0.3.tgz", + "integrity": "sha512-pSOfUMx8Ld/WUreoSzvMFQG5i9uEiWIsBYjpU9+TTASOeUa89j5HykomeqVULm1oqWtBdleI3KEFRLrlA3zGIw==", + "dependencies": { + "@ts-morph/common": "~0.12.3", + "code-block-writer": "^11.0.0" + } + }, "node_modules/ts-node": { "version": "10.5.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.5.0.tgz", @@ -12514,8 +12558,8 @@ "fetch-har": "^6.1.0", "js-yaml": "^4.1.0", "json-schema-to-typescript": "^10.1.5", - "lodash": "^4.17.21", "oas": "^17.7.3", + "ts-morph": "^13.0.3", "typescript": "^4.6.2" }, "devDependencies": { @@ -13911,12 +13955,12 @@ "globby": "^11.1.0", "js-yaml": "^4.1.0", "json-schema-to-typescript": "^10.1.5", - "lodash": "^4.17.21", "mocha": "^9.2.0", "oas": "^17.7.3", "oclif": "^2.4.4", "prettier": "^2.5.1", "shx": "^0.3.3", + "ts-morph": "^13.0.3", "ts-node": "^10.5.0", "tslib": "^2.3.1", "typescript": "^4.6.2" @@ -14120,6 +14164,24 @@ "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", "dev": true }, + "@ts-morph/common": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.12.3.tgz", + "integrity": "sha512-4tUmeLyXJnJWvTFOKtcNJ1yh0a3SsTLi2MUoyj8iUNznFRN1ZquaNe7Oukqrnki2FzZkm0J9adCNLDZxUzvj+w==", + "requires": { + "fast-glob": "^3.2.7", + "minimatch": "^3.0.4", + "mkdirp": "^1.0.4", + "path-browserify": "^1.0.1" + }, + "dependencies": { + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + } + } + }, "@tsconfig/node10": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", @@ -15190,6 +15252,14 @@ "mkdirp-infer-owner": "^2.0.0" } }, + "code-block-writer": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-11.0.0.tgz", + "integrity": "sha512-GEqWvEWWsOvER+g9keO4ohFoD3ymwyCnqY3hoTr7GZipYFwEhMHJw+TtV0rfgRhNImM6QWZGO2XYjlJVyYT62w==", + "requires": { + "tslib": "2.3.1" + } + }, "code-error-fragment": { "version": "0.0.230", "resolved": "https://registry.npmjs.org/code-error-fragment/-/code-error-fragment-0.0.230.tgz", @@ -19743,6 +19813,11 @@ } } }, + "path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" + }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -21367,6 +21442,15 @@ "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", "dev": true }, + "ts-morph": { + "version": "13.0.3", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-13.0.3.tgz", + "integrity": "sha512-pSOfUMx8Ld/WUreoSzvMFQG5i9uEiWIsBYjpU9+TTASOeUa89j5HykomeqVULm1oqWtBdleI3KEFRLrlA3zGIw==", + "requires": { + "@ts-morph/common": "~0.12.3", + "code-block-writer": "^11.0.0" + } + }, "ts-node": { "version": "10.5.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.5.0.tgz", diff --git a/packages/cli/package-lock.json b/packages/cli/package-lock.json index 8562fea9..08852433 100644 --- a/packages/cli/package-lock.json +++ b/packages/cli/package-lock.json @@ -17,8 +17,8 @@ "fetch-har": "^6.1.0", "js-yaml": "^4.1.0", "json-schema-to-typescript": "^10.1.5", - "lodash": "^4.17.21", "oas": "^17.7.3", + "ts-morph": "^13.0.3", "typescript": "^4.6.2" }, "devDependencies": { @@ -1007,6 +1007,17 @@ "node": ">= 6" } }, + "node_modules/@ts-morph/common": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.12.3.tgz", + "integrity": "sha512-4tUmeLyXJnJWvTFOKtcNJ1yh0a3SsTLi2MUoyj8iUNznFRN1ZquaNe7Oukqrnki2FzZkm0J9adCNLDZxUzvj+w==", + "dependencies": { + "fast-glob": "^3.2.7", + "minimatch": "^3.0.4", + "mkdirp": "^1.0.4", + "path-browserify": "^1.0.1" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", @@ -2271,6 +2282,14 @@ "node": ">=10" } }, + "node_modules/code-block-writer": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-11.0.0.tgz", + "integrity": "sha512-GEqWvEWWsOvER+g9keO4ohFoD3ymwyCnqY3hoTr7GZipYFwEhMHJw+TtV0rfgRhNImM6QWZGO2XYjlJVyYT62w==", + "dependencies": { + "tslib": "2.3.1" + } + }, "node_modules/code-error-fragment": { "version": "0.0.230", "resolved": "https://registry.npmjs.org/code-error-fragment/-/code-error-fragment-0.0.230.tgz", @@ -7306,6 +7325,11 @@ "which": "bin/which" } }, + "node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" + }, "node_modules/path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -9244,6 +9268,15 @@ "integrity": "sha512-whw60l7r+8ZU8Tu/Uc2yxtc4ZTZbR/PF3u1IPNKGQ6p8EICLb3Z2lAgoqw9bqYd8IkgnsaOcLzYHFckjqNsf0g==", "dev": true }, + "node_modules/ts-morph": { + "version": "13.0.3", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-13.0.3.tgz", + "integrity": "sha512-pSOfUMx8Ld/WUreoSzvMFQG5i9uEiWIsBYjpU9+TTASOeUa89j5HykomeqVULm1oqWtBdleI3KEFRLrlA3zGIw==", + "dependencies": { + "@ts-morph/common": "~0.12.3", + "code-block-writer": "^11.0.0" + } + }, "node_modules/ts-node": { "version": "10.5.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.5.0.tgz", @@ -11150,6 +11183,17 @@ "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", "dev": true }, + "@ts-morph/common": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.12.3.tgz", + "integrity": "sha512-4tUmeLyXJnJWvTFOKtcNJ1yh0a3SsTLi2MUoyj8iUNznFRN1ZquaNe7Oukqrnki2FzZkm0J9adCNLDZxUzvj+w==", + "requires": { + "fast-glob": "^3.2.7", + "minimatch": "^3.0.4", + "mkdirp": "^1.0.4", + "path-browserify": "^1.0.1" + } + }, "@tsconfig/node10": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", @@ -12088,6 +12132,14 @@ "mkdirp-infer-owner": "^2.0.0" } }, + "code-block-writer": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-11.0.0.tgz", + "integrity": "sha512-GEqWvEWWsOvER+g9keO4ohFoD3ymwyCnqY3hoTr7GZipYFwEhMHJw+TtV0rfgRhNImM6QWZGO2XYjlJVyYT62w==", + "requires": { + "tslib": "2.3.1" + } + }, "code-error-fragment": { "version": "0.0.230", "resolved": "https://registry.npmjs.org/code-error-fragment/-/code-error-fragment-0.0.230.tgz", @@ -15910,6 +15962,11 @@ } } }, + "path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" + }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -17367,6 +17424,15 @@ "integrity": "sha512-whw60l7r+8ZU8Tu/Uc2yxtc4ZTZbR/PF3u1IPNKGQ6p8EICLb3Z2lAgoqw9bqYd8IkgnsaOcLzYHFckjqNsf0g==", "dev": true }, + "ts-morph": { + "version": "13.0.3", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-13.0.3.tgz", + "integrity": "sha512-pSOfUMx8Ld/WUreoSzvMFQG5i9uEiWIsBYjpU9+TTASOeUa89j5HykomeqVULm1oqWtBdleI3KEFRLrlA3zGIw==", + "requires": { + "@ts-morph/common": "~0.12.3", + "code-block-writer": "^11.0.0" + } + }, "ts-node": { "version": "10.5.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.5.0.tgz", diff --git a/packages/cli/package.json b/packages/cli/package.json index e5ace673..04361695 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -42,8 +42,8 @@ "fetch-har": "^6.1.0", "js-yaml": "^4.1.0", "json-schema-to-typescript": "^10.1.5", - "lodash": "^4.17.21", "oas": "^17.7.3", + "ts-morph": "^13.0.3", "typescript": "^4.6.2" }, "devDependencies": { diff --git a/packages/cli/src/generator/typescript/index.ts b/packages/cli/src/generator/typescript/index.ts index f8c623d6..486fec17 100644 --- a/packages/cli/src/generator/typescript/index.ts +++ b/packages/cli/src/generator/typescript/index.ts @@ -1,15 +1,23 @@ -/* eslint-disable prettier/prettier */ import type Oas from 'oas'; import type { Operation } from 'oas'; import type { JSONSchema, SchemaObject } from 'oas/@types/rmoas.types'; // import type { SchemaWrapper } from 'oas/@types/operation/get-parameters-as-json-schema'; +import { IndentationText, Project, QuoteKind, ScriptTarget, StructureKind } from 'ts-morph'; import * as ts from 'typescript'; import { compile } from 'json-schema-to-typescript'; -import { OpenAPIV3 } from 'openapi-types'; -import * as cg from './oaz/tscodegen'; -import ApiGenerator from './oaz/generate'; +import { inspect } from 'util'; + +declare global { + interface Console { + logx: any; + } +} + +console.logx = (obj: any) => { + console.log(inspect(obj, false, null, true)); +}; type ResponseJsonSchema = { type: string | string[]; @@ -66,15 +74,19 @@ async function loadOperationsAndMethods(spec: Oas) { Object.entries(spec.getPaths()).map(async ([path, ops]) => { await Promise.all( Object.entries(ops).map(async ([method, operation]) => { - // if (!(method in methods)) { - // methods[method] = {}; - // } + if (!(method in methods)) { + methods[method] = {}; + } const operationId = operation.getOperationId(); let params; // @todo we should be smarter about how we're compiling json schema for these so we bundle all metadata types together under one `allOf` type -- it's dumb to have 3+ types be present with a union on a single method param - const paramSchemas = operation.getParametersAsJsonSchema(); + const paramSchemas = operation.getParametersAsJsonSchema({ + // mergeIntoBodyAndMetadata: true, + // retainDeprecatedProperties: true, + }); + if (paramSchemas) { params = await Promise.resolve(paramSchemas.map(param => ({ [param.type]: param.schema }))) .then(res => res.reduce((prev, next) => Object.assign(prev, next))) @@ -89,43 +101,43 @@ async function loadOperationsAndMethods(spec: Oas) { schema as JSONSchema, `${operationId}_${paramType}_param` ), - } + }, }; }) ); - }); + }) + .then(res => res.reduce((prev, next) => Object.assign(prev, next), {})); } // @todo what does this do for a spec that has no responses? - let responses; - // const responses = await Promise.resolve( - // operation - // .getResponseStatusCodes() - // .map(status => { - // const schema = operation.getResponseAsJsonSchema(status); - // if (!schema) { - // return false; - // } - - // return { - // [status]: schema.shift() as ResponseJsonSchema, - // }; - // }) - // .reduce((prev, next) => Object.assign(prev, next)) - // ).then(res => { - // return Promise.all( - // Object.entries(res as Record).map(async ([status, jsonSchema]) => { - // return { - // [status]: await convertJSONSchemaToTypescript( - // jsonSchema.schema as JSONSchema, - // `${operationId}_Response_${status}` - // ), - // }; - // }) - // ); - // }); - - // methods[method][path] = { types: { params, responses }, operation }; + const responses = await Promise.resolve( + operation + .getResponseStatusCodes() + .map(status => { + const schema = operation.getResponseAsJsonSchema(status); + if (!schema) { + return false; + } + + return { + [status]: schema.shift() as ResponseJsonSchema, + }; + }) + .reduce((prev, next) => Object.assign(prev, next)) + ).then(res => { + return Promise.all( + Object.entries(res as Record).map(async ([status, jsonSchema]) => { + return { + [status]: await convertJSONSchemaToTypescript( + jsonSchema.schema as JSONSchema, + `${operationId}_Response_${status}` + ), + }; + }) + ); + }); + + methods[method][path] = { types: { params, responses }, operation }; if (operation.hasOperationId()) { operations[operation.getOperationId()] = { types: { params, responses }, @@ -141,18 +153,142 @@ async function loadOperationsAndMethods(spec: Oas) { } export default async function generator(spec: Oas) { - // const [operations, methods] = await loadOperationsAndMethods(spec); + const [operations, methods] = await loadOperationsAndMethods(spec); + + // @todo fill this user agent in with something contextual. + const userAgent = 'api/1.0.0'; + + const project = new Project({ + manipulationSettings: { + indentationText: IndentationText.TwoSpaces, + quoteKind: QuoteKind.Single, + }, + compilerOptions: { + // target: ScriptTarget.ES3, + outDir: 'dist', + }, + }); + + // project.addSourceFilesAtPaths("src/**/*.ts"); + const sdkSource = project.createSourceFile('src/api/index.ts', 'export default class SDK {}'); + // const myEnumFile = project.createSourceFile("src/api/MyEnum.ts", { + // statements: [{ + // kind: StructureKind.Enum, + // name: "MyEnum", + // isExported: true, + // members: [{ name: "member" }], + // }], + // }); + + // get information + // sdk.getName(); // returns: "MyClass" + // sdk.hasExportKeyword(); // returns: true + // sdk.isDefaultExport(); // returns: false + + // manipulate + // const myInterface = sdkSource.addInterface({ + // name: 'IMyInterface', + // isExported: true, + // properties: [ + // { + // name: 'myProp', + // type: 'object', + // } + // ], + // }); + + sdkSource.addImportDeclarations([ + { defaultImport: 'Oas', moduleSpecifier: 'oas' }, + { defaultImport: 'APICore', moduleSpecifier: '@readme/api-core' }, + { + defaultImport: 'definition', + moduleSpecifier: '../fixtures/simple.oas.json', // './openapi.json', + }, + ]); + + const sdk = sdkSource.getClassOrThrow('SDK'); + sdk.addProperty({ name: 'spec', type: 'Oas' }); + sdk.addProperty({ name: 'core', type: 'APICore' }); + sdk.addProperty({ name: 'authKeys', type: '(number | string)[][]', initializer: '[]' }); + + sdk.addConstructor({ + statements: ['this.spec = Oas.init(definition);', `this.core = new APICore(this.spec, '${userAgent}');`], + }); + + Object.entries(operations).forEach(([operationId, data]) => { + const operation: Operation = data.operation; + const fetchArgs = [`'${operation.path}'`, `'${operation.method}'`]; + const parameters = []; + if (data.types.params) { + if (data.types.params.body || data.types.params.formData) { + // @todo change this to just look for `body` when https://github.com/readmeio/oas/pull/617 is merged. + parameters.push({ name: 'body', type: data.types.params.body.ts.typeName }); + fetchArgs.push('body'); + sdkSource.addStatements(data.types.params.body.ts.type); + } + + if ( + data.types.params.path || + data.types.params.query || + data.types.params.cookie || + data.types.params.header || + data.types.params.query + ) { + // @todo change this to just look for `metadata` when https://github.com/readmeio/oas/pull/617 is merged. + parameters.push({ name: 'metadata', type: data.types.params.query.ts.typeName }); + fetchArgs.push('metadata'); + sdkSource.addStatements(data.types.params.query.ts.type); + } + } + + const method = sdk.addMethod({ + name: operationId, + // returnType: "string", + parameters, + statements: `return this.core.fetch(${fetchArgs.join(', ')});`, + }); + + const summary = operation.getSummary(); + const description = operation.getDescription(); + if (summary || description) { + method.addJsDoc( + [ + summary ? `${summary.replace(/\n/g, '\n * ')}` : '', + description ? `${description.replace(/\n/g, '\n * ')}` : '', + ] + .filter(Boolean) + .join('\n\n') + ); + } + + // Add the required types we need for this operation. + console.logx(data.types); + console.log('------------------') + }); + + // .addJsDoc('this is a constructor'); + + // const result = project.emitToMemory(); + console.log(project.getSourceFiles()[0].getFullText()) + // console.log({ methods }) + // console.log(operations) + + + +// private authKeys: (number | string)[][] = []; + +// private userAgent = 'autogenSDK/1.0.0'; + +// constructor() { +// this.spec = Oas.init(defintion); - // type Opts = { - // include?: string[]; - // exclude?: string[]; - // optimistic?: boolean; - // }; +// // this.spec.api.servers[0].url = '{scheme}://httpbin.org/anything/testing'; +// } */ - const ast = new ApiGenerator(spec.api as OpenAPIV3.Document).generateApi(); - const src = cg.printFile(ast); + // const ast = new ApiGenerator(spec.api as OpenAPIV3.Document).generateApi(); + // const src = cg.printFile(ast); - console.log(src) + // console.log(src) diff --git a/packages/cli/src/generator/typescript/oaz/APIStub.ts b/packages/cli/src/generator/typescript/oaz/APIStub.ts deleted file mode 100644 index 4f5b2a53..00000000 --- a/packages/cli/src/generator/typescript/oaz/APIStub.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * DO NOT MODIFY - This file has been generated using oazapfts. - * See https://www.npmjs.com/package/oazapfts - */ - -import APICore from '@readme/api-core'; -import * as Oazapfts from "oazapfts/lib/runtime"; -import * as QS from "oazapfts/lib/runtime/query"; - -export const defaults: Oazapfts.RequestOpts = { - baseUrl: "/", -}; - -const oazapfts = Oazapfts.runtime(defaults); - -export const servers = {}; diff --git a/packages/cli/src/generator/typescript/oaz/generate.ts b/packages/cli/src/generator/typescript/oaz/generate.ts deleted file mode 100644 index a43ea1f7..00000000 --- a/packages/cli/src/generator/typescript/oaz/generate.ts +++ /dev/null @@ -1,717 +0,0 @@ -/* eslint-disable no-restricted-imports */ -/* eslint-disable unicorn/no-useless-spread */ -/* eslint-disable @typescript-eslint/consistent-indexed-object-style */ -/* eslint-disable eqeqeq */ -/* eslint-disable no-else-return */ -/* eslint-disable no-plusplus */ -/* eslint-disable class-methods-use-this */ -/* eslint-disable no-multi-assign */ -/* eslint-disable spaced-comment */ -/* eslint-disable unicorn/prefer-type-error */ -/* eslint-disable no-shadow */ -/* eslint-disable consistent-return */ -/* eslint-disable no-param-reassign */ -import type { OpenAPIV3 } from 'openapi-types'; -import type { OASDocument } from 'oas/@types/rmoas.types'; - -import _ from 'lodash'; -import ts, { factory } from 'typescript'; -import path from 'path'; - -import * as cg from './tscodegen'; - -export const verbs = ['GET', 'PUT', 'POST', 'DELETE','OPTIONS', 'HEAD', 'PATCH', 'TRACE']; - -type ContentType = 'json' | 'form' | 'multipart'; - -export const contentTypes: Record = { - '*/*': 'json', - 'application/json': 'json', - 'application/hal+json': 'json', - 'application/x-www-form-urlencoded': 'form', - 'multipart/form-data': 'multipart', -}; - -/** - * Get the name of a formatter function for a given parameter. - */ -export function getFormatter({ style, explode }: OpenAPIV3.ParameterObject) { - if (style === 'spaceDelimited') return 'space'; - if (style === 'pipeDelimited') return 'pipe'; - if (style === 'deepObject') return 'deep'; - return explode ? 'explode' : 'form'; -} - -export function getOperationIdentifier(id?: string) { - if (!id) return; - if (id.match(/[^\w\s]/)) return; - id = _.camelCase(id); - if (cg.isValidIdentifier(id)) return id; -} - -/** - * Create a method name for a given operation, either from its operationId or - * the HTTP verb and path. - */ -export function getOperationName(verb: string, path: string, operationId?: string) { - const id = getOperationIdentifier(operationId); - if (id) return id; - path = path.replace(/\{(.+?)\}/, 'by $1').replace(/\{(.+?)\}/, 'and $1'); - return _.camelCase(`${verb} ${path}`); -} - -export function isNullable(schema: any) { - return !!(schema && schema.nullable); -} - -export function isReference(obj: any): obj is OpenAPIV3.ReferenceObject { - return obj && '$ref' in obj; -} - -//See https://swagger.io/docs/specification/using-ref/ -export function getReference(spec: any, ref: string) { - const path = ref - .slice(2) - .split('/') - .map(s => unescape(s.replace(/~1/g, '/').replace(/~0/g, '~'))); - - const ret = _.get(spec, path); - if (typeof ret === 'undefined') { - throw new Error(`Can't find ${path}`); - } - return ret; -} -/** - * If the given object is a ReferenceObject, return the last part of its path. - */ -export function getReferenceName(obj: any) { - if (isReference(obj)) { - return _.camelCase(obj.$ref.split('/').slice(-1)[0]); - } -} - -/** - * Create a template string literal from the given OpenAPI urlTemplate. - * Curly braces in the path are turned into identifier expressions, - * which are read from the local scope during runtime. - */ -export function createUrlExpression(path: string, qs?: ts.Expression) { - const spans: { expression: ts.Expression; literal: string }[] = []; - // Use a replacer function to collect spans as a side effect: - const head = path.replace(/(.*?)\{(.+?)\}(.*?)(?=\{|$)/g, (_substr, head, name, literal) => { - const expression = _.camelCase(name); - spans.push({ expression: factory.createIdentifier(expression), literal }); - return head; - }); - - if (qs) { - // add the query string as last span - spans.push({ expression: qs, literal: '' }); - } - - return cg.createTemplateString(head, spans); -} - -/** - * Create a call expression for one of the QS runtime functions. - */ -export function callQsFunction(name: string, args: ts.Expression[]) { - return cg.createCall(factory.createPropertyAccessExpression(factory.createIdentifier('QS'), name), { args }); -} - -/** - * Create a call expression for one of the oazapfts runtime functions. - */ -export function callOazapftsFunction(name: string, args: ts.Expression[], typeArgs?: ts.TypeNode[]) { - return cg.createCall(factory.createPropertyAccessExpression(factory.createIdentifier('oazapfts'), name), { - args, - typeArgs, - }); -} - -/** - * Despite its name, OpenApi's `deepObject` serialization does not support - * deeply nested objects. As a workaround we detect parameters that contain - * square brackets and merge them into a single object. - */ -export function supportDeepObjects(params: OpenAPIV3.ParameterObject[]) { - const res: OpenAPIV3.ParameterObject[] = []; - const merged: any = {}; - params.forEach(p => { - const m = /^(.+?)\[(.*?)\]/.exec(p.name); - if (!m) { - res.push(p); - return; - } - const [, name, prop] = m; - let obj = merged[name]; - if (!obj) { - obj = merged[name] = { - name, - in: p.in, - style: 'deepObject', - schema: { - type: 'object', - properties: {}, - }, - }; - res.push(obj); - } - obj.schema.properties[prop] = p.schema; - }); - - return res; -} - -/** - * Main entry point that generates TypeScript code from a given API spec. - */ -export default class ApiGenerator { - public readonly spec: OpenAPIV3.Document; - - constructor(spec: OpenAPIV3.Document) { - this.spec = spec; - } - - aliases: ts.TypeAliasDeclaration[] = []; - - // Collect the types of all referenced schemas so we can export them later - refs: Record = {}; - - // Keep track of already used type aliases - typeAliases: Record = {}; - - reset() { - this.aliases = []; - this.refs = {}; - this.typeAliases = {}; - } - - resolve(obj: T | OpenAPIV3.ReferenceObject) { - if (!isReference(obj)) return obj; - const ref = obj.$ref; - if (!ref.startsWith('#/')) { - throw new Error(`External refs are not supported (${ref}). Make sure to call SwaggerParser.bundle() first.`); - } - return getReference(this.spec, ref) as T; - } - - resolveArray(array?: (T | OpenAPIV3.ReferenceObject)[]) { - return array ? array.map(el => this.resolve(el)) : []; - } - - getUniqueAlias(name: string) { - let used = this.typeAliases[name] || 0; - if (used) { - this.typeAliases[name] = ++used; - name += used; - } - this.typeAliases[name] = 1; - return name; - } - - getRefBasename(ref: string): string { - return ref.replace(/.+\//, ''); - } - - /** - * Create a type alias for the schema referenced by the given ReferenceObject - */ - getRefAlias(obj: OpenAPIV3.ReferenceObject) { - const { $ref } = obj; - let ref = this.refs[$ref]; - if (!ref) { - const schema = this.resolve(obj); - const name = this.getUniqueAlias(_.upperFirst(_.camelCase(schema.title || this.getRefBasename($ref)))); - - ref = this.refs[$ref] = factory.createTypeReferenceNode(name, undefined); - - const type = this.getTypeFromSchema(schema); - this.aliases.push( - cg.createTypeAliasDeclaration({ - modifiers: [cg.modifier.export], - name, - type, - }) - ); - } - return ref; - } - - getUnionType( - variants: (OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject)[], - discriminator?: OpenAPIV3.DiscriminatorObject - ): ts.TypeNode { - if (discriminator) { - // oneOf + discriminator -> tagged union (polymorphism) - if (discriminator.propertyName === undefined) { - throw new Error('Discriminators require a propertyName'); - } - - // By default, the last component of the ref name (i.e., after the last trailing slash) is - // used as the discriminator value for each variant. This can be overridden using the - // discriminator.mapping property. - const mappedValues = new Set(Object.values(discriminator.mapping || {}).map(ref => this.getRefBasename(ref))); - - return factory.createUnionTypeNode( - ( - [ - ...Object.entries(discriminator.mapping || {}).map(([discriminatorValue, variantRef]) => [ - discriminatorValue, - { $ref: variantRef }, - ]), - ...variants - .filter(variant => { - if (!isReference(variant)) { - // From the Swagger spec: "When using the discriminator, inline schemas will not be - // considered." - throw new Error('Discriminators require references, not inline schemas'); - } - return !mappedValues.has(this.getRefBasename(variant.$ref)); - }) - .map(schema => [this.getRefBasename((schema as OpenAPIV3.ReferenceObject).$ref), schema]), - ] as [string, OpenAPIV3.ReferenceObject][] - ).map(([discriminatorValue, variant]) => - // Yields: { [discriminator.propertyName]: discriminatorValue } & variant - factory.createIntersectionTypeNode([ - factory.createTypeLiteralNode([ - cg.createPropertySignature({ - name: discriminator.propertyName, - type: factory.createLiteralTypeNode(factory.createStringLiteral(discriminatorValue)), - }), - ]), - this.getTypeFromSchema(variant), - ]) - ) - ); - } - - // oneOf -> untagged union - return factory.createUnionTypeNode(variants.map(schema => this.getTypeFromSchema(schema))); - } - - /** - * Creates a type node from a given schema. - * Delegates to getBaseTypeFromSchema internally and - * optionally adds a union with null. - */ - getTypeFromSchema(schema?: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject): ts.TypeNode { - const type = this.getBaseTypeFromSchema(schema); - return isNullable(schema) ? factory.createUnionTypeNode([type, cg.keywordType.null]) : type; - } - - /** - * This is the very core of the OpenAPI to TS conversion - it takes a - * schema and returns the appropriate type. - */ - getBaseTypeFromSchema(schema?: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject): ts.TypeNode { - if (!schema) return cg.keywordType.any; - if (isReference(schema)) { - return this.getRefAlias(schema); - } - - if (schema.oneOf) { - // oneOf -> union - return this.getUnionType(schema.oneOf, schema.discriminator); - } - - if (schema.anyOf) { - // anyOf -> union - return factory.createUnionTypeNode(schema.anyOf.map(schema => this.getTypeFromSchema(schema))); - } - - if (schema.allOf) { - // allOf -> intersection - return factory.createIntersectionTypeNode(schema.allOf.map(schema => this.getTypeFromSchema(schema))); - } - - if ('items' in schema) { - // items -> array - return factory.createArrayTypeNode(this.getTypeFromSchema(schema.items)); - } - - if (schema.properties || schema.additionalProperties) { - // properties -> literal type - return this.getTypeFromProperties(schema.properties || {}, schema.required, schema.additionalProperties); - } - - if (schema.enum) { - // enum -> union of literal types - const types = schema.enum.map(s => { - if (s === null) return cg.keywordType.null; - if (typeof s === 'boolean') { - return s - ? factory.createLiteralTypeNode(ts.factory.createToken(ts.SyntaxKind.TrueKeyword)) - : factory.createLiteralTypeNode(ts.factory.createToken(ts.SyntaxKind.FalseKeyword)); - } - if (typeof s === 'number') { - return factory.createLiteralTypeNode(factory.createNumericLiteral(s)); - } - return factory.createLiteralTypeNode(factory.createStringLiteral(s)); - }); - return types.length > 1 ? factory.createUnionTypeNode(types) : types[0]; - } - - if (schema.format == 'binary') { - return factory.createTypeReferenceNode('Blob', []); - } - - if (schema.type) { - // string, boolean, null, number - if (schema.type in cg.keywordType) return cg.keywordType[schema.type]; - if (schema.type === 'integer') return cg.keywordType.number; - } - - return cg.keywordType.any; - } - - /** - * Recursively creates a type literal with the given props. - */ - getTypeFromProperties( - props: { - [prop: string]: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject; - }, - required?: string[], - additionalProperties?: boolean | OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject - ) { - const members: ts.TypeElement[] = Object.keys(props).map(name => { - const schema = props[name]; - const isRequired = required && required.includes(name); - return cg.createPropertySignature({ - questionToken: !isRequired, - name, - type: this.getTypeFromSchema(schema), - }); - }); - - if (additionalProperties) { - const type = additionalProperties === true ? cg.keywordType.any : this.getTypeFromSchema(additionalProperties); - - members.push(cg.createIndexSignature(type)); - } - - return factory.createTypeLiteralNode(members); - } - - getTypeFromResponses(responses: OpenAPIV3.ResponsesObject) { - return factory.createUnionTypeNode( - Object.entries(responses).map(([code, res]) => { - const statusType = - code === 'default' - ? cg.keywordType.number - : factory.createLiteralTypeNode(factory.createNumericLiteral(code)); - - const props = [ - cg.createPropertySignature({ - name: 'status', - type: statusType, - }), - ]; - - const dataType = this.getTypeFromResponse(res); - if (dataType !== cg.keywordType.void) { - props.push( - cg.createPropertySignature({ - name: 'data', - type: dataType, - }) - ); - } - return factory.createTypeLiteralNode(props); - }) - ); - } - - getTypeFromResponse(resOrRef: OpenAPIV3.ResponseObject | OpenAPIV3.ReferenceObject) { - const res = this.resolve(resOrRef); - if (!res || !res.content) return cg.keywordType.void; - return this.getTypeFromSchema(this.getSchemaFromContent(res.content)); - } - - getResponseType(responses?: OpenAPIV3.ResponsesObject): 'json' | 'text' | 'blob' { - // backwards-compatibility - if (!responses) return 'text'; - - const resolvedResponses = Object.values(responses).map(response => this.resolve(response)); - - // if no content is specified, assume `text` (backwards-compatibility) - if (!resolvedResponses.some(res => Object.keys(res.content ?? []).length > 0)) { - return 'text'; - } - - const isJson = resolvedResponses.some(response => { - const responseMimeTypes = Object.keys(response.content ?? {}); - return responseMimeTypes.some(mimeType => contentTypes[mimeType] === 'json'); - }); - - // if there’s `application/json` or `*/*`, assume `json` - if (isJson) { - return 'json'; - } - - // if there’s `text/*`, assume `text` - if (resolvedResponses.some(res => Object.keys(res.content ?? []).some(type => type.startsWith('text/')))) { - return 'text'; - } - - // for the rest, assume `blob` - return 'blob'; - } - - getSchemaFromContent(content: any) { - const contentType = Object.keys(contentTypes).find(t => t in content); - let schema; - if (contentType) { - schema = _.get(content, [contentType, 'schema']); - } - if (schema) { - return schema; - } - - // if no content is specified -> string - // `text/*` -> string - if (Object.keys(content).length === 0 || Object.keys(content).some(type => type.startsWith('text/'))) { - return { type: 'string' }; - } - - // rest (e.g. `application/octet-stream`, `application/gzip`, …) -> binary - return { type: 'string', format: 'binary' }; - } - - wrapResult(ex: ts.Expression) { - return ex; - // return this.opts?.optimistic ? callOazapftsFunction('ok', [ex]) : ex; - } - - generateApi() { - this.reset(); - - // Parse ApiStub.ts so that we don't have to generate everything manually - const stub = cg.parseFile(path.resolve(__dirname, './ApiStub.ts')); - - // ApiStub contains `const servers = {}`, find it ... - // const servers = cg.findFirstVariableDeclaration(stub.statements, 'servers'); - // servers.initializer is readonly, this might break in a future TS version, but works fine for now. - // Object.assign(servers, { - // initializer: generateServers(this.spec.servers || []), - // }); - - const { initializer } = cg.findFirstVariableDeclaration(stub.statements, 'defaults'); - if (!initializer || !ts.isObjectLiteralExpression(initializer)) { - throw new Error('No object literal: defaults'); - } - - // cg.changePropertyValue( - // initializer, - // 'baseUrl', - // defaultBaseUrl(this.spec.servers || []), - // ); - - // Collect class functions to be added... - const functions: ts.FunctionDeclaration[] = []; - - // Keep track of names to detect duplicates - const names: Record = {}; - - Object.keys(this.spec.paths).forEach(path => { - const item = this.spec.paths[path]; - - if (!item) { - return; - } - - Object.keys(this.resolve(item)).forEach(verb => { - const method = verb.toUpperCase(); - // skip summary/description/parameters etc... - if (!verbs.includes(method)) return; - - const op: OpenAPIV3.OperationObject = (item as any)[verb]; - const { - operationId, - requestBody, - responses, - summary, - description, - // tags, - } = op; - - let name = getOperationName(verb, path, operationId); - const count = (names[name] = (names[name] || 0) + 1); - if (count > 1) { - // The name is already taken, which means that the spec is probably - // invalid as operationIds must be unique. Since this is quite common - // nevertheless we append a counter: - name += count; - } - - // merge item and op parameters - const resolvedParameters = [...this.resolveArray(item.parameters), ...this.resolveArray(op.parameters)]; - - // expand older OpenAPI parameters into deepObject style where needed - // const parameters = this.isConverted ? supportDeepObjects(resolvedParameters) : resolvedParameters; - const parameters = resolvedParameters; - - // split into required/optional - const [required, optional] = _.partition(parameters, 'required'); - - // convert parameter names to argument names ... - const argNames: any = {}; - parameters - .map(p => p.name) - .sort((a, b) => a.length - b.length) - .forEach(name => { - argNames[name] = _.camelCase(name); - }); - - // build the method signature - first all the required parameters - const methodParams = required.map(p => - cg.createParameter(argNames[this.resolve(p).name], { - type: this.getTypeFromSchema(isReference(p) ? p : p.schema), - }) - ); - - let body: any; - let bodyVar; - - // add body if present - if (requestBody) { - body = this.resolve(requestBody); - const schema = this.getSchemaFromContent(body.content); - const type = this.getTypeFromSchema(schema); - bodyVar = _.camelCase((type as any).name || getReferenceName(schema) || 'body'); - methodParams.push( - cg.createParameter(bodyVar, { - type, - questionToken: !body.required, - }) - ); - } - - // add an object with all optional parameters - if (optional.length) { - methodParams.push( - cg.createParameter( - cg.createObjectBinding( - optional.map(param => this.resolve(param)).map(({ name }) => ({ name: argNames[name] })) - ), - { - initializer: factory.createObjectLiteralExpression(), - type: factory.createTypeLiteralNode( - optional.map(p => - cg.createPropertySignature({ - name: argNames[this.resolve(p).name], - questionToken: true, - type: this.getTypeFromSchema(isReference(p) ? p : p.schema), - }) - ) - ), - } - ) - ); - } - - methodParams.push( - cg.createParameter('opts', { - type: factory.createTypeReferenceNode('Oazapfts.RequestOpts', undefined), - questionToken: true, - }) - ); - - // Next, build the method body... - - const returnType = this.getResponseType(responses); - const query = parameters.filter(p => p.in === 'query'); - const header = parameters.filter(p => p.in === 'header').map(p => p.name); - let qs; - if (query.length) { - const paramsByFormatter = _.groupBy(query, getFormatter); - qs = callQsFunction( - 'query', - Object.entries(paramsByFormatter).map(([format, params]) => { - //const [allowReserved, encodeReserved] = _.partition(params, "allowReserved"); - return callQsFunction(format, [cg.createObjectLiteral(params.map(p => [p.name, argNames[p.name]]))]); - }) - ); - } - - const url = createUrlExpression(path, qs); - const init: ts.ObjectLiteralElementLike[] = [factory.createSpreadAssignment(factory.createIdentifier('opts'))]; - - if (method !== 'GET') { - init.push(factory.createPropertyAssignment('method', factory.createStringLiteral(method))); - } - - if (bodyVar) { - init.push(cg.createPropertyAssignment('body', factory.createIdentifier(bodyVar))); - } - - if (header.length) { - init.push( - factory.createPropertyAssignment( - 'headers', - factory.createObjectLiteralExpression( - [ - factory.createSpreadAssignment( - factory.createLogicalAnd( - factory.createIdentifier('opts'), - factory.createPropertyAccessExpression(factory.createIdentifier('opts'), 'headers') - ) - ), - ...header.map(name => cg.createPropertyAssignment(name, factory.createIdentifier(argNames[name]))), - ], - true - ) - ) - ); - } - - const args: ts.Expression[] = [url]; - - if (init.length) { - const m = Object.entries(contentTypes).find(([type]) => { - return !!_.get(body, ['content', type]); - }); - const initObj = factory.createObjectLiteralExpression(init, true); - args.push(m ? callOazapftsFunction(m[1], [initObj]) : initObj); // json, form, multipart - } - - functions.push( - cg.addComment( - cg.createFunctionDeclaration( - name, - { - modifiers: [cg.modifier.export], - }, - methodParams, - cg.block( - factory.createReturnStatement( - this.wrapResult( - callOazapftsFunction( - { - json: 'fetchJson', - text: 'fetchText', - blob: 'fetchBlob', - }[returnType], - args, - returnType === 'json' || returnType === 'blob' - ? [this.getTypeFromResponses(responses!) || ts.SyntaxKind.AnyKeyword] - : undefined - ) - ) - ) - ) - ), - summary || description - ) - ); - }); - }); - - Object.assign(stub, { - statements: cg.appendNodes(stub.statements, ...[...this.aliases, ...functions]), - }); - - return stub; - } -} diff --git a/packages/cli/src/generator/typescript/oaz/tscodegen.ts b/packages/cli/src/generator/typescript/oaz/tscodegen.ts deleted file mode 100644 index bbbb676a..00000000 --- a/packages/cli/src/generator/typescript/oaz/tscodegen.ts +++ /dev/null @@ -1,434 +0,0 @@ -/* eslint-disable no-shadow */ -/* eslint-disable no-use-before-define */ -/* eslint-disable @typescript-eslint/consistent-indexed-object-style */ -/* eslint-disable default-case */ -/* eslint-disable consistent-return */ -/* eslint-disable no-unused-expressions */ -import fs from 'fs'; -import ts, { factory } from 'typescript'; - -ts.parseIsolatedEntityName; -type KeywordTypeName = 'any' | 'number' | 'object' | 'string' | 'boolean' | 'undefined' | 'null'; - -export const questionToken = factory.createToken(ts.SyntaxKind.QuestionToken); - -export function createQuestionToken(token?: boolean | ts.QuestionToken) { - if (!token) return undefined; - if (token === true) return questionToken; - return token; -} - -export function createKeywordType(type: KeywordTypeName) { - switch (type) { - case 'any': - return factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword); - case 'number': - return factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword); - case 'object': - return factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword); - case 'string': - return factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword); - case 'boolean': - return factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword); - case 'undefined': - return factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword); - case 'null': - return factory.createLiteralTypeNode(ts.factory.createToken(ts.SyntaxKind.NullKeyword)); - } -} - -export const keywordType: { - [type: string]: ts.KeywordTypeNode | ts.LiteralTypeNode; -} = { - any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword), - number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword), - object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword), - string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), - boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword), - undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword), - null: factory.createLiteralTypeNode(ts.factory.createToken(ts.SyntaxKind.NullKeyword)), -}; - -export const modifier = { - async: factory.createModifier(ts.SyntaxKind.AsyncKeyword), - export: factory.createModifier(ts.SyntaxKind.ExportKeyword), -}; - -export function createTypeAliasDeclaration({ - decorators, - modifiers, - name, - typeParameters, - type, -}: { - decorators?: ts.Decorator[]; - modifiers?: ts.Modifier[]; - name: string | ts.Identifier; - typeParameters?: ts.TypeParameterDeclaration[]; - type: ts.TypeNode; -}) { - return factory.createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type); -} - -export function toExpression(ex: ts.Expression | string) { - if (typeof ex === 'string') return factory.createIdentifier(ex); - return ex; -} - -export function createCall( - expression: ts.Expression | string, - { - typeArgs, - args, - }: { - typeArgs?: ts.TypeNode[]; - args?: ts.Expression[]; - } = {} -) { - return factory.createCallExpression(toExpression(expression), typeArgs, args); -} - -export function createMethodCall( - method: string, - opts: { - typeArgs?: ts.TypeNode[]; - args?: ts.Expression[]; - } -) { - return createCall(factory.createPropertyAccessExpression(factory.createThis(), method), opts); -} - -export function createObjectLiteral(props: [string, string | ts.Expression][]) { - return factory.createObjectLiteralExpression( - props.map(([name, identifier]) => createPropertyAssignment(name, toExpression(identifier))), - true - ); -} - -export function createPropertyAssignment(name: string, expression: ts.Expression) { - if (ts.isIdentifier(expression)) { - if (expression.text === name) { - return factory.createShorthandPropertyAssignment(name); - } - } - return factory.createPropertyAssignment(propertyName(name), expression); -} - -export function block(...statements: ts.Statement[]) { - return factory.createBlock(statements, true); -} - -export function createArrowFunction( - parameters: ts.ParameterDeclaration[], - body: ts.ConciseBody, - { - modifiers, - typeParameters, - type, - equalsGreaterThanToken, - }: { - modifiers?: ts.Modifier[]; - typeParameters?: ts.TypeParameterDeclaration[]; - type?: ts.TypeNode; - equalsGreaterThanToken?: ts.EqualsGreaterThanToken; - } = {} -) { - return factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body); -} - -export function createFunctionDeclaration( - name: string | ts.Identifier | undefined, - { - decorators, - modifiers, - asteriskToken, - typeParameters, - type, - }: { - decorators?: ts.Decorator[]; - modifiers?: ts.Modifier[]; - asteriskToken?: ts.AsteriskToken; - typeParameters?: ts.TypeParameterDeclaration[]; - type?: ts.TypeNode; - }, - parameters: ts.ParameterDeclaration[], - body?: ts.Block -): ts.FunctionDeclaration { - return factory.createFunctionDeclaration( - decorators, - modifiers, - asteriskToken, - name, - typeParameters, - parameters, - type, - body - ); -} - -export function createClassDeclaration({ - decorators, - modifiers, - name, - typeParameters, - heritageClauses, - members, -}: { - decorators?: ts.Decorator[]; - modifiers?: ts.Modifier[]; - name?: string | ts.Identifier; - typeParameters?: ts.TypeParameterDeclaration[]; - heritageClauses?: ts.HeritageClause[]; - members: ts.ClassElement[]; -}) { - return factory.createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members); -} - -export function createConstructor({ - decorators, - modifiers, - parameters, - body, -}: { - decorators?: ts.Decorator[]; - modifiers?: ts.Modifier[]; - parameters: ts.ParameterDeclaration[]; - body?: ts.Block; -}) { - return factory.createConstructorDeclaration(decorators, modifiers, parameters, body); -} - -export function createMethod( - name: string | ts.Identifier | ts.StringLiteral | ts.NumericLiteral | ts.ComputedPropertyName, - { - decorators, - modifiers, - asteriskToken, - questionToken, - typeParameters, - type, - }: { - decorators?: ts.Decorator[]; - modifiers?: ts.Modifier[]; - asteriskToken?: ts.AsteriskToken; - questionToken?: ts.QuestionToken | boolean; - typeParameters?: ts.TypeParameterDeclaration[]; - type?: ts.TypeNode; - } = {}, - parameters: ts.ParameterDeclaration[] = [], - body?: ts.Block -): ts.MethodDeclaration { - return factory.createMethodDeclaration( - decorators, - modifiers, - asteriskToken, - name, - createQuestionToken(questionToken), - typeParameters, - parameters, - type, - body - ); -} - -export function createParameter( - name: string | ts.BindingName, - { - decorators, - modifiers, - dotDotDotToken, - questionToken, - type, - initializer, - }: { - decorators?: ts.Decorator[]; - modifiers?: ts.Modifier[]; - dotDotDotToken?: ts.DotDotDotToken; - questionToken?: ts.QuestionToken | boolean; - type?: ts.TypeNode; - initializer?: ts.Expression; - } -): ts.ParameterDeclaration { - return factory.createParameterDeclaration( - decorators, - modifiers, - dotDotDotToken, - name, - createQuestionToken(questionToken), - type, - initializer - ); -} - -function propertyName(name: string | ts.PropertyName): ts.PropertyName { - if (typeof name === 'string') { - return isValidIdentifier(name) ? factory.createIdentifier(name) : factory.createStringLiteral(name); - } - return name; -} - -export function createPropertySignature({ - modifiers, - name, - questionToken, - type, -}: { - modifiers?: ts.Modifier[]; - name: ts.PropertyName | string; - questionToken?: ts.QuestionToken | boolean; - type?: ts.TypeNode; -}) { - return factory.createPropertySignature(modifiers, propertyName(name), createQuestionToken(questionToken), type); -} - -export function createIndexSignature( - type: ts.TypeNode, - { - decorators, - modifiers, - indexName = 'key', - indexType = keywordType.string, - }: { - indexName?: string; - indexType?: ts.TypeNode; - decorators?: ts.Decorator[]; - modifiers?: ts.Modifier[]; - } = {} -) { - return factory.createIndexSignature(decorators, modifiers, [createParameter(indexName, { type: indexType })], type); -} - -export function createObjectBinding( - elements: { - name: string | ts.BindingName; - dotDotDotToken?: ts.DotDotDotToken; - propertyName?: string | ts.PropertyName; - initializer?: ts.Expression; - }[] -) { - return factory.createObjectBindingPattern( - elements.map(({ dotDotDotToken, propertyName, name, initializer }) => - factory.createBindingElement(dotDotDotToken, propertyName, name, initializer) - ) - ); -} - -export function createTemplateString(head: string, spans: { literal: string; expression: ts.Expression }[]) { - if (!spans.length) return factory.createStringLiteral(head); - return factory.createTemplateExpression( - factory.createTemplateHead(head), - spans.map(({ expression, literal }, i) => - factory.createTemplateSpan( - expression, - i === spans.length - 1 ? factory.createTemplateTail(literal) : factory.createTemplateMiddle(literal) - ) - ) - ); -} - -export function findNode( - nodes: ts.NodeArray, - kind: T extends { kind: infer K } ? K : never, - test?: (node: T) => boolean | undefined -): T { - const node = nodes.find(s => s.kind === kind && (!test || test(s as T))) as T; - if (!node) throw new Error(`Node not found: ${kind}`); - return node; -} - -export function getName(name: ts.Node) { - if (ts.isIdentifier(name)) { - return name.escapedText; - } - if (ts.isLiteralExpression(name)) { - return name.text; - } - return ''; -} - -export function getFirstDeclarationName(n: ts.VariableStatement) { - const name = ts.getNameOfDeclaration(n.declarationList.declarations[0]); - return name ? getName(name) : ''; -} - -export function findFirstVariableDeclaration(nodes: ts.NodeArray, name: string) { - const statement = findNode( - nodes, - ts.SyntaxKind.VariableStatement, - n => getFirstDeclarationName(n) === name - ); - const [first] = statement.declarationList.declarations; - if (!first) throw new Error('Missing declaration'); - return first; -} - -export function changePropertyValue(o: ts.ObjectLiteralExpression, property: string, value: ts.Expression) { - const p = o.properties.find(p => ts.isPropertyAssignment(p) && getName(p.name) === property); - if (p && ts.isPropertyAssignment(p)) { - // p.initializer is readonly, this might break in a future TS version, but works fine for now. - Object.assign(p, { initializer: value }); - } else { - throw new Error(`No such property: ${property}`); - } -} - -export function appendNodes(array: ts.NodeArray, ...nodes: T[]) { - return factory.createNodeArray([...array, ...nodes]); -} - -export function addComment(node: T, comment?: string) { - if (!comment) return node; - return ts.addSyntheticLeadingComment( - node, - ts.SyntaxKind.MultiLineCommentTrivia, - `*\n * ${comment.replace(/\n/g, '\n * ')}\n `, - true - ); -} - -export function parseFile(file: string) { - return ts.createSourceFile( - file, - fs.readFileSync(file, 'utf8'), - ts.ScriptTarget.Latest, - /* setParentNodes */ false, - ts.ScriptKind.TS - ); -} - -const printer = ts.createPrinter({ - newLine: ts.NewLineKind.LineFeed, -}); - -export function printNode(node: ts.Node) { - const file = ts.createSourceFile( - 'someFileName.ts', - '', - ts.ScriptTarget.Latest, - /* setParentNodes */ false, - ts.ScriptKind.TS - ); - return printer.printNode(ts.EmitHint.Unspecified, node, file); -} - -export function printNodes(nodes: ts.Node[]) { - const file = ts.createSourceFile( - 'someFileName.ts', - '', - ts.ScriptTarget.Latest, - /* setParentNodes */ false, - ts.ScriptKind.TS - ); - - return nodes.map(node => printer.printNode(ts.EmitHint.Unspecified, node, file)).join('\n'); -} - -export function printFile(sourceFile: ts.SourceFile) { - return printer.printFile(sourceFile); -} - -export function isValidIdentifier(str: string) { - if (!str.length || str.trim() !== str) return false; - const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest); - return !!node && node.kind === ts.SyntaxKind.Identifier && node.originalKeywordKind === undefined; -} From 942d52d3ba89a54dd0b9025fbed0ba8811b38b4f Mon Sep 17 00:00:00 2001 From: Jon Ursenbach Date: Tue, 8 Mar 2022 11:50:01 -0800 Subject: [PATCH 5/5] feat: more work on splitting types up --- .../cli/src/generator/typescript/index.ts | 82 ++++++++++++------- 1 file changed, 51 insertions(+), 31 deletions(-) diff --git a/packages/cli/src/generator/typescript/index.ts b/packages/cli/src/generator/typescript/index.ts index 486fec17..5579340c 100644 --- a/packages/cli/src/generator/typescript/index.ts +++ b/packages/cli/src/generator/typescript/index.ts @@ -3,10 +3,11 @@ import type { Operation } from 'oas'; import type { JSONSchema, SchemaObject } from 'oas/@types/rmoas.types'; // import type { SchemaWrapper } from 'oas/@types/operation/get-parameters-as-json-schema'; -import { IndentationText, Project, QuoteKind, ScriptTarget, StructureKind } from 'ts-morph'; -import * as ts from 'typescript'; +import { IndentationText, Project, QuoteKind } from 'ts-morph'; +// import * as ts from 'typescript'; import { compile } from 'json-schema-to-typescript'; +// ////////////////////////////////////////////////////////////////// import { inspect } from 'util'; declare global { @@ -18,6 +19,7 @@ declare global { console.logx = (obj: any) => { console.log(inspect(obj, false, null, true)); }; +// ////////////////////////////////////////////////////////////////// type ResponseJsonSchema = { type: string | string[]; @@ -29,37 +31,39 @@ type ResponseJsonSchema = { async function convertJSONSchemaToTypescript(schema: JSONSchema, name: string) { // Though our JSON Schema type exposes JSONSchema4, which `json-schema-to-typescript`, it won't // accept our custom type. - const interfaceCode = await compile(schema as any, name, { + return compile(schema as any, name, { bannerComment: '', }); // Because the `name` that we're passing to `json-schema-to-typescript` gets run through some // internal logic there and won't always be what we supply it we need to parse the TS that that // library creates so we can grab the interface name for use in our own autogenerated code. - const sourceFile = ts.createSourceFile(`${name}.d.ts`, interfaceCode, ts.ScriptTarget.Latest); - - let typeName; - await ts.forEachChild(sourceFile, node => { - if (node.kind === ts.SyntaxKind.EndOfFileToken) { - return; - } - - if (ts.isInterfaceDeclaration(node)) { - // The Node `name` property, an `IdentifierObject`, is not formally exposed in the TS types - // and there aren't any accessors for this either. - typeName = node.name.text; - } else if (ts.isTypeAliasDeclaration(node)) { - typeName = node.name.text; - } - }); + // const sourceFile = ts.createSourceFile(`${name}.d.ts`, interfaceCode, ts.ScriptTarget.Latest); + + // let primaryTypeName; + // const typeNames: string[] = []; + // await ts.forEachChild(sourceFile, node => { + // if (node.kind === ts.SyntaxKind.EndOfFileToken) { + // return; + // } + + // if (ts.isInterfaceDeclaration(node)) { + // // The Node `name` property, an `IdentifierObject`, is not formally exposed in the TS types + // // and there aren't any accessors for this either. + // typeNames.push(node.name.text); + // } else if (ts.isTypeAliasDeclaration(node)) { + // typeNames.push(node.name.text); + // } + // }); - return { - typeName, - type: interfaceCode, - }; + // return { + // primaryTypeName, + // typeNames, + // type: interfaceCode, + // }; } -async function loadOperationsAndMethods(spec: Oas) { +async function loadOperationsAndMethods(project: Project, spec: Oas) { const operations: Record< /* operationId */ string, { types: { params: any; responses?: any }; operation: Operation } @@ -81,7 +85,6 @@ async function loadOperationsAndMethods(spec: Oas) { const operationId = operation.getOperationId(); let params; - // @todo we should be smarter about how we're compiling json schema for these so we bundle all metadata types together under one `allOf` type -- it's dumb to have 3+ types be present with a union on a single method param const paramSchemas = operation.getParametersAsJsonSchema({ // mergeIntoBodyAndMetadata: true, // retainDeprecatedProperties: true, @@ -94,13 +97,17 @@ async function loadOperationsAndMethods(spec: Oas) { return Promise.all( Object.entries(res).map(async ([paramType, schema]) => { // @todo add tests for when schema is `{ type: string }` + const ts = await convertJSONSchemaToTypescript( + schema as JSONSchema, + `${operationId}_${paramType}_param` + ); + + const types = await getTypesFromTypescript(project, ts); + return { [paramType]: { schema, - ts: await convertJSONSchemaToTypescript( - schema as JSONSchema, - `${operationId}_${paramType}_param` - ), + ts, }, }; }) @@ -152,9 +159,16 @@ async function loadOperationsAndMethods(spec: Oas) { return [operations, methods]; } -export default async function generator(spec: Oas) { - const [operations, methods] = await loadOperationsAndMethods(spec); +export async function getTypesFromTypescript(project: Project, ts: string) { + const inf = project.createSourceFile('src/api/type.tmp.ts', ts); + const types = Array.from(inf.getExportedDeclarations().keys()); + + project.removeSourceFile(inf); + + return types; +} +export default async function generator(spec: Oas) { // @todo fill this user agent in with something contextual. const userAgent = 'api/1.0.0'; @@ -169,6 +183,8 @@ export default async function generator(spec: Oas) { }, }); + const [operations, methods, types] = await loadOperationsAndMethods(project, spec); + // project.addSourceFilesAtPaths("src/**/*.ts"); const sdkSource = project.createSourceFile('src/api/index.ts', 'export default class SDK {}'); // const myEnumFile = project.createSourceFile("src/api/MyEnum.ts", { @@ -216,6 +232,10 @@ export default async function generator(spec: Oas) { }); Object.entries(operations).forEach(([operationId, data]) => { + + console.logx(data.types) + return; + const operation: Operation = data.operation; const fetchArgs = [`'${operation.path}'`, `'${operation.method}'`]; const parameters = [];